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

Unified Diff: Source/core/rendering/exclusions/ExclusionShape.cpp

Issue 14892005: [CSS Exclusions] ExclusionShape bounding box methods should return LayoutRects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reverted LineSegment logicalLeft,Right type change Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/exclusions/ExclusionShape.cpp
diff --git a/Source/core/rendering/exclusions/ExclusionShape.cpp b/Source/core/rendering/exclusions/ExclusionShape.cpp
index 271d3082472f53a5144ec3ca0078735cd547f007..53fc9c11100d207c963a7158ad667857909edede 100644
--- a/Source/core/rendering/exclusions/ExclusionShape.cpp
+++ b/Source/core/rendering/exclusions/ExclusionShape.cpp
@@ -90,13 +90,13 @@ static inline FloatSize physicalSizeToLogical(const FloatSize& size, WritingMode
return size.transposedSize();
}
-PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* basicShape, float logicalBoxWidth, float logicalBoxHeight, WritingMode writingMode, Length margin, Length padding)
+PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, Length margin, Length padding)
{
ASSERT(basicShape);
bool horizontalWritingMode = isHorizontalWritingMode(writingMode);
- float boxWidth = horizontalWritingMode ? logicalBoxWidth : logicalBoxHeight;
- float boxHeight = horizontalWritingMode ? logicalBoxHeight : logicalBoxWidth;
+ float boxWidth = horizontalWritingMode ? logicalBoxSize.width() : logicalBoxSize.height();
+ float boxHeight = horizontalWritingMode ? logicalBoxSize.height() : logicalBoxSize.width();
OwnPtr<ExclusionShape> exclusionShape;
switch (basicShape->type()) {
@@ -113,7 +113,7 @@ PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape
FloatSize cornerRadii(
radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth),
radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight));
- FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxHeight, writingMode);
+ FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.height(), writingMode);
exclusionShape = createExclusionRectangle(logicalBounds, physicalSizeToLogical(cornerRadii, writingMode));
break;
@@ -124,7 +124,7 @@ PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape
float centerX = floatValueForLength(circle->centerX(), boxWidth);
float centerY = floatValueForLength(circle->centerY(), boxHeight);
float radius = floatValueForLength(circle->radius(), std::min(boxHeight, boxWidth));
- FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
+ FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
exclusionShape = createExclusionCircle(logicalCenter, radius);
break;
@@ -136,7 +136,7 @@ PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape
float centerY = floatValueForLength(ellipse->centerY(), boxHeight);
float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth);
float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight);
- FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
+ FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radiusY), writingMode);
exclusionShape = createExclusionEllipse(logicalCenter, logicalRadii);
@@ -153,7 +153,7 @@ PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape
FloatPoint vertex(
floatValueForLength(values.at(i), boxWidth),
floatValueForLength(values.at(i + 1), boxHeight));
- (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxHeight, writingMode);
+ (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.height(), writingMode);
}
exclusionShape = createExclusionPolygon(vertices.release(), polygon->windRule());
break;
@@ -163,8 +163,6 @@ PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape
ASSERT_NOT_REACHED();
}
- exclusionShape->m_logicalBoxWidth = logicalBoxWidth;
- exclusionShape->m_logicalBoxHeight = logicalBoxHeight;
exclusionShape->m_writingMode = writingMode;
exclusionShape->m_margin = floatValueForLength(margin, 0);
exclusionShape->m_padding = floatValueForLength(padding, 0);
« no previous file with comments | « Source/core/rendering/exclusions/ExclusionShape.h ('k') | Source/core/rendering/exclusions/ExclusionShapeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698