Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: Source/core/css/CSSGradientValue.cpp

Issue 342693003: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/CSSFontSelector.cpp ('k') | Source/core/css/CSSReflectValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 #include "core/dom/NodeRenderStyle.h" 32 #include "core/dom/NodeRenderStyle.h"
33 #include "core/dom/TextLinkColors.h" 33 #include "core/dom/TextLinkColors.h"
34 #include "core/rendering/RenderObject.h" 34 #include "core/rendering/RenderObject.h"
35 #include "platform/geometry/IntSize.h" 35 #include "platform/geometry/IntSize.h"
36 #include "platform/graphics/Gradient.h" 36 #include "platform/graphics/Gradient.h"
37 #include "platform/graphics/GradientGeneratedImage.h" 37 #include "platform/graphics/GradientGeneratedImage.h"
38 #include "platform/graphics/Image.h" 38 #include "platform/graphics/Image.h"
39 #include "wtf/text/StringBuilder.h" 39 #include "wtf/text/StringBuilder.h"
40 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
41 41
42 using namespace std;
43
44 namespace WebCore { 42 namespace WebCore {
45 43
46 void CSSGradientColorStop::trace(Visitor* visitor) 44 void CSSGradientColorStop::trace(Visitor* visitor)
47 { 45 {
48 visitor->trace(m_position); 46 visitor->trace(m_position);
49 visitor->trace(m_color); 47 visitor->trace(m_color);
50 } 48 }
51 49
52 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& size) 50 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& size)
53 { 51 {
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 break; 1047 break;
1050 default: 1048 default:
1051 break; 1049 break;
1052 } 1050 }
1053 1051
1054 // Now compute the end radii based on the second point, shape and fill. 1052 // Now compute the end radii based on the second point, shape and fill.
1055 1053
1056 // Horizontal 1054 // Horizontal
1057 switch (fill) { 1055 switch (fill) {
1058 case ClosestSide: { 1056 case ClosestSide: {
1059 float xDist = min(secondPoint.x(), size.width() - secondPoint.x()); 1057 float xDist = std::min(secondPoint.x(), size.width() - secondPoint.x ());
1060 float yDist = min(secondPoint.y(), size.height() - secondPoint.y()); 1058 float yDist = std::min(secondPoint.y(), size.height() - secondPoint. y());
1061 if (shape == Circle) { 1059 if (shape == Circle) {
1062 float smaller = min(xDist, yDist); 1060 float smaller = std::min(xDist, yDist);
1063 xDist = smaller; 1061 xDist = smaller;
1064 yDist = smaller; 1062 yDist = smaller;
1065 } 1063 }
1066 secondRadius = xDist; 1064 secondRadius = xDist;
1067 aspectRatio = xDist / yDist; 1065 aspectRatio = xDist / yDist;
1068 break; 1066 break;
1069 } 1067 }
1070 case FarthestSide: { 1068 case FarthestSide: {
1071 float xDist = max(secondPoint.x(), size.width() - secondPoint.x()); 1069 float xDist = std::max(secondPoint.x(), size.width() - secondPoint.x ());
1072 float yDist = max(secondPoint.y(), size.height() - secondPoint.y()); 1070 float yDist = std::max(secondPoint.y(), size.height() - secondPoint. y());
1073 if (shape == Circle) { 1071 if (shape == Circle) {
1074 float larger = max(xDist, yDist); 1072 float larger = std::max(xDist, yDist);
1075 xDist = larger; 1073 xDist = larger;
1076 yDist = larger; 1074 yDist = larger;
1077 } 1075 }
1078 secondRadius = xDist; 1076 secondRadius = xDist;
1079 aspectRatio = xDist / yDist; 1077 aspectRatio = xDist / yDist;
1080 break; 1078 break;
1081 } 1079 }
1082 case ClosestCorner: { 1080 case ClosestCorner: {
1083 FloatPoint corner; 1081 FloatPoint corner;
1084 float distance = distanceToClosestCorner(secondPoint, size, corner); 1082 float distance = distanceToClosestCorner(secondPoint, size, corner);
1085 if (shape == Circle) 1083 if (shape == Circle)
1086 secondRadius = distance; 1084 secondRadius = distance;
1087 else { 1085 else {
1088 // If <shape> is ellipse, the gradient-shape has the same ratio of width to height 1086 // If <shape> is ellipse, the gradient-shape has the same ratio of width to height
1089 // that it would if closest-side or farthest-side were specified , as appropriate. 1087 // that it would if closest-side or farthest-side were specified , as appropriate.
1090 float xDist = min(secondPoint.x(), size.width() - secondPoint.x( )); 1088 float xDist = std::min(secondPoint.x(), size.width() - secondPoi nt.x());
1091 float yDist = min(secondPoint.y(), size.height() - secondPoint.y ()); 1089 float yDist = std::min(secondPoint.y(), size.height() - secondPo int.y());
1092 1090
1093 secondRadius = horizontalEllipseRadius(corner - secondPoint, xDi st / yDist); 1091 secondRadius = horizontalEllipseRadius(corner - secondPoint, xDi st / yDist);
1094 aspectRatio = xDist / yDist; 1092 aspectRatio = xDist / yDist;
1095 } 1093 }
1096 break; 1094 break;
1097 } 1095 }
1098 1096
1099 case FarthestCorner: { 1097 case FarthestCorner: {
1100 FloatPoint corner; 1098 FloatPoint corner;
1101 float distance = distanceToFarthestCorner(secondPoint, size, corner) ; 1099 float distance = distanceToFarthestCorner(secondPoint, size, corner) ;
1102 if (shape == Circle) 1100 if (shape == Circle)
1103 secondRadius = distance; 1101 secondRadius = distance;
1104 else { 1102 else {
1105 // If <shape> is ellipse, the gradient-shape has the same ratio of width to height 1103 // If <shape> is ellipse, the gradient-shape has the same ratio of width to height
1106 // that it would if closest-side or farthest-side were specified , as appropriate. 1104 // that it would if closest-side or farthest-side were specified , as appropriate.
1107 float xDist = max(secondPoint.x(), size.width() - secondPoint.x( )); 1105 float xDist = std::max(secondPoint.x(), size.width() - secondPoi nt.x());
1108 float yDist = max(secondPoint.y(), size.height() - secondPoint.y ()); 1106 float yDist = std::max(secondPoint.y(), size.height() - secondPo int.y());
1109 1107
1110 secondRadius = horizontalEllipseRadius(corner - secondPoint, xDi st / yDist); 1108 secondRadius = horizontalEllipseRadius(corner - secondPoint, xDi st / yDist);
1111 aspectRatio = xDist / yDist; 1109 aspectRatio = xDist / yDist;
1112 } 1110 }
1113 break; 1111 break;
1114 } 1112 }
1115 } 1113 }
1116 } 1114 }
1117 1115
1118 RefPtr<Gradient> gradient = Gradient::create(firstPoint, firstRadius, second Point, secondRadius, aspectRatio); 1116 RefPtr<Gradient> gradient = Gradient::create(firstPoint, firstRadius, second Point, secondRadius, aspectRatio);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 visitor->trace(m_firstRadius); 1181 visitor->trace(m_firstRadius);
1184 visitor->trace(m_secondRadius); 1182 visitor->trace(m_secondRadius);
1185 visitor->trace(m_shape); 1183 visitor->trace(m_shape);
1186 visitor->trace(m_sizingBehavior); 1184 visitor->trace(m_sizingBehavior);
1187 visitor->trace(m_endHorizontalSize); 1185 visitor->trace(m_endHorizontalSize);
1188 visitor->trace(m_endVerticalSize); 1186 visitor->trace(m_endVerticalSize);
1189 CSSGradientValue::traceAfterDispatch(visitor); 1187 CSSGradientValue::traceAfterDispatch(visitor);
1190 } 1188 }
1191 1189
1192 } // namespace WebCore 1190 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontSelector.cpp ('k') | Source/core/css/CSSReflectValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698