| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 if (behavior & RenderAsTextShowLayerNesting) { | 629 if (behavior & RenderAsTextShowLayerNesting) { |
| 630 writeIndent(ts, indent); | 630 writeIndent(ts, indent); |
| 631 ts << " positive z-order list(" << posList->size() << ")\n"; | 631 ts << " positive z-order list(" << posList->size() << ")\n"; |
| 632 ++currIndent; | 632 ++currIndent; |
| 633 } | 633 } |
| 634 for (unsigned i = 0; i != posList->size(); ++i) | 634 for (unsigned i = 0; i != posList->size(); ++i) |
| 635 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect,
currIndent, behavior); | 635 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect,
currIndent, behavior); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 | 638 |
| 639 static String nodePosition(Node* node) | 639 String nodePositionAsStringForTesting(Node* node) |
| 640 { | 640 { |
| 641 StringBuilder result; | 641 StringBuilder result; |
| 642 | 642 |
| 643 Element* body = node->document().body(); | 643 Element* body = node->document().body(); |
| 644 Node* parent; | 644 Node* parent; |
| 645 for (Node* n = node; n; n = parent) { | 645 for (Node* n = node; n; n = parent) { |
| 646 parent = n->parentOrShadowHostNode(); | 646 parent = n->parentOrShadowHostNode(); |
| 647 if (n != node) | 647 if (n != node) |
| 648 result.appendLiteral(" of "); | 648 result.appendLiteral(" of "); |
| 649 if (parent) { | 649 if (parent) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 676 if (!n || !n->isDocumentNode()) | 676 if (!n || !n->isDocumentNode()) |
| 677 return; | 677 return; |
| 678 | 678 |
| 679 Document* doc = toDocument(n); | 679 Document* doc = toDocument(n); |
| 680 LocalFrame* frame = doc->frame(); | 680 LocalFrame* frame = doc->frame(); |
| 681 if (!frame) | 681 if (!frame) |
| 682 return; | 682 return; |
| 683 | 683 |
| 684 VisibleSelection selection = frame->selection().selection(); | 684 VisibleSelection selection = frame->selection().selection(); |
| 685 if (selection.isCaret()) { | 685 if (selection.isCaret()) { |
| 686 ts << "caret: position " << selection.start().deprecatedEditingOffset()
<< " of " << nodePosition(selection.start().deprecatedNode()); | 686 ts << "caret: position " << selection.start().deprecatedEditingOffset()
<< " of " << nodePositionAsStringForTesting(selection.start().deprecatedNode()); |
| 687 if (selection.affinity() == UPSTREAM) | 687 if (selection.affinity() == UPSTREAM) |
| 688 ts << " (upstream affinity)"; | 688 ts << " (upstream affinity)"; |
| 689 ts << "\n"; | 689 ts << "\n"; |
| 690 } else if (selection.isRange()) | 690 } else if (selection.isRange()) { |
| 691 ts << "selection start: position " << selection.start().deprecatedEditin
gOffset() << " of " << nodePosition(selection.start().deprecatedNode()) << "\n" | 691 ts << "selection start: position " << selection.start().deprecatedEditin
gOffset() << " of " << nodePositionAsStringForTesting(selection.start().deprecat
edNode()) << "\n" |
| 692 << "selection end: position " << selection.end().deprecatedEditingO
ffset() << " of " << nodePosition(selection.end().deprecatedNode()) << "\n"; | 692 << "selection end: position " << selection.end().deprecatedEditing
Offset() << " of " << nodePositionAsStringForTesting(selection.end().deprecatedN
ode()) << "\n"; |
| 693 } |
| 693 } | 694 } |
| 694 | 695 |
| 695 static String externalRepresentation(RenderBox* renderer, RenderAsTextBehavior b
ehavior) | 696 static String externalRepresentation(RenderBox* renderer, RenderAsTextBehavior b
ehavior) |
| 696 { | 697 { |
| 697 TextStream ts; | 698 TextStream ts; |
| 698 if (!renderer->hasLayer()) | 699 if (!renderer->hasLayer()) |
| 699 return ts.release(); | 700 return ts.release(); |
| 700 | 701 |
| 701 RenderLayer* layer = renderer->layer(); | 702 RenderLayer* layer = renderer->layer(); |
| 702 RenderTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior); | 703 RenderTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 element->document().updateLayout(); | 770 element->document().updateLayout(); |
| 770 | 771 |
| 771 RenderObject* renderer = element->renderer(); | 772 RenderObject* renderer = element->renderer(); |
| 772 if (!renderer || !renderer->isListItem()) | 773 if (!renderer || !renderer->isListItem()) |
| 773 return String(); | 774 return String(); |
| 774 | 775 |
| 775 return toRenderListItem(renderer)->markerText(); | 776 return toRenderListItem(renderer)->markerText(); |
| 776 } | 777 } |
| 777 | 778 |
| 778 } // namespace WebCore | 779 } // namespace WebCore |
| OLD | NEW |