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

Side by Side Diff: Source/core/rendering/shapes/ShapeInsideInfo.h

Issue 178473024: Convert some Shape code to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased patch Created 6 years, 9 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) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 struct LineSegmentRange { 55 struct LineSegmentRange {
56 LineSegmentIterator start; 56 LineSegmentIterator start;
57 LineSegmentIterator end; 57 LineSegmentIterator end;
58 LineSegmentRange(const InlineIterator& start, const InlineIterator& end); 58 LineSegmentRange(const InlineIterator& start, const InlineIterator& end);
59 }; 59 };
60 60
61 typedef Vector<LineSegmentRange> SegmentRangeList; 61 typedef Vector<LineSegmentRange> SegmentRangeList;
62 62
63 class ShapeInsideInfo FINAL : public ShapeInfo<RenderBlock> { 63 class ShapeInsideInfo FINAL : public ShapeInfo<RenderBlock> {
64 public: 64 public:
65 static PassOwnPtr<ShapeInsideInfo> createInfo(const RenderBlock* renderer) { return adoptPtr(new ShapeInsideInfo(renderer)); } 65 static PassOwnPtr<ShapeInsideInfo> createInfo(const RenderBlock& renderer) { return adoptPtr(new ShapeInsideInfo(renderer)); }
66 66 static bool isEnabledFor(const RenderBlock& renderer);
67 static bool isEnabledFor(const RenderBlock* renderer);
68 67
69 bool updateSegmentsForLine(LayoutSize lineOffset, LayoutUnit lineHeight); 68 bool updateSegmentsForLine(LayoutSize lineOffset, LayoutUnit lineHeight);
70 bool updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight); 69 bool updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight);
71 70
72 bool hasSegments() const 71 bool hasSegments() const
73 { 72 {
74 return lineOverlapsShapeBounds() && m_segments.size(); 73 return lineOverlapsShapeBounds() && m_segments.size();
75 } 74 }
76 const SegmentList& segments() const 75 const SegmentList& segments() const
77 { 76 {
(...skipping 11 matching lines...) Expand all
89 } 88 }
90 void clearSegments() { m_segments.clear(); } 89 void clearSegments() { m_segments.clear(); }
91 bool adjustLogicalLineTop(float minSegmentWidth); 90 bool adjustLogicalLineTop(float minSegmentWidth);
92 LayoutUnit computeFirstFitPositionForFloat(const FloatSize&) const; 91 LayoutUnit computeFirstFitPositionForFloat(const FloatSize&) const;
93 92
94 void setNeedsLayout(bool value) { m_needsLayout = value; } 93 void setNeedsLayout(bool value) { m_needsLayout = value; }
95 bool needsLayout() { return m_needsLayout; } 94 bool needsLayout() { return m_needsLayout; }
96 95
97 virtual bool lineOverlapsShapeBounds() const OVERRIDE 96 virtual bool lineOverlapsShapeBounds() const OVERRIDE
98 { 97 {
99 return computedShape()->lineOverlapsShapePaddingBounds(m_referenceBoxLin eTop, m_lineHeight); 98 return computedShape().lineOverlapsShapePaddingBounds(m_referenceBoxLine Top, m_lineHeight);
100 } 99 }
101 100
102 protected: 101 protected:
103 virtual LayoutBox referenceBox() const OVERRIDE 102 virtual LayoutBox referenceBox() const OVERRIDE
104 { 103 {
105 if (shapeValue()->layoutBox() == BoxMissing) 104 if (shapeValue()->layoutBox() == BoxMissing)
106 return ContentBox; 105 return ContentBox;
107 return shapeValue()->layoutBox(); 106 return shapeValue()->layoutBox();
108 } 107 }
109 virtual LayoutRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape()->shapePaddingLogicalBoundingBox(); } 108 virtual LayoutRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape().shapePaddingLogicalBoundingBox(); }
110 virtual ShapeValue* shapeValue() const OVERRIDE; 109 virtual ShapeValue* shapeValue() const OVERRIDE;
111 virtual void getIntervals(LayoutUnit lineTop, LayoutUnit lineHeight, Segment List& segments) const OVERRIDE 110 virtual void getIntervals(LayoutUnit lineTop, LayoutUnit lineHeight, Segment List& segments) const OVERRIDE
112 { 111 {
113 return computedShape()->getIncludedIntervals(lineTop, lineHeight, segmen ts); 112 return computedShape().getIncludedIntervals(lineTop, lineHeight, segment s);
114 } 113 }
115 114
116 private: 115 private:
117 ShapeInsideInfo(const RenderBlock* renderer) 116 ShapeInsideInfo(const RenderBlock& renderer)
118 : ShapeInfo<RenderBlock> (renderer) 117 : ShapeInfo<RenderBlock> (renderer)
119 , m_needsLayout(false) 118 , m_needsLayout(false)
120 { } 119 { }
121 120
122 SegmentRangeList m_segmentRanges; 121 SegmentRangeList m_segmentRanges;
123 bool m_needsLayout; 122 bool m_needsLayout;
124 SegmentList m_segments; 123 SegmentList m_segments;
125 }; 124 };
126 125
127 } 126 }
128 #endif 127 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/ShapeInfo.cpp ('k') | Source/core/rendering/shapes/ShapeInsideInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698