| 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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 break; | 1083 break; |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 graphicsContext->drawConvexPolygon(4, quad, antialias); | 1086 graphicsContext->drawConvexPolygon(4, quad, antialias); |
| 1087 graphicsContext->setStrokeStyle(oldStrokeStyle); | 1087 graphicsContext->setStrokeStyle(oldStrokeStyle); |
| 1088 break; | 1088 break; |
| 1089 } | 1089 } |
| 1090 } | 1090 } |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void RenderObject::paintFocusRing(GraphicsContext* context, const LayoutPoint& p
aintOffset, RenderStyle* style) | 1093 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) |
| 1094 { | 1094 { |
| 1095 Vector<IntRect> focusRingRects; | 1095 Vector<IntRect> focusRingRects; |
| 1096 addFocusRingRects(focusRingRects, paintOffset); | 1096 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer); |
| 1097 if (style->outlineStyleIsAuto()) | 1097 if (style->outlineStyleIsAuto()) |
| 1098 context->drawFocusRing(focusRingRects, style->outlineWidth(), style->out
lineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor)); | 1098 paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(),
style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor)); |
| 1099 else | 1099 else |
| 1100 addPDFURLRect(context, unionRect(focusRingRects)); | 1100 addPDFURLRect(paintInfo.context, unionRect(focusRingRects)); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 void RenderObject::addPDFURLRect(GraphicsContext* context, const LayoutRect& rec
t) | 1103 void RenderObject::addPDFURLRect(GraphicsContext* context, const LayoutRect& rec
t) |
| 1104 { | 1104 { |
| 1105 if (rect.isEmpty()) | 1105 if (rect.isEmpty()) |
| 1106 return; | 1106 return; |
| 1107 Node* n = node(); | 1107 Node* n = node(); |
| 1108 if (!n || !n->isLink() || !n->isElementNode()) | 1108 if (!n || !n->isLink() || !n->isElementNode()) |
| 1109 return; | 1109 return; |
| 1110 const AtomicString& href = static_cast<Element*>(n)->getAttribute(hrefAttr); | 1110 const AtomicString& href = static_cast<Element*>(n)->getAttribute(hrefAttr); |
| 1111 if (href.isNull()) | 1111 if (href.isNull()) |
| 1112 return; | 1112 return; |
| 1113 context->setURLForRect(n->document()->completeURL(href), pixelSnappedIntRect
(rect)); | 1113 context->setURLForRect(n->document()->completeURL(href), pixelSnappedIntRect
(rect)); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRe
ct& paintRect) | 1116 void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
t) |
| 1117 { | 1117 { |
| 1118 if (!hasOutline()) | 1118 if (!hasOutline()) |
| 1119 return; | 1119 return; |
| 1120 | 1120 |
| 1121 RenderStyle* styleToUse = style(); | 1121 RenderStyle* styleToUse = style(); |
| 1122 LayoutUnit outlineWidth = styleToUse->outlineWidth(); | 1122 LayoutUnit outlineWidth = styleToUse->outlineWidth(); |
| 1123 EBorderStyle outlineStyle = styleToUse->outlineStyle(); | |
| 1124 | |
| 1125 Color outlineColor = styleToUse->visitedDependentColor(CSSPropertyOutlineCol
or); | |
| 1126 | 1123 |
| 1127 int outlineOffset = styleToUse->outlineOffset(); | 1124 int outlineOffset = styleToUse->outlineOffset(); |
| 1128 | 1125 |
| 1129 if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) { | 1126 if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) { |
| 1130 if (!theme()->supportsFocusRing(styleToUse)) { | 1127 if (!theme()->supportsFocusRing(styleToUse)) { |
| 1131 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. | 1128 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. |
| 1132 paintFocusRing(graphicsContext, paintRect.location(), styleToUse); | 1129 paintFocusRing(paintInfo, paintRect.location(), styleToUse); |
| 1133 } | 1130 } |
| 1134 } | 1131 } |
| 1135 | 1132 |
| 1136 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) | 1133 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) |
| 1137 return; | 1134 return; |
| 1138 | 1135 |
| 1139 IntRect inner = pixelSnappedIntRect(paintRect); | 1136 IntRect inner = pixelSnappedIntRect(paintRect); |
| 1140 inner.inflate(outlineOffset); | 1137 inner.inflate(outlineOffset); |
| 1141 | 1138 |
| 1142 IntRect outer = pixelSnappedIntRect(inner); | 1139 IntRect outer = pixelSnappedIntRect(inner); |
| 1143 outer.inflate(outlineWidth); | 1140 outer.inflate(outlineWidth); |
| 1144 | 1141 |
| 1145 // FIXME: This prevents outlines from painting inside the object. See bug 12
042 | 1142 // FIXME: This prevents outlines from painting inside the object. See bug 12
042 |
| 1146 if (outer.isEmpty()) | 1143 if (outer.isEmpty()) |
| 1147 return; | 1144 return; |
| 1148 | 1145 |
| 1146 EBorderStyle outlineStyle = styleToUse->outlineStyle(); |
| 1147 Color outlineColor = styleToUse->visitedDependentColor(CSSPropertyOutlineCol
or); |
| 1148 |
| 1149 GraphicsContext* graphicsContext = paintInfo.context; |
| 1149 bool useTransparencyLayer = outlineColor.hasAlpha(); | 1150 bool useTransparencyLayer = outlineColor.hasAlpha(); |
| 1150 if (useTransparencyLayer) { | 1151 if (useTransparencyLayer) { |
| 1151 if (outlineStyle == SOLID) { | 1152 if (outlineStyle == SOLID) { |
| 1152 Path path; | 1153 Path path; |
| 1153 path.addRect(outer); | 1154 path.addRect(outer); |
| 1154 path.addRect(inner); | 1155 path.addRect(inner); |
| 1155 graphicsContext->setFillRule(RULE_EVENODD); | 1156 graphicsContext->setFillRule(RULE_EVENODD); |
| 1156 graphicsContext->setFillColor(outlineColor, styleToUse->colorSpace()
); | 1157 graphicsContext->setFillColor(outlineColor, styleToUse->colorSpace()
); |
| 1157 graphicsContext->fillPath(path); | 1158 graphicsContext->fillPath(path); |
| 1158 return; | 1159 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1212 |
| 1212 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) | 1213 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) |
| 1213 { | 1214 { |
| 1214 Vector<IntRect> rects; | 1215 Vector<IntRect> rects; |
| 1215 // FIXME: addFocusRingRects() needs to be passed this transform-unaware | 1216 // FIXME: addFocusRingRects() needs to be passed this transform-unaware |
| 1216 // localToAbsolute() offset here because RenderInline::addFocusRingRects() | 1217 // localToAbsolute() offset here because RenderInline::addFocusRingRects() |
| 1217 // implicitly assumes that. This doesn't work correctly with transformed | 1218 // implicitly assumes that. This doesn't work correctly with transformed |
| 1218 // descendants. | 1219 // descendants. |
| 1219 FloatPoint absolutePoint = localToAbsolute(); | 1220 FloatPoint absolutePoint = localToAbsolute(); |
| 1220 addFocusRingRects(rects, flooredLayoutPoint(absolutePoint)); | 1221 addFocusRingRects(rects, flooredLayoutPoint(absolutePoint)); |
| 1221 size_t count = rects.size(); | 1222 size_t count = rects.size(); |
| 1222 for (size_t i = 0; i < count; ++i) { | 1223 for (size_t i = 0; i < count; ++i) { |
| 1223 IntRect rect = rects[i]; | 1224 IntRect rect = rects[i]; |
| 1224 rect.move(-absolutePoint.x(), -absolutePoint.y()); | 1225 rect.move(-absolutePoint.x(), -absolutePoint.y()); |
| 1225 quads.append(localToAbsoluteQuad(FloatQuad(rect))); | 1226 quads.append(localToAbsoluteQuad(FloatQuad(rect))); |
| 1226 } | 1227 } |
| 1227 } | 1228 } |
| 1228 | 1229 |
| 1229 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) | 1230 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) |
| 1230 { | 1231 { |
| 1231 if (!range || !range->startContainer()) | 1232 if (!range || !range->startContainer()) |
| (...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3174 { | 3175 { |
| 3175 if (object1) { | 3176 if (object1) { |
| 3176 const WebCore::RenderObject* root = object1; | 3177 const WebCore::RenderObject* root = object1; |
| 3177 while (root->parent()) | 3178 while (root->parent()) |
| 3178 root = root->parent(); | 3179 root = root->parent(); |
| 3179 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3180 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3180 } | 3181 } |
| 3181 } | 3182 } |
| 3182 | 3183 |
| 3183 #endif | 3184 #endif |
| OLD | NEW |