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

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
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/svg/LayoutSVGBlock.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) 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 operator()(FloatRect(rect));
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 operator()(FloatRect(rect));
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 {
1369 operator()(LayoutRect(rect));
1370 }
1371 void operator()(const LayoutRect& rect)
1372 {
1356 LayoutRect layoutRect(rect); 1373 LayoutRect layoutRect(rect);
1357 layoutRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y()); 1374 layoutRect.moveBy(m_accumulatedOffset);
1358 m_rects.append(layoutRect); 1375 m_rects.append(layoutRect);
1359 } 1376 }
1360 private: 1377 private:
1361 Vector<LayoutRect>& m_rects; 1378 Vector<LayoutRect>& m_rects;
1362 const LayoutPoint& m_accumulatedOffset; 1379 const LayoutPoint& m_accumulatedOffset;
1363 }; 1380 };
1364 1381
1365 class AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteLay outRectsGeneratorContext { 1382 class AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteLay outRectsGeneratorContext {
1366 public: 1383 public:
1367 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext(Vector<LayoutRect>& re cts, const LayoutPoint& accumulatedOffset) 1384 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext(Vector<LayoutRect>& re cts, const LayoutPoint& accumulatedOffset)
1368 : AbsoluteLayoutRectsGeneratorContext(rects, accumulatedOffset) { } 1385 : AbsoluteLayoutRectsGeneratorContext(rects, accumulatedOffset) { }
1369 1386
1370 void operator()(const FloatRect& rect) 1387 void operator()(const FloatRect& rect)
1371 { 1388 {
1372 if (!rect.isEmpty()) 1389 if (!rect.isEmpty())
1373 AbsoluteLayoutRectsGeneratorContext::operator()(rect); 1390 AbsoluteLayoutRectsGeneratorContext::operator()(rect);
1374 } 1391 }
1392 void operator()(const LayoutRect& rect)
1393 {
1394 if (!rect.isEmpty())
1395 AbsoluteLayoutRectsGeneratorContext::operator()(FloatRect(rect));
1396 }
1375 }; 1397 };
1376 1398
1377 } // unnamed namespace 1399 } // unnamed namespace
1378 1400
1379 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const 1401 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const
1380 { 1402 {
1381 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, additio nalOffset); 1403 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, additio nalOffset);
1382 generateLineBoxRects(context); 1404 generateLineBoxRects(context);
1383 addOutlineRectsForChildrenAndContinuations(rects, additionalOffset); 1405 addOutlineRectsForChildrenAndContinuations(rects, additionalOffset);
1384 } 1406 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 } 1451 }
1430 1452
1431 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const 1453 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const
1432 { 1454 {
1433 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r); 1455 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r);
1434 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1456 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1435 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1457 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1436 } 1458 }
1437 1459
1438 } // namespace blink 1460 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/svg/LayoutSVGBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698