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

Side by Side Diff: Source/core/layout/LayoutInline.cpp

Issue 1280543005: Refactor LayoutInline::addOutlineRects to avoid tricky logic to avoid dups (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 { 1371 {
1372 if (!rect.isEmpty()) 1372 if (!rect.isEmpty())
1373 AbsoluteLayoutRectsGeneratorContext::operator()(rect); 1373 AbsoluteLayoutRectsGeneratorContext::operator()(rect);
1374 } 1374 }
1375 }; 1375 };
1376 1376
1377 } // unnamed namespace 1377 } // unnamed namespace
1378 1378
1379 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const 1379 void LayoutInline::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const
1380 { 1380 {
1381 // Add line boxes only if this object is the first object of addOutlineRects (). 1381 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, additio nalOffset);
1382 // Otherwise the parent (LayoutBlockFlow or LayoutInline) should have added line box rects 1382 generateLineBoxRects(context);
1383 // covering those of this object. 1383 addOutlineRectsForChildrenAndContinuations(rects, additionalOffset);
1384 if (rects.isEmpty()) { 1384 }
chrishtr 2015/08/07 17:08:40 I don't quite get yet why the new version avoids t
Xianzhu 2015/08/07 17:18:49 The duplication problem is about LayoutBlocks with
1385 AbsoluteLayoutRectsIgnoringEmptyRectsGeneratorContext context(rects, add itionalOffset); 1385 void LayoutInline::addOutlineRectsForChildrenAndContinuations(Vector<LayoutRect> & rects, const LayoutPoint& additionalOffset) const
1386 generateLineBoxRects(context); 1386 {
1387 } 1387 addOutlineRectsForNormalChildren(rects, additionalOffset);
1388 addOutlineRectsForContinuations(rects, additionalOffset);
1389 }
1388 1390
1389 addOutlineRectsForNormalChildren(rects, additionalOffset); 1391 void LayoutInline::addOutlineRectsForContinuations(Vector<LayoutRect>& rects, co nst LayoutPoint& additionalOffset) const
1390 1392 {
1391 if (LayoutBoxModelObject* continuation = this->continuation()) { 1393 if (LayoutBoxModelObject* continuation = this->continuation()) {
1392 if (continuation->isInline()) 1394 if (continuation->isInline())
1393 continuation->addOutlineRects(rects, additionalOffset + (continuatio n->containingBlock()->location() - containingBlock()->location())); 1395 continuation->addOutlineRects(rects, additionalOffset + (continuatio n->containingBlock()->location() - containingBlock()->location()));
1394 else 1396 else
1395 continuation->addOutlineRects(rects, additionalOffset + (toLayoutBox (continuation)->location() - containingBlock()->location())); 1397 continuation->addOutlineRects(rects, additionalOffset + (toLayoutBox (continuation)->location() - containingBlock()->location()));
1396 } 1398 }
1397 } 1399 }
1398 1400
1399 void LayoutInline::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layo utPoint& layerOffset) const 1401 void LayoutInline::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layo utPoint& layerOffset) const
1400 { 1402 {
(...skipping 26 matching lines...) Expand all
1427 } 1429 }
1428 1430
1429 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const 1431 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const
1430 { 1432 {
1431 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r); 1433 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r);
1432 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1434 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1433 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1435 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1434 } 1436 }
1435 1437
1436 } // namespace blink 1438 } // namespace blink
OLDNEW
« Source/core/layout/LayoutBoxModelObject.cpp ('K') | « Source/core/layout/LayoutInline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698