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 12 matching lines...) Expand all Loading... |
23 #import "core/frame/FrameView.h" | 23 #import "core/frame/FrameView.h" |
24 #import "core/layout/LayoutProgress.h" | 24 #import "core/layout/LayoutProgress.h" |
25 #import "core/layout/LayoutThemeMac.h" | 25 #import "core/layout/LayoutThemeMac.h" |
26 #import "core/layout/LayoutView.h" | 26 #import "core/layout/LayoutView.h" |
27 #import "core/paint/PaintInfo.h" | 27 #import "core/paint/PaintInfo.h" |
28 #import "platform/geometry/FloatRoundedRect.h" | 28 #import "platform/geometry/FloatRoundedRect.h" |
29 #import "platform/graphics/BitmapImage.h" | 29 #import "platform/graphics/BitmapImage.h" |
30 #import "platform/graphics/GraphicsContextStateSaver.h" | 30 #import "platform/graphics/GraphicsContextStateSaver.h" |
31 #import "platform/graphics/Image.h" | 31 #import "platform/graphics/Image.h" |
32 #import "platform/graphics/ImageBuffer.h" | 32 #import "platform/graphics/ImageBuffer.h" |
| 33 #import "platform/graphics/paint/PaintCanvas.h" |
33 #import "platform/mac/BlockExceptions.h" | 34 #import "platform/mac/BlockExceptions.h" |
34 #import "platform/mac/ColorMac.h" | 35 #import "platform/mac/ColorMac.h" |
35 #import "platform/mac/LocalCurrentGraphicsContext.h" | 36 #import "platform/mac/LocalCurrentGraphicsContext.h" |
36 #import "platform/mac/ThemeMac.h" | 37 #import "platform/mac/ThemeMac.h" |
37 #import "platform/mac/WebCoreNSCellExtras.h" | 38 #import "platform/mac/WebCoreNSCellExtras.h" |
38 #import <AvailabilityMacros.h> | 39 #import <AvailabilityMacros.h> |
39 #import <Carbon/Carbon.h> | 40 #import <Carbon/Carbon.h> |
40 #import <Cocoa/Cocoa.h> | 41 #import <Cocoa/Cocoa.h> |
41 #import <math.h> | 42 #import <math.h> |
42 | 43 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 float leftEdge; | 286 float leftEdge; |
286 if (o.styleRef().direction() == TextDirection::kLtr) { | 287 if (o.styleRef().direction() == TextDirection::kLtr) { |
287 leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth; | 288 leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth; |
288 } else { | 289 } else { |
289 leftEdge = bounds.x() + scaledPaddingEnd; | 290 leftEdge = bounds.x() + scaledPaddingEnd; |
290 } | 291 } |
291 if (bounds.width() < arrowWidth + scaledPaddingEnd) | 292 if (bounds.width() < arrowWidth + scaledPaddingEnd) |
292 return false; | 293 return false; |
293 | 294 |
294 Color color = o.styleRef().visitedDependentColor(CSSPropertyColor); | 295 Color color = o.styleRef().visitedDependentColor(CSSPropertyColor); |
295 SkPaint paint = paintInfo.context.fillPaint(); | 296 PaintFlags paint = paintInfo.context.fillPaint(); |
296 paint.setAntiAlias(true); | 297 paint.setAntiAlias(true); |
297 paint.setColor(color.rgb()); | 298 paint.setColor(color.rgb()); |
298 | 299 |
299 SkPath arrow1; | 300 SkPath arrow1; |
300 arrow1.moveTo(leftEdge, centerY - spaceBetweenArrows / 2.0f); | 301 arrow1.moveTo(leftEdge, centerY - spaceBetweenArrows / 2.0f); |
301 arrow1.lineTo(leftEdge + arrowWidth, centerY - spaceBetweenArrows / 2.0f); | 302 arrow1.lineTo(leftEdge + arrowWidth, centerY - spaceBetweenArrows / 2.0f); |
302 arrow1.lineTo(leftEdge + arrowWidth / 2.0f, | 303 arrow1.lineTo(leftEdge + arrowWidth / 2.0f, |
303 centerY - spaceBetweenArrows / 2.0f - arrowHeight); | 304 centerY - spaceBetweenArrows / 2.0f - arrowHeight); |
304 | 305 |
305 // Draw the top arrow. | 306 // Draw the top arrow. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 borderGradient->addColorStop(1.0, borderGradientBottomColor); | 392 borderGradient->addColorStop(1.0, borderGradientBottomColor); |
392 | 393 |
393 FloatRect borderRect(unzoomedRect); | 394 FloatRect borderRect(unzoomedRect); |
394 borderRect.inflate(-LayoutThemeMac::sliderTrackBorderWidth / 2.0); | 395 borderRect.inflate(-LayoutThemeMac::sliderTrackBorderWidth / 2.0); |
395 float borderRadiusSize = | 396 float borderRadiusSize = |
396 (isVerticalSlider ? borderRect.width() : borderRect.height()) / 2; | 397 (isVerticalSlider ? borderRect.width() : borderRect.height()) / 2; |
397 FloatSize borderRadius(borderRadiusSize, borderRadiusSize); | 398 FloatSize borderRadius(borderRadiusSize, borderRadiusSize); |
398 FloatRoundedRect borderRRect(borderRect, borderRadius, borderRadius, | 399 FloatRoundedRect borderRRect(borderRect, borderRadius, borderRadius, |
399 borderRadius, borderRadius); | 400 borderRadius, borderRadius); |
400 paintInfo.context.setStrokeThickness(LayoutThemeMac::sliderTrackBorderWidth); | 401 paintInfo.context.setStrokeThickness(LayoutThemeMac::sliderTrackBorderWidth); |
401 SkPaint borderPaint(paintInfo.context.strokePaint()); | 402 PaintFlags borderPaint(paintInfo.context.strokePaint()); |
402 borderGradient->applyToPaint(borderPaint, SkMatrix::I()); | 403 borderGradient->applyToPaint(borderPaint, SkMatrix::I()); |
403 paintInfo.context.drawRRect(borderRRect, borderPaint); | 404 paintInfo.context.drawRRect(borderRRect, borderPaint); |
404 | 405 |
405 return false; | 406 return false; |
406 } | 407 } |
407 | 408 |
408 bool ThemePainterMac::paintSliderThumb(const LayoutObject& o, | 409 bool ThemePainterMac::paintSliderThumb(const LayoutObject& o, |
409 const PaintInfo& paintInfo, | 410 const PaintInfo& paintInfo, |
410 const IntRect& r) { | 411 const IntRect& r) { |
411 GraphicsContextStateSaver stateSaver(paintInfo.context); | 412 GraphicsContextStateSaver stateSaver(paintInfo.context); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 paintInfo.context.fillEllipse(borderBounds); | 463 paintInfo.context.fillEllipse(borderBounds); |
463 paintInfo.context.setDrawLooper(nullptr); | 464 paintInfo.context.setDrawLooper(nullptr); |
464 | 465 |
465 IntRect fillBounds = enclosedIntRect(unzoomedRect); | 466 IntRect fillBounds = enclosedIntRect(unzoomedRect); |
466 RefPtr<Gradient> fillGradient = Gradient::create(fillBounds.minXMinYCorner(), | 467 RefPtr<Gradient> fillGradient = Gradient::create(fillBounds.minXMinYCorner(), |
467 fillBounds.minXMaxYCorner()); | 468 fillBounds.minXMaxYCorner()); |
468 fillGradient->addColorStop(0.0, fillGradientTopColor); | 469 fillGradient->addColorStop(0.0, fillGradientTopColor); |
469 fillGradient->addColorStop(0.52, fillGradientUpperMiddleColor); | 470 fillGradient->addColorStop(0.52, fillGradientUpperMiddleColor); |
470 fillGradient->addColorStop(0.52, fillGradientLowerMiddleColor); | 471 fillGradient->addColorStop(0.52, fillGradientLowerMiddleColor); |
471 fillGradient->addColorStop(1.0, fillGradientBottomColor); | 472 fillGradient->addColorStop(1.0, fillGradientBottomColor); |
472 SkPaint fillPaint(paintInfo.context.fillPaint()); | 473 PaintFlags fillPaint(paintInfo.context.fillPaint()); |
473 fillGradient->applyToPaint(fillPaint, SkMatrix::I()); | 474 fillGradient->applyToPaint(fillPaint, SkMatrix::I()); |
474 paintInfo.context.drawOval(borderBounds, fillPaint); | 475 paintInfo.context.drawOval(borderBounds, fillPaint); |
475 | 476 |
476 RefPtr<Gradient> borderGradient = Gradient::create( | 477 RefPtr<Gradient> borderGradient = Gradient::create( |
477 fillBounds.minXMinYCorner(), fillBounds.minXMaxYCorner()); | 478 fillBounds.minXMinYCorner(), fillBounds.minXMaxYCorner()); |
478 borderGradient->addColorStop(0.0, borderGradientTopColor); | 479 borderGradient->addColorStop(0.0, borderGradientTopColor); |
479 borderGradient->addColorStop(1.0, borderGradientBottomColor); | 480 borderGradient->addColorStop(1.0, borderGradientBottomColor); |
480 paintInfo.context.setStrokeThickness(LayoutThemeMac::sliderThumbBorderWidth); | 481 paintInfo.context.setStrokeThickness(LayoutThemeMac::sliderThumbBorderWidth); |
481 SkPaint borderPaint(paintInfo.context.strokePaint()); | 482 PaintFlags borderPaint(paintInfo.context.strokePaint()); |
482 borderGradient->applyToPaint(borderPaint, SkMatrix::I()); | 483 borderGradient->applyToPaint(borderPaint, SkMatrix::I()); |
483 paintInfo.context.drawOval(borderBounds, borderPaint); | 484 paintInfo.context.drawOval(borderBounds, borderPaint); |
484 | 485 |
485 if (LayoutTheme::isFocused(o)) { | 486 if (LayoutTheme::isFocused(o)) { |
486 Path borderPath; | 487 Path borderPath; |
487 borderPath.addEllipse(borderBounds); | 488 borderPath.addEllipse(borderBounds); |
488 paintInfo.context.drawFocusRing(borderPath, 5, -2, | 489 paintInfo.context.drawFocusRing(borderPath, 5, -2, |
489 m_layoutTheme.focusRingColor()); | 490 m_layoutTheme.focusRingColor()); |
490 } | 491 } |
491 | 492 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; | 803 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; |
803 } | 804 } |
804 | 805 |
805 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); | 806 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); |
806 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), | 807 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), |
807 kHIThemeOrientationNormal, 0); | 808 kHIThemeOrientationNormal, 0); |
808 return false; | 809 return false; |
809 } | 810 } |
810 | 811 |
811 } // namespace blink | 812 } // namespace blink |
OLD | NEW |