| OLD | NEW |
| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 return renderer && renderer->isBoxModelObject() ? toRenderBoxModelObject(ren
derer) : 0; | 426 return renderer && renderer->isBoxModelObject() ? toRenderBoxModelObject(ren
derer) : 0; |
| 427 } | 427 } |
| 428 | 428 |
| 429 LayoutRect Node::boundingBox() const | 429 LayoutRect Node::boundingBox() const |
| 430 { | 430 { |
| 431 if (renderer()) | 431 if (renderer()) |
| 432 return renderer()->absoluteBoundingBoxRect(); | 432 return renderer()->absoluteBoundingBoxRect(); |
| 433 return LayoutRect(); | 433 return LayoutRect(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 bool Node::hasNonEmptyBoundingBox() const | |
| 437 { | |
| 438 // Before calling absoluteRects, check for the common case where the rendere
r | |
| 439 // is non-empty, since this is a faster check and almost always returns true
. | |
| 440 RenderBoxModelObject* box = renderBoxModelObject(); | |
| 441 if (!box) | |
| 442 return false; | |
| 443 if (!box->borderBoundingBox().isEmpty()) | |
| 444 return true; | |
| 445 | |
| 446 Vector<IntRect> rects; | |
| 447 FloatPoint absPos = renderer()->localToAbsolute(); | |
| 448 renderer()->absoluteRects(rects, flooredLayoutPoint(absPos)); | |
| 449 size_t n = rects.size(); | |
| 450 for (size_t i = 0; i < n; ++i) | |
| 451 if (!rects[i].isEmpty()) | |
| 452 return true; | |
| 453 | |
| 454 return false; | |
| 455 } | |
| 456 | |
| 457 void Node::recalcDistribution() | 436 void Node::recalcDistribution() |
| 458 { | 437 { |
| 459 if (isElementNode()) { | 438 if (isElementNode()) { |
| 460 if (ElementShadow* shadow = toElement(this)->shadow()) | 439 if (ElementShadow* shadow = toElement(this)->shadow()) |
| 461 shadow->distributeIfNeeded(); | 440 shadow->distributeIfNeeded(); |
| 462 } | 441 } |
| 463 | 442 |
| 464 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 443 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 465 if (child->childNeedsDistributionRecalc()) | 444 if (child->childNeedsDistributionRecalc()) |
| 466 child->recalcDistribution(); | 445 child->recalcDistribution(); |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 node->showTreeForThis(); | 1618 node->showTreeForThis(); |
| 1640 } | 1619 } |
| 1641 | 1620 |
| 1642 void showNodePath(const blink::Node* node) | 1621 void showNodePath(const blink::Node* node) |
| 1643 { | 1622 { |
| 1644 if (node) | 1623 if (node) |
| 1645 node->showNodePathForThis(); | 1624 node->showNodePathForThis(); |
| 1646 } | 1625 } |
| 1647 | 1626 |
| 1648 #endif | 1627 #endif |
| OLD | NEW |