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

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

Issue 1062283002: Use C++11 range-based loop for core/layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix it naming 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 | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutFlowThread.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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 line->attachLine(); 1006 line->attachLine();
1007 if (paginated) { 1007 if (paginated) {
1008 delta -= line->paginationStrut(); 1008 delta -= line->paginationStrut();
1009 adjustLinePositionForPagination(*line, delta, layoutState.fl owThread()); 1009 adjustLinePositionForPagination(*line, delta, layoutState.fl owThread());
1010 } 1010 }
1011 if (delta) { 1011 if (delta) {
1012 layoutState.updatePaintInvalidationRangeFromBox(line, delta) ; 1012 layoutState.updatePaintInvalidationRangeFromBox(line, delta) ;
1013 line->adjustBlockDirectionPosition(delta.toFloat()); 1013 line->adjustBlockDirectionPosition(delta.toFloat());
1014 } 1014 }
1015 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { 1015 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) {
1016 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); 1016 for (auto* box : *cleanLineFloats) {
1017 for (Vector<LayoutBox*>::iterator f = cleanLineFloats->begin (); f != end; ++f) { 1017 FloatingObject* floatingObject = insertFloatingObject(*b ox);
1018 FloatingObject* floatingObject = insertFloatingObject(** f);
1019 ASSERT(!floatingObject->originatingLine()); 1018 ASSERT(!floatingObject->originatingLine());
1020 floatingObject->setOriginatingLine(line); 1019 floatingObject->setOriginatingLine(line);
1021 setLogicalHeight(logicalTopForChild(**f) - marginBeforeF orChild(**f) + delta); 1020 setLogicalHeight(logicalTopForChild(*box) - marginBefore ForChild(*box) + delta);
1022 positionNewFloats(); 1021 positionNewFloats();
1023 } 1022 }
1024 } 1023 }
1025 } 1024 }
1026 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); 1025 setLogicalHeight(lastRootBox()->lineBottomWithLeading());
1027 } else { 1026 } else {
1028 // Delete all the remaining lines. 1027 // Delete all the remaining lines.
1029 deleteLineRange(layoutState, layoutState.endLine()); 1028 deleteLineRange(layoutState, layoutState.endLine());
1030 } 1029 }
1031 } 1030 }
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 if (isFullLayout && firstLineBox()) 1621 if (isFullLayout && firstLineBox())
1623 setShouldDoFullPaintInvalidation(); 1622 setShouldDoFullPaintInvalidation();
1624 } 1623 }
1625 1624
1626 void LayoutBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF loat) 1625 void LayoutBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF loat)
1627 { 1626 {
1628 Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr(); 1627 Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr();
1629 if (!cleanLineFloats) 1628 if (!cleanLineFloats)
1630 return; 1629 return;
1631 1630
1632 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); 1631 for (auto* floatingBox : *cleanLineFloats) {
1633 for (Vector<LayoutBox*>::iterator it = cleanLineFloats->begin(); it != end; ++it) {
1634 LayoutBox* floatingBox = *it;
1635 floatingBox->layoutIfNeeded(); 1632 floatingBox->layoutIfNeeded();
1636 LayoutSize newSize = floatingBox->size() + 1633 LayoutSize newSize = floatingBox->size() +
1637 LayoutSize(floatingBox->marginWidth(), floatingBox->marginHeight()); 1634 LayoutSize(floatingBox->marginWidth(), floatingBox->marginHeight());
1638 if (floats[floatIndex].object != floatingBox) { 1635 if (floats[floatIndex].object != floatingBox) {
1639 encounteredNewFloat = true; 1636 encounteredNewFloat = true;
1640 return; 1637 return;
1641 } 1638 }
1642 1639
1643 if (floats[floatIndex].rect.size() != newSize) { 1640 if (floats[floatIndex].rect.size() != newSize) {
1644 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex] .rect.y() : floats[floatIndex].rect.x(); 1641 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex] .rect.y() : floats[floatIndex].rect.x();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 last = curr ? curr->prevRootBox() : lastRootBox(); 1732 last = curr ? curr->prevRootBox() : lastRootBox();
1736 } 1733 }
1737 1734
1738 unsigned numCleanFloats = 0; 1735 unsigned numCleanFloats = 0;
1739 if (!layoutState.floats().isEmpty()) { 1736 if (!layoutState.floats().isEmpty()) {
1740 LayoutUnit savedLogicalHeight = logicalHeight(); 1737 LayoutUnit savedLogicalHeight = logicalHeight();
1741 // Restore floats from clean lines. 1738 // Restore floats from clean lines.
1742 RootInlineBox* line = firstRootBox(); 1739 RootInlineBox* line = firstRootBox();
1743 while (line != curr) { 1740 while (line != curr) {
1744 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { 1741 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) {
1745 Vector<LayoutBox*>::iterator end = cleanLineFloats->end(); 1742 for (auto* box : *cleanLineFloats) {
1746 for (Vector<LayoutBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { 1743 FloatingObject* floatingObject = insertFloatingObject(*box);
1747 FloatingObject* floatingObject = insertFloatingObject(**f);
1748 ASSERT(!floatingObject->originatingLine()); 1744 ASSERT(!floatingObject->originatingLine());
1749 floatingObject->setOriginatingLine(line); 1745 floatingObject->setOriginatingLine(line);
1750 setLogicalHeight(logicalTopForChild(**f) - marginBeforeForCh ild(**f)); 1746 setLogicalHeight(logicalTopForChild(*box) - marginBeforeForC hild(*box));
1751 positionNewFloats(); 1747 positionNewFloats();
1752 ASSERT(layoutState.floats()[numCleanFloats].object == *f); 1748 ASSERT(layoutState.floats()[numCleanFloats].object == box);
1753 numCleanFloats++; 1749 numCleanFloats++;
1754 } 1750 }
1755 } 1751 }
1756 line = line->nextRootBox(); 1752 line = line->nextRootBox();
1757 } 1753 }
1758 setLogicalHeight(savedLogicalHeight); 1754 setLogicalHeight(savedLogicalHeight);
1759 } 1755 }
1760 layoutState.setFloatIndex(numCleanFloats); 1756 layoutState.setFloatIndex(numCleanFloats);
1761 1757
1762 layoutState.lineInfo().setFirstLine(!last); 1758 layoutState.lineInfo().setFirstLine(!last);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2052 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2057 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2053 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2058 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2054 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2059 2055
2060 if (!style()->isLeftToRightDirection()) 2056 if (!style()->isLeftToRightDirection())
2061 return logicalWidth() - logicalLeft; 2057 return logicalWidth() - logicalLeft;
2062 return logicalLeft; 2058 return logicalLeft;
2063 } 2059 }
2064 2060
2065 } 2061 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutFlowThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698