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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No reference reassignment. Created 6 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
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | Source/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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (lineInfo.isEmpty()) 249 if (lineInfo.isEmpty())
250 continue; 250 continue;
251 251
252 InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRu n); 252 InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRu n);
253 r->m_box = box; 253 r->m_box = box;
254 254
255 ASSERT(box); 255 ASSERT(box);
256 if (!box) 256 if (!box)
257 continue; 257 continue;
258 258
259 if (!rootHasSelectedChildren && box->renderer()->selectionState() != Ren derObject::SelectionNone) 259 if (!rootHasSelectedChildren && box->renderer().selectionState() != Rend erObject::SelectionNone)
260 rootHasSelectedChildren = true; 260 rootHasSelectedChildren = true;
261 261
262 // If we have no parent box yet, or if the run is not simply a sibling, 262 // If we have no parent box yet, or if the run is not simply a sibling,
263 // then we need to construct inline boxes as necessary to properly enclo se the 263 // then we need to construct inline boxes as necessary to properly enclo se the
264 // run's inline box. Segments can only be siblings at the root level, as 264 // run's inline box. Segments can only be siblings at the root level, as
265 // they are positioned separately. 265 // they are positioned separately.
266 bool runStartsSegment = r->m_startsSegment; 266 bool runStartsSegment = r->m_startsSegment;
267 267
268 if (!parentBox || parentBox->renderer() != r->m_object->parent() || runS tartsSegment) 268 if (!parentBox || parentBox->renderer() != r->m_object->parent() || runS tartsSegment)
269 // Create new inline boxes all the way back to the appropriate inser tion point. 269 // Create new inline boxes all the way back to the appropriate inser tion point.
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 if (!layoutState.usesRepaintBounds()) 954 if (!layoutState.usesRepaintBounds())
955 layoutState.setRepaintRange(logicalHeight()); 955 layoutState.setRepaintRange(logicalHeight());
956 deleteLineRange(layoutState, startLine); 956 deleteLineRange(layoutState, startLine);
957 } 957 }
958 958
959 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB reak()) { 959 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB reak()) {
960 // If the last line before the start line ends with a line break that cl ear floats, 960 // If the last line before the start line ends with a line break that cl ear floats,
961 // adjust the height accordingly. 961 // adjust the height accordingly.
962 // A line break can be either the first or the last object on a line, de pending on its direction. 962 // A line break can be either the first or the last object on a line, de pending on its direction.
963 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) { 963 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) {
964 RenderObject* lastObject = lastLeafChild->renderer(); 964 RenderObject* lastObject = &lastLeafChild->renderer();
965 if (!lastObject->isBR()) 965 if (!lastObject->isBR())
966 lastObject = lastRootBox()->firstLeafChild()->renderer(); 966 lastObject = &lastRootBox()->firstLeafChild()->renderer();
967 if (lastObject->isBR()) { 967 if (lastObject->isBR()) {
968 EClear clear = lastObject->style()->clear(); 968 EClear clear = lastObject->style()->clear();
969 if (clear != CNONE) 969 if (clear != CNONE)
970 clearFloats(clear); 970 clearFloats(clear);
971 } 971 }
972 } 972 }
973 } 973 }
974 974
975 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB idiStatus, consecutiveHyphenatedLines); 975 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB idiStatus, consecutiveHyphenatedLines);
976 linkToEndLineIfNeeded(layoutState); 976 linkToEndLineIfNeeded(layoutState);
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } 1416 }
1417 } 1417 }
1418 1418
1419 if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positi onNewFloats()) && lastRootBox()) { 1419 if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positi onNewFloats()) && lastRootBox()) {
1420 // In case we have a float on the last line, it might not be positioned up to now. 1420 // In case we have a float on the last line, it might not be positioned up to now.
1421 // This has to be done before adding in the bottom border/padding, or th e float will 1421 // This has to be done before adding in the bottom border/padding, or th e float will
1422 // include the padding incorrectly. -dwh 1422 // include the padding incorrectly. -dwh
1423 if (layoutState.checkForFloatsFromLastLine()) { 1423 if (layoutState.checkForFloatsFromLastLine()) {
1424 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual Overflow(); 1424 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual Overflow();
1425 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout Overflow(); 1425 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout Overflow();
1426 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo atsRootInlineBox(this); 1426 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo atsRootInlineBox(*this);
1427 m_lineBoxes.appendLineBox(trailingFloatsLineBox); 1427 m_lineBoxes.appendLineBox(trailingFloatsLineBox);
1428 trailingFloatsLineBox->setConstructed(); 1428 trailingFloatsLineBox->setConstructed();
1429 GlyphOverflowAndFallbackFontsMap textBoxDataMap; 1429 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
1430 VerticalPositionCache verticalPositionCache; 1430 VerticalPositionCache verticalPositionCache;
1431 LayoutUnit blockLogicalHeight = logicalHeight(); 1431 LayoutUnit blockLogicalHeight = logicalHeight();
1432 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight , textBoxDataMap, verticalPositionCache); 1432 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight , textBoxDataMap, verticalPositionCache);
1433 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); 1433 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight);
1434 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo rContent()); 1434 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo rContent());
1435 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay outOverflow - blockLogicalHeight); 1435 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay outOverflow - blockLogicalHeight);
1436 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis ualOverflow - blockLogicalHeight); 1436 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis ualOverflow - blockLogicalHeight);
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2434 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2435 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2435 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2436 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2436 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2437 2437
2438 if (!style()->isLeftToRightDirection()) 2438 if (!style()->isLeftToRightDirection())
2439 return logicalWidth() - logicalLeft; 2439 return logicalWidth() - logicalLeft;
2440 return logicalLeft; 2440 return logicalLeft;
2441 } 2441 }
2442 2442
2443 } 2443 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698