OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #include "platform/geometry/TransformState.h" | 83 #include "platform/geometry/TransformState.h" |
84 #include "platform/graphics/GraphicsContext.h" | 84 #include "platform/graphics/GraphicsContext.h" |
85 #include "wtf/RefCountedLeakCounter.h" | 85 #include "wtf/RefCountedLeakCounter.h" |
86 #include "wtf/text/StringBuilder.h" | 86 #include "wtf/text/StringBuilder.h" |
87 #include "wtf/text/WTFString.h" | 87 #include "wtf/text/WTFString.h" |
88 #include <algorithm> | 88 #include <algorithm> |
89 #ifndef NDEBUG | 89 #ifndef NDEBUG |
90 #include <stdio.h> | 90 #include <stdio.h> |
91 #endif | 91 #endif |
92 | 92 |
93 using namespace std; | |
94 | |
95 namespace WebCore { | 93 namespace WebCore { |
96 | 94 |
97 namespace { | 95 namespace { |
98 | 96 |
99 static bool gModifyRenderTreeStructureAnyState = false; | 97 static bool gModifyRenderTreeStructureAnyState = false; |
100 | 98 |
101 } // namespace | 99 } // namespace |
102 | 100 |
103 using namespace HTMLNames; | 101 using namespace HTMLNames; |
104 | 102 |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 graphicsContext->setShouldAntialias(wasAntialiased); | 1071 graphicsContext->setShouldAntialias(wasAntialiased); |
1074 graphicsContext->setStrokeStyle(oldStrokeStyle); | 1072 graphicsContext->setStrokeStyle(oldStrokeStyle); |
1075 return; | 1073 return; |
1076 } | 1074 } |
1077 | 1075 |
1078 int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacen
tWidth1 - 1) / 3; | 1076 int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacen
tWidth1 - 1) / 3; |
1079 int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacen
tWidth2 - 1) / 3; | 1077 int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacen
tWidth2 - 1) / 3; |
1080 | 1078 |
1081 switch (side) { | 1079 switch (side) { |
1082 case BSTop: | 1080 case BSTop: |
1083 drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) /
3, 0), | 1081 drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 +
1) / 3, 0), |
1084 y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThicknes
s, | 1082 y1, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThi
ckness, |
1085 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1083 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1086 drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) /
3, 0), | 1084 drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 +
1) / 3, 0), |
1087 y2 - thirdOfThickness, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2
, | 1085 y2 - thirdOfThickness, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0
), y2, |
1088 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1086 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1089 break; | 1087 break; |
1090 case BSLeft: | 1088 case BSLeft: |
1091 drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjacentWidth1 * 2 +
1) / 3, 0), | 1089 drawLineForBoxSide(graphicsContext, x1, y1 + std::max((-adjacentWidth1 *
2 + 1) / 3, 0), |
1092 x1 + thirdOfThickness, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), | 1090 x1 + thirdOfThickness, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3,
0), |
1093 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1091 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1094 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((adj
acentWidth1 * 2 + 1) / 3, 0), | 1092 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max
((adjacentWidth1 * 2 + 1) / 3, 0), |
1095 x2, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0), | 1093 x2, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), |
1096 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1094 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1097 break; | 1095 break; |
1098 case BSBottom: | 1096 case BSBottom: |
1099 drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) /
3, 0), | 1097 drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 +
1) / 3, 0), |
1100 y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness
, | 1098 y1, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThic
kness, |
1101 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1099 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1102 drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) /
3, 0), | 1100 drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 +
1) / 3, 0), |
1103 y2 - thirdOfThickness, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y
2, | 1101 y2 - thirdOfThickness, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3,
0), y2, |
1104 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1102 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1105 break; | 1103 break; |
1106 case BSRight: | 1104 case BSRight: |
1107 drawLineForBoxSide(graphicsContext, x1, y1 + max((adjacentWidth1 * 2 + 1
) / 3, 0), | 1105 drawLineForBoxSide(graphicsContext, x1, y1 + std::max((adjacentWidth1 *
2 + 1) / 3, 0), |
1108 x1 + thirdOfThickness, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0), | 1106 x1 + thirdOfThickness, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0
), |
1109 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1107 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1110 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((-ad
jacentWidth1 * 2 + 1) / 3, 0), | 1108 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max
((-adjacentWidth1 * 2 + 1) / 3, 0), |
1111 x2, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), | 1109 x2, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), |
1112 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | 1110 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; |
1113 break; | 1111 break; |
1114 default: | 1112 default: |
1115 break; | 1113 break; |
1116 } | 1114 } |
1117 } | 1115 } |
1118 | 1116 |
1119 void RenderObject::drawRidgeOrGrooveBoxSide(GraphicsContext* graphicsContext, in
t x1, int y1, int x2, int y2, | 1117 void RenderObject::drawRidgeOrGrooveBoxSide(GraphicsContext* graphicsContext, in
t x1, int y1, int x2, int y2, |
1120 BoxSide side, Color color, EBorderStyle style, int adjacentWidth1, int adjac
entWidth2, bool antialias) | 1118 BoxSide side, Color color, EBorderStyle style, int adjacentWidth1, int adjac
entWidth2, bool antialias) |
1121 { | 1119 { |
1122 EBorderStyle s1; | 1120 EBorderStyle s1; |
1123 EBorderStyle s2; | 1121 EBorderStyle s2; |
1124 if (style == GROOVE) { | 1122 if (style == GROOVE) { |
1125 s1 = INSET; | 1123 s1 = INSET; |
1126 s2 = OUTSET; | 1124 s2 = OUTSET; |
1127 } else { | 1125 } else { |
1128 s1 = OUTSET; | 1126 s1 = OUTSET; |
1129 s2 = INSET; | 1127 s2 = INSET; |
1130 } | 1128 } |
1131 | 1129 |
1132 int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacent
Width1 - 1) / 2; | 1130 int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacent
Width1 - 1) / 2; |
1133 int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacent
Width2 - 1) / 2; | 1131 int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacent
Width2 - 1) / 2; |
1134 | 1132 |
1135 switch (side) { | 1133 switch (side) { |
1136 case BSTop: | 1134 case BSTop: |
1137 drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1, 0) / 2, y1
, x2 - max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, | 1135 drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1, 0) /
2, y1, x2 - std::max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, |
1138 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); | 1136 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); |
1139 drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1 + 1, 0) / 2,
(y1 + y2 + 1) / 2, x2 - max(adjacentWidth2 + 1, 0) / 2, y2, | 1137 drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1 + 1, 0)
/ 2, (y1 + y2 + 1) / 2, x2 - std::max(adjacentWidth2 + 1, 0) / 2, y2, |
1140 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | 1138 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); |
1141 break; | 1139 break; |
1142 case BSLeft: | 1140 case BSLeft: |
1143 drawLineForBoxSide(graphicsContext, x1, y1 + max(-adjacentWidth1, 0) / 2
, (x1 + x2 + 1) / 2, y2 - max(-adjacentWidth2, 0) / 2, | 1141 drawLineForBoxSide(graphicsContext, x1, y1 + std::max(-adjacentWidth1, 0
) / 2, (x1 + x2 + 1) / 2, y2 - std::max(-adjacentWidth2, 0) / 2, |
1144 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); | 1142 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); |
1145 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjacent
Width1 + 1, 0) / 2, x2, y2 - max(adjacentWidth2 + 1, 0) / 2, | 1143 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(adj
acentWidth1 + 1, 0) / 2, x2, y2 - std::max(adjacentWidth2 + 1, 0) / 2, |
1146 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | 1144 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); |
1147 break; | 1145 break; |
1148 case BSBottom: | 1146 case BSBottom: |
1149 drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1, 0) / 2, y1,
x2 - max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, | 1147 drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1, 0) / 2
, y1, x2 - std::max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, |
1150 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); | 1148 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); |
1151 drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1 + 1, 0) / 2
, (y1 + y2 + 1) / 2, x2 - max(-adjacentWidth2 + 1, 0) / 2, y2, | 1149 drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1 + 1, 0
) / 2, (y1 + y2 + 1) / 2, x2 - std::max(-adjacentWidth2 + 1, 0) / 2, y2, |
1152 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | 1150 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); |
1153 break; | 1151 break; |
1154 case BSRight: | 1152 case BSRight: |
1155 drawLineForBoxSide(graphicsContext, x1, y1 + max(adjacentWidth1, 0) / 2,
(x1 + x2 + 1) / 2, y2 - max(adjacentWidth2, 0) / 2, | 1153 drawLineForBoxSide(graphicsContext, x1, y1 + std::max(adjacentWidth1, 0)
/ 2, (x1 + x2 + 1) / 2, y2 - std::max(adjacentWidth2, 0) / 2, |
1156 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); | 1154 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); |
1157 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjacen
tWidth1 + 1, 0) / 2, x2, y2 - max(-adjacentWidth2 + 1, 0) / 2, | 1155 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(-ad
jacentWidth1 + 1, 0) / 2, x2, y2 - std::max(-adjacentWidth2 + 1, 0) / 2, |
1158 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | 1156 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); |
1159 break; | 1157 break; |
1160 } | 1158 } |
1161 } | 1159 } |
1162 | 1160 |
1163 void RenderObject::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, in
t y1, int x2, int y2, | 1161 void RenderObject::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, in
t y1, int x2, int y2, |
1164 BoxSide side, Color color, int adjacentWidth1, int adjacentWidth2, bool anti
alias) | 1162 BoxSide side, Color color, int adjacentWidth1, int adjacentWidth2, bool anti
alias) |
1165 { | 1163 { |
1166 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); | 1164 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); |
1167 graphicsContext->setStrokeStyle(NoStroke); | 1165 graphicsContext->setStrokeStyle(NoStroke); |
1168 graphicsContext->setFillColor(color); | 1166 graphicsContext->setFillColor(color); |
1169 ASSERT(x2 >= x1); | 1167 ASSERT(x2 >= x1); |
1170 ASSERT(y2 >= y1); | 1168 ASSERT(y2 >= y1); |
1171 if (!adjacentWidth1 && !adjacentWidth2) { | 1169 if (!adjacentWidth1 && !adjacentWidth2) { |
1172 // Turn off antialiasing to match the behavior of drawConvexPolygon(); | 1170 // Turn off antialiasing to match the behavior of drawConvexPolygon(); |
1173 // this matters for rects in transformed contexts. | 1171 // this matters for rects in transformed contexts. |
1174 bool wasAntialiased = graphicsContext->shouldAntialias(); | 1172 bool wasAntialiased = graphicsContext->shouldAntialias(); |
1175 graphicsContext->setShouldAntialias(antialias); | 1173 graphicsContext->setShouldAntialias(antialias); |
1176 graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1)); | 1174 graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1)); |
1177 graphicsContext->setShouldAntialias(wasAntialiased); | 1175 graphicsContext->setShouldAntialias(wasAntialiased); |
1178 graphicsContext->setStrokeStyle(oldStrokeStyle); | 1176 graphicsContext->setStrokeStyle(oldStrokeStyle); |
1179 return; | 1177 return; |
1180 } | 1178 } |
1181 FloatPoint quad[4]; | 1179 FloatPoint quad[4]; |
1182 switch (side) { | 1180 switch (side) { |
1183 case BSTop: | 1181 case BSTop: |
1184 quad[0] = FloatPoint(x1 + max(-adjacentWidth1, 0), y1); | 1182 quad[0] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y1); |
1185 quad[1] = FloatPoint(x1 + max(adjacentWidth1, 0), y2); | 1183 quad[1] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y2); |
1186 quad[2] = FloatPoint(x2 - max(adjacentWidth2, 0), y2); | 1184 quad[2] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y2); |
1187 quad[3] = FloatPoint(x2 - max(-adjacentWidth2, 0), y1); | 1185 quad[3] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y1); |
1188 break; | 1186 break; |
1189 case BSBottom: | 1187 case BSBottom: |
1190 quad[0] = FloatPoint(x1 + max(adjacentWidth1, 0), y1); | 1188 quad[0] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y1); |
1191 quad[1] = FloatPoint(x1 + max(-adjacentWidth1, 0), y2); | 1189 quad[1] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y2); |
1192 quad[2] = FloatPoint(x2 - max(-adjacentWidth2, 0), y2); | 1190 quad[2] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y2); |
1193 quad[3] = FloatPoint(x2 - max(adjacentWidth2, 0), y1); | 1191 quad[3] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y1); |
1194 break; | 1192 break; |
1195 case BSLeft: | 1193 case BSLeft: |
1196 quad[0] = FloatPoint(x1, y1 + max(-adjacentWidth1, 0)); | 1194 quad[0] = FloatPoint(x1, y1 + std::max(-adjacentWidth1, 0)); |
1197 quad[1] = FloatPoint(x1, y2 - max(-adjacentWidth2, 0)); | 1195 quad[1] = FloatPoint(x1, y2 - std::max(-adjacentWidth2, 0)); |
1198 quad[2] = FloatPoint(x2, y2 - max(adjacentWidth2, 0)); | 1196 quad[2] = FloatPoint(x2, y2 - std::max(adjacentWidth2, 0)); |
1199 quad[3] = FloatPoint(x2, y1 + max(adjacentWidth1, 0)); | 1197 quad[3] = FloatPoint(x2, y1 + std::max(adjacentWidth1, 0)); |
1200 break; | 1198 break; |
1201 case BSRight: | 1199 case BSRight: |
1202 quad[0] = FloatPoint(x1, y1 + max(adjacentWidth1, 0)); | 1200 quad[0] = FloatPoint(x1, y1 + std::max(adjacentWidth1, 0)); |
1203 quad[1] = FloatPoint(x1, y2 - max(adjacentWidth2, 0)); | 1201 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); |
1204 quad[2] = FloatPoint(x2, y2 - max(-adjacentWidth2, 0)); | 1202 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); |
1205 quad[3] = FloatPoint(x2, y1 + max(-adjacentWidth1, 0)); | 1203 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
1206 break; | 1204 break; |
1207 } | 1205 } |
1208 | 1206 |
1209 graphicsContext->drawConvexPolygon(4, quad, antialias); | 1207 graphicsContext->drawConvexPolygon(4, quad, antialias); |
1210 graphicsContext->setStrokeStyle(oldStrokeStyle); | 1208 graphicsContext->setStrokeStyle(oldStrokeStyle); |
1211 } | 1209 } |
1212 | 1210 |
1213 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) | 1211 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) |
1214 { | 1212 { |
1215 Vector<IntRect> focusRingRects; | 1213 Vector<IntRect> focusRingRects; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 RenderStyle* outlineStyle = outlineStyleForPaintInvalidation(); | 1741 RenderStyle* outlineStyle = outlineStyleForPaintInvalidation(); |
1744 LayoutUnit outlineWidth = outlineStyle->outlineSize(); | 1742 LayoutUnit outlineWidth = outlineStyle->outlineSize(); |
1745 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); | 1743 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); |
1746 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); | 1744 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); |
1747 if (width) { | 1745 if (width) { |
1748 LayoutUnit shadowLeft; | 1746 LayoutUnit shadowLeft; |
1749 LayoutUnit shadowRight; | 1747 LayoutUnit shadowRight; |
1750 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); | 1748 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); |
1751 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; | 1749 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; |
1752 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); | 1750 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); |
1753 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten
t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); | 1751 LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadow
Extent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width())); |
1754 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va
lueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(
style()->borderBottomRightRadius().width(), boxWidth))); | 1752 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight, std::max<Layo
utUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), value
ForLength(style()->borderBottomRightRadius().width(), boxWidth))); |
1755 LayoutUnit decorationsLeftWidth = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidt
h, -shadowLeft); | 1753 LayoutUnit decorationsLeftWidth = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(o
utlineWidth, -shadowLeft); |
1756 LayoutUnit decorationsRightWidth = max<LayoutUnit>(-outlineStyle->outlin
eOffset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWid
th, shadowRight); | 1754 LayoutUnit decorationsRightWidth = std::max<LayoutUnit>(-outlineStyle->o
utlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(
outlineWidth, shadowRight); |
1757 LayoutRect rightRect(newBounds.x() + min(newBounds.width(), oldBounds.wi
dth()) - decorationsLeftWidth, | 1755 LayoutRect rightRect(newBounds.x() + std::min(newBounds.width(), oldBoun
ds.width()) - decorationsLeftWidth, |
1758 newBounds.y(), | 1756 newBounds.y(), |
1759 width + decorationsLeftWidth + decorationsRightWidth, | 1757 width + decorationsLeftWidth + decorationsRightWidth, |
1760 max(newBounds.height(), oldBounds.height())); | 1758 std::max(newBounds.height(), oldBounds.height())); |
1761 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); | 1759 LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX
()); |
1762 if (rightRect.x() < right) { | 1760 if (rightRect.x() < right) { |
1763 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); | 1761 rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()
)); |
1764 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(rightRect), invalidationReason); | 1762 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(rightRect), invalidationReason); |
1765 } | 1763 } |
1766 } | 1764 } |
1767 LayoutUnit height = absoluteValue(newBounds.height() - oldBounds.height()); | 1765 LayoutUnit height = absoluteValue(newBounds.height() - oldBounds.height()); |
1768 if (height) { | 1766 if (height) { |
1769 LayoutUnit shadowTop; | 1767 LayoutUnit shadowTop; |
1770 LayoutUnit shadowBottom; | 1768 LayoutUnit shadowBottom; |
1771 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); | 1769 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); |
1772 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; | 1770 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; |
1773 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni
t(); | 1771 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni
t(); |
1774 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte
nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height())); | 1772 LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShado
wExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height())); |
1775 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>(
valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForL
ength(style()->borderBottomRightRadius().height(), boxHeight))); | 1773 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom, std::max<La
youtUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight),
valueForLength(style()->borderBottomRightRadius().height(), boxHeight))); |
1776 LayoutUnit decorationsTopHeight = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWi
dth, -shadowTop); | 1774 LayoutUnit decorationsTopHeight = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUnit>
(outlineWidth, -shadowTop); |
1777 LayoutUnit decorationsBottomHeight = max<LayoutUnit>(-outlineStyle->outl
ineOffset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlin
eWidth, shadowBottom); | 1775 LayoutUnit decorationsBottomHeight = std::max<LayoutUnit>(-outlineStyle-
>outlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUn
it>(outlineWidth, shadowBottom); |
1778 LayoutRect bottomRect(newBounds.x(), | 1776 LayoutRect bottomRect(newBounds.x(), |
1779 min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, | 1777 std::min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, |
1780 max(newBounds.width(), oldBounds.width()), | 1778 std::max(newBounds.width(), oldBounds.width()), |
1781 height + decorationsTopHeight + decorationsBottomHeight); | 1779 height + decorationsTopHeight + decorationsBottomHeight); |
1782 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); | 1780 LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY()); |
1783 if (bottomRect.y() < bottom) { | 1781 if (bottomRect.y() < bottom) { |
1784 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y(
))); | 1782 bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRe
ct.y())); |
1785 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(bottomRect), invalidationReason); | 1783 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(bottomRect), invalidationReason); |
1786 } | 1784 } |
1787 } | 1785 } |
1788 return false; | 1786 return false; |
1789 } | 1787 } |
1790 | 1788 |
1791 void RenderObject::invalidatePaintForOverflow() | 1789 void RenderObject::invalidatePaintForOverflow() |
1792 { | 1790 { |
1793 } | 1791 } |
1794 | 1792 |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3258 } | 3256 } |
3259 | 3257 |
3260 int RenderObject::caretMinOffset() const | 3258 int RenderObject::caretMinOffset() const |
3261 { | 3259 { |
3262 return 0; | 3260 return 0; |
3263 } | 3261 } |
3264 | 3262 |
3265 int RenderObject::caretMaxOffset() const | 3263 int RenderObject::caretMaxOffset() const |
3266 { | 3264 { |
3267 if (isReplaced()) | 3265 if (isReplaced()) |
3268 return node() ? max(1U, node()->countChildren()) : 1; | 3266 return node() ? std::max(1U, node()->countChildren()) : 1; |
3269 if (isHR()) | 3267 if (isHR()) |
3270 return 1; | 3268 return 1; |
3271 return 0; | 3269 return 0; |
3272 } | 3270 } |
3273 | 3271 |
3274 int RenderObject::previousOffset(int current) const | 3272 int RenderObject::previousOffset(int current) const |
3275 { | 3273 { |
3276 return current - 1; | 3274 return current - 1; |
3277 } | 3275 } |
3278 | 3276 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 { | 3536 { |
3539 if (object1) { | 3537 if (object1) { |
3540 const WebCore::RenderObject* root = object1; | 3538 const WebCore::RenderObject* root = object1; |
3541 while (root->parent()) | 3539 while (root->parent()) |
3542 root = root->parent(); | 3540 root = root->parent(); |
3543 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3541 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3544 } | 3542 } |
3545 } | 3543 } |
3546 | 3544 |
3547 #endif | 3545 #endif |
OLD | NEW |