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

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

Issue 1987983002: Remove Range.expand() method Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 { 1491 {
1492 DCHECK_EQ(oldNode.document(), m_ownerDocument); 1492 DCHECK_EQ(oldNode.document(), m_ownerDocument);
1493 DCHECK(oldNode.parentNode()); 1493 DCHECK(oldNode.parentNode());
1494 DCHECK(oldNode.nextSibling()); 1494 DCHECK(oldNode.nextSibling());
1495 DCHECK(oldNode.nextSibling()->isTextNode()); 1495 DCHECK(oldNode.nextSibling()->isTextNode());
1496 boundaryTextNodeSplit(m_start, oldNode); 1496 boundaryTextNodeSplit(m_start, oldNode);
1497 boundaryTextNodeSplit(m_end, oldNode); 1497 boundaryTextNodeSplit(m_end, oldNode);
1498 DCHECK(boundaryPointsValid()); 1498 DCHECK(boundaryPointsValid());
1499 } 1499 }
1500 1500
1501 void Range::expand(const String& unit, ExceptionState& exceptionState)
1502 {
1503 VisiblePosition start = createVisiblePosition(startPosition());
1504 VisiblePosition end = createVisiblePosition(endPosition());
1505 if (unit == "word") {
1506 start = startOfWord(start);
1507 end = endOfWord(end);
1508 } else if (unit == "sentence") {
1509 start = startOfSentence(start);
1510 end = endOfSentence(end);
1511 } else if (unit == "block") {
1512 start = startOfParagraph(start);
1513 end = endOfParagraph(end);
1514 } else if (unit == "document") {
1515 start = startOfDocument(start);
1516 end = endOfDocument(end);
1517 } else {
1518 return;
1519 }
1520 setStart(start.deepEquivalent().computeContainerNode(), start.deepEquivalent ().computeOffsetInContainerNode(), exceptionState);
1521 setEnd(end.deepEquivalent().computeContainerNode(), end.deepEquivalent().com puteOffsetInContainerNode(), exceptionState);
1522 }
1523
1524 ClientRectList* Range::getClientRects() const 1501 ClientRectList* Range::getClientRects() const
1525 { 1502 {
1526 m_ownerDocument->updateLayoutIgnorePendingStylesheets(); 1503 m_ownerDocument->updateLayoutIgnorePendingStylesheets();
1527 1504
1528 Vector<FloatQuad> quads; 1505 Vector<FloatQuad> quads;
1529 getBorderAndTextQuads(quads); 1506 getBorderAndTextQuads(quads);
1530 1507
1531 return ClientRectList::create(quads); 1508 return ClientRectList::create(quads);
1532 } 1509 }
1533 1510
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 { 1584 {
1608 if (range && range->boundaryPointsValid()) { 1585 if (range && range->boundaryPointsValid()) {
1609 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1586 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1610 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1587 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1611 } else { 1588 } else {
1612 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n"); 1589 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n");
1613 } 1590 }
1614 } 1591 }
1615 1592
1616 #endif 1593 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Range.h ('k') | third_party/WebKit/Source/core/dom/Range.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698