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

Side by Side Diff: Source/core/layout/LayoutTreeAsText.cpp

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
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 "core/HTMLNames.h" 29 #include "core/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/dom/PseudoElement.h" 32 #include "core/dom/PseudoElement.h"
33 #include "core/editing/FrameSelection.h" 33 #include "core/editing/FrameSelection.h"
34 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
37 #include "core/html/HTMLElement.h" 37 #include "core/html/HTMLElement.h"
38 #include "core/layout/Layer.h"
38 #include "core/layout/LayoutTableCell.h" 39 #include "core/layout/LayoutTableCell.h"
39 #include "core/layout/compositing/CompositedLayerMapping.h" 40 #include "core/layout/compositing/CompositedLayerMapping.h"
40 #include "core/page/PrintContext.h" 41 #include "core/page/PrintContext.h"
41 #include "core/rendering/InlineTextBox.h" 42 #include "core/rendering/InlineTextBox.h"
42 #include "core/rendering/RenderBR.h" 43 #include "core/rendering/RenderBR.h"
43 #include "core/rendering/RenderDetailsMarker.h" 44 #include "core/rendering/RenderDetailsMarker.h"
44 #include "core/rendering/RenderFileUploadControl.h" 45 #include "core/rendering/RenderFileUploadControl.h"
45 #include "core/rendering/RenderInline.h" 46 #include "core/rendering/RenderInline.h"
46 #include "core/rendering/RenderLayer.h"
47 #include "core/rendering/RenderListItem.h" 47 #include "core/rendering/RenderListItem.h"
48 #include "core/rendering/RenderListMarker.h" 48 #include "core/rendering/RenderListMarker.h"
49 #include "core/rendering/RenderPart.h" 49 #include "core/rendering/RenderPart.h"
50 #include "core/rendering/RenderView.h" 50 #include "core/rendering/RenderView.h"
51 #include "core/rendering/svg/RenderSVGContainer.h" 51 #include "core/rendering/svg/RenderSVGContainer.h"
52 #include "core/rendering/svg/RenderSVGGradientStop.h" 52 #include "core/rendering/svg/RenderSVGGradientStop.h"
53 #include "core/rendering/svg/RenderSVGImage.h" 53 #include "core/rendering/svg/RenderSVGImage.h"
54 #include "core/rendering/svg/RenderSVGInlineText.h" 54 #include "core/rendering/svg/RenderSVGInlineText.h"
55 #include "core/rendering/svg/RenderSVGPath.h" 55 #include "core/rendering/svg/RenderSVGPath.h"
56 #include "core/rendering/svg/RenderSVGRoot.h" 56 #include "core/rendering/svg/RenderSVGRoot.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 write(ts, *child, indent + 1, behavior); 484 write(ts, *child, indent + 1, behavior);
485 } 485 }
486 486
487 if (o.isRenderPart()) { 487 if (o.isRenderPart()) {
488 Widget* widget = toRenderPart(o).widget(); 488 Widget* widget = toRenderPart(o).widget();
489 if (widget && widget->isFrameView()) { 489 if (widget && widget->isFrameView()) {
490 FrameView* view = toFrameView(widget); 490 FrameView* view = toFrameView(widget);
491 RenderView* root = view->renderView(); 491 RenderView* root = view->renderView();
492 if (root) { 492 if (root) {
493 view->layout(); 493 view->layout();
494 RenderLayer* layer = root->layer(); 494 Layer* layer = root->layer();
495 if (layer) 495 if (layer)
496 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect( ), indent + 1, behavior); 496 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect( ), indent + 1, behavior);
497 } 497 }
498 } 498 }
499 } 499 }
500 } 500 }
501 501
502 enum LayerPaintPhase { 502 enum LayerPaintPhase {
503 LayerPaintPhaseAll = 0, 503 LayerPaintPhaseAll = 0,
504 LayerPaintPhaseBackground = -1, 504 LayerPaintPhaseBackground = -1,
505 LayerPaintPhaseForeground = 1 505 LayerPaintPhaseForeground = 1
506 }; 506 };
507 507
508 static void write(TextStream& ts, RenderLayer& layer, 508 static void write(TextStream& ts, Layer& layer,
509 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L ayoutRect& clipRect, const LayoutRect& outlineClipRect, 509 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L ayoutRect& clipRect, const LayoutRect& outlineClipRect,
510 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex tBehavior behavior = LayoutAsTextBehaviorNormal) 510 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex tBehavior behavior = LayoutAsTextBehaviorNormal)
511 { 511 {
512 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); 512 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
513 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds; 513 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds;
514 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ; 514 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ;
515 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); 515 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
516 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect); 516 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect);
517 517
518 Settings* settings = layer.renderer()->document().settings(); 518 Settings* settings = layer.renderer()->document().settings();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 << ")"; 584 << ")";
585 } 585 }
586 } 586 }
587 587
588 ts << "\n"; 588 ts << "\n";
589 589
590 if (paintPhase != LayerPaintPhaseBackground) 590 if (paintPhase != LayerPaintPhaseBackground)
591 write(ts, *layer.renderer(), indent + 1, behavior); 591 write(ts, *layer.renderer(), indent + 1, behavior);
592 } 592 }
593 593
594 void LayoutTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer, 594 void LayoutTreeAsText::writeLayers(TextStream& ts, const Layer* rootLayer, Layer * layer,
595 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior) 595 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior)
596 { 596 {
597 // Calculate the clip rects we should use. 597 // Calculate the clip rects we should use.
598 LayoutRect layerBounds; 598 LayoutRect layerBounds;
599 ClipRect damageRect, clipRectToApply, outlineRect; 599 ClipRect damageRect, clipRectToApply, outlineRect;
600 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintRect, layerBounds, damageRect, clipRectToApply, outlineRect); 600 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintRect, layerBounds, damageRect, clipRectToApply, outlineRect);
601 601
602 // Ensure our lists are up-to-date. 602 // Ensure our lists are up-to-date.
603 layer->stackingNode()->updateLayerListsIfNeeded(); 603 layer->stackingNode()->updateLayerListsIfNeeded();
604 604
605 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 605 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) ? true : layer->in tersectsDamageRect(layerBounds, damageRect.rect(), rootLayer);
606 606
607 Vector<RenderLayerStackingNode*>* negList = layer->stackingNode()->negZOrder List(); 607 Vector<LayerStackingNode*>* negList = layer->stackingNode()->negZOrderList() ;
608 bool paintsBackgroundSeparately = negList && negList->size() > 0; 608 bool paintsBackgroundSeparately = negList && negList->size() > 0;
609 if (shouldPaint && paintsBackgroundSeparately) 609 if (shouldPaint && paintsBackgroundSeparately)
610 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); 610 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior);
611 611
612 if (negList) { 612 if (negList) {
613 int currIndent = indent; 613 int currIndent = indent;
614 if (behavior & LayoutAsTextShowLayerNesting) { 614 if (behavior & LayoutAsTextShowLayerNesting) {
615 writeIndent(ts, indent); 615 writeIndent(ts, indent);
616 ts << " negative z-order list(" << negList->size() << ")\n"; 616 ts << " negative z-order list(" << negList->size() << ")\n";
617 ++currIndent; 617 ++currIndent;
618 } 618 }
619 for (unsigned i = 0; i != negList->size(); ++i) 619 for (unsigned i = 0; i != negList->size(); ++i)
620 writeLayers(ts, rootLayer, negList->at(i)->layer(), paintRect, currI ndent, behavior); 620 writeLayers(ts, rootLayer, negList->at(i)->layer(), paintRect, currI ndent, behavior);
621 } 621 }
622 622
623 if (shouldPaint) 623 if (shouldPaint)
624 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : L ayerPaintPhaseAll, indent, behavior); 624 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect() , outlineRect.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : L ayerPaintPhaseAll, indent, behavior);
625 625
626 if (Vector<RenderLayerStackingNode*>* normalFlowList = layer->stackingNode() ->normalFlowList()) { 626 if (Vector<LayerStackingNode*>* normalFlowList = layer->stackingNode()->norm alFlowList()) {
627 int currIndent = indent; 627 int currIndent = indent;
628 if (behavior & LayoutAsTextShowLayerNesting) { 628 if (behavior & LayoutAsTextShowLayerNesting) {
629 writeIndent(ts, indent); 629 writeIndent(ts, indent);
630 ts << " normal flow list(" << normalFlowList->size() << ")\n"; 630 ts << " normal flow list(" << normalFlowList->size() << ")\n";
631 ++currIndent; 631 ++currIndent;
632 } 632 }
633 for (unsigned i = 0; i != normalFlowList->size(); ++i) 633 for (unsigned i = 0; i != normalFlowList->size(); ++i)
634 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintRect , currIndent, behavior); 634 writeLayers(ts, rootLayer, normalFlowList->at(i)->layer(), paintRect , currIndent, behavior);
635 } 635 }
636 636
637 if (Vector<RenderLayerStackingNode*>* posList = layer->stackingNode()->posZO rderList()) { 637 if (Vector<LayerStackingNode*>* posList = layer->stackingNode()->posZOrderLi st()) {
638 int currIndent = indent; 638 int currIndent = indent;
639 if (behavior & LayoutAsTextShowLayerNesting) { 639 if (behavior & LayoutAsTextShowLayerNesting) {
640 writeIndent(ts, indent); 640 writeIndent(ts, indent);
641 ts << " positive z-order list(" << posList->size() << ")\n"; 641 ts << " positive z-order list(" << posList->size() << ")\n";
642 ++currIndent; 642 ++currIndent;
643 } 643 }
644 for (unsigned i = 0; i != posList->size(); ++i) 644 for (unsigned i = 0; i != posList->size(); ++i)
645 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintRect, currI ndent, behavior); 645 writeLayers(ts, rootLayer, posList->at(i)->layer(), paintRect, currI ndent, behavior);
646 } 646 }
647 } 647 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 << "selection end: position " << selection.end().deprecatedEditing Offset() << " of " << nodePositionAsStringForTesting(selection.end().deprecatedN ode()) << "\n"; 703 << "selection end: position " << selection.end().deprecatedEditing Offset() << " of " << nodePositionAsStringForTesting(selection.end().deprecatedN ode()) << "\n";
704 } 704 }
705 } 705 }
706 706
707 static String externalRepresentation(RenderBox* renderer, LayoutAsTextBehavior b ehavior) 707 static String externalRepresentation(RenderBox* renderer, LayoutAsTextBehavior b ehavior)
708 { 708 {
709 TextStream ts; 709 TextStream ts;
710 if (!renderer->hasLayer()) 710 if (!renderer->hasLayer())
711 return ts.release(); 711 return ts.release();
712 712
713 RenderLayer* layer = renderer->layer(); 713 Layer* layer = renderer->layer();
714 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior); 714 LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior);
715 writeSelection(ts, renderer); 715 writeSelection(ts, renderer);
716 return ts.release(); 716 return ts.release();
717 } 717 }
718 718
719 String externalRepresentation(LocalFrame* frame, LayoutAsTextBehavior behavior) 719 String externalRepresentation(LocalFrame* frame, LayoutAsTextBehavior behavior)
720 { 720 {
721 if (!(behavior & LayoutAsTextDontUpdateLayout)) 721 if (!(behavior & LayoutAsTextDontUpdateLayout))
722 frame->document()->updateLayout(); 722 frame->document()->updateLayout();
723 723
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 element->document().updateLayout(); 781 element->document().updateLayout();
782 782
783 RenderObject* renderer = element->renderer(); 783 RenderObject* renderer = element->renderer();
784 if (!renderer || !renderer->isListItem()) 784 if (!renderer || !renderer->isListItem())
785 return String(); 785 return String();
786 786
787 return toRenderListItem(renderer)->markerText(); 787 return toRenderListItem(renderer)->markerText();
788 } 788 }
789 789
790 } // namespace blink 790 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTreeAsText.h ('k') | Source/core/layout/compositing/CompositedLayerMapping.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698