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

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

Issue 288013005: Handle transformed descendants when drawing focus rings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Exclude the new flaky test. The other new test covers the change. 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 1241
1242 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth); 1242 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth);
1243 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth); 1243 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth);
1244 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); 1244 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth);
1245 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); 1245 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth);
1246 1246
1247 if (useTransparencyLayer) 1247 if (useTransparencyLayer)
1248 graphicsContext->endLayer(); 1248 graphicsContext->endLayer();
1249 } 1249 }
1250 1250
1251 void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPo int& additionalOffset, const RenderLayerModelObject* paintContainer)
1252 {
1253 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) {
1254 if (current->isText() || current->isListMarker())
1255 continue;
1256
1257 if (current->isBox()) {
1258 RenderBox* box = toRenderBox(current);
1259 if (box->hasLayer()) {
1260 Vector<IntRect> layerFocusRingRects;
1261 box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box);
1262 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) {
1263 FloatQuad quadInBox = box->localToContainerQuad(FloatRect(la yerFocusRingRects[i]), paintContainer);
1264 rects.append(pixelSnappedIntRect(LayoutRect(quadInBox.boundi ngBox())));
1265 }
1266 } else {
1267 FloatPoint pos(additionalOffset);
1268 pos.move(box->locationOffset()); // FIXME: Snap offsets? crbug.c om/350474
1269 box->addFocusRingRects(rects, flooredIntPoint(pos), paintContain er);
1270 }
1271 } else {
1272 current->addFocusRingRects(rects, additionalOffset, paintContainer);
1273 }
1274 }
1275 }
1276
1251 // FIXME: In repaint-after-layout, we should be able to change the logic to remo ve the need for this function. See crbug.com/368416. 1277 // FIXME: In repaint-after-layout, we should be able to change the logic to remo ve the need for this function. See crbug.com/368416.
1252 LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObj ect* repaintContainer) const 1278 LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObj ect* repaintContainer) const
1253 { 1279 {
1254 // FIXME: This assert should be re-enabled when we move repaint to after com positing update. crbug.com/360286 1280 // FIXME: This assert should be re-enabled when we move repaint to after com positing update. crbug.com/360286
1255 // ASSERT(containerForRepaint() == repaintContainer); 1281 // ASSERT(containerForRepaint() == repaintContainer);
1256 1282
1257 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint() ; 1283 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint() ;
1258 if (repaintContainer == this) 1284 if (repaintContainer == this)
1259 return offset; 1285 return offset;
1260 1286
(...skipping 27 matching lines...) Expand all
1288 1314
1289 LayoutRect result = rects[0]; 1315 LayoutRect result = rects[0];
1290 for (size_t i = 1; i < n; ++i) 1316 for (size_t i = 1; i < n; ++i)
1291 result.unite(rects[i]); 1317 result.unite(rects[i]);
1292 return pixelSnappedIntRect(result); 1318 return pixelSnappedIntRect(result);
1293 } 1319 }
1294 1320
1295 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) 1321 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
1296 { 1322 {
1297 Vector<IntRect> rects; 1323 Vector<IntRect> rects;
1298 // FIXME: addFocusRingRects() needs to be passed this transform-unaware 1324 const RenderLayerModelObject* container = containerForRepaint();
1299 // localToAbsolute() offset here because RenderInline::addFocusRingRects() 1325 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer)), container);
1300 // implicitly assumes that. This doesn't work correctly with transformed
1301 // descendants.
1302 FloatPoint absolutePoint = localToAbsolute();
1303 addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
1304 size_t count = rects.size(); 1326 size_t count = rects.size();
1305 for (size_t i = 0; i < count; ++i) { 1327 for (size_t i = 0; i < count; ++i)
1306 IntRect rect = rects[i]; 1328 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i])));
1307 rect.move(-absolutePoint.x(), -absolutePoint.y());
1308 quads.append(localToAbsoluteQuad(FloatQuad(rect)));
1309 }
1310 } 1329 }
1311 1330
1312 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) 1331 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
1313 { 1332 {
1314 if (!range || !range->startContainer()) 1333 if (!range || !range->startContainer())
1315 return FloatRect(); 1334 return FloatRect();
1316 1335
1317 range->ownerDocument().updateLayout(); 1336 range->ownerDocument().updateLayout();
1318 1337
1319 Vector<FloatQuad> quads; 1338 Vector<FloatQuad> quads;
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 { 3494 {
3476 if (object1) { 3495 if (object1) {
3477 const WebCore::RenderObject* root = object1; 3496 const WebCore::RenderObject* root = object1;
3478 while (root->parent()) 3497 while (root->parent())
3479 root = root->parent(); 3498 root = root->parent();
3480 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3499 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3481 } 3500 }
3482 } 3501 }
3483 3502
3484 #endif 3503 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698