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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 2610253004: Migrate WTF::Vector::append() to ::push_back() [part 9 of N] (Closed)
Patch Set: rebase Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // There will eventually be a better approach to this problem that will let us 413 // There will eventually be a better approach to this problem that will let us
414 // nest to a much greater depth (see bugzilla bug 13430) but for now we have a 414 // nest to a much greater depth (see bugzilla bug 13430) but for now we have a
415 // limit. This *will* result in incorrect rendering, but the alternative is to 415 // limit. This *will* result in incorrect rendering, but the alternative is to
416 // hang forever. 416 // hang forever.
417 const unsigned cMaxSplitDepth = 200; 417 const unsigned cMaxSplitDepth = 200;
418 Vector<LayoutInline*> inlinesToClone; 418 Vector<LayoutInline*> inlinesToClone;
419 LayoutInline* topMostInline = this; 419 LayoutInline* topMostInline = this;
420 for (LayoutObject* o = this; o != fromBlock; o = o->parent()) { 420 for (LayoutObject* o = this; o != fromBlock; o = o->parent()) {
421 topMostInline = toLayoutInline(o); 421 topMostInline = toLayoutInline(o);
422 if (inlinesToClone.size() < cMaxSplitDepth) 422 if (inlinesToClone.size() < cMaxSplitDepth)
423 inlinesToClone.append(topMostInline); 423 inlinesToClone.push_back(topMostInline);
424 // Keep walking up the chain to ensure |topMostInline| is a child of 424 // Keep walking up the chain to ensure |topMostInline| is a child of
425 // |fromBlock|, to avoid assertion failure when |fromBlock|'s children are 425 // |fromBlock|, to avoid assertion failure when |fromBlock|'s children are
426 // moved to |toBlock| below. 426 // moved to |toBlock| below.
427 } 427 }
428 428
429 // Create a new clone of the top-most inline in |inlinesToClone|. 429 // Create a new clone of the top-most inline in |inlinesToClone|.
430 LayoutInline* topMostInlineToClone = inlinesToClone.back(); 430 LayoutInline* topMostInlineToClone = inlinesToClone.back();
431 LayoutInline* cloneInline = topMostInlineToClone->clone(); 431 LayoutInline* cloneInline = topMostInlineToClone->clone();
432 432
433 // Now we are at the block level. We need to put the clone into the |toBlock|. 433 // Now we are at the block level. We need to put the clone into the |toBlock|.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 class AbsoluteRectsGeneratorContext { 714 class AbsoluteRectsGeneratorContext {
715 public: 715 public:
716 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, 716 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects,
717 const LayoutPoint& accumulatedOffset) 717 const LayoutPoint& accumulatedOffset)
718 : m_rects(rects), m_accumulatedOffset(accumulatedOffset) {} 718 : m_rects(rects), m_accumulatedOffset(accumulatedOffset) {}
719 719
720 void operator()(const LayoutRect& rect) { 720 void operator()(const LayoutRect& rect) {
721 IntRect intRect = enclosingIntRect(rect); 721 IntRect intRect = enclosingIntRect(rect);
722 intRect.move(m_accumulatedOffset.x().toInt(), 722 intRect.move(m_accumulatedOffset.x().toInt(),
723 m_accumulatedOffset.y().toInt()); 723 m_accumulatedOffset.y().toInt());
724 m_rects.append(intRect); 724 m_rects.push_back(intRect);
725 } 725 }
726 726
727 private: 727 private:
728 Vector<IntRect>& m_rects; 728 Vector<IntRect>& m_rects;
729 const LayoutPoint& m_accumulatedOffset; 729 const LayoutPoint& m_accumulatedOffset;
730 }; 730 };
731 731
732 } // unnamed namespace 732 } // unnamed namespace
733 733
734 void LayoutInline::absoluteRects(Vector<IntRect>& rects, 734 void LayoutInline::absoluteRects(Vector<IntRect>& rects,
(...skipping 23 matching lines...) Expand all
758 class AbsoluteQuadsGeneratorContext { 758 class AbsoluteQuadsGeneratorContext {
759 public: 759 public:
760 AbsoluteQuadsGeneratorContext(const LayoutInline* layoutObject, 760 AbsoluteQuadsGeneratorContext(const LayoutInline* layoutObject,
761 Vector<FloatQuad>& quads, 761 Vector<FloatQuad>& quads,
762 MapCoordinatesFlags mode) 762 MapCoordinatesFlags mode)
763 : m_quads(quads), m_geometryMap(mode) { 763 : m_quads(quads), m_geometryMap(mode) {
764 m_geometryMap.pushMappingsToAncestor(layoutObject, 0); 764 m_geometryMap.pushMappingsToAncestor(layoutObject, 0);
765 } 765 }
766 766
767 void operator()(const FloatRect& rect) { 767 void operator()(const FloatRect& rect) {
768 m_quads.append(m_geometryMap.absoluteRect(rect)); 768 m_quads.push_back(m_geometryMap.absoluteRect(rect));
769 } 769 }
770 void operator()(const LayoutRect& rect) { operator()(FloatRect(rect)); } 770 void operator()(const LayoutRect& rect) { operator()(FloatRect(rect)); }
771 771
772 private: 772 private:
773 Vector<FloatQuad>& m_quads; 773 Vector<FloatQuad>& m_quads;
774 LayoutGeometryMap m_geometryMap; 774 LayoutGeometryMap m_geometryMap;
775 }; 775 };
776 776
777 } // unnamed namespace 777 } // unnamed namespace
778 778
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 class AbsoluteLayoutRectsGeneratorContext { 1413 class AbsoluteLayoutRectsGeneratorContext {
1414 public: 1414 public:
1415 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, 1415 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects,
1416 const LayoutPoint& accumulatedOffset) 1416 const LayoutPoint& accumulatedOffset)
1417 : m_rects(rects), m_accumulatedOffset(accumulatedOffset) {} 1417 : m_rects(rects), m_accumulatedOffset(accumulatedOffset) {}
1418 1418
1419 void operator()(const FloatRect& rect) { operator()(LayoutRect(rect)); } 1419 void operator()(const FloatRect& rect) { operator()(LayoutRect(rect)); }
1420 void operator()(const LayoutRect& rect) { 1420 void operator()(const LayoutRect& rect) {
1421 LayoutRect layoutRect(rect); 1421 LayoutRect layoutRect(rect);
1422 layoutRect.moveBy(m_accumulatedOffset); 1422 layoutRect.moveBy(m_accumulatedOffset);
1423 m_rects.append(layoutRect); 1423 m_rects.push_back(layoutRect);
1424 } 1424 }
1425 1425
1426 private: 1426 private:
1427 Vector<LayoutRect>& m_rects; 1427 Vector<LayoutRect>& m_rects;
1428 const LayoutPoint& m_accumulatedOffset; 1428 const LayoutPoint& m_accumulatedOffset;
1429 }; 1429 };
1430 1430
1431 } // unnamed namespace 1431 } // unnamed namespace
1432 1432
1433 void LayoutInline::addOutlineRects( 1433 void LayoutInline::addOutlineRects(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 region.bounds = LayoutRect(linesBoundingBox()); 1495 region.bounds = LayoutRect(linesBoundingBox());
1496 1496
1497 LayoutObject* container = containingBlock(); 1497 LayoutObject* container = containingBlock();
1498 if (!container) 1498 if (!container)
1499 container = this; 1499 container = this;
1500 1500
1501 FloatPoint absPos = container->localToAbsolute(); 1501 FloatPoint absPos = container->localToAbsolute();
1502 region.bounds.setX(LayoutUnit(absPos.x() + region.bounds.x())); 1502 region.bounds.setX(LayoutUnit(absPos.x() + region.bounds.x()));
1503 region.bounds.setY(LayoutUnit(absPos.y() + region.bounds.y())); 1503 region.bounds.setY(LayoutUnit(absPos.y() + region.bounds.y()));
1504 1504
1505 regions.append(region); 1505 regions.push_back(region);
1506 } 1506 }
1507 1507
1508 void LayoutInline::invalidateDisplayItemClients( 1508 void LayoutInline::invalidateDisplayItemClients(
1509 PaintInvalidationReason invalidationReason) const { 1509 PaintInvalidationReason invalidationReason) const {
1510 ObjectPaintInvalidator paintInvalidator(*this); 1510 ObjectPaintInvalidator paintInvalidator(*this);
1511 paintInvalidator.invalidateDisplayItemClient(*this, invalidationReason); 1511 paintInvalidator.invalidateDisplayItemClient(*this, invalidationReason);
1512 1512
1513 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1513 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1514 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1514 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1515 } 1515 }
1516 1516
1517 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1517 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1518 LayoutRect LayoutInline::debugRect() const { 1518 LayoutRect LayoutInline::debugRect() const {
1519 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1519 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1520 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1520 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1521 } 1521 }
1522 1522
1523 } // namespace blink 1523 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698