OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const FloatRect& rect = marginBounds.rect(); | 63 const FloatRect& rect = marginBounds.rect(); |
64 | 64 |
65 if (!marginBounds.isRounded()) { | 65 if (!marginBounds.isRounded()) { |
66 result.append(LineSegment(marginBounds.rect().x(), marginBounds.rect().m
axX())); | 66 result.append(LineSegment(marginBounds.rect().x(), marginBounds.rect().m
axX())); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 float topCornerMaxY = std::max<float>(marginBounds.topLeftCorner().maxY(), m
arginBounds.topRightCorner().maxY()); | 70 float topCornerMaxY = std::max<float>(marginBounds.topLeftCorner().maxY(), m
arginBounds.topRightCorner().maxY()); |
71 float bottomCornerMinY = std::min<float>(marginBounds.bottomLeftCorner().y()
, marginBounds.bottomRightCorner().y()); | 71 float bottomCornerMinY = std::min<float>(marginBounds.bottomLeftCorner().y()
, marginBounds.bottomRightCorner().y()); |
72 | 72 |
73 if (y1 <= topCornerMaxY && y2 >= bottomCornerMinY) { | 73 if (topCornerMaxY <= bottomCornerMinY && y1 <= topCornerMaxY && y2 >= bottom
CornerMinY) { |
74 result.append(LineSegment(rect.x(), rect.maxX())); | 74 result.append(LineSegment(rect.x(), rect.maxX())); |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 float x1 = rect.maxX(); | 78 float x1 = rect.maxX(); |
79 float x2 = rect.x(); | 79 float x2 = rect.x(); |
80 float minXIntercept; | 80 float minXIntercept; |
81 float maxXIntercept; | 81 float maxXIntercept; |
82 | 82 |
| 83 if (y1 <= marginBounds.topLeftCorner().maxY() && y2 >= marginBounds.bottomLe
ftCorner().y()) |
| 84 x1 = rect.x(); |
| 85 |
| 86 if (y1 <= marginBounds.topRightCorner().maxY() && y2 >= marginBounds.bottomR
ightCorner().y()) |
| 87 x2 = rect.maxX(); |
| 88 |
83 if (marginBounds.xInterceptsAtY(y1, minXIntercept, maxXIntercept)) { | 89 if (marginBounds.xInterceptsAtY(y1, minXIntercept, maxXIntercept)) { |
84 x1 = std::min<float>(x1, minXIntercept); | 90 x1 = std::min<float>(x1, minXIntercept); |
85 x2 = std::max<float>(x2, maxXIntercept); | 91 x2 = std::max<float>(x2, maxXIntercept); |
86 } | 92 } |
87 | 93 |
88 if (marginBounds.xInterceptsAtY(y2, minXIntercept, maxXIntercept)) { | 94 if (marginBounds.xInterceptsAtY(y2, minXIntercept, maxXIntercept)) { |
89 x1 = std::min<float>(x1, minXIntercept); | 95 x1 = std::min<float>(x1, minXIntercept); |
90 x2 = std::max<float>(x2, maxXIntercept); | 96 x2 = std::max<float>(x2, maxXIntercept); |
91 } | 97 } |
92 | 98 |
93 ASSERT(x2 >= x1); | 99 ASSERT(x2 >= x1); |
94 result.append(LineSegment(x1, x2)); | 100 result.append(LineSegment(x1, x2)); |
95 } | 101 } |
96 | 102 |
97 } // namespace WebCore | 103 } // namespace WebCore |
OLD | NEW |