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

Side by Side Diff: third_party/WebKit/Source/core/dom/Range.cpp

Issue 2209513002: Exclude start/end container in Range::getBorderAndTextQuads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 4 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
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 Node* stopNode = pastLastNode(); 1523 Node* stopNode = pastLastNode();
1524 1524
1525 HeapHashSet<Member<Node>> nodeSet; 1525 HeapHashSet<Member<Node>> nodeSet;
1526 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1526 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1527 if (node->isElementNode()) 1527 if (node->isElementNode())
1528 nodeSet.add(node); 1528 nodeSet.add(node);
1529 } 1529 }
1530 1530
1531 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1531 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1532 if (node->isElementNode()) { 1532 if (node->isElementNode()) {
1533 if (!nodeSet.contains(node->parentNode())) { 1533 if (!nodeSet.contains(node->parentNode())
1534 && !node->contains(startContainer)
yosin_UTC9 2016/08/03 01:25:04 Since |nodeSet| is used only here, we have two opt
eae 2016/08/03 01:49:48 Oh, that's a good idea. Thanks for the suggestions
1535 && !node->contains(endContainer)) {
1534 if (LayoutObject* layoutObject = toElement(node)->layoutObject() ) { 1536 if (LayoutObject* layoutObject = toElement(node)->layoutObject() ) {
1535 Vector<FloatQuad> elementQuads; 1537 Vector<FloatQuad> elementQuads;
1536 layoutObject->absoluteQuads(elementQuads); 1538 layoutObject->absoluteQuads(elementQuads);
1537 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(el ementQuads, *layoutObject); 1539 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(el ementQuads, *layoutObject);
1538 1540
1539 quads.appendVector(elementQuads); 1541 quads.appendVector(elementQuads);
1540 } 1542 }
1541 } 1543 }
1542 } else if (node->isTextNode()) { 1544 } else if (node->isTextNode()) {
1543 if (LayoutText* layoutText = toText(node)->layoutObject()) { 1545 if (LayoutText* layoutText = toText(node)->layoutObject()) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 { 1589 {
1588 if (range && range->boundaryPointsValid()) { 1590 if (range && range->boundaryPointsValid()) {
1589 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1591 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1590 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1592 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1591 } else { 1593 } else {
1592 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n"); 1594 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n");
1593 } 1595 }
1594 } 1596 }
1595 1597
1596 #endif 1598 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698