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

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

Issue 1162383003: C++11: Replace 0 with nullptr where applicable in layout code. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add one more file. Created 5 years, 6 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/layout/LayoutBlockFlow.h ('k') | Source/core/layout/LayoutBlockFlowLine.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 static_assert(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), "MarginInf o should stay small"); 168 static_assert(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), "MarginInf o should stay small");
169 setChildrenInline(true); 169 setChildrenInline(true);
170 } 170 }
171 171
172 LayoutBlockFlow::~LayoutBlockFlow() 172 LayoutBlockFlow::~LayoutBlockFlow()
173 { 173 {
174 } 174 }
175 175
176 LayoutBlockFlow* LayoutBlockFlow::createAnonymous(Document* document) 176 LayoutBlockFlow* LayoutBlockFlow::createAnonymous(Document* document)
177 { 177 {
178 LayoutBlockFlow* layoutBlockFlow = new LayoutBlockFlow(0); 178 LayoutBlockFlow* layoutBlockFlow = new LayoutBlockFlow(nullptr);
179 layoutBlockFlow->setDocumentForAnonymous(document); 179 layoutBlockFlow->setDocumentForAnonymous(document);
180 return layoutBlockFlow; 180 return layoutBlockFlow;
181 } 181 }
182 182
183 LayoutObject* LayoutBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope) 183 LayoutObject* LayoutBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
184 { 184 {
185 LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread(); 185 LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread();
186 if (!flowThread) 186 if (!flowThread)
187 return 0; 187 return nullptr;
188 setLogicalTopForChild(*flowThread, borderBefore() + paddingBefore()); 188 setLogicalTopForChild(*flowThread, borderBefore() + paddingBefore());
189 flowThread->layoutColumns(relayoutChildren, layoutScope); 189 flowThread->layoutColumns(relayoutChildren, layoutScope);
190 determineLogicalLeftPositionForChild(*flowThread); 190 determineLogicalLeftPositionForChild(*flowThread);
191 return flowThread; 191 return flowThread;
192 } 192 }
193 193
194 bool LayoutBlockFlow::updateLogicalWidthAndColumnWidth() 194 bool LayoutBlockFlow::updateLogicalWidthAndColumnWidth()
195 { 195 {
196 bool relayoutChildren = LayoutBlock::updateLogicalWidthAndColumnWidth(); 196 bool relayoutChildren = LayoutBlock::updateLogicalWidthAndColumnWidth();
197 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { 197 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) {
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 MarginInfo marginInfo(this, beforeEdge, afterEdge); 947 MarginInfo marginInfo(this, beforeEdge, afterEdge);
948 948
949 // Fieldsets need to find their legend and position it inside the border of the object. 949 // Fieldsets need to find their legend and position it inside the border of the object.
950 // The legend then gets skipped during normal layout. The same is true for r uby text. 950 // The legend then gets skipped during normal layout. The same is true for r uby text.
951 // It doesn't get included in the normal layout process but is instead skipp ed. 951 // It doesn't get included in the normal layout process but is instead skipp ed.
952 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); 952 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope);
953 953
954 LayoutUnit previousFloatLogicalBottom = 0; 954 LayoutUnit previousFloatLogicalBottom = 0;
955 955
956 LayoutBox* next = firstChildBox(); 956 LayoutBox* next = firstChildBox();
957 LayoutBox* lastNormalFlowChild = 0; 957 LayoutBox* lastNormalFlowChild = nullptr;
958 958
959 while (next) { 959 while (next) {
960 LayoutBox* child = next; 960 LayoutBox* child = next;
961 next = child->nextSiblingBox(); 961 next = child->nextSiblingBox();
962 962
963 child->setMayNeedPaintInvalidation(); 963 child->setMayNeedPaintInvalidation();
964 964
965 if (childToExclude == child) 965 if (childToExclude == child)
966 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs). 966 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs).
967 967
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 // the line that they're on, but it still needs to be dirtie d. This is 2264 // the line that they're on, but it still needs to be dirtie d. This is
2265 // accomplished by pretending they have a height of 1. 2265 // accomplished by pretending they have a height of 1.
2266 logicalBottom = std::max(logicalBottom, logicalTop + 1); 2266 logicalBottom = std::max(logicalBottom, logicalTop + 1);
2267 } 2267 }
2268 if (floatingObject->originatingLine()) { 2268 if (floatingObject->originatingLine()) {
2269 if (!selfNeedsLayout()) { 2269 if (!selfNeedsLayout()) {
2270 ASSERT(floatingObject->originatingLine()->layoutObject() == this); 2270 ASSERT(floatingObject->originatingLine()->layoutObject() == this);
2271 floatingObject->originatingLine()->markDirty(); 2271 floatingObject->originatingLine()->markDirty();
2272 } 2272 }
2273 #if ENABLE(ASSERT) 2273 #if ENABLE(ASSERT)
2274 floatingObject->setOriginatingLine(0); 2274 floatingObject->setOriginatingLine(nullptr);
2275 #endif 2275 #endif
2276 } 2276 }
2277 markLinesDirtyInBlockRange(0, logicalBottom); 2277 markLinesDirtyInBlockRange(0, logicalBottom);
2278 } 2278 }
2279 m_floatingObjects->remove(floatingObject); 2279 m_floatingObjects->remove(floatingObject);
2280 } 2280 }
2281 } 2281 }
2282 } 2282 }
2283 2283
2284 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int logicalOffset) 2284 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int logicalOffset)
(...skipping 23 matching lines...) Expand all
2308 // If all floats have already been positioned, then we have no work to do. 2308 // If all floats have already been positioned, then we have no work to do.
2309 if (floatingObjectSet.last()->isPlaced()) 2309 if (floatingObjectSet.last()->isPlaced())
2310 return false; 2310 return false;
2311 2311
2312 // Move backwards through our floating object list until we find a float tha t has 2312 // Move backwards through our floating object list until we find a float tha t has
2313 // already been positioned. Then we'll be able to move forward, positioning all of 2313 // already been positioned. Then we'll be able to move forward, positioning all of
2314 // the new floats that need it. 2314 // the new floats that need it.
2315 FloatingObjectSetIterator it = floatingObjectSet.end(); 2315 FloatingObjectSetIterator it = floatingObjectSet.end();
2316 --it; // Go to last item. 2316 --it; // Go to last item.
2317 FloatingObjectSetIterator begin = floatingObjectSet.begin(); 2317 FloatingObjectSetIterator begin = floatingObjectSet.begin();
2318 FloatingObject* lastPlacedFloatingObject = 0; 2318 FloatingObject* lastPlacedFloatingObject = nullptr;
2319 while (it != begin) { 2319 while (it != begin) {
2320 --it; 2320 --it;
2321 if ((*it)->isPlaced()) { 2321 if ((*it)->isPlaced()) {
2322 lastPlacedFloatingObject = it->get(); 2322 lastPlacedFloatingObject = it->get();
2323 ++it; 2323 ++it;
2324 break; 2324 break;
2325 } 2325 }
2326 } 2326 }
2327 2327
2328 LayoutUnit logicalTop = logicalHeight(); 2328 LayoutUnit logicalTop = logicalHeight();
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 if (containsStart) { 2686 if (containsStart) {
2687 // Go ahead and update our lastLogicalTop to be the bottom of the bl ock. <hr>s or empty blocks with height can trip this 2687 // Go ahead and update our lastLogicalTop to be the bottom of the bl ock. <hr>s or empty blocks with height can trip this
2688 // case. 2688 // case.
2689 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock ) + logicalHeight(); 2689 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock ) + logicalHeight();
2690 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeigh t()); 2690 lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeigh t());
2691 lastLogicalRight = logicalRightSelectionOffset(rootBlock, logicalHei ght()); 2691 lastLogicalRight = logicalRightSelectionOffset(rootBlock, logicalHei ght());
2692 } 2692 }
2693 return result; 2693 return result;
2694 } 2694 }
2695 2695
2696 RootInlineBox* lastSelectedLine = 0; 2696 RootInlineBox* lastSelectedLine = nullptr;
2697 RootInlineBox* curr; 2697 RootInlineBox* curr;
2698 for (curr = firstRootBox(); curr && !curr->hasSelectedChildren(); curr = cur r->nextRootBox()) { } 2698 for (curr = firstRootBox(); curr && !curr->hasSelectedChildren(); curr = cur r->nextRootBox()) { }
2699 2699
2700 // Now paint the gaps for the lines. 2700 // Now paint the gaps for the lines.
2701 for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) { 2701 for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) {
2702 LayoutUnit selTop = curr->selectionTopAdjustedForPrecedingBlock(); 2702 LayoutUnit selTop = curr->selectionTopAdjustedForPrecedingBlock();
2703 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock(); 2703 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock();
2704 2704
2705 if (!containsStart && !lastSelectedLine && selectionState() != Selection Start && selectionState() != SelectionBoth) { 2705 if (!containsStart && !lastSelectedLine && selectionState() != Selection Start && selectionState() != SelectionBoth) {
2706 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPos ition, offsetFromRootBlock, lastLogicalTop, 2706 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPos ition, offsetFromRootBlock, lastLogicalTop,
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3053 FrameView* frameView = document().view(); 3053 FrameView* frameView = document().view();
3054 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3054 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3055 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3055 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3056 if (size().height() < visibleHeight) 3056 if (size().height() < visibleHeight)
3057 top += (visibleHeight - size().height()) / 2; 3057 top += (visibleHeight - size().height()) / 2;
3058 setY(top); 3058 setY(top);
3059 dialog->setCentered(top); 3059 dialog->setCentered(top);
3060 } 3060 }
3061 3061
3062 } // namespace blink 3062 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | Source/core/layout/LayoutBlockFlowLine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698