Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 #import "core/platform/SharedBuffer.h" | 41 #import "core/platform/SharedBuffer.h" |
| 42 #import "core/platform/graphics/BitmapImage.h" | 42 #import "core/platform/graphics/BitmapImage.h" |
| 43 #import "core/platform/graphics/Image.h" | 43 #import "core/platform/graphics/Image.h" |
| 44 #import "core/platform/graphics/ImageBuffer.h" | 44 #import "core/platform/graphics/ImageBuffer.h" |
| 45 #import "core/platform/graphics/StringTruncator.h" | 45 #import "core/platform/graphics/StringTruncator.h" |
| 46 #import "core/platform/graphics/cg/GraphicsContextCG.h" | 46 #import "core/platform/graphics/cg/GraphicsContextCG.h" |
| 47 #import "core/platform/graphics/mac/ColorMac.h" | 47 #import "core/platform/graphics/mac/ColorMac.h" |
| 48 #import "core/platform/mac/LocalCurrentGraphicsContext.h" | 48 #import "core/platform/mac/LocalCurrentGraphicsContext.h" |
| 49 #import "core/platform/mac/ThemeMac.h" | 49 #import "core/platform/mac/ThemeMac.h" |
| 50 #import "core/platform/mac/WebCoreNSCellExtras.h" | 50 #import "core/platform/mac/WebCoreNSCellExtras.h" |
| 51 #import "core/platform/mac/WebCoreSystemInterface.h" | |
| 52 #import "core/rendering/PaintInfo.h" | 51 #import "core/rendering/PaintInfo.h" |
| 53 #import "core/rendering/RenderLayer.h" | 52 #import "core/rendering/RenderLayer.h" |
| 54 #import "core/rendering/RenderMedia.h" | 53 #import "core/rendering/RenderMedia.h" |
| 55 #import "core/rendering/RenderMediaControls.h" | 54 #import "core/rendering/RenderMediaControls.h" |
| 56 #import "core/rendering/RenderMediaControlsChromium.h" | 55 #import "core/rendering/RenderMediaControlsChromium.h" |
| 57 #import "core/rendering/RenderMeter.h" | 56 #import "core/rendering/RenderMeter.h" |
| 58 #import "core/rendering/RenderProgress.h" | 57 #import "core/rendering/RenderProgress.h" |
| 59 #import "core/rendering/RenderSlider.h" | 58 #import "core/rendering/RenderSlider.h" |
| 60 #import "core/rendering/RenderView.h" | 59 #import "core/rendering/RenderView.h" |
| 61 | 60 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 void RenderThemeChromiumMac::adjustTextFieldStyle(StyleResolver*, RenderStyle*, Element*) const | 764 void RenderThemeChromiumMac::adjustTextFieldStyle(StyleResolver*, RenderStyle*, Element*) const |
| 766 { | 765 { |
| 767 } | 766 } |
| 768 | 767 |
| 769 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn fo& paintInfo, const IntRect& r) | 768 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn fo& paintInfo, const IntRect& r) |
| 770 { | 769 { |
| 771 if (paintInfo.context->paintingDisabled()) | 770 if (paintInfo.context->paintingDisabled()) |
| 772 return true; | 771 return true; |
| 773 | 772 |
| 774 LocalCurrentGraphicsContext localContext(paintInfo.context); | 773 LocalCurrentGraphicsContext localContext(paintInfo.context); |
| 775 WKDrawCapsLockIndicator(localContext.cgContext(), r); | 774 |
|
Nico
2013/05/02 20:57:13
Can you add a comment like
// Matches the appeara
Robert Sesek
2013/05/02 21:07:25
Done.
| |
| 775 CGContextRef c = localContext.cgContext(); | |
| 776 CGContextSaveGState(c); | |
|
Nico
2013/05/02 20:57:13
.cgContext() returns a fresh context, so you proba
Robert Sesek
2013/05/02 21:07:25
Done.
| |
| 777 CGMutablePathRef shape = CGPathCreateMutable(); | |
| 778 | |
| 779 // To draw the caps lock indicator, draw the shape into a small | |
| 780 // square that is then scaled to the size of r. | |
| 781 const CGFloat kSquareSize = 17; | |
| 782 | |
| 783 // Create a rounted square shape. | |
| 784 CGPathMoveToPoint(shape, NULL, 16.5, 4.5); | |
| 785 CGPathAddArc(shape, NULL, 12.5, 12.5, 4, 0, M_PI_2, false); | |
| 786 CGPathAddArc(shape, NULL, 4.5, 12.5, 4, M_PI_2, M_PI, false); | |
| 787 CGPathAddArc(shape, NULL, 4.5, 4.5, 4, M_PI, 3*M_PI/2, false); | |
| 788 CGPathAddArc(shape, NULL, 12.5, 4.5, 4, 3*M_PI/2, 0, false); | |
| 789 | |
| 790 // Draw the arrow - note this is drawing in a flipped coordinate system, so the | |
| 791 // arrow is pointing down. | |
| 792 CGPathMoveToPoint(shape, NULL, 8.5, 2); // Tip point. | |
| 793 CGPathAddLineToPoint(shape, NULL, 4, 7); | |
| 794 CGPathAddLineToPoint(shape, NULL, 6.25, 7); | |
| 795 CGPathAddLineToPoint(shape, NULL, 6.25, 10.25); | |
| 796 CGPathAddLineToPoint(shape, NULL, 10.75, 10.25); | |
| 797 CGPathAddLineToPoint(shape, NULL, 10.75, 7); | |
| 798 CGPathAddLineToPoint(shape, NULL, 13, 7); | |
| 799 CGPathAddLineToPoint(shape, NULL, 8.5, 2); | |
| 800 | |
| 801 // Draw the rectangle that underneath (or above in the flipped system) the a rrow. | |
| 802 CGPathAddLineToPoint(shape, NULL, 10.75, 12); | |
| 803 CGPathAddLineToPoint(shape, NULL, 6.25, 12); | |
| 804 CGPathAddLineToPoint(shape, NULL, 6.25, 14.25); | |
| 805 CGPathAddLineToPoint(shape, NULL, 10.75, 14.25); | |
| 806 CGPathAddLineToPoint(shape, NULL, 10.75, 12); | |
| 807 | |
| 808 // Scale and translate the shape. | |
| 809 CGRect cgr = r; | |
| 810 CGFloat maxX = CGRectGetMaxX(cgr); | |
| 811 CGFloat minY = CGRectGetMinY(cgr); | |
| 812 CGFloat heightScale = r.height() / kSquareSize; | |
| 813 CGAffineTransform transform = CGAffineTransformMake( | |
| 814 heightScale, 0, // A B | |
| 815 0, heightScale, // C D | |
| 816 maxX - r.height(), minY); // Tx Ty | |
| 817 | |
| 818 CGMutablePathRef paintPath = CGPathCreateMutable(); | |
| 819 CGPathAddPath(paintPath, &transform, shape); | |
| 820 CGPathRelease(shape); | |
| 821 | |
| 822 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); | |
| 823 CGContextBeginPath(c); | |
| 824 CGContextAddPath(c, paintPath); | |
| 825 CGContextFillPath(c); | |
| 826 CGPathRelease(paintPath); | |
| 827 | |
| 828 CGContextRestoreGState(c); | |
| 776 | 829 |
| 777 return false; | 830 return false; |
| 778 } | 831 } |
| 779 | 832 |
| 780 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r) | 833 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r) |
| 781 { | 834 { |
| 782 LocalCurrentGraphicsContext localContext(paintInfo.context); | 835 LocalCurrentGraphicsContext localContext(paintInfo.context); |
| 783 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES ); | 836 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES ); |
| 784 return false; | 837 return false; |
| 785 } | 838 } |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1976 { | 2029 { |
| 1977 return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscr eenButton, object, paintInfo, rect); | 2030 return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscr eenButton, object, paintInfo, rect); |
| 1978 } | 2031 } |
| 1979 | 2032 |
| 1980 bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) | 2033 bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) |
| 1981 { | 2034 { |
| 1982 return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCa ptionsButton, object, paintInfo, rect); | 2035 return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCa ptionsButton, object, paintInfo, rect); |
| 1983 } | 2036 } |
| 1984 | 2037 |
| 1985 } // namespace WebCore | 2038 } // namespace WebCore |
| OLD | NEW |