| 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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 void LayoutObject::showLineTreeForThis() const | 1601 void LayoutObject::showLineTreeForThis() const |
| 1602 { | 1602 { |
| 1603 if (LayoutBlock* cb = containingBlock()) { | 1603 if (LayoutBlock* cb = containingBlock()) { |
| 1604 if (cb->isLayoutBlockFlow()) | 1604 if (cb->isLayoutBlockFlow()) |
| 1605 toLayoutBlockFlow(cb)->showLineTreeAndMark(nullptr, nullptr, nullptr
, nullptr, this); | 1605 toLayoutBlockFlow(cb)->showLineTreeAndMark(nullptr, nullptr, nullptr
, nullptr, this); |
| 1606 } | 1606 } |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 void LayoutObject::showLayoutObject() const | 1609 void LayoutObject::showLayoutObject() const |
| 1610 { | 1610 { |
| 1611 showLayoutObject(0); | 1611 StringBuilder stringBuilder; |
| 1612 showLayoutObject(stringBuilder); |
| 1612 } | 1613 } |
| 1613 | 1614 |
| 1614 void LayoutObject::showLayoutObject(int printedCharacters) const | 1615 void LayoutObject::showLayoutObject(StringBuilder& stringBuilder) const |
| 1615 { | 1616 { |
| 1616 printedCharacters += fprintf(stderr, "%s %p", decoratedName().ascii().data()
, this); | 1617 stringBuilder.append(String::format("%s %p", decoratedName().ascii().data(),
this)); |
| 1617 | 1618 |
| 1618 if (isText() && toLayoutText(this)->isTextFragment()) | 1619 if (isText() && toLayoutText(this)->isTextFragment()) |
| 1619 printedCharacters += fprintf(stderr, " \"%s\" ", toLayoutText(this)->tex
t().ascii().data()); | 1620 stringBuilder.append(String::format(" \"%s\" ", toLayoutText(this)->text
().ascii().data())); |
| 1620 | 1621 |
| 1621 if (virtualContinuation()) | 1622 if (virtualContinuation()) |
| 1622 printedCharacters += fprintf(stderr, " continuation=%p", virtualContinua
tion()); | 1623 stringBuilder.append(String::format(" continuation=%p", virtualContinuat
ion())); |
| 1623 | 1624 |
| 1624 if (node()) { | 1625 if (node()) { |
| 1625 if (printedCharacters) | 1626 while (stringBuilder.length() < showTreeCharacterOffset) |
| 1626 for (; printedCharacters < showTreeCharacterOffset; printedCharacter
s++) | 1627 stringBuilder.append(' '); |
| 1627 fputc(' ', stderr); | 1628 stringBuilder.append('\t'); |
| 1628 fputc('\t', stderr); | 1629 node()->showNode(stringBuilder.toString().utf8().data()); |
| 1629 node()->showNode(); | |
| 1630 } else { | 1630 } else { |
| 1631 fputc('\n', stderr); | 1631 WTFLogAlways("%s", stringBuilder.toString().utf8().data()); |
| 1632 } | 1632 } |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 void LayoutObject::showLayoutTreeAndMark(const LayoutObject* markedObject1, cons
t char* markedLabel1, const LayoutObject* markedObject2, const char* markedLabel
2, int depth) const | 1635 void LayoutObject::showLayoutTreeAndMark(const LayoutObject* markedObject1, cons
t char* markedLabel1, const LayoutObject* markedObject2, const char* markedLabel
2, unsigned depth) const |
| 1636 { | 1636 { |
| 1637 int printedCharacters = 0; | 1637 StringBuilder stringBuilder; |
| 1638 if (markedObject1 == this && markedLabel1) | 1638 if (markedObject1 == this && markedLabel1) |
| 1639 printedCharacters += fprintf(stderr, "%s", markedLabel1); | 1639 stringBuilder.append(markedLabel1); |
| 1640 if (markedObject2 == this && markedLabel2) | 1640 if (markedObject2 == this && markedLabel2) |
| 1641 printedCharacters += fprintf(stderr, "%s", markedLabel2); | 1641 stringBuilder.append(markedLabel2); |
| 1642 for (; printedCharacters < depth * 2; printedCharacters++) | 1642 while (stringBuilder.length() < depth * 2) |
| 1643 fputc(' ', stderr); | 1643 stringBuilder.append(' '); |
| 1644 | 1644 |
| 1645 showLayoutObject(printedCharacters); | 1645 showLayoutObject(stringBuilder); |
| 1646 | 1646 |
| 1647 for (const LayoutObject* child = slowFirstChild(); child; child = child->nex
tSibling()) | 1647 for (const LayoutObject* child = slowFirstChild(); child; child = child->nex
tSibling()) |
| 1648 child->showLayoutTreeAndMark(markedObject1, markedLabel1, markedObject2,
markedLabel2, depth + 1); | 1648 child->showLayoutTreeAndMark(markedObject1, markedLabel1, markedObject2,
markedLabel2, depth + 1); |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 #endif // NDEBUG | 1651 #endif // NDEBUG |
| 1652 | 1652 |
| 1653 bool LayoutObject::isSelectable() const | 1653 bool LayoutObject::isSelectable() const |
| 1654 { | 1654 { |
| 1655 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user
Modify() == READ_ONLY); | 1655 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user
Modify() == READ_ONLY); |
| (...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3607 | 3607 |
| 3608 } // namespace blink | 3608 } // namespace blink |
| 3609 | 3609 |
| 3610 #ifndef NDEBUG | 3610 #ifndef NDEBUG |
| 3611 | 3611 |
| 3612 void showTree(const blink::LayoutObject* object) | 3612 void showTree(const blink::LayoutObject* object) |
| 3613 { | 3613 { |
| 3614 if (object) | 3614 if (object) |
| 3615 object->showTreeForThis(); | 3615 object->showTreeForThis(); |
| 3616 else | 3616 else |
| 3617 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); | 3617 WTFLogAlways("%s", "Cannot showTree. Root is (nil)"); |
| 3618 } | 3618 } |
| 3619 | 3619 |
| 3620 void showLineTree(const blink::LayoutObject* object) | 3620 void showLineTree(const blink::LayoutObject* object) |
| 3621 { | 3621 { |
| 3622 if (object) | 3622 if (object) |
| 3623 object->showLineTreeForThis(); | 3623 object->showLineTreeForThis(); |
| 3624 else | 3624 else |
| 3625 fprintf(stderr, "Cannot showLineTree. Root is (nil)\n"); | 3625 WTFLogAlways("%s", "Cannot showLineTree. Root is (nil)"); |
| 3626 } | 3626 } |
| 3627 | 3627 |
| 3628 void showLayoutTree(const blink::LayoutObject* object1) | 3628 void showLayoutTree(const blink::LayoutObject* object1) |
| 3629 { | 3629 { |
| 3630 showLayoutTree(object1, 0); | 3630 showLayoutTree(object1, 0); |
| 3631 } | 3631 } |
| 3632 | 3632 |
| 3633 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2) | 3633 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2) |
| 3634 { | 3634 { |
| 3635 if (object1) { | 3635 if (object1) { |
| 3636 const blink::LayoutObject* root = object1; | 3636 const blink::LayoutObject* root = object1; |
| 3637 while (root->parent()) | 3637 while (root->parent()) |
| 3638 root = root->parent(); | 3638 root = root->parent(); |
| 3639 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3639 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3640 } else { | 3640 } else { |
| 3641 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3641 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3642 } | 3642 } |
| 3643 } | 3643 } |
| 3644 | 3644 |
| 3645 #endif | 3645 #endif |
| OLD | NEW |