OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const PaintInfo& paintInfo, | 265 const PaintInfo& paintInfo, |
266 const IntRect& r) { | 266 const IntRect& r) { |
267 IntRect bounds = IntRect(r.x() + o.styleRef().borderLeftWidth(), | 267 IntRect bounds = IntRect(r.x() + o.styleRef().borderLeftWidth(), |
268 r.y() + o.styleRef().borderTopWidth(), | 268 r.y() + o.styleRef().borderTopWidth(), |
269 r.width() - o.styleRef().borderLeftWidth() - | 269 r.width() - o.styleRef().borderLeftWidth() - |
270 o.styleRef().borderRightWidth(), | 270 o.styleRef().borderRightWidth(), |
271 r.height() - o.styleRef().borderTopWidth() - | 271 r.height() - o.styleRef().borderTopWidth() - |
272 o.styleRef().borderBottomWidth()); | 272 o.styleRef().borderBottomWidth()); |
273 // Since we actually know the size of the control here, we restrict the font | 273 // Since we actually know the size of the control here, we restrict the font |
274 // scale to make sure the arrows will fit vertically in the bounds | 274 // scale to make sure the arrows will fit vertically in the bounds |
275 float fontScale = std::min( | 275 float fontScale = |
276 o.styleRef().fontSize() / LayoutThemeMac::baseFontSize, | 276 std::min(o.styleRef().fontSize() / LayoutThemeMac::baseFontSize, |
277 bounds.height() / (LayoutThemeMac::menuListBaseArrowHeight * 2 + | 277 bounds.height() / |
278 LayoutThemeMac::menuListBaseSpaceBetweenArrows)); | 278 (LayoutThemeMac::menuListBaseArrowHeight * 2 + |
| 279 LayoutThemeMac::menuListBaseSpaceBetweenArrows)); |
279 float centerY = bounds.y() + bounds.height() / 2.0f; | 280 float centerY = bounds.y() + bounds.height() / 2.0f; |
280 float arrowHeight = LayoutThemeMac::menuListBaseArrowHeight * fontScale; | 281 float arrowHeight = LayoutThemeMac::menuListBaseArrowHeight * fontScale; |
281 float arrowWidth = LayoutThemeMac::menuListBaseArrowWidth * fontScale; | 282 float arrowWidth = LayoutThemeMac::menuListBaseArrowWidth * fontScale; |
282 float spaceBetweenArrows = | 283 float spaceBetweenArrows = |
283 LayoutThemeMac::menuListBaseSpaceBetweenArrows * fontScale; | 284 LayoutThemeMac::menuListBaseSpaceBetweenArrows * fontScale; |
284 float scaledPaddingEnd = | 285 float scaledPaddingEnd = |
285 LayoutThemeMac::menuListArrowPaddingEnd * o.styleRef().effectiveZoom(); | 286 LayoutThemeMac::menuListArrowPaddingEnd * o.styleRef().effectiveZoom(); |
286 float leftEdge; | 287 float leftEdge; |
287 if (o.styleRef().direction() == TextDirection::kLtr) { | 288 if (o.styleRef().direction() == TextDirection::kLtr) { |
288 leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth; | 289 leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; | 804 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; |
804 } | 805 } |
805 | 806 |
806 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); | 807 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); |
807 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), | 808 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), |
808 kHIThemeOrientationNormal, 0); | 809 kHIThemeOrientationNormal, 0); |
809 return false; | 810 return false; |
810 } | 811 } |
811 | 812 |
812 } // namespace blink | 813 } // namespace blink |
OLD | NEW |