Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: Source/core/rendering/RenderTreeAsText.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderTableSection.cpp ('k') | Source/core/rendering/RenderView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 28
29 #include "HTMLNames.h" 29 #include "HTMLNames.h"
30 #include "core/css/StylePropertySet.h" 30 #include "core/css/StylePropertySet.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/editing/FrameSelection.h" 32 #include "core/editing/FrameSelection.h"
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"
39 #include "core/rendering/InlineTextBox.h" 38 #include "core/rendering/InlineTextBox.h"
40 #include "core/rendering/RenderBR.h" 39 #include "core/rendering/RenderBR.h"
41 #include "core/rendering/RenderDetailsMarker.h" 40 #include "core/rendering/RenderDetailsMarker.h"
42 #include "core/rendering/RenderFileUploadControl.h" 41 #include "core/rendering/RenderFileUploadControl.h"
43 #include "core/rendering/RenderInline.h" 42 #include "core/rendering/RenderInline.h"
44 #include "core/rendering/RenderLayer.h" 43 #include "core/rendering/RenderLayer.h"
45 #include "core/rendering/RenderListItem.h" 44 #include "core/rendering/RenderListItem.h"
46 #include "core/rendering/RenderListMarker.h" 45 #include "core/rendering/RenderListMarker.h"
47 #include "core/rendering/RenderNamedFlowThread.h"
48 #include "core/rendering/RenderPart.h" 46 #include "core/rendering/RenderPart.h"
49 #include "core/rendering/RenderRegion.h"
50 #include "core/rendering/RenderTableCell.h" 47 #include "core/rendering/RenderTableCell.h"
51 #include "core/rendering/RenderView.h" 48 #include "core/rendering/RenderView.h"
52 #include "core/rendering/RenderWidget.h" 49 #include "core/rendering/RenderWidget.h"
53 #include "core/rendering/svg/RenderSVGContainer.h" 50 #include "core/rendering/svg/RenderSVGContainer.h"
54 #include "core/rendering/svg/RenderSVGGradientStop.h" 51 #include "core/rendering/svg/RenderSVGGradientStop.h"
55 #include "core/rendering/svg/RenderSVGImage.h" 52 #include "core/rendering/svg/RenderSVGImage.h"
56 #include "core/rendering/svg/RenderSVGInlineText.h" 53 #include "core/rendering/svg/RenderSVGInlineText.h"
57 #include "core/rendering/svg/RenderSVGPath.h" 54 #include "core/rendering/svg/RenderSVGPath.h"
58 #include "core/rendering/svg/RenderSVGRoot.h" 55 #include "core/rendering/svg/RenderSVGRoot.h"
59 #include "core/rendering/svg/RenderSVGText.h" 56 #include "core/rendering/svg/RenderSVGText.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 << ")"; 558 << ")";
562 } 559 }
563 } 560 }
564 561
565 ts << "\n"; 562 ts << "\n";
566 563
567 if (paintPhase != LayerPaintPhaseBackground) 564 if (paintPhase != LayerPaintPhaseBackground)
568 write(ts, *l.renderer(), indent + 1, behavior); 565 write(ts, *l.renderer(), indent + 1, behavior);
569 } 566 }
570 567
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, 568 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer,
657 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior) 569 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior)
658 { 570 {
659 // FIXME: Apply overflow to the root layer to not break every test. Complet e hack. Sigh. 571 // FIXME: Apply overflow to the root layer to not break every test. Complet e hack. Sigh.
660 LayoutRect paintDirtyRect(paintRect); 572 LayoutRect paintDirtyRect(paintRect);
661 if (rootLayer == layer) { 573 if (rootLayer == layer) {
662 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye r->renderBox()->layoutOverflowRect().maxX())); 574 paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLaye r->renderBox()->layoutOverflowRect().maxX()));
663 paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLa yer->renderBox()->layoutOverflowRect().maxY())); 575 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)))); 576 layer->setSize(layer->size().expandedTo(pixelSnappedIntSize(layer->rende rBox()->maxLayoutOverflow(), LayoutPoint(0, 0))));
665 } 577 }
666 578
667 // Calculate the clip rects we should use. 579 // Calculate the clip rects we should use.
668 LayoutRect layerBounds; 580 LayoutRect layerBounds;
669 ClipRect damageRect, clipRectToApply, outlineRect; 581 ClipRect damageRect, clipRectToApply, outlineRect;
670 layer->clipper().calculateRects(ClipRectsContext(rootLayer, 0, TemporaryClip Rects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); 582 layer->clipper().calculateRects(ClipRectsContext(rootLayer, TemporaryClipRec ts), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
671 583
672 // Ensure our lists are up-to-date. 584 // Ensure our lists are up-to-date.
673 layer->stackingNode()->updateLayerListsIfNeeded(); 585 layer->stackingNode()->updateLayerListsIfNeeded();
674 586
675 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 587 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer);
676 588
677 Vector<RenderLayerStackingNode*>* negList = layer->stackingNode()->negZOrder List(); 589 Vector<RenderLayerStackingNode*>* negList = layer->stackingNode()->negZOrder List();
678 bool paintsBackgroundSeparately = negList && negList->size() > 0; 590 bool paintsBackgroundSeparately = negList && negList->size() > 0;
679 if (shouldPaint && paintsBackgroundSeparately) 591 if (shouldPaint && paintsBackgroundSeparately)
680 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); 592 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior);
(...skipping 26 matching lines...) Expand all
707 if (Vector<RenderLayerStackingNode*>* posList = layer->stackingNode()->posZO rderList()) { 619 if (Vector<RenderLayerStackingNode*>* posList = layer->stackingNode()->posZO rderList()) {
708 int currIndent = indent; 620 int currIndent = indent;
709 if (behavior & RenderAsTextShowLayerNesting) { 621 if (behavior & RenderAsTextShowLayerNesting) {
710 writeIndent(ts, indent); 622 writeIndent(ts, indent);
711 ts << " positive z-order list(" << posList->size() << ")\n"; 623 ts << " positive z-order list(" << posList->size() << ")\n";
712 ++currIndent; 624 ++currIndent;
713 } 625 }
714 for (unsigned i = 0; i != posList->size(); ++i) 626 for (unsigned i = 0; i != posList->size(); ++i)
715 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect, currIndent, behavior); 627 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintDirtyRect, currIndent, behavior);
716 } 628 }
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 } 629 }
725 630
726 static String nodePosition(Node* node) 631 static String nodePosition(Node* node)
727 { 632 {
728 StringBuilder result; 633 StringBuilder result;
729 634
730 Element* body = node->document().body(); 635 Element* body = node->document().body();
731 Node* parent; 636 Node* parent;
732 for (Node* n = node; n; n = parent) { 637 for (Node* n = node; n; n = parent) {
733 parent = n->parentOrShadowHostNode(); 638 parent = n->parentOrShadowHostNode();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 element->document().updateLayout(); 761 element->document().updateLayout();
857 762
858 RenderObject* renderer = element->renderer(); 763 RenderObject* renderer = element->renderer();
859 if (!renderer || !renderer->isListItem()) 764 if (!renderer || !renderer->isListItem())
860 return String(); 765 return String();
861 766
862 return toRenderListItem(renderer)->markerText(); 767 return toRenderListItem(renderer)->markerText();
863 } 768 }
864 769
865 } // namespace WebCore 770 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTableSection.cpp ('k') | Source/core/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698