| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 GraphicsContextStateSaver stateSaver(paintInfo.context); | 80 GraphicsContextStateSaver stateSaver(paintInfo.context); |
| 81 | 81 |
| 82 [textField setEnabled:(LayoutTheme::isEnabled(o) && !LayoutTheme::isReadOnly
Control(o))]; | 82 [textField setEnabled:(LayoutTheme::isEnabled(o) && !LayoutTheme::isReadOnly
Control(o))]; |
| 83 [textField drawWithFrame:NSRect(r) inView:m_layoutTheme.documentViewFor(o)]; | 83 [textField drawWithFrame:NSRect(r) inView:m_layoutTheme.documentViewFor(o)]; |
| 84 | 84 |
| 85 [textField setControlView:nil]; | 85 [textField setControlView:nil]; |
| 86 | 86 |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ThemePainterMac::paintCapsLockIndicator(const LayoutObject&, const PaintInf
o& paintInfo, const IntRect& r) | 90 bool ThemePainterMac::paintCapsLockIndicator(const LayoutObject& o, const PaintI
nfo& paintInfo, const IntRect& r) |
| 91 { | 91 { |
| 92 // This draws the caps lock indicator as it was done by | 92 // This draws the caps lock indicator as it was done by |
| 93 // WKDrawCapsLockIndicator. | 93 // WKDrawCapsLockIndicator. |
| 94 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 94 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
| 95 CGContextRef c = localContext.cgContext(); | 95 CGContextRef c = localContext.cgContext(); |
| 96 CGMutablePathRef shape = CGPathCreateMutable(); | 96 CGMutablePathRef shape = CGPathCreateMutable(); |
| 97 | 97 |
| 98 // To draw the caps lock indicator, draw the shape into a small | 98 // To draw the caps lock indicator, draw the shape into a small |
| 99 // square that is then scaled to the size of r. | 99 // square that is then scaled to the size of r. |
| 100 const CGFloat kSquareSize = 17; | 100 const CGFloat kSquareSize = 17; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 121 // arrow. | 121 // arrow. |
| 122 CGPathAddLineToPoint(shape, NULL, 10.75, 12); | 122 CGPathAddLineToPoint(shape, NULL, 10.75, 12); |
| 123 CGPathAddLineToPoint(shape, NULL, 6.25, 12); | 123 CGPathAddLineToPoint(shape, NULL, 6.25, 12); |
| 124 CGPathAddLineToPoint(shape, NULL, 6.25, 14.25); | 124 CGPathAddLineToPoint(shape, NULL, 6.25, 14.25); |
| 125 CGPathAddLineToPoint(shape, NULL, 10.75, 14.25); | 125 CGPathAddLineToPoint(shape, NULL, 10.75, 14.25); |
| 126 CGPathAddLineToPoint(shape, NULL, 10.75, 12); | 126 CGPathAddLineToPoint(shape, NULL, 10.75, 12); |
| 127 | 127 |
| 128 // Scale and translate the shape. | 128 // Scale and translate the shape. |
| 129 CGRect cgr = r; | 129 CGRect cgr = r; |
| 130 CGFloat maxX = CGRectGetMaxX(cgr); | 130 CGFloat maxX = CGRectGetMaxX(cgr); |
| 131 CGFloat minX = CGRectGetMinX(cgr); |
| 131 CGFloat minY = CGRectGetMinY(cgr); | 132 CGFloat minY = CGRectGetMinY(cgr); |
| 132 CGFloat heightScale = r.height() / kSquareSize; | 133 CGFloat heightScale = r.height() / kSquareSize; |
| 134 bool isRTL = o.styleRef().direction() == RTL; |
| 133 CGAffineTransform transform = CGAffineTransformMake( | 135 CGAffineTransform transform = CGAffineTransformMake( |
| 134 heightScale, 0, // A B | 136 heightScale, 0, // A B |
| 135 0, heightScale, // C D | 137 0, heightScale, // C D |
| 136 maxX - r.height(), minY); // Tx Ty | 138 isRTL ? minX : maxX - r.height(), minY); // Tx Ty |
| 137 | 139 |
| 138 CGMutablePathRef paintPath = CGPathCreateMutable(); | 140 CGMutablePathRef paintPath = CGPathCreateMutable(); |
| 139 CGPathAddPath(paintPath, &transform, shape); | 141 CGPathAddPath(paintPath, &transform, shape); |
| 140 CGPathRelease(shape); | 142 CGPathRelease(shape); |
| 141 | 143 |
| 142 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); | 144 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); |
| 143 CGContextBeginPath(c); | 145 CGContextBeginPath(c); |
| 144 CGContextAddPath(c, paintPath); | 146 CGContextAddPath(c, paintPath); |
| 145 CGContextFillPath(c); | 147 CGContextFillPath(c); |
| 146 CGPathRelease(paintPath); | 148 CGPathRelease(paintPath); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 paintInfo.context.rotate(deg2rad(-45.0)); | 543 paintInfo.context.rotate(deg2rad(-45.0)); |
| 542 paintInfo.context.translate(-centerX, -centerY); | 544 paintInfo.context.translate(-centerX, -centerY); |
| 543 | 545 |
| 544 paintInfo.context.setFillColor(fillColor); | 546 paintInfo.context.setFillColor(fillColor); |
| 545 paintInfo.context.fillEllipse(unzoomedRect); | 547 paintInfo.context.fillEllipse(unzoomedRect); |
| 546 | 548 |
| 547 return false; | 549 return false; |
| 548 } | 550 } |
| 549 | 551 |
| 550 } // namespace blink | 552 } // namespace blink |
| OLD | NEW |