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

Side by Side Diff: Source/WebCore/rendering/RenderObject.cpp

Issue 12545020: Revert 145087 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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/WebCore/rendering/RenderObject.h ('k') | Source/WebCore/rendering/RenderReplaced.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) 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
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(PaintInfo& paintInfo, const LayoutPoint& paint Offset, RenderStyle* style) 1093 void RenderObject::paintFocusRing(GraphicsContext* context, const LayoutPoint& p aintOffset, RenderStyle* style)
1094 { 1094 {
1095 Vector<IntRect> focusRingRects; 1095 Vector<IntRect> focusRingRects;
1096 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer); 1096 addFocusRingRects(focusRingRects, paintOffset);
1097 if (style->outlineStyleIsAuto()) 1097 if (style->outlineStyleIsAuto())
1098 paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor)); 1098 context->drawFocusRing(focusRingRects, style->outlineWidth(), style->out lineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
1099 else 1099 else
1100 addPDFURLRect(paintInfo.context, unionRect(focusRingRects)); 1100 addPDFURLRect(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(PaintInfo& paintInfo, const LayoutRect& paintRec t) 1116 void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRe ct& paintRect)
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);
1123 1126
1124 int outlineOffset = styleToUse->outlineOffset(); 1127 int outlineOffset = styleToUse->outlineOffset();
1125 1128
1126 if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) { 1129 if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) {
1127 if (!theme()->supportsFocusRing(styleToUse)) { 1130 if (!theme()->supportsFocusRing(styleToUse)) {
1128 // Only paint the focus ring by hand if the theme isn't able to draw the focus ring. 1131 // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
1129 paintFocusRing(paintInfo, paintRect.location(), styleToUse); 1132 paintFocusRing(graphicsContext, paintRect.location(), styleToUse);
1130 } 1133 }
1131 } 1134 }
1132 1135
1133 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) 1136 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE)
1134 return; 1137 return;
1135 1138
1136 IntRect inner = pixelSnappedIntRect(paintRect); 1139 IntRect inner = pixelSnappedIntRect(paintRect);
1137 inner.inflate(outlineOffset); 1140 inner.inflate(outlineOffset);
1138 1141
1139 IntRect outer = pixelSnappedIntRect(inner); 1142 IntRect outer = pixelSnappedIntRect(inner);
1140 outer.inflate(outlineWidth); 1143 outer.inflate(outlineWidth);
1141 1144
1142 // FIXME: This prevents outlines from painting inside the object. See bug 12 042 1145 // FIXME: This prevents outlines from painting inside the object. See bug 12 042
1143 if (outer.isEmpty()) 1146 if (outer.isEmpty())
1144 return; 1147 return;
1145 1148
1146 EBorderStyle outlineStyle = styleToUse->outlineStyle();
1147 Color outlineColor = styleToUse->visitedDependentColor(CSSPropertyOutlineCol or);
1148
1149 GraphicsContext* graphicsContext = paintInfo.context;
1150 bool useTransparencyLayer = outlineColor.hasAlpha(); 1149 bool useTransparencyLayer = outlineColor.hasAlpha();
1151 if (useTransparencyLayer) { 1150 if (useTransparencyLayer) {
1152 if (outlineStyle == SOLID) { 1151 if (outlineStyle == SOLID) {
1153 Path path; 1152 Path path;
1154 path.addRect(outer); 1153 path.addRect(outer);
1155 path.addRect(inner); 1154 path.addRect(inner);
1156 graphicsContext->setFillRule(RULE_EVENODD); 1155 graphicsContext->setFillRule(RULE_EVENODD);
1157 graphicsContext->setFillColor(outlineColor, styleToUse->colorSpace() ); 1156 graphicsContext->setFillColor(outlineColor, styleToUse->colorSpace() );
1158 graphicsContext->fillPath(path); 1157 graphicsContext->fillPath(path);
1159 return; 1158 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 1211
1213 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) 1212 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
1214 { 1213 {
1215 Vector<IntRect> rects; 1214 Vector<IntRect> rects;
1216 // FIXME: addFocusRingRects() needs to be passed this transform-unaware 1215 // FIXME: addFocusRingRects() needs to be passed this transform-unaware
1217 // localToAbsolute() offset here because RenderInline::addFocusRingRects() 1216 // localToAbsolute() offset here because RenderInline::addFocusRingRects()
1218 // implicitly assumes that. This doesn't work correctly with transformed 1217 // implicitly assumes that. This doesn't work correctly with transformed
1219 // descendants. 1218 // descendants.
1220 FloatPoint absolutePoint = localToAbsolute(); 1219 FloatPoint absolutePoint = localToAbsolute();
1221 addFocusRingRects(rects, flooredLayoutPoint(absolutePoint)); 1220 addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
1222 size_t count = rects.size(); 1221 size_t count = rects.size();
1223 for (size_t i = 0; i < count; ++i) { 1222 for (size_t i = 0; i < count; ++i) {
1224 IntRect rect = rects[i]; 1223 IntRect rect = rects[i];
1225 rect.move(-absolutePoint.x(), -absolutePoint.y()); 1224 rect.move(-absolutePoint.x(), -absolutePoint.y());
1226 quads.append(localToAbsoluteQuad(FloatQuad(rect))); 1225 quads.append(localToAbsoluteQuad(FloatQuad(rect)));
1227 } 1226 }
1228 } 1227 }
1229 1228
1230 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) 1229 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
1231 { 1230 {
1232 if (!range || !range->startContainer()) 1231 if (!range || !range->startContainer())
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 { 3174 {
3176 if (object1) { 3175 if (object1) {
3177 const WebCore::RenderObject* root = object1; 3176 const WebCore::RenderObject* root = object1;
3178 while (root->parent()) 3177 while (root->parent())
3179 root = root->parent(); 3178 root = root->parent();
3180 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3179 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3181 } 3180 }
3182 } 3181 }
3183 3182
3184 #endif 3183 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderObject.h ('k') | Source/WebCore/rendering/RenderReplaced.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698