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

Side by Side Diff: Source/core/rendering/shapes/RasterShape.cpp

Issue 237313003: CSS shapes support in Web Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review comment and add test Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 { 111 {
112 m_bounds = IntRect(); 112 m_bounds = IntRect();
113 for (int y = minY(); y < maxY(); ++y) { 113 for (int y = minY(); y < maxY(); ++y) {
114 const IntShapeInterval& intervalAtY = intervalAt(y); 114 const IntShapeInterval& intervalAtY = intervalAt(y);
115 if (intervalAtY.isEmpty()) 115 if (intervalAtY.isEmpty())
116 continue; 116 continue;
117 m_bounds.unite(IntRect(intervalAtY.x1(), y, intervalAtY.width(), 1)); 117 m_bounds.unite(IntRect(intervalAtY.x1(), y, intervalAtY.width(), 1));
118 } 118 }
119 } 119 }
120 120
121 void RasterShapeIntervals::buildBoundsPath(Path& path) const
122 {
123 for (int y = bounds().y(); y < bounds().maxY(); y++) {
apavlov 2014/04/17 16:11:32 You've got two loops using bounds().maxY() in the
Habib Virji 2014/04/17 16:27:02 Done.
124 if (intervalAt(y).isEmpty())
125 continue;
126
127 IntShapeInterval extent = intervalAt(y);
128 int endY = y + 1;
apavlov 2014/04/17 16:11:32 This could easily go into the for-initializer
apavlov 2014/04/17 16:12:26 Sorry, it's not visible outside the loop, unlike i
129 for (; endY < bounds().maxY(); endY++) {
130 if (intervalAt(endY).isEmpty() || intervalAt(endY) != extent)
131 break;
132 }
133 path.addRect(FloatRect(extent.x1(), y, extent.width(), endY - y));
134 y = endY - 1;
135 }
136 }
137
121 const RasterShapeIntervals& RasterShape::marginIntervals() const 138 const RasterShapeIntervals& RasterShape::marginIntervals() const
122 { 139 {
123 ASSERT(shapeMargin() >= 0); 140 ASSERT(shapeMargin() >= 0);
124 if (!shapeMargin()) 141 if (!shapeMargin())
125 return *m_intervals; 142 return *m_intervals;
126 143
127 int shapeMarginInt = clampToPositiveInteger(ceil(shapeMargin())); 144 int shapeMarginInt = clampToPositiveInteger(ceil(shapeMargin()));
128 int maxShapeMarginInt = std::max(m_marginRectSize.width(), m_marginRectSize. height()) * sqrtf(2); 145 int maxShapeMarginInt = std::max(m_marginRectSize.width(), m_marginRectSize. height()) * sqrtf(2);
129 if (!m_marginIntervals) 146 if (!m_marginIntervals)
130 m_marginIntervals = m_intervals->computeShapeMarginIntervals(std::min(sh apeMarginInt, maxShapeMarginInt)); 147 m_marginIntervals = m_intervals->computeShapeMarginIntervals(std::min(sh apeMarginInt, maxShapeMarginInt));
(...skipping 17 matching lines...) Expand all
148 y2 = std::min(y2, intervals.bounds().maxY()); 165 y2 = std::min(y2, intervals.bounds().maxY());
149 IntShapeInterval excludedInterval; 166 IntShapeInterval excludedInterval;
150 167
151 for (int y = y1; y < y2; y++) 168 for (int y = y1; y < y2; y++)
152 excludedInterval.unite(intervals.intervalAt(y)); 169 excludedInterval.unite(intervals.intervalAt(y));
153 170
154 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2() + 1)) ; 171 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2() + 1)) ;
155 } 172 }
156 173
157 } // namespace WebCore 174 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698