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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/layout/LayoutThemeTest.cpp ('k') | Source/core/layout/LayoutView.cpp » ('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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 static void write(TextStream& ts, Layer& layer, 507 static void write(TextStream& ts, Layer& layer,
508 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L ayoutRect& clipRect, const LayoutRect& outlineClipRect, 508 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L ayoutRect& clipRect, const LayoutRect& outlineClipRect,
509 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex tBehavior behavior = LayoutAsTextBehaviorNormal) 509 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex tBehavior behavior = LayoutAsTextBehaviorNormal)
510 { 510 {
511 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); 511 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
512 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds; 512 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds;
513 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ; 513 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect) ;
514 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); 514 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
515 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect); 515 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect);
516 516
517 Settings* settings = layer.renderer()->document().settings(); 517 Settings* settings = layer.layoutObject()->document().settings();
518 bool reportFrameScrollInfo = layer.renderer()->isLayoutView() && settings && !settings->rootLayerScrolls(); 518 bool reportFrameScrollInfo = layer.layoutObject()->isLayoutView() && setting s && !settings->rootLayerScrolls();
519 519
520 if (reportFrameScrollInfo) { 520 if (reportFrameScrollInfo) {
521 LayoutView* layoutView = toLayoutView(layer.renderer()); 521 LayoutView* layoutView = toLayoutView(layer.layoutObject());
522 522
523 adjustedLayoutBoundsWithScrollbars.setWidth(layoutView->viewWidth(Includ eScrollbars)); 523 adjustedLayoutBoundsWithScrollbars.setWidth(layoutView->viewWidth(Includ eScrollbars));
524 adjustedLayoutBoundsWithScrollbars.setHeight(layoutView->viewHeight(Incl udeScrollbars)); 524 adjustedLayoutBoundsWithScrollbars.setHeight(layoutView->viewHeight(Incl udeScrollbars));
525 } 525 }
526 526
527 writeIndent(ts, indent); 527 writeIndent(ts, indent);
528 528
529 if (layer.renderer()->style()->visibility() == HIDDEN) 529 if (layer.layoutObject()->style()->visibility() == HIDDEN)
530 ts << "hidden "; 530 ts << "hidden ";
531 531
532 ts << "layer "; 532 ts << "layer ";
533 533
534 if (behavior & LayoutAsTextShowAddresses) 534 if (behavior & LayoutAsTextShowAddresses)
535 ts << static_cast<const void*>(&layer) << " "; 535 ts << static_cast<const void*>(&layer) << " ";
536 536
537 ts << adjustedLayoutBoundsWithScrollbars; 537 ts << adjustedLayoutBoundsWithScrollbars;
538 538
539 if (!adjustedLayoutBounds.isEmpty()) { 539 if (!adjustedLayoutBounds.isEmpty()) {
540 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) 540 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds))
541 ts << " backgroundClip " << adjustedBackgroundClipRect; 541 ts << " backgroundClip " << adjustedBackgroundClipRect;
542 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars)) 542 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars))
543 ts << " clip " << adjustedClipRect; 543 ts << " clip " << adjustedClipRect;
544 if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds)) 544 if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds))
545 ts << " outlineClip " << adjustedOutlineClipRect; 545 ts << " outlineClip " << adjustedOutlineClipRect;
546 } 546 }
547 if (layer.isTransparent()) 547 if (layer.isTransparent())
548 ts << " transparent"; 548 ts << " transparent";
549 549
550 if (layer.renderer()->hasOverflowClip() || reportFrameScrollInfo) { 550 if (layer.layoutObject()->hasOverflowClip() || reportFrameScrollInfo) {
551 ScrollableArea* scrollableArea; 551 ScrollableArea* scrollableArea;
552 if (reportFrameScrollInfo) 552 if (reportFrameScrollInfo)
553 scrollableArea = toLayoutView(layer.renderer())->frameView(); 553 scrollableArea = toLayoutView(layer.layoutObject())->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.layoutBox() && layer.layoutBox()->pixelSnappedClientWidth() != layer.layoutBox()->pixelSnappedScrollWidth()) 562 if (layer.layoutBox() && layer.layoutBox()->pixelSnappedClientWidth() != layer.layoutBox()->pixelSnappedScrollWidth())
563 ts << " scrollWidth " << layer.layoutBox()->pixelSnappedScrollWidth( ); 563 ts << " scrollWidth " << layer.layoutBox()->pixelSnappedScrollWidth( );
564 if (layer.layoutBox() && layer.layoutBox()->pixelSnappedClientHeight() ! = layer.layoutBox()->pixelSnappedScrollHeight()) 564 if (layer.layoutBox() && layer.layoutBox()->pixelSnappedClientHeight() ! = layer.layoutBox()->pixelSnappedScrollHeight())
565 ts << " scrollHeight " << layer.layoutBox()->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.layoutObject()->style()->hasBlendMode())
574 ts << " blendMode: " << compositeOperatorName(CompositeSourceOver, layer .renderer()->style()->blendMode()); 574 ts << " blendMode: " << compositeOperatorName(CompositeSourceOver, layer .layoutObject()->style()->blendMode());
575 575
576 if (behavior & LayoutAsTextShowCompositedLayers) { 576 if (behavior & LayoutAsTextShowCompositedLayers) {
577 if (layer.hasCompositedLayerMapping()) { 577 if (layer.hasCompositedLayerMapping()) {
578 ts << " (composited, bounds=" 578 ts << " (composited, bounds="
579 << layer.compositedLayerMapping()->compositedBounds() 579 << layer.compositedLayerMapping()->compositedBounds()
580 << ", drawsContent=" 580 << ", drawsContent="
581 << layer.compositedLayerMapping()->mainGraphicsLayer()->drawsCon tent() 581 << layer.compositedLayerMapping()->mainGraphicsLayer()->drawsCon tent()
582 << (layer.shouldIsolateCompositedDescendants() ? ", isolatesComp ositedBlending" : "") 582 << (layer.shouldIsolateCompositedDescendants() ? ", isolatesComp ositedBlending" : "")
583 << ")"; 583 << ")";
584 } 584 }
585 } 585 }
586 586
587 ts << "\n"; 587 ts << "\n";
588 588
589 if (paintPhase != LayerPaintPhaseBackground) 589 if (paintPhase != LayerPaintPhaseBackground)
590 write(ts, *layer.renderer(), indent + 1, behavior); 590 write(ts, *layer.layoutObject(), indent + 1, behavior);
591 } 591 }
592 592
593 void LayoutTreeAsText::writeLayers(TextStream& ts, const Layer* rootLayer, Layer * layer, 593 void LayoutTreeAsText::writeLayers(TextStream& ts, const Layer* rootLayer, Layer * layer,
594 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior) 594 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior)
595 { 595 {
596 // Calculate the clip rects we should use. 596 // Calculate the clip rects we should use.
597 LayoutRect layerBounds; 597 LayoutRect layerBounds;
598 ClipRect damageRect, clipRectToApply, outlineRect; 598 ClipRect damageRect, clipRectToApply, outlineRect;
599 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintRect, layerBounds, damageRect, clipRectToApply, outlineRect); 599 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect s), paintRect, layerBounds, damageRect, clipRectToApply, outlineRect);
600 600
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 return externalRepresentation(toLayoutBox(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->layoutObject();
742 if (!renderer || !renderer->isBox()) 742 if (!renderer || !renderer->isBox())
743 return String(); 743 return String();
744 744
745 return externalRepresentation(toLayoutBox(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()) {
(...skipping 20 matching lines...) Expand all
772 writeCounterValuesFromChildren(stream, after, isFirstCounter); 772 writeCounterValuesFromChildren(stream, after, isFirstCounter);
773 return stream.release(); 773 return stream.release();
774 } 774 }
775 775
776 String markerTextForListItem(Element* element) 776 String markerTextForListItem(Element* element)
777 { 777 {
778 // Make sure the element is not freed during the layout. 778 // Make sure the element is not freed during the layout.
779 RefPtrWillBeRawPtr<Element> protector(element); 779 RefPtrWillBeRawPtr<Element> protector(element);
780 element->document().updateLayout(); 780 element->document().updateLayout();
781 781
782 LayoutObject* renderer = element->renderer(); 782 LayoutObject* renderer = element->layoutObject();
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
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutThemeTest.cpp ('k') | Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698