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

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

Issue 1316163002: Make the LayoutRect->FloatRect constructor explicit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
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. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 : m_quads(quads) 675 : m_quads(quads)
676 , m_geometryMap() 676 , m_geometryMap()
677 { 677 {
678 m_geometryMap.pushMappingsToAncestor(layoutObject, 0); 678 m_geometryMap.pushMappingsToAncestor(layoutObject, 0);
679 } 679 }
680 680
681 void operator()(const FloatRect& rect) 681 void operator()(const FloatRect& rect)
682 { 682 {
683 m_quads.append(m_geometryMap.absoluteRect(rect)); 683 m_quads.append(m_geometryMap.absoluteRect(rect));
684 } 684 }
685 void operator()(const LayoutRect& rect)
686 {
687 m_quads.append(m_geometryMap.absoluteRect(FloatRect(rect)));
jbroman 2015/08/26 19:06:43 nit: I don't feel strongly, but how about delegati
chrishtr 2015/08/26 20:53:51 Done.
688 }
685 private: 689 private:
686 Vector<FloatQuad>& m_quads; 690 Vector<FloatQuad>& m_quads;
687 LayoutGeometryMap m_geometryMap; 691 LayoutGeometryMap m_geometryMap;
688 }; 692 };
689 693
690 } // unnamed namespace 694 } // unnamed namespace
691 695
692 void LayoutInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 696 void LayoutInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
693 { 697 {
694 AbsoluteQuadsGeneratorContext context(this, quads); 698 AbsoluteQuadsGeneratorContext context(this, quads);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 namespace { 783 namespace {
780 784
781 class HitTestCulledInlinesGeneratorContext { 785 class HitTestCulledInlinesGeneratorContext {
782 public: 786 public:
783 HitTestCulledInlinesGeneratorContext(Region& region, const HitTestLocation& location) : m_intersected(false), m_region(region), m_location(location) { } 787 HitTestCulledInlinesGeneratorContext(Region& region, const HitTestLocation& location) : m_intersected(false), m_region(region), m_location(location) { }
784 void operator()(const FloatRect& rect) 788 void operator()(const FloatRect& rect)
785 { 789 {
786 m_intersected = m_intersected || m_location.intersects(rect); 790 m_intersected = m_intersected || m_location.intersects(rect);
787 m_region.unite(enclosingIntRect(rect)); 791 m_region.unite(enclosingIntRect(rect));
788 } 792 }
793 void operator()(const LayoutRect& rect)
794 {
795 m_intersected = m_intersected || m_location.intersects(rect);
796 m_region.unite(enclosingIntRect(rect));
797 }
789 bool intersected() const { return m_intersected; } 798 bool intersected() const { return m_intersected; }
790 private: 799 private:
791 bool m_intersected; 800 bool m_intersected;
792 Region& m_region; 801 Region& m_region;
793 const HitTestLocation& m_location; 802 const HitTestLocation& m_location;
794 }; 803 };
795 804
796 } // unnamed namespace 805 } // unnamed namespace
797 806
798 bool LayoutInline::hitTestCulledInline(HitTestResult& result, const HitTestLocat ion& locationInContainer, const LayoutPoint& accumulatedOffset) 807 bool LayoutInline::hitTestCulledInline(HitTestResult& result, const HitTestLocat ion& locationInContainer, const LayoutPoint& accumulatedOffset)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 851
843 namespace { 852 namespace {
844 853
845 class LinesBoundingBoxGeneratorContext { 854 class LinesBoundingBoxGeneratorContext {
846 public: 855 public:
847 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { } 856 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { }
848 void operator()(const FloatRect& rect) 857 void operator()(const FloatRect& rect)
849 { 858 {
850 m_rect.uniteIfNonZero(rect); 859 m_rect.uniteIfNonZero(rect);
851 } 860 }
861 void operator()(const LayoutRect& rect)
862 {
863 m_rect.uniteIfNonZero(FloatRect(rect));
jbroman 2015/08/26 19:06:43 could do the same here; not sure if it's cleaner o
chrishtr 2015/08/26 20:53:51 Done.
864 }
852 private: 865 private:
853 FloatRect& m_rect; 866 FloatRect& m_rect;
854 }; 867 };
855 868
856 } // unnamed namespace 869 } // unnamed namespace
857 870
858 IntRect LayoutInline::linesBoundingBox() const 871 IntRect LayoutInline::linesBoundingBox() const
859 { 872 {
860 if (!alwaysCreateLineBoxes()) { 873 if (!alwaysCreateLineBoxes()) {
861 ASSERT(!firstLineBox()); 874 ASSERT(!firstLineBox());
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 namespace { 1359 namespace {
1347 1360
1348 class AbsoluteLayoutRectsGeneratorContext { 1361 class AbsoluteLayoutRectsGeneratorContext {
1349 public: 1362 public:
1350 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutP oint& accumulatedOffset) 1363 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutP oint& accumulatedOffset)
1351 : m_rects(rects) 1364 : m_rects(rects)
1352 , m_accumulatedOffset(accumulatedOffset) { } 1365 , m_accumulatedOffset(accumulatedOffset) { }
1353 1366
1354 void operator()(const FloatRect& rect) 1367 void operator()(const FloatRect& rect)
1355 { 1368 {
1356 LayoutRect layoutRect(rect); 1369 LayoutRect layoutRect(rect);
jbroman 2015/08/26 19:06:43 nit: and here, but delegating to the LayoutRect ov
chrishtr 2015/08/26 20:53:51 Done.
1357 layoutRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y()); 1370 layoutRect.moveBy(m_accumulatedOffset);
1371 m_rects.append(layoutRect);
1372 }
1373 void operator()(const LayoutRect& rect)
1374 {
1375 LayoutRect layoutRect(rect);
1376 layoutRect.moveBy(m_accumulatedOffset);
1358 m_rects.append(layoutRect); 1377 m_rects.append(layoutRect);
1359 } 1378 }
1360 private: 1379 private:
1361 Vector<LayoutRect>& m_rects; 1380 Vector<LayoutRect>& m_rects;
1362 const LayoutPoint& m_accumulatedOffset; 1381 const LayoutPoint& m_accumulatedOffset;
1363 }; 1382 };
1364 1383
1365 class AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteLay outRectsGeneratorContext { 1384 class AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteLay outRectsGeneratorContext {
1366 public: 1385 public:
1367 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext(Vector<LayoutRect>& re cts, const LayoutPoint& accumulatedOffset) 1386 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext(Vector<LayoutRect>& re cts, const LayoutPoint& accumulatedOffset)
1368 : AbsoluteLayoutRectsGeneratorContext(rects, accumulatedOffset) { } 1387 : AbsoluteLayoutRectsGeneratorContext(rects, accumulatedOffset) { }
1369 1388
1370 void operator()(const FloatRect& rect) 1389 void operator()(const FloatRect& rect)
1371 { 1390 {
1372 if (!rect.isEmpty()) 1391 if (!rect.isEmpty())
1373 AbsoluteLayoutRectsGeneratorContext::operator()(rect); 1392 AbsoluteLayoutRectsGeneratorContext::operator()(rect);
1374 } 1393 }
1394 void operator()(const LayoutRect& rect)
1395 {
1396 if (!rect.isEmpty())
1397 AbsoluteLayoutRectsGeneratorContext::operator()(FloatRect(rect));
1398 }
1375 }; 1399 };
1376 1400
1377 } // unnamed namespace 1401 } // unnamed namespace
1378 1402
1379 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const 1403 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const
1380 { 1404 {
1381 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, additio nalOffset); 1405 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, additio nalOffset);
1382 generateLineBoxRects(context); 1406 generateLineBoxRects(context);
1383 addOutlineRectsForChildrenAndContinuations(rects, additionalOffset); 1407 addOutlineRectsForChildrenAndContinuations(rects, additionalOffset);
1384 } 1408 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 } 1453 }
1430 1454
1431 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const 1455 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const
1432 { 1456 {
1433 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r); 1457 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r);
1434 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1458 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1435 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1459 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1436 } 1460 }
1437 1461
1438 } // namespace blink 1462 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698