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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (r->m_object->isText()) 213 if (r->m_object->isText())
214 box = createInlineBoxForText(*r, isOnlyRun); 214 box = createInlineBoxForText(*r, isOnlyRun);
215 else 215 else
216 box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun); 216 box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
217 r->m_box = box; 217 r->m_box = box;
218 218
219 ASSERT(box); 219 ASSERT(box);
220 if (!box) 220 if (!box)
221 continue; 221 continue;
222 222
223 if (!rootHasSelectedChildren && box->renderer().selectionState() != Layo utObject::SelectionNone) 223 if (!rootHasSelectedChildren && box->layoutObject().selectionState() != LayoutObject::SelectionNone)
224 rootHasSelectedChildren = true; 224 rootHasSelectedChildren = true;
225 225
226 // If we have no parent box yet, or if the run is not simply a sibling, 226 // If we have no parent box yet, or if the run is not simply a sibling,
227 // then we need to construct inline boxes as necessary to properly enclo se the 227 // then we need to construct inline boxes as necessary to properly enclo se the
228 // run's inline box. Segments can only be siblings at the root level, as 228 // run's inline box. Segments can only be siblings at the root level, as
229 // they are positioned separately. 229 // they are positioned separately.
230 if (!parentBox || parentBox->renderer() != r->m_object->parent()) { 230 if (!parentBox || parentBox->layoutObject() != r->m_object->parent()) {
231 // Create new inline boxes all the way back to the appropriate inser tion point. 231 // Create new inline boxes all the way back to the appropriate inser tion point.
232 parentBox = createLineBoxes(r->m_object->parent(), lineInfo, box); 232 parentBox = createLineBoxes(r->m_object->parent(), lineInfo, box);
233 } else { 233 } else {
234 // Append the inline box to this line. 234 // Append the inline box to this line.
235 parentBox->addToLine(box); 235 parentBox->addToLine(box);
236 } 236 }
237 237
238 box->setBidiLevel(r->level()); 238 box->setBidiLevel(r->level());
239 239
240 if (box->isInlineTextBox()) { 240 if (box->isInlineTextBox()) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 expansionOpportunityCount -= opportunitiesInRun; 483 expansionOpportunityCount -= opportunitiesInRun;
484 if (!expansionOpportunityCount) 484 if (!expansionOpportunityCount)
485 break; 485 break;
486 } 486 }
487 } 487 }
488 } 488 }
489 489
490 void LayoutBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign , const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalL eft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionO pportunityCount) 490 void LayoutBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign , const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalL eft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionO pportunityCount)
491 { 491 {
492 TextDirection direction; 492 TextDirection direction;
493 if (rootInlineBox && rootInlineBox->renderer().style()->unicodeBidi() == Pla intext) 493 if (rootInlineBox && rootInlineBox->layoutObject().style()->unicodeBidi() == Plaintext)
494 direction = rootInlineBox->direction(); 494 direction = rootInlineBox->direction();
495 else 495 else
496 direction = style()->direction(); 496 direction = style()->direction();
497 497
498 // Armed with the total width of the line (without justification), 498 // Armed with the total width of the line (without justification),
499 // we now examine our text-align property in order to determine where to pos ition the 499 // we now examine our text-align property in order to determine where to pos ition the
500 // objects horizontally. The total width of the line can be increased if we end up 500 // objects horizontally. The total width of the line can be increased if we end up
501 // justifying text. 501 // justifying text.
502 switch (textAlign) { 502 switch (textAlign) {
503 case LEFT: 503 case LEFT:
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 toLayoutText(r->m_object)->positionLineBox(r->m_box); 667 toLayoutText(r->m_object)->positionLineBox(r->m_box);
668 else if (r->m_object->isBox()) 668 else if (r->m_object->isBox())
669 toLayoutBox(r->m_object)->positionLineBox(r->m_box); 669 toLayoutBox(r->m_object)->positionLineBox(r->m_box);
670 } 670 }
671 } 671 }
672 672
673 void LayoutBlockFlow::appendFloatingObjectToLastLine(FloatingObject* floatingObj ect) 673 void LayoutBlockFlow::appendFloatingObjectToLastLine(FloatingObject* floatingObj ect)
674 { 674 {
675 ASSERT(!floatingObject->originatingLine()); 675 ASSERT(!floatingObject->originatingLine());
676 floatingObject->setOriginatingLine(lastRootBox()); 676 floatingObject->setOriginatingLine(lastRootBox());
677 lastRootBox()->appendFloat(floatingObject->renderer()); 677 lastRootBox()->appendFloat(floatingObject->layoutObject());
678 } 678 }
679 679
680 // This function constructs line boxes for all of the text runs in the resolver and computes their position. 680 // This function constructs line boxes for all of the text runs in the resolver and computes their position.
681 RootInlineBox* LayoutBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, V erticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeas urements& wordMeasurements) 681 RootInlineBox* LayoutBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, V erticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeas urements& wordMeasurements)
682 { 682 {
683 if (!bidiRuns.runCount()) 683 if (!bidiRuns.runCount())
684 return 0; 684 return 0;
685 685
686 // FIXME: Why is this only done when we had runs? 686 // FIXME: Why is this only done when we had runs?
687 lineInfo.setLastLine(!end.object()); 687 lineInfo.setLastLine(!end.object());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 if (!layoutState.usesPaintInvalidationBounds()) 753 if (!layoutState.usesPaintInvalidationBounds())
754 layoutState.setPaintInvalidationRange(logicalHeight()); 754 layoutState.setPaintInvalidationRange(logicalHeight());
755 deleteLineRange(layoutState, startLine); 755 deleteLineRange(layoutState, startLine);
756 } 756 }
757 757
758 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB reak()) { 758 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB reak()) {
759 // If the last line before the start line ends with a line break that cl ear floats, 759 // If the last line before the start line ends with a line break that cl ear floats,
760 // adjust the height accordingly. 760 // adjust the height accordingly.
761 // A line break can be either the first or the last object on a line, de pending on its direction. 761 // A line break can be either the first or the last object on a line, de pending on its direction.
762 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) { 762 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) {
763 LayoutObject* lastObject = &lastLeafChild->renderer(); 763 LayoutObject* lastObject = &lastLeafChild->layoutObject();
764 if (!lastObject->isBR()) 764 if (!lastObject->isBR())
765 lastObject = &lastRootBox()->firstLeafChild()->renderer(); 765 lastObject = &lastRootBox()->firstLeafChild()->layoutObject();
766 if (lastObject->isBR()) { 766 if (lastObject->isBR()) {
767 EClear clear = lastObject->style()->clear(); 767 EClear clear = lastObject->style()->clear();
768 if (clear != CNONE) 768 if (clear != CNONE)
769 clearFloats(clear); 769 clearFloats(clear);
770 } 770 }
771 } 771 }
772 } 772 }
773 773
774 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB idiStatus); 774 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB idiStatus);
775 linkToEndLineIfNeeded(layoutState); 775 linkToEndLineIfNeeded(layoutState);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 FloatingObjectSetIterator end = floatingObjectSet.end(); 908 FloatingObjectSetIterator end = floatingObjectSet.end();
909 if (layoutState.lastFloat()) { 909 if (layoutState.lastFloat()) {
910 FloatingObjectSetIterator lastFloatIterator = floatingObject Set.find(layoutState.lastFloat()); 910 FloatingObjectSetIterator lastFloatIterator = floatingObject Set.find(layoutState.lastFloat());
911 ASSERT(lastFloatIterator != end); 911 ASSERT(lastFloatIterator != end);
912 ++lastFloatIterator; 912 ++lastFloatIterator;
913 it = lastFloatIterator; 913 it = lastFloatIterator;
914 } 914 }
915 for (; it != end; ++it) { 915 for (; it != end; ++it) {
916 FloatingObject* f = it->get(); 916 FloatingObject* f = it->get();
917 appendFloatingObjectToLastLine(f); 917 appendFloatingObjectToLastLine(f);
918 ASSERT(f->renderer() == layoutState.floats()[layoutState.flo atIndex()].object); 918 ASSERT(f->layoutObject() == layoutState.floats()[layoutState .floatIndex()].object);
919 // If a float's geometry has changed, give up on syncing wit h clean lines. 919 // If a float's geometry has changed, give up on syncing wit h clean lines.
920 if (layoutState.floats()[layoutState.floatIndex()].rect != f ->frameRect()) 920 if (layoutState.floats()[layoutState.floatIndex()].rect != f ->frameRect())
921 checkForEndLineMatch = false; 921 checkForEndLineMatch = false;
922 layoutState.setFloatIndex(layoutState.floatIndex() + 1); 922 layoutState.setFloatIndex(layoutState.floatIndex() + 1);
923 } 923 }
924 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floating ObjectSet.last().get() : 0); 924 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floating ObjectSet.last().get() : 0);
925 } 925 }
926 } 926 }
927 927
928 lineMidpointState.reset(); 928 lineMidpointState.reset();
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 FloatingObjectSetIterator it = floatingObjectSet.end(); 2013 FloatingObjectSetIterator it = floatingObjectSet.end();
2014 --it; // Last float is newFloat, skip that one. 2014 --it; // Last float is newFloat, skip that one.
2015 FloatingObjectSetIterator begin = floatingObjectSet.begin(); 2015 FloatingObjectSetIterator begin = floatingObjectSet.begin();
2016 while (it != begin) { 2016 while (it != begin) {
2017 --it; 2017 --it;
2018 FloatingObject* floatingObject = it->get(); 2018 FloatingObject* floatingObject = it->get();
2019 if (floatingObject == lastFloatFromPreviousLine) 2019 if (floatingObject == lastFloatFromPreviousLine)
2020 break; 2020 break;
2021 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo atPaginationStrut()) { 2021 if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.flo atPaginationStrut()) {
2022 floatingObject->setPaginationStrut(paginationStrut + floatingObject- >paginationStrut()); 2022 floatingObject->setPaginationStrut(paginationStrut + floatingObject- >paginationStrut());
2023 LayoutBox* floatBox = floatingObject->renderer(); 2023 LayoutBox* floatBox = floatingObject->layoutObject();
2024 setLogicalTopForChild(*floatBox, logicalTopForChild(*floatBox) + mar ginBeforeForChild(*floatBox) + paginationStrut); 2024 setLogicalTopForChild(*floatBox, logicalTopForChild(*floatBox) + mar ginBeforeForChild(*floatBox) + paginationStrut);
2025 if (floatBox->isLayoutBlock()) 2025 if (floatBox->isLayoutBlock())
2026 floatBox->forceChildLayout(); 2026 floatBox->forceChildLayout();
2027 else 2027 else
2028 floatBox->layoutIfNeeded(); 2028 floatBox->layoutIfNeeded();
2029 // Save the old logical top before calling removePlacedObject which will set 2029 // Save the old logical top before calling removePlacedObject which will set
2030 // isPlaced to false. Otherwise it will trigger an assert in logical TopForFloat. 2030 // isPlaced to false. Otherwise it will trigger an assert in logical TopForFloat.
2031 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject); 2031 LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject);
2032 m_floatingObjects->removePlacedObject(floatingObject); 2032 m_floatingObjects->removePlacedObject(floatingObject);
2033 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru t); 2033 setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStru t);
(...skipping 19 matching lines...) Expand all
2053 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2053 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2054 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2054 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2055 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2055 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2056 2056
2057 if (!style()->isLeftToRightDirection()) 2057 if (!style()->isLeftToRightDirection())
2058 return logicalWidth() - logicalLeft; 2058 return logicalWidth() - logicalLeft;
2059 return logicalLeft; 2059 return logicalLeft;
2060 } 2060 }
2061 2061
2062 } 2062 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698