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

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

Issue 2692853016: Change PaintLayer::m_layoutObject to a reference. (Closed)
Patch Set: restore inadvertantly removed null check Created 3 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
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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 LayerPaintPhase paintPhase = LayerPaintPhaseAll, 555 LayerPaintPhase paintPhase = LayerPaintPhaseAll,
556 int indent = 0, 556 int indent = 0,
557 LayoutAsTextBehavior behavior = LayoutAsTextBehaviorNormal, 557 LayoutAsTextBehavior behavior = LayoutAsTextBehaviorNormal,
558 const PaintLayer* markedLayer = nullptr) { 558 const PaintLayer* markedLayer = nullptr) {
559 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); 559 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
560 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds; 560 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds;
561 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect); 561 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect);
562 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); 562 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
563 563
564 bool reportFrameScrollInfo = 564 bool reportFrameScrollInfo =
565 layer.layoutObject()->isLayoutView() && 565 layer.layoutObject().isLayoutView() &&
566 !RuntimeEnabledFeatures::rootLayerScrollingEnabled(); 566 !RuntimeEnabledFeatures::rootLayerScrollingEnabled();
567 567
568 if (reportFrameScrollInfo) { 568 if (reportFrameScrollInfo) {
569 LayoutView* layoutView = toLayoutView(layer.layoutObject()); 569 LayoutView& layoutView = toLayoutView(layer.layoutObject());
570 570
571 adjustedLayoutBoundsWithScrollbars.setWidth( 571 adjustedLayoutBoundsWithScrollbars.setWidth(
572 layoutView->viewWidth(IncludeScrollbars)); 572 layoutView.viewWidth(IncludeScrollbars));
573 adjustedLayoutBoundsWithScrollbars.setHeight( 573 adjustedLayoutBoundsWithScrollbars.setHeight(
574 layoutView->viewHeight(IncludeScrollbars)); 574 layoutView.viewHeight(IncludeScrollbars));
575 } 575 }
576 576
577 if (markedLayer) 577 if (markedLayer)
578 ts << (markedLayer == &layer ? "*" : " "); 578 ts << (markedLayer == &layer ? "*" : " ");
579 579
580 writeIndent(ts, indent); 580 writeIndent(ts, indent);
581 581
582 if (layer.layoutObject()->style()->visibility() == EVisibility::kHidden) 582 if (layer.layoutObject().style()->visibility() == EVisibility::kHidden)
583 ts << "hidden "; 583 ts << "hidden ";
584 584
585 ts << "layer "; 585 ts << "layer ";
586 586
587 if (behavior & LayoutAsTextShowAddresses) 587 if (behavior & LayoutAsTextShowAddresses)
588 ts << static_cast<const void*>(&layer) << " "; 588 ts << static_cast<const void*>(&layer) << " ";
589 589
590 ts << adjustedLayoutBoundsWithScrollbars; 590 ts << adjustedLayoutBoundsWithScrollbars;
591 591
592 if (!adjustedLayoutBounds.isEmpty()) { 592 if (!adjustedLayoutBounds.isEmpty()) {
593 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) 593 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds))
594 ts << " backgroundClip " << adjustedBackgroundClipRect; 594 ts << " backgroundClip " << adjustedBackgroundClipRect;
595 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars)) 595 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars))
596 ts << " clip " << adjustedClipRect; 596 ts << " clip " << adjustedClipRect;
597 } 597 }
598 if (layer.isTransparent()) 598 if (layer.isTransparent())
599 ts << " transparent"; 599 ts << " transparent";
600 600
601 if (layer.layoutObject()->hasOverflowClip() || reportFrameScrollInfo) { 601 if (layer.layoutObject().hasOverflowClip() || reportFrameScrollInfo) {
602 ScrollableArea* scrollableArea; 602 ScrollableArea* scrollableArea;
603 if (reportFrameScrollInfo) 603 if (reportFrameScrollInfo)
604 scrollableArea = toLayoutView(layer.layoutObject())->frameView(); 604 scrollableArea = toLayoutView(layer.layoutObject()).frameView();
605 else 605 else
606 scrollableArea = layer.getScrollableArea(); 606 scrollableArea = layer.getScrollableArea();
607 607
608 ScrollOffset adjustedScrollOffset = 608 ScrollOffset adjustedScrollOffset =
609 scrollableArea->getScrollOffset() + 609 scrollableArea->getScrollOffset() +
610 toFloatSize(scrollableArea->scrollOrigin()); 610 toFloatSize(scrollableArea->scrollOrigin());
611 if (adjustedScrollOffset.width()) 611 if (adjustedScrollOffset.width())
612 ts << " scrollX " << adjustedScrollOffset.width(); 612 ts << " scrollX " << adjustedScrollOffset.width();
613 if (adjustedScrollOffset.height()) 613 if (adjustedScrollOffset.height())
614 ts << " scrollY " << adjustedScrollOffset.height(); 614 ts << " scrollY " << adjustedScrollOffset.height();
615 if (layer.layoutBox() && 615 if (layer.layoutBox() &&
616 layer.layoutBox()->pixelSnappedClientWidth() != 616 layer.layoutBox()->pixelSnappedClientWidth() !=
617 layer.layoutBox()->pixelSnappedScrollWidth()) 617 layer.layoutBox()->pixelSnappedScrollWidth())
618 ts << " scrollWidth " << layer.layoutBox()->pixelSnappedScrollWidth(); 618 ts << " scrollWidth " << layer.layoutBox()->pixelSnappedScrollWidth();
619 if (layer.layoutBox() && 619 if (layer.layoutBox() &&
620 layer.layoutBox()->pixelSnappedClientHeight() != 620 layer.layoutBox()->pixelSnappedClientHeight() !=
621 layer.layoutBox()->pixelSnappedScrollHeight()) 621 layer.layoutBox()->pixelSnappedScrollHeight())
622 ts << " scrollHeight " << layer.layoutBox()->pixelSnappedScrollHeight(); 622 ts << " scrollHeight " << layer.layoutBox()->pixelSnappedScrollHeight();
623 } 623 }
624 624
625 if (paintPhase == LayerPaintPhaseBackground) 625 if (paintPhase == LayerPaintPhaseBackground)
626 ts << " layerType: background only"; 626 ts << " layerType: background only";
627 else if (paintPhase == LayerPaintPhaseForeground) 627 else if (paintPhase == LayerPaintPhaseForeground)
628 ts << " layerType: foreground only"; 628 ts << " layerType: foreground only";
629 629
630 if (layer.layoutObject()->style()->hasBlendMode()) 630 if (layer.layoutObject().style()->hasBlendMode()) {
631 ts << " blendMode: " 631 ts << " blendMode: "
632 << compositeOperatorName(CompositeSourceOver, 632 << compositeOperatorName(CompositeSourceOver,
633 layer.layoutObject()->style()->blendMode()); 633 layer.layoutObject().style()->blendMode());
634 }
634 635
635 if (behavior & LayoutAsTextShowCompositedLayers) { 636 if (behavior & LayoutAsTextShowCompositedLayers) {
636 if (layer.hasCompositedLayerMapping()) { 637 if (layer.hasCompositedLayerMapping()) {
637 ts << " (composited, bounds=" 638 ts << " (composited, bounds="
638 << layer.compositedLayerMapping()->compositedBounds() 639 << layer.compositedLayerMapping()->compositedBounds()
639 << ", drawsContent=" 640 << ", drawsContent="
640 << layer.compositedLayerMapping()->mainGraphicsLayer()->drawsContent() 641 << layer.compositedLayerMapping()->mainGraphicsLayer()->drawsContent()
641 << (layer.shouldIsolateCompositedDescendants() 642 << (layer.shouldIsolateCompositedDescendants()
642 ? ", isolatesCompositedBlending" 643 ? ", isolatesCompositedBlending"
643 : "") 644 : "")
644 << ")"; 645 << ")";
645 } 646 }
646 } 647 }
647 648
648 ts << "\n"; 649 ts << "\n";
649 650
650 if (paintPhase != LayerPaintPhaseBackground) 651 if (paintPhase != LayerPaintPhaseBackground)
651 write(ts, *layer.layoutObject(), indent + 1, behavior); 652 write(ts, layer.layoutObject(), indent + 1, behavior);
652 } 653 }
653 654
654 static Vector<PaintLayerStackingNode*> normalFlowListFor( 655 static Vector<PaintLayerStackingNode*> normalFlowListFor(
655 PaintLayerStackingNode* node) { 656 PaintLayerStackingNode* node) {
656 PaintLayerStackingNodeIterator it(*node, NormalFlowChildren); 657 PaintLayerStackingNodeIterator it(*node, NormalFlowChildren);
657 Vector<PaintLayerStackingNode*> vector; 658 Vector<PaintLayerStackingNode*> vector;
658 while (PaintLayerStackingNode* normalFlowChild = it.next()) 659 while (PaintLayerStackingNode* normalFlowChild = it.next())
659 vector.push_back(normalFlowChild); 660 vector.push_back(normalFlowChild);
660 return vector; 661 return vector;
661 } 662 }
(...skipping 15 matching lines...) Expand all
677 // Ensure our lists are up to date. 678 // Ensure our lists are up to date.
678 layer->stackingNode()->updateLayerListsIfNeeded(); 679 layer->stackingNode()->updateLayerListsIfNeeded();
679 680
680 LayoutPoint offsetFromRoot; 681 LayoutPoint offsetFromRoot;
681 layer->convertToLayerCoords(rootLayer, offsetFromRoot); 682 layer->convertToLayerCoords(rootLayer, offsetFromRoot);
682 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) 683 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers)
683 ? true 684 ? true
684 : layer->intersectsDamageRect( 685 : layer->intersectsDamageRect(
685 layerBounds, damageRect.rect(), offsetFromRoot); 686 layerBounds, damageRect.rect(), offsetFromRoot);
686 687
687 if (layer->layoutObject()->isLayoutPart() && 688 if (layer->layoutObject().isLayoutPart() &&
688 toLayoutPart(layer->layoutObject())->isThrottledFrameView()) 689 toLayoutPart(layer->layoutObject()).isThrottledFrameView())
689 shouldPaint = false; 690 shouldPaint = false;
690 691
691 Vector<PaintLayerStackingNode*>* negList = 692 Vector<PaintLayerStackingNode*>* negList =
692 layer->stackingNode()->negZOrderList(); 693 layer->stackingNode()->negZOrderList();
693 bool paintsBackgroundSeparately = negList && negList->size() > 0; 694 bool paintsBackgroundSeparately = negList && negList->size() > 0;
694 if (shouldPaint && paintsBackgroundSeparately) 695 if (shouldPaint && paintsBackgroundSeparately)
695 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), 696 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect(),
696 LayerPaintPhaseBackground, indent, behavior, markedLayer); 697 LayerPaintPhaseBackground, indent, behavior, markedLayer);
697 698
698 if (negList) { 699 if (negList) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 element->document().updateStyleAndLayout(); 882 element->document().updateStyleAndLayout();
882 883
883 LayoutObject* layoutObject = element->layoutObject(); 884 LayoutObject* layoutObject = element->layoutObject();
884 if (!layoutObject || !layoutObject->isListItem()) 885 if (!layoutObject || !layoutObject->isListItem())
885 return String(); 886 return String();
886 887
887 return toLayoutListItem(layoutObject)->markerText(); 888 return toLayoutListItem(layoutObject)->markerText();
888 } 889 }
889 890
890 } // namespace blink 891 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698