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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 524523003: Revert of Remove webkitConvertPointFromPageToNode() and webkitConvertPointFromNodeToPage() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 3 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/dom/Node.h ('k') | Source/core/frame/LocalDOMWindow.h » ('j') | 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) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 } 1595 }
1596 } 1596 }
1597 1597
1598 // There was no difference between the two parent chains, i.e., one was a su bset of the other. The shorter 1598 // There was no difference between the two parent chains, i.e., one was a su bset of the other. The shorter
1599 // chain is the ancestor. 1599 // chain is the ancestor.
1600 return index1 < index2 ? 1600 return index1 < index2 ?
1601 DOCUMENT_POSITION_FOLLOWING | DOCUMENT_POSITION_CONTAINED_BY | co nnection : 1601 DOCUMENT_POSITION_FOLLOWING | DOCUMENT_POSITION_CONTAINED_BY | co nnection :
1602 DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connec tion; 1602 DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connec tion;
1603 } 1603 }
1604 1604
1605 FloatPoint Node::convertToPage(const FloatPoint& p) const
1606 {
1607 // If there is a renderer, just ask it to do the conversion
1608 if (renderer())
1609 return renderer()->localToAbsolute(p, UseTransforms);
1610
1611 // Otherwise go up the tree looking for a renderer
1612 if (Element* parent = parentElement())
1613 return parent->convertToPage(p);
1614
1615 // No parent - no conversion needed
1616 return p;
1617 }
1618
1619 FloatPoint Node::convertFromPage(const FloatPoint& p) const
1620 {
1621 // If there is a renderer, just ask it to do the conversion
1622 if (renderer())
1623 return renderer()->absoluteToLocal(p, UseTransforms);
1624
1625 // Otherwise go up the tree looking for a renderer
1626 if (Element* parent = parentElement())
1627 return parent->convertFromPage(p);
1628
1629 // No parent - no conversion needed
1630 return p;
1631 }
1632
1605 String Node::debugName() const 1633 String Node::debugName() const
1606 { 1634 {
1607 StringBuilder name; 1635 StringBuilder name;
1608 name.append(nodeName()); 1636 name.append(nodeName());
1609 1637
1610 if (isElementNode()) { 1638 if (isElementNode()) {
1611 const Element& thisElement = toElement(*this); 1639 const Element& thisElement = toElement(*this);
1612 if (thisElement.hasID()) { 1640 if (thisElement.hasID()) {
1613 name.appendLiteral(" id=\'"); 1641 name.appendLiteral(" id=\'");
1614 name.append(thisElement.getIdAttribute()); 1642 name.append(thisElement.getIdAttribute());
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 node->showTreeForThis(); 2510 node->showTreeForThis();
2483 } 2511 }
2484 2512
2485 void showNodePath(const blink::Node* node) 2513 void showNodePath(const blink::Node* node)
2486 { 2514 {
2487 if (node) 2515 if (node)
2488 node->showNodePathForThis(); 2516 node->showNodePathForThis();
2489 } 2517 }
2490 2518
2491 #endif 2519 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/frame/LocalDOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698