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

Side by Side Diff: sky/engine/core/rendering/shapes/Shape.cpp

Issue 688213002: First pass at removing dead vertical writing mode code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/rendering/shapes/Shape.h ('k') | sky/engine/core/rendering/style/RenderStyle.h » ('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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), cen ter.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); 65 return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), cen ter.y() - radii.height(), radii.width()*2, radii.height()*2), radii));
66 } 66 }
67 67
68 static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint> > vert ices, WindRule fillRule) 68 static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint> > vert ices, WindRule fillRule)
69 { 69 {
70 return adoptPtr(new PolygonShape(vertices, fillRule)); 70 return adoptPtr(new PolygonShape(vertices, fillRule));
71 } 71 }
72 72
73 static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logic alBoxHeight) 73 static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logic alBoxHeight)
74 { 74 {
75 if (isHorizontalWritingMode()) 75 return rect;
76 return rect;
77 if (isFlippedBlocksWritingMode())
78 return FloatRect(rect.y(), logicalBoxHeight - rect.maxX(), rect.height() , rect.width());
79 return rect.transposedRect();
80 } 76 }
81 77
82 static inline FloatPoint physicalPointToLogical(const FloatPoint& point, float l ogicalBoxHeight) 78 static inline FloatPoint physicalPointToLogical(const FloatPoint& point, float l ogicalBoxHeight)
83 { 79 {
84 if (isHorizontalWritingMode()) 80 return point;
85 return point;
86 if (isFlippedBlocksWritingMode())
87 return FloatPoint(point.y(), logicalBoxHeight - point.x());
88 return point.transposedPoint();
89 } 81 }
90 82
91 static inline FloatSize physicalSizeToLogical(const FloatSize& size) 83 static inline FloatSize physicalSizeToLogical(const FloatSize& size)
92 { 84 {
93 if (isHorizontalWritingMode()) 85 return size;
94 return size;
95 return size.transposedSize();
96 } 86 }
97 87
98 PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS ize& logicalBoxSize, float margin) 88 PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS ize& logicalBoxSize, float margin)
99 { 89 {
100 ASSERT(basicShape); 90 ASSERT(basicShape);
101 91
102 bool horizontalWritingMode = isHorizontalWritingMode(); 92 float boxWidth = logicalBoxSize.width().toFloat();
103 float boxWidth = horizontalWritingMode ? logicalBoxSize.width().toFloat() : logicalBoxSize.height().toFloat(); 93 float boxHeight = logicalBoxSize.height().toFloat();
104 float boxHeight = horizontalWritingMode ? logicalBoxSize.height().toFloat() : logicalBoxSize.width().toFloat();
105 OwnPtr<Shape> shape; 94 OwnPtr<Shape> shape;
106 95
107 switch (basicShape->type()) { 96 switch (basicShape->type()) {
108 97
109 case BasicShape::BasicShapeCircleType: { 98 case BasicShape::BasicShapeCircleType: {
110 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape); 99 const BasicShapeCircle* circle = toBasicShapeCircle(basicShape);
111 FloatPoint center = floatPointForCenterCoordinate(circle->centerX(), cir cle->centerY(), FloatSize(boxWidth, boxHeight)); 100 FloatPoint center = floatPointForCenterCoordinate(circle->centerX(), cir cle->centerY(), FloatSize(boxWidth, boxHeight));
112 float radius = circle->floatValueForRadiusInBox(FloatSize(boxWidth, boxH eight)); 101 float radius = circle->floatValueForRadiusInBox(FloatSize(boxWidth, boxH eight));
113 FloatPoint logicalCenter = physicalPointToLogical(center, logicalBoxSize .height().toFloat()); 102 FloatPoint logicalCenter = physicalPointToLogical(center, logicalBoxSize .height().toFloat());
114 103
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 { 217 {
229 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height() ); 218 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height() );
230 FloatRoundedRect bounds(rect, roundedRect.radii()); 219 FloatRoundedRect bounds(rect, roundedRect.radii());
231 OwnPtr<Shape> shape = createInsetShape(bounds); 220 OwnPtr<Shape> shape = createInsetShape(bounds);
232 shape->m_margin = margin; 221 shape->m_margin = margin;
233 222
234 return shape.release(); 223 return shape.release();
235 } 224 }
236 225
237 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/shapes/Shape.h ('k') | sky/engine/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698