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

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

Issue 492053002: Use LayoutRect during addFocusRingRects to avoid loss of precision (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1356
1357 void RenderInline::imageChanged(WrappedImagePtr, const IntRect*) 1357 void RenderInline::imageChanged(WrappedImagePtr, const IntRect*)
1358 { 1358 {
1359 if (!parent()) 1359 if (!parent())
1360 return; 1360 return;
1361 1361
1362 // FIXME: We can do better. 1362 // FIXME: We can do better.
1363 setShouldDoFullPaintInvalidation(true); 1363 setShouldDoFullPaintInvalidation(true);
1364 } 1364 }
1365 1365
1366 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const
1367 {
1368 AbsoluteRectsGeneratorContext context(rects, additionalOffset);
1369 generateLineBoxRects(context);
1370
1371 addChildFocusRingRects(rects, additionalOffset, paintContainer);
1372
1373 if (continuation()) {
1374 // If the continuation doesn't paint into the same container, let its pa int invalidation container handle it.
1375 if (paintContainer != continuation()->containerForPaintInvalidation())
1376 return;
1377 if (continuation()->isInline())
1378 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition alOffset + continuation()->containingBlock()->location() - containingBlock()->lo cation()), paintContainer);
1379 else
1380 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition alOffset + toRenderBox(continuation())->location() - containingBlock()->location ()), paintContainer);
1381 }
1382 }
1383
1384 namespace { 1366 namespace {
1385 1367
1386 class AbsoluteLayoutRectsGeneratorContext { 1368 class AbsoluteLayoutRectsGeneratorContext {
1387 public: 1369 public:
1388 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutP oint& accumulatedOffset) 1370 AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutP oint& accumulatedOffset)
1389 : m_rects(rects) 1371 : m_rects(rects)
1390 , m_accumulatedOffset(accumulatedOffset) { } 1372 , m_accumulatedOffset(accumulatedOffset) { }
1391 1373
1392 void operator()(const FloatRect& rect) 1374 void operator()(const FloatRect& rect)
1393 { 1375 {
1394 LayoutRect layoutRect(rect); 1376 LayoutRect layoutRect(rect);
1395 layoutRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y()); 1377 layoutRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y());
1396 m_rects.append(layoutRect); 1378 m_rects.append(layoutRect);
1397 } 1379 }
1398 private: 1380 private:
1399 Vector<LayoutRect>& m_rects; 1381 Vector<LayoutRect>& m_rects;
1400 const LayoutPoint& m_accumulatedOffset; 1382 const LayoutPoint& m_accumulatedOffset;
1401 }; 1383 };
1402 1384
1403 } 1385 }
1404 1386
1387 void RenderInline::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoin t& additionalOffset, const RenderLayerModelObject* paintContainer) const
1388 {
1389 AbsoluteLayoutRectsGeneratorContext context(rects, additionalOffset);
1390 generateLineBoxRects(context);
1391
1392 addChildFocusRingRects(rects, additionalOffset, paintContainer);
1393
1394 if (continuation()) {
1395 // If the continuation doesn't paint into the same container, let its pa int invalidation container handle it.
1396 if (paintContainer != continuation()->containerForPaintInvalidation())
1397 return;
1398 LayoutPoint continuationAdditionalOffset = additionalOffset;
1399 continuationAdditionalOffset.move(continuation()->isInline()
1400 ? continuation()->containingBlock()->location() - containingBlock()- >location()
1401 : toRenderBox(continuation())->location() - containingBlock()->locat ion());
Julien - ping for review 2014/08/20 22:12:31 I found the previous structure more readable. We
Xianzhu 2014/09/04 00:29:12 Done.
1402 continuation()->addFocusRingRects(rects, continuationAdditionalOffset, p aintContainer);
1403 }
1404 }
1405
1405 void RenderInline::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layo utPoint& layerOffset) const 1406 void RenderInline::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layo utPoint& layerOffset) const
1406 { 1407 {
1407 AbsoluteLayoutRectsGeneratorContext context(rects, layerOffset); 1408 AbsoluteLayoutRectsGeneratorContext context(rects, layerOffset);
1408 generateLineBoxRects(context); 1409 generateLineBoxRects(context);
1409 } 1410 }
1410 1411
1411 void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 1412 void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
1412 { 1413 {
1413 if (!hasOutline()) 1414 if (!hasOutline())
1414 return; 1415 return;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 container = this; 1581 container = this;
1581 1582
1582 FloatPoint absPos = container->localToAbsolute(); 1583 FloatPoint absPos = container->localToAbsolute();
1583 region.bounds.setX(absPos.x() + region.bounds.x()); 1584 region.bounds.setX(absPos.x() + region.bounds.x());
1584 region.bounds.setY(absPos.y() + region.bounds.y()); 1585 region.bounds.setY(absPos.y() + region.bounds.y());
1585 1586
1586 regions.append(region); 1587 regions.append(region);
1587 } 1588 }
1588 1589
1589 } // namespace blink 1590 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698