| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/html/HTMLElement.h" | 33 #include "core/html/HTMLElement.h" |
| 34 #include "core/frame/Frame.h" | 34 #include "core/frame/Frame.h" |
| 35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
| 36 #include "core/page/PrintContext.h" | 36 #include "core/page/PrintContext.h" |
| 37 #include "core/rendering/CompositedLayerMapping.h" | 37 #include "core/rendering/CompositedLayerMapping.h" |
| 38 #include "core/rendering/FlowThreadController.h" | 38 #include "core/rendering/FlowThreadController.h" |
| 39 #include "core/rendering/InlineTextBox.h" | 39 #include "core/rendering/InlineTextBox.h" |
| 40 #include "core/rendering/RenderBR.h" | 40 #include "core/rendering/RenderBR.h" |
| 41 #include "core/rendering/RenderDetailsMarker.h" | 41 #include "core/rendering/RenderDetailsMarker.h" |
| 42 #include "core/rendering/RenderFileUploadControl.h" | 42 #include "core/rendering/RenderFileUploadControl.h" |
| 43 #include "core/rendering/RenderFlowThread.h" |
| 43 #include "core/rendering/RenderInline.h" | 44 #include "core/rendering/RenderInline.h" |
| 44 #include "core/rendering/RenderLayer.h" | 45 #include "core/rendering/RenderLayer.h" |
| 45 #include "core/rendering/RenderListItem.h" | 46 #include "core/rendering/RenderListItem.h" |
| 46 #include "core/rendering/RenderListMarker.h" | 47 #include "core/rendering/RenderListMarker.h" |
| 47 #include "core/rendering/RenderNamedFlowThread.h" | |
| 48 #include "core/rendering/RenderPart.h" | 48 #include "core/rendering/RenderPart.h" |
| 49 #include "core/rendering/RenderRegion.h" | |
| 50 #include "core/rendering/RenderTableCell.h" | 49 #include "core/rendering/RenderTableCell.h" |
| 51 #include "core/rendering/RenderView.h" | 50 #include "core/rendering/RenderView.h" |
| 52 #include "core/rendering/RenderWidget.h" | 51 #include "core/rendering/RenderWidget.h" |
| 53 #include "core/rendering/svg/RenderSVGContainer.h" | 52 #include "core/rendering/svg/RenderSVGContainer.h" |
| 54 #include "core/rendering/svg/RenderSVGGradientStop.h" | 53 #include "core/rendering/svg/RenderSVGGradientStop.h" |
| 55 #include "core/rendering/svg/RenderSVGImage.h" | 54 #include "core/rendering/svg/RenderSVGImage.h" |
| 56 #include "core/rendering/svg/RenderSVGInlineText.h" | 55 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 57 #include "core/rendering/svg/RenderSVGPath.h" | 56 #include "core/rendering/svg/RenderSVGPath.h" |
| 58 #include "core/rendering/svg/RenderSVGRoot.h" | 57 #include "core/rendering/svg/RenderSVGRoot.h" |
| 59 #include "core/rendering/svg/RenderSVGText.h" | 58 #include "core/rendering/svg/RenderSVGText.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 << ")"; | 560 << ")"; |
| 562 } | 561 } |
| 563 } | 562 } |
| 564 | 563 |
| 565 ts << "\n"; | 564 ts << "\n"; |
| 566 | 565 |
| 567 if (paintPhase != LayerPaintPhaseBackground) | 566 if (paintPhase != LayerPaintPhaseBackground) |
| 568 write(ts, *l.renderer(), indent + 1, behavior); | 567 write(ts, *l.renderer(), indent + 1, behavior); |
| 569 } | 568 } |
| 570 | 569 |
| 571 static void writeRenderRegionList(const RenderRegionList& flowThreadRegionList,
TextStream& ts, int indent) | |
| 572 { | |
| 573 for (RenderRegionList::const_iterator itRR = flowThreadRegionList.begin(); i
tRR != flowThreadRegionList.end(); ++itRR) { | |
| 574 const RenderRegion* renderRegion = *itRR; | |
| 575 | |
| 576 writeIndent(ts, indent); | |
| 577 ts << renderRegion->renderName(); | |
| 578 | |
| 579 Node* generatingNodeForRegion = renderRegion->generatingNodeForRegion(); | |
| 580 if (generatingNodeForRegion) { | |
| 581 if (renderRegion->hasCustomRegionStyle()) | |
| 582 ts << " region style: 1"; | |
| 583 if (renderRegion->hasAutoLogicalHeight()) | |
| 584 ts << " hasAutoLogicalHeight"; | |
| 585 | |
| 586 bool isRenderNamedFlowFragment = renderRegion->isRenderNamedFlowFrag
ment(); | |
| 587 if (isRenderNamedFlowFragment) | |
| 588 ts << " (anonymous child of"; | |
| 589 | |
| 590 StringBuilder tagName; | |
| 591 tagName.append(generatingNodeForRegion->nodeName()); | |
| 592 | |
| 593 Node* nodeForRegion = renderRegion->nodeForRegion(); | |
| 594 if (nodeForRegion->isPseudoElement()) { | |
| 595 if (nodeForRegion->isBeforePseudoElement()) | |
| 596 tagName.append("::before"); | |
| 597 else if (nodeForRegion->isAfterPseudoElement()) | |
| 598 tagName.append("::after"); | |
| 599 } | |
| 600 | |
| 601 ts << " {" << tagName.toString() << "}"; | |
| 602 | |
| 603 if (generatingNodeForRegion->isElementNode() && generatingNodeForReg
ion->hasID()) { | |
| 604 Element* element = toElement(generatingNodeForRegion); | |
| 605 ts << " #" << element->idForStyleResolution(); | |
| 606 } | |
| 607 | |
| 608 if (isRenderNamedFlowFragment) | |
| 609 ts << ")"; | |
| 610 } | |
| 611 | |
| 612 if (!renderRegion->isValid()) | |
| 613 ts << " invalid"; | |
| 614 | |
| 615 ts << "\n"; | |
| 616 } | |
| 617 } | |
| 618 | |
| 619 static void writeRenderNamedFlowThreads(TextStream& ts, RenderView* renderView,
const RenderLayer* rootLayer, | |
| 620 const LayoutRect& paintRect, int indent, RenderAsTextBeh
avior behavior) | |
| 621 { | |
| 622 if (!renderView->hasRenderNamedFlowThreads()) | |
| 623 return; | |
| 624 | |
| 625 const RenderNamedFlowThreadList* list = renderView->flowThreadController()->
renderNamedFlowThreadList(); | |
| 626 | |
| 627 writeIndent(ts, indent); | |
| 628 ts << "Named flows\n"; | |
| 629 | |
| 630 for (RenderNamedFlowThreadList::const_iterator iter = list->begin(); iter !=
list->end(); ++iter) { | |
| 631 const RenderNamedFlowThread* renderFlowThread = *iter; | |
| 632 | |
| 633 writeIndent(ts, indent + 1); | |
| 634 ts << "Named flow '" << renderFlowThread->flowThreadName() << "'\n"; | |
| 635 | |
| 636 RenderLayer* layer = renderFlowThread->layer(); | |
| 637 RenderTreeAsText::writeLayers(ts, rootLayer, layer, paintRect, indent +
2, behavior); | |
| 638 | |
| 639 // Display the valid and invalid render regions attached to this flow th
read. | |
| 640 const RenderRegionList& validRegionsList = renderFlowThread->renderRegio
nList(); | |
| 641 if (!validRegionsList.isEmpty()) { | |
| 642 writeIndent(ts, indent + 2); | |
| 643 ts << "Regions for named flow '" << renderFlowThread->flowThreadName
() << "'\n"; | |
| 644 writeRenderRegionList(validRegionsList, ts, indent + 3); | |
| 645 } | |
| 646 | |
| 647 const RenderRegionList& invalidRegionsList = renderFlowThread->invalidRe
nderRegionList(); | |
| 648 if (!invalidRegionsList.isEmpty()) { | |
| 649 writeIndent(ts, indent + 2); | |
| 650 ts << "Invalid regions for named flow '" << renderFlowThread->flowTh
readName() << "'\n"; | |
| 651 writeRenderRegionList(invalidRegionsList, ts, indent + 3); | |
| 652 } | |
| 653 } | |
| 654 } | |
| 655 | |
| 656 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer,
RenderLayer* layer, | 570 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer,
RenderLayer* layer, |
| 657 const LayoutRect& paintRect, int indent, RenderAsTextBeh
avior behavior) | 571 const LayoutRect& paintRect, int indent, RenderAsTextBeh
avior behavior) |
| 658 { | 572 { |
| 659 // FIXME: Apply overflow to the root layer to not break every test. Complet
e hack. Sigh. | 573 // FIXME: Apply overflow to the root layer to not break every test. Complet
e hack. Sigh. |
| 660 LayoutRect paintDirtyRect(paintRect); | 574 LayoutRect paintDirtyRect(paintRect); |
| 661 if (rootLayer == layer) { | 575 if (rootLayer == layer) { |
| 662 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye
r->renderBox()->layoutOverflowRect().maxX())); | 576 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye
r->renderBox()->layoutOverflowRect().maxX())); |
| 663 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa
yer->renderBox()->layoutOverflowRect().maxY())); | 577 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa
yer->renderBox()->layoutOverflowRect().maxY())); |
| 664 layer->setSize(layer->size().expandedTo(pixelSnappedIntSize(layer->rende
rBox()->maxLayoutOverflow(), LayoutPoint(0, 0)))); | 578 layer->setSize(layer->size().expandedTo(pixelSnappedIntSize(layer->rende
rBox()->maxLayoutOverflow(), LayoutPoint(0, 0)))); |
| 665 } | 579 } |
| 666 | 580 |
| 667 // Calculate the clip rects we should use. | 581 // Calculate the clip rects we should use. |
| 668 LayoutRect layerBounds; | 582 LayoutRect layerBounds; |
| 669 ClipRect damageRect, clipRectToApply, outlineRect; | 583 ClipRect damageRect, clipRectToApply, outlineRect; |
| 670 layer->clipper().calculateRects(ClipRectsContext(rootLayer, 0, TemporaryClip
Rects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); | 584 layer->clipper().calculateRects(ClipRectsContext(rootLayer, TemporaryClipRec
ts), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); |
| 671 | 585 |
| 672 // Ensure our lists are up-to-date. | 586 // Ensure our lists are up-to-date. |
| 673 layer->stackingNode()->updateLayerListsIfNeeded(); | 587 layer->stackingNode()->updateLayerListsIfNeeded(); |
| 674 | 588 |
| 675 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); | 589 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); |
| 676 | 590 |
| 677 Vector<RenderLayerStackingNode*>* negList = layer->stackingNode()->negZOrder
List(); | 591 Vector<RenderLayerStackingNode*>* negList = layer->stackingNode()->negZOrder
List(); |
| 678 bool paintsBackgroundSeparately = negList && negList->size() > 0; | 592 bool paintsBackgroundSeparately = negList && negList->size() > 0; |
| 679 if (shouldPaint && paintsBackgroundSeparately) | 593 if (shouldPaint && paintsBackgroundSeparately) |
| 680 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); | 594 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 707 if (Vector<RenderLayerStackingNode*>* posList = layer->stackingNode()->posZO
rderList()) { | 621 if (Vector<RenderLayerStackingNode*>* posList = layer->stackingNode()->posZO
rderList()) { |
| 708 int currIndent = indent; | 622 int currIndent = indent; |
| 709 if (behavior & RenderAsTextShowLayerNesting) { | 623 if (behavior & RenderAsTextShowLayerNesting) { |
| 710 writeIndent(ts, indent); | 624 writeIndent(ts, indent); |
| 711 ts << " positive z-order list(" << posList->size() << ")\n"; | 625 ts << " positive z-order list(" << posList->size() << ")\n"; |
| 712 ++currIndent; | 626 ++currIndent; |
| 713 } | 627 } |
| 714 for (unsigned i = 0; i != posList->size(); ++i) | 628 for (unsigned i = 0; i != posList->size(); ++i) |
| 715 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect,
currIndent, behavior); | 629 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect,
currIndent, behavior); |
| 716 } | 630 } |
| 717 | |
| 718 // Altough the RenderFlowThread requires a layer, it is not collected by its
parent, | |
| 719 // so we have to treat it as a special case. | |
| 720 if (layer->renderer()->isRenderView()) { | |
| 721 RenderView* renderView = toRenderView(layer->renderer()); | |
| 722 writeRenderNamedFlowThreads(ts, renderView, rootLayer, paintDirtyRect, i
ndent, behavior); | |
| 723 } | |
| 724 } | 631 } |
| 725 | 632 |
| 726 static String nodePosition(Node* node) | 633 static String nodePosition(Node* node) |
| 727 { | 634 { |
| 728 StringBuilder result; | 635 StringBuilder result; |
| 729 | 636 |
| 730 Element* body = node->document().body(); | 637 Element* body = node->document().body(); |
| 731 Node* parent; | 638 Node* parent; |
| 732 for (Node* n = node; n; n = parent) { | 639 for (Node* n = node; n; n = parent) { |
| 733 parent = n->parentOrShadowHostNode(); | 640 parent = n->parentOrShadowHostNode(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 element->document().updateLayout(); | 763 element->document().updateLayout(); |
| 857 | 764 |
| 858 RenderObject* renderer = element->renderer(); | 765 RenderObject* renderer = element->renderer(); |
| 859 if (!renderer || !renderer->isListItem()) | 766 if (!renderer || !renderer->isListItem()) |
| 860 return String(); | 767 return String(); |
| 861 | 768 |
| 862 return toRenderListItem(renderer)->markerText(); | 769 return toRenderListItem(renderer)->markerText(); |
| 863 } | 770 } |
| 864 | 771 |
| 865 } // namespace WebCore | 772 } // namespace WebCore |
| OLD | NEW |