| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 const RenderInline& inlineFlow = toRenderInline(o); | 199 const RenderInline& inlineFlow = toRenderInline(o); |
| 200 r = IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inlineFlow.line
sBoundingBox().height()); | 200 r = IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inlineFlow.line
sBoundingBox().height()); |
| 201 adjustForTableCells = false; | 201 adjustForTableCells = false; |
| 202 } else if (o.isTableCell()) { | 202 } else if (o.isTableCell()) { |
| 203 // FIXME: Deliberately dump the "inner" box of table cells, since that i
s what current results reflect. We'd like | 203 // FIXME: Deliberately dump the "inner" box of table cells, since that i
s what current results reflect. We'd like |
| 204 // to clean up the results to dump both the outer box and the intrinsic
padding so that both bits of information are | 204 // to clean up the results to dump both the outer box and the intrinsic
padding so that both bits of information are |
| 205 // captured by the results. | 205 // captured by the results. |
| 206 const LayoutTableCell& cell = toLayoutTableCell(o); | 206 const LayoutTableCell& cell = toLayoutTableCell(o); |
| 207 r = LayoutRect(cell.location().x(), cell.location().y() + cell.intrinsic
PaddingBefore(), cell.size().width(), cell.size().height() - cell.intrinsicPaddi
ngBefore() - cell.intrinsicPaddingAfter()); | 207 r = LayoutRect(cell.location().x(), cell.location().y() + cell.intrinsic
PaddingBefore(), cell.size().width(), cell.size().height() - cell.intrinsicPaddi
ngBefore() - cell.intrinsicPaddingAfter()); |
| 208 } else if (o.isBox()) { | 208 } else if (o.isBox()) { |
| 209 r = toRenderBox(&o)->frameRect(); | 209 r = toLayoutBox(&o)->frameRect(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 // FIXME: Temporary in order to ensure compatibility with existing layout te
st results. | 212 // FIXME: Temporary in order to ensure compatibility with existing layout te
st results. |
| 213 if (adjustForTableCells) | 213 if (adjustForTableCells) |
| 214 r.move(0, -toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefor
e()); | 214 r.move(0, -toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefor
e()); |
| 215 | 215 |
| 216 if (o.isRenderView()) { | 216 if (o.isRenderView()) { |
| 217 r.setWidth(toRenderView(o).viewWidth(IncludeScrollbars)); | 217 r.setWidth(toRenderView(o).viewWidth(IncludeScrollbars)); |
| 218 r.setHeight(toRenderView(o).viewHeight(IncludeScrollbars)); | 218 r.setHeight(toRenderView(o).viewHeight(IncludeScrollbars)); |
| 219 } | 219 } |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (reportFrameScrollInfo) | 552 if (reportFrameScrollInfo) |
| 553 scrollableArea = toRenderView(layer.renderer())->frameView(); | 553 scrollableArea = toRenderView(layer.renderer())->frameView(); |
| 554 else | 554 else |
| 555 scrollableArea = layer.scrollableArea(); | 555 scrollableArea = layer.scrollableArea(); |
| 556 | 556 |
| 557 DoublePoint adjustedScrollOffset = scrollableArea->scrollPositionDouble(
) + toDoubleSize(scrollableArea->scrollOrigin()); | 557 DoublePoint adjustedScrollOffset = scrollableArea->scrollPositionDouble(
) + toDoubleSize(scrollableArea->scrollOrigin()); |
| 558 if (adjustedScrollOffset.x()) | 558 if (adjustedScrollOffset.x()) |
| 559 ts << " scrollX " << adjustedScrollOffset.x(); | 559 ts << " scrollX " << adjustedScrollOffset.x(); |
| 560 if (adjustedScrollOffset.y()) | 560 if (adjustedScrollOffset.y()) |
| 561 ts << " scrollY " << adjustedScrollOffset.y(); | 561 ts << " scrollY " << adjustedScrollOffset.y(); |
| 562 if (layer.renderBox() && layer.renderBox()->pixelSnappedClientWidth() !=
layer.renderBox()->pixelSnappedScrollWidth()) | 562 if (layer.layoutBox() && layer.layoutBox()->pixelSnappedClientWidth() !=
layer.layoutBox()->pixelSnappedScrollWidth()) |
| 563 ts << " scrollWidth " << layer.renderBox()->pixelSnappedScrollWidth(
); | 563 ts << " scrollWidth " << layer.layoutBox()->pixelSnappedScrollWidth(
); |
| 564 if (layer.renderBox() && layer.renderBox()->pixelSnappedClientHeight() !
= layer.renderBox()->pixelSnappedScrollHeight()) | 564 if (layer.layoutBox() && layer.layoutBox()->pixelSnappedClientHeight() !
= layer.layoutBox()->pixelSnappedScrollHeight()) |
| 565 ts << " scrollHeight " << layer.renderBox()->pixelSnappedScrollHeigh
t(); | 565 ts << " scrollHeight " << layer.layoutBox()->pixelSnappedScrollHeigh
t(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 if (paintPhase == LayerPaintPhaseBackground) | 568 if (paintPhase == LayerPaintPhaseBackground) |
| 569 ts << " layerType: background only"; | 569 ts << " layerType: background only"; |
| 570 else if (paintPhase == LayerPaintPhaseForeground) | 570 else if (paintPhase == LayerPaintPhaseForeground) |
| 571 ts << " layerType: foreground only"; | 571 ts << " layerType: foreground only"; |
| 572 | 572 |
| 573 if (layer.renderer()->style()->hasBlendMode()) | 573 if (layer.renderer()->style()->hasBlendMode()) |
| 574 ts << " blendMode: " << compositeOperatorName(CompositeSourceOver, layer
.renderer()->style()->blendMode()); | 574 ts << " blendMode: " << compositeOperatorName(CompositeSourceOver, layer
.renderer()->style()->blendMode()); |
| 575 | 575 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 ts << "caret: position " << selection.start().deprecatedEditingOffset()
<< " of " << nodePositionAsStringForTesting(selection.start().deprecatedNode()); | 696 ts << "caret: position " << selection.start().deprecatedEditingOffset()
<< " of " << nodePositionAsStringForTesting(selection.start().deprecatedNode()); |
| 697 if (selection.affinity() == UPSTREAM) | 697 if (selection.affinity() == UPSTREAM) |
| 698 ts << " (upstream affinity)"; | 698 ts << " (upstream affinity)"; |
| 699 ts << "\n"; | 699 ts << "\n"; |
| 700 } else if (selection.isRange()) { | 700 } else if (selection.isRange()) { |
| 701 ts << "selection start: position " << selection.start().deprecatedEditin
gOffset() << " of " << nodePositionAsStringForTesting(selection.start().deprecat
edNode()) << "\n" | 701 ts << "selection start: position " << selection.start().deprecatedEditin
gOffset() << " of " << nodePositionAsStringForTesting(selection.start().deprecat
edNode()) << "\n" |
| 702 << "selection end: position " << selection.end().deprecatedEditing
Offset() << " of " << nodePositionAsStringForTesting(selection.end().deprecatedN
ode()) << "\n"; | 702 << "selection end: position " << selection.end().deprecatedEditing
Offset() << " of " << nodePositionAsStringForTesting(selection.end().deprecatedN
ode()) << "\n"; |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 | 705 |
| 706 static String externalRepresentation(RenderBox* renderer, LayoutAsTextBehavior b
ehavior) | 706 static String externalRepresentation(LayoutBox* renderer, LayoutAsTextBehavior b
ehavior) |
| 707 { | 707 { |
| 708 TextStream ts; | 708 TextStream ts; |
| 709 if (!renderer->hasLayer()) | 709 if (!renderer->hasLayer()) |
| 710 return ts.release(); | 710 return ts.release(); |
| 711 | 711 |
| 712 Layer* layer = renderer->layer(); | 712 Layer* layer = renderer->layer(); |
| 713 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior); | 713 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior); |
| 714 writeSelection(ts, renderer); | 714 writeSelection(ts, renderer); |
| 715 return ts.release(); | 715 return ts.release(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 String externalRepresentation(LocalFrame* frame, LayoutAsTextBehavior behavior) | 718 String externalRepresentation(LocalFrame* frame, LayoutAsTextBehavior behavior) |
| 719 { | 719 { |
| 720 if (!(behavior & LayoutAsTextDontUpdateLayout)) | 720 if (!(behavior & LayoutAsTextDontUpdateLayout)) |
| 721 frame->document()->updateLayout(); | 721 frame->document()->updateLayout(); |
| 722 | 722 |
| 723 LayoutObject* renderer = frame->contentRenderer(); | 723 LayoutObject* renderer = frame->contentRenderer(); |
| 724 if (!renderer || !renderer->isBox()) | 724 if (!renderer || !renderer->isBox()) |
| 725 return String(); | 725 return String(); |
| 726 | 726 |
| 727 PrintContext printContext(frame); | 727 PrintContext printContext(frame); |
| 728 if (behavior & LayoutAsTextPrintingMode) | 728 if (behavior & LayoutAsTextPrintingMode) |
| 729 printContext.begin(toRenderBox(renderer)->size().width().toFloat()); | 729 printContext.begin(toLayoutBox(renderer)->size().width().toFloat()); |
| 730 | 730 |
| 731 return externalRepresentation(toRenderBox(renderer), behavior); | 731 return externalRepresentation(toLayoutBox(renderer), behavior); |
| 732 } | 732 } |
| 733 | 733 |
| 734 String externalRepresentation(Element* element, LayoutAsTextBehavior behavior) | 734 String externalRepresentation(Element* element, LayoutAsTextBehavior behavior) |
| 735 { | 735 { |
| 736 // Doesn't support printing mode. | 736 // Doesn't support printing mode. |
| 737 ASSERT(!(behavior & LayoutAsTextPrintingMode)); | 737 ASSERT(!(behavior & LayoutAsTextPrintingMode)); |
| 738 if (!(behavior & LayoutAsTextDontUpdateLayout)) | 738 if (!(behavior & LayoutAsTextDontUpdateLayout)) |
| 739 element->document().updateLayout(); | 739 element->document().updateLayout(); |
| 740 | 740 |
| 741 LayoutObject* renderer = element->renderer(); | 741 LayoutObject* renderer = element->renderer(); |
| 742 if (!renderer || !renderer->isBox()) | 742 if (!renderer || !renderer->isBox()) |
| 743 return String(); | 743 return String(); |
| 744 | 744 |
| 745 return externalRepresentation(toRenderBox(renderer), behavior | LayoutAsText
ShowAllLayers); | 745 return externalRepresentation(toLayoutBox(renderer), behavior | LayoutAsText
ShowAllLayers); |
| 746 } | 746 } |
| 747 | 747 |
| 748 static void writeCounterValuesFromChildren(TextStream& stream, LayoutObject* par
ent, bool& isFirstCounter) | 748 static void writeCounterValuesFromChildren(TextStream& stream, LayoutObject* par
ent, bool& isFirstCounter) |
| 749 { | 749 { |
| 750 for (LayoutObject* child = parent->slowFirstChild(); child; child = child->n
extSibling()) { | 750 for (LayoutObject* child = parent->slowFirstChild(); child; child = child->n
extSibling()) { |
| 751 if (child->isCounter()) { | 751 if (child->isCounter()) { |
| 752 if (!isFirstCounter) | 752 if (!isFirstCounter) |
| 753 stream << " "; | 753 stream << " "; |
| 754 isFirstCounter = false; | 754 isFirstCounter = false; |
| 755 String str(toRenderText(child)->text()); | 755 String str(toRenderText(child)->text()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 780 element->document().updateLayout(); | 780 element->document().updateLayout(); |
| 781 | 781 |
| 782 LayoutObject* renderer = element->renderer(); | 782 LayoutObject* renderer = element->renderer(); |
| 783 if (!renderer || !renderer->isListItem()) | 783 if (!renderer || !renderer->isListItem()) |
| 784 return String(); | 784 return String(); |
| 785 | 785 |
| 786 return toLayoutListItem(renderer)->markerText(); | 786 return toLayoutListItem(renderer)->markerText(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 } // namespace blink | 789 } // namespace blink |
| OLD | NEW |