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 23 matching lines...) Expand all Loading... |
34 #include "core/dom/StyleEngine.h" | 34 #include "core/dom/StyleEngine.h" |
35 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
36 #include "core/editing/EditingBoundary.h" | 36 #include "core/editing/EditingBoundary.h" |
37 #include "core/editing/FrameSelection.h" | 37 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/htmlediting.h" | 38 #include "core/editing/htmlediting.h" |
39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
40 #include "core/fetch/ResourceLoader.h" | 40 #include "core/fetch/ResourceLoader.h" |
41 #include "core/frame/EventHandlerRegistry.h" | 41 #include "core/frame/EventHandlerRegistry.h" |
42 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 44 #include "core/frame/Settings.h" |
| 45 #include "core/frame/UseCounter.h" |
44 #include "core/html/HTMLAnchorElement.h" | 46 #include "core/html/HTMLAnchorElement.h" |
45 #include "core/html/HTMLElement.h" | 47 #include "core/html/HTMLElement.h" |
46 #include "core/html/HTMLHtmlElement.h" | 48 #include "core/html/HTMLHtmlElement.h" |
47 #include "core/html/HTMLTableCellElement.h" | 49 #include "core/html/HTMLTableCellElement.h" |
48 #include "core/html/HTMLTableElement.h" | 50 #include "core/html/HTMLTableElement.h" |
49 #include "core/page/AutoscrollController.h" | 51 #include "core/page/AutoscrollController.h" |
50 #include "core/page/EventHandler.h" | 52 #include "core/page/EventHandler.h" |
51 #include "core/page/Page.h" | 53 #include "core/page/Page.h" |
52 #include "core/frame/Settings.h" | 54 #include "core/paint/ObjectPainter.h" |
53 #include "core/frame/UseCounter.h" | |
54 #include "core/rendering/FlowThreadController.h" | 55 #include "core/rendering/FlowThreadController.h" |
55 #include "core/rendering/HitTestResult.h" | 56 #include "core/rendering/HitTestResult.h" |
56 #include "core/rendering/RenderCounter.h" | 57 #include "core/rendering/RenderCounter.h" |
57 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 58 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
58 #include "core/rendering/RenderFlexibleBox.h" | 59 #include "core/rendering/RenderFlexibleBox.h" |
59 #include "core/rendering/RenderFlowThread.h" | 60 #include "core/rendering/RenderFlowThread.h" |
60 #include "core/rendering/RenderGeometryMap.h" | 61 #include "core/rendering/RenderGeometryMap.h" |
61 #include "core/rendering/RenderGrid.h" | 62 #include "core/rendering/RenderGrid.h" |
62 #include "core/rendering/RenderImage.h" | 63 #include "core/rendering/RenderImage.h" |
63 #include "core/rendering/RenderImageResourceStyleImage.h" | 64 #include "core/rendering/RenderImageResourceStyleImage.h" |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 if (mustInvalidateFillLayersPaintOnHeightChange(style()->backgroundLayers())
) | 971 if (mustInvalidateFillLayersPaintOnHeightChange(style()->backgroundLayers())
) |
971 return true; | 972 return true; |
972 | 973 |
973 // Our fill layers are ok. Let's check border. | 974 // Our fill layers are ok. Let's check border. |
974 if (style()->hasBorder() && canRenderBorderImage()) | 975 if (style()->hasBorder() && canRenderBorderImage()) |
975 return true; | 976 return true; |
976 | 977 |
977 return false; | 978 return false; |
978 } | 979 } |
979 | 980 |
980 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, | |
981 BoxSide side, Color color, EBorderStyle st
yle, | |
982 int adjacentWidth1, int adjacentWidth2, bo
ol antialias) | |
983 { | |
984 int thickness; | |
985 int length; | |
986 if (side == BSTop || side == BSBottom) { | |
987 thickness = y2 - y1; | |
988 length = x2 - x1; | |
989 } else { | |
990 thickness = x2 - x1; | |
991 length = y2 - y1; | |
992 } | |
993 | |
994 // FIXME: We really would like this check to be an ASSERT as we don't want t
o draw empty borders. However | |
995 // nothing guarantees that the following recursive calls to drawLineForBoxSi
de will have non-null dimensions. | |
996 if (!thickness || !length) | |
997 return; | |
998 | |
999 if (style == DOUBLE && thickness < 3) | |
1000 style = SOLID; | |
1001 | |
1002 switch (style) { | |
1003 case BNONE: | |
1004 case BHIDDEN: | |
1005 return; | |
1006 case DOTTED: | |
1007 case DASHED: | |
1008 drawDashedOrDottedBoxSide(graphicsContext, x1, y1, x2, y2, side, | |
1009 color, thickness, style, antialias); | |
1010 break; | |
1011 case DOUBLE: | |
1012 drawDoubleBoxSide(graphicsContext, x1, y1, x2, y2, length, side, color, | |
1013 thickness, adjacentWidth1, adjacentWidth2, antialias); | |
1014 break; | |
1015 case RIDGE: | |
1016 case GROOVE: | |
1017 drawRidgeOrGrooveBoxSide(graphicsContext, x1, y1, x2, y2, side, color, | |
1018 style, adjacentWidth1, adjacentWidth2, antialias); | |
1019 break; | |
1020 case INSET: | |
1021 // FIXME: Maybe we should lighten the colors on one side like Firefox. | |
1022 // https://bugs.webkit.org/show_bug.cgi?id=58608 | |
1023 if (side == BSTop || side == BSLeft) | |
1024 color = color.dark(); | |
1025 // fall through | |
1026 case OUTSET: | |
1027 if (style == OUTSET && (side == BSBottom || side == BSRight)) | |
1028 color = color.dark(); | |
1029 // fall through | |
1030 case SOLID: | |
1031 drawSolidBoxSide(graphicsContext, x1, y1, x2, y2, side, color, adjacentW
idth1, adjacentWidth2, antialias); | |
1032 break; | |
1033 } | |
1034 } | |
1035 | |
1036 void RenderObject::drawDashedOrDottedBoxSide(GraphicsContext* graphicsContext, i
nt x1, int y1, int x2, int y2, | |
1037 BoxSide side, Color color, int thickness, EBorderStyle style, bool antialias
) | |
1038 { | |
1039 if (thickness <= 0) | |
1040 return; | |
1041 | |
1042 bool wasAntialiased = graphicsContext->shouldAntialias(); | |
1043 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); | |
1044 graphicsContext->setShouldAntialias(antialias); | |
1045 graphicsContext->setStrokeColor(color); | |
1046 graphicsContext->setStrokeThickness(thickness); | |
1047 graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStrok
e); | |
1048 | |
1049 switch (side) { | |
1050 case BSBottom: | |
1051 case BSTop: | |
1052 graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1
+ y2) / 2)); | |
1053 break; | |
1054 case BSRight: | |
1055 case BSLeft: | |
1056 graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2
) / 2, y2)); | |
1057 break; | |
1058 } | |
1059 graphicsContext->setShouldAntialias(wasAntialiased); | |
1060 graphicsContext->setStrokeStyle(oldStrokeStyle); | |
1061 } | |
1062 | |
1063 void RenderObject::drawDoubleBoxSide(GraphicsContext* graphicsContext, int x1, i
nt y1, int x2, int y2, | |
1064 int length, BoxSide side, Color color, int thickness, int adjacentWidth1, in
t adjacentWidth2, bool antialias) | |
1065 { | |
1066 int thirdOfThickness = (thickness + 1) / 3; | |
1067 ASSERT(thirdOfThickness); | |
1068 | |
1069 if (!adjacentWidth1 && !adjacentWidth2) { | |
1070 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); | |
1071 graphicsContext->setStrokeStyle(NoStroke); | |
1072 graphicsContext->setFillColor(color); | |
1073 | |
1074 bool wasAntialiased = graphicsContext->shouldAntialias(); | |
1075 graphicsContext->setShouldAntialias(antialias); | |
1076 | |
1077 switch (side) { | |
1078 case BSTop: | |
1079 case BSBottom: | |
1080 graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness))
; | |
1081 graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length,
thirdOfThickness)); | |
1082 break; | |
1083 case BSLeft: | |
1084 case BSRight: | |
1085 // FIXME: Why do we offset the border by 1 in this case but not the
other one? | |
1086 if (length > 1) { | |
1087 graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness,
length - 1)); | |
1088 graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1,
thirdOfThickness, length - 1)); | |
1089 } | |
1090 break; | |
1091 } | |
1092 | |
1093 graphicsContext->setShouldAntialias(wasAntialiased); | |
1094 graphicsContext->setStrokeStyle(oldStrokeStyle); | |
1095 return; | |
1096 } | |
1097 | |
1098 int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacen
tWidth1 - 1) / 3; | |
1099 int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacen
tWidth2 - 1) / 3; | |
1100 | |
1101 switch (side) { | |
1102 case BSTop: | |
1103 drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 +
1) / 3, 0), | |
1104 y1, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThi
ckness, | |
1105 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1106 drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 +
1) / 3, 0), | |
1107 y2 - thirdOfThickness, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0
), y2, | |
1108 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1109 break; | |
1110 case BSLeft: | |
1111 drawLineForBoxSide(graphicsContext, x1, y1 + std::max((-adjacentWidth1 *
2 + 1) / 3, 0), | |
1112 x1 + thirdOfThickness, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3,
0), | |
1113 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1114 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max
((adjacentWidth1 * 2 + 1) / 3, 0), | |
1115 x2, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), | |
1116 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1117 break; | |
1118 case BSBottom: | |
1119 drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 +
1) / 3, 0), | |
1120 y1, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThic
kness, | |
1121 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1122 drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 +
1) / 3, 0), | |
1123 y2 - thirdOfThickness, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3,
0), y2, | |
1124 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1125 break; | |
1126 case BSRight: | |
1127 drawLineForBoxSide(graphicsContext, x1, y1 + std::max((adjacentWidth1 *
2 + 1) / 3, 0), | |
1128 x1 + thirdOfThickness, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0
), | |
1129 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1130 drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max
((-adjacentWidth1 * 2 + 1) / 3, 0), | |
1131 x2, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), | |
1132 side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias)
; | |
1133 break; | |
1134 default: | |
1135 break; | |
1136 } | |
1137 } | |
1138 | |
1139 void RenderObject::drawRidgeOrGrooveBoxSide(GraphicsContext* graphicsContext, in
t x1, int y1, int x2, int y2, | |
1140 BoxSide side, Color color, EBorderStyle style, int adjacentWidth1, int adjac
entWidth2, bool antialias) | |
1141 { | |
1142 EBorderStyle s1; | |
1143 EBorderStyle s2; | |
1144 if (style == GROOVE) { | |
1145 s1 = INSET; | |
1146 s2 = OUTSET; | |
1147 } else { | |
1148 s1 = OUTSET; | |
1149 s2 = INSET; | |
1150 } | |
1151 | |
1152 int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacent
Width1 - 1) / 2; | |
1153 int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacent
Width2 - 1) / 2; | |
1154 | |
1155 switch (side) { | |
1156 case BSTop: | |
1157 drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1, 0) /
2, y1, x2 - std::max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, | |
1158 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); | |
1159 drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1 + 1, 0)
/ 2, (y1 + y2 + 1) / 2, x2 - std::max(adjacentWidth2 + 1, 0) / 2, y2, | |
1160 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | |
1161 break; | |
1162 case BSLeft: | |
1163 drawLineForBoxSide(graphicsContext, x1, y1 + std::max(-adjacentWidth1, 0
) / 2, (x1 + x2 + 1) / 2, y2 - std::max(-adjacentWidth2, 0) / 2, | |
1164 side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias); | |
1165 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(adj
acentWidth1 + 1, 0) / 2, x2, y2 - std::max(adjacentWidth2 + 1, 0) / 2, | |
1166 side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | |
1167 break; | |
1168 case BSBottom: | |
1169 drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1, 0) / 2
, y1, x2 - std::max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2, | |
1170 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); | |
1171 drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1 + 1, 0
) / 2, (y1 + y2 + 1) / 2, x2 - std::max(-adjacentWidth2 + 1, 0) / 2, y2, | |
1172 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | |
1173 break; | |
1174 case BSRight: | |
1175 drawLineForBoxSide(graphicsContext, x1, y1 + std::max(adjacentWidth1, 0)
/ 2, (x1 + x2 + 1) / 2, y2 - std::max(adjacentWidth2, 0) / 2, | |
1176 side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias); | |
1177 drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(-ad
jacentWidth1 + 1, 0) / 2, x2, y2 - std::max(-adjacentWidth2 + 1, 0) / 2, | |
1178 side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias); | |
1179 break; | |
1180 } | |
1181 } | |
1182 | |
1183 void RenderObject::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, in
t y1, int x2, int y2, | |
1184 BoxSide side, Color color, int adjacentWidth1, int adjacentWidth2, bool anti
alias) | |
1185 { | |
1186 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); | |
1187 graphicsContext->setStrokeStyle(NoStroke); | |
1188 graphicsContext->setFillColor(color); | |
1189 ASSERT(x2 >= x1); | |
1190 ASSERT(y2 >= y1); | |
1191 if (!adjacentWidth1 && !adjacentWidth2) { | |
1192 // Turn off antialiasing to match the behavior of drawConvexPolygon(); | |
1193 // this matters for rects in transformed contexts. | |
1194 bool wasAntialiased = graphicsContext->shouldAntialias(); | |
1195 graphicsContext->setShouldAntialias(antialias); | |
1196 graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1)); | |
1197 graphicsContext->setShouldAntialias(wasAntialiased); | |
1198 graphicsContext->setStrokeStyle(oldStrokeStyle); | |
1199 return; | |
1200 } | |
1201 FloatPoint quad[4]; | |
1202 switch (side) { | |
1203 case BSTop: | |
1204 quad[0] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y1); | |
1205 quad[1] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y2); | |
1206 quad[2] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y2); | |
1207 quad[3] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y1); | |
1208 break; | |
1209 case BSBottom: | |
1210 quad[0] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y1); | |
1211 quad[1] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y2); | |
1212 quad[2] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y2); | |
1213 quad[3] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y1); | |
1214 break; | |
1215 case BSLeft: | |
1216 quad[0] = FloatPoint(x1, y1 + std::max(-adjacentWidth1, 0)); | |
1217 quad[1] = FloatPoint(x1, y2 - std::max(-adjacentWidth2, 0)); | |
1218 quad[2] = FloatPoint(x2, y2 - std::max(adjacentWidth2, 0)); | |
1219 quad[3] = FloatPoint(x2, y1 + std::max(adjacentWidth1, 0)); | |
1220 break; | |
1221 case BSRight: | |
1222 quad[0] = FloatPoint(x1, y1 + std::max(adjacentWidth1, 0)); | |
1223 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); | |
1224 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); | |
1225 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | |
1226 break; | |
1227 } | |
1228 | |
1229 graphicsContext->drawConvexPolygon(4, quad, antialias); | |
1230 graphicsContext->setStrokeStyle(oldStrokeStyle); | |
1231 } | |
1232 | |
1233 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) | |
1234 { | |
1235 Vector<LayoutRect> focusRingRects; | |
1236 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); | |
1237 ASSERT(style->outlineStyleIsAuto()); | |
1238 Vector<IntRect> focusRingIntRects; | |
1239 for (size_t i = 0; i < focusRingRects.size(); ++i) | |
1240 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); | |
1241 paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), s
tyle->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); | |
1242 } | |
1243 | |
1244 void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
t) | 981 void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
t) |
1245 { | 982 { |
1246 RenderStyle* styleToUse = style(); | 983 ObjectPainter(*this).paintOutline(paintInfo, paintRect); |
1247 if (!styleToUse->hasOutline()) | |
1248 return; | |
1249 | |
1250 LayoutUnit outlineWidth = styleToUse->outlineWidth(); | |
1251 | |
1252 int outlineOffset = styleToUse->outlineOffset(); | |
1253 | |
1254 if (styleToUse->outlineStyleIsAuto()) { | |
1255 if (RenderTheme::theme().shouldDrawDefaultFocusRing(this)) { | |
1256 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. | |
1257 paintFocusRing(paintInfo, paintRect.location(), styleToUse); | |
1258 } | |
1259 return; | |
1260 } | |
1261 | |
1262 if (styleToUse->outlineStyle() == BNONE) | |
1263 return; | |
1264 | |
1265 IntRect inner = pixelSnappedIntRect(paintRect); | |
1266 inner.inflate(outlineOffset); | |
1267 | |
1268 IntRect outer = pixelSnappedIntRect(inner); | |
1269 outer.inflate(outlineWidth); | |
1270 | |
1271 // FIXME: This prevents outlines from painting inside the object. See bug 12
042 | |
1272 if (outer.isEmpty()) | |
1273 return; | |
1274 | |
1275 EBorderStyle outlineStyle = styleToUse->outlineStyle(); | |
1276 Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor); | |
1277 | |
1278 GraphicsContext* graphicsContext = paintInfo.context; | |
1279 bool useTransparencyLayer = outlineColor.hasAlpha(); | |
1280 if (useTransparencyLayer) { | |
1281 if (outlineStyle == SOLID) { | |
1282 Path path; | |
1283 path.addRect(outer); | |
1284 path.addRect(inner); | |
1285 graphicsContext->setFillRule(RULE_EVENODD); | |
1286 graphicsContext->setFillColor(outlineColor); | |
1287 graphicsContext->fillPath(path); | |
1288 return; | |
1289 } | |
1290 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.
alpha()) / 255); | |
1291 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineCo
lor.blue()); | |
1292 } | |
1293 | |
1294 int leftOuter = outer.x(); | |
1295 int leftInner = inner.x(); | |
1296 int rightOuter = outer.maxX(); | |
1297 int rightInner = inner.maxX(); | |
1298 int topOuter = outer.y(); | |
1299 int topInner = inner.y(); | |
1300 int bottomOuter = outer.maxY(); | |
1301 int bottomInner = inner.maxY(); | |
1302 | |
1303 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu
ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth); | |
1304 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne
r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth); | |
1305 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom
Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); | |
1306 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott
omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); | |
1307 | |
1308 if (useTransparencyLayer) | |
1309 graphicsContext->endLayer(); | |
1310 } | 984 } |
1311 | 985 |
1312 void RenderObject::addChildFocusRingRects(Vector<LayoutRect>& rects, const Layou
tPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const | 986 void RenderObject::addChildFocusRingRects(Vector<LayoutRect>& rects, const Layou
tPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const |
1313 { | 987 { |
1314 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) { | 988 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) { |
1315 if (current->isText() || current->isListMarker()) | 989 if (current->isText() || current->isListMarker()) |
1316 continue; | 990 continue; |
1317 | 991 |
1318 if (current->isBox()) { | 992 if (current->isBox()) { |
1319 RenderBox* box = toRenderBox(current); | 993 RenderBox* box = toRenderBox(current); |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3491 { | 3165 { |
3492 if (object1) { | 3166 if (object1) { |
3493 const blink::RenderObject* root = object1; | 3167 const blink::RenderObject* root = object1; |
3494 while (root->parent()) | 3168 while (root->parent()) |
3495 root = root->parent(); | 3169 root = root->parent(); |
3496 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3170 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3497 } | 3171 } |
3498 } | 3172 } |
3499 | 3173 |
3500 #endif | 3174 #endif |
OLD | NEW |