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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 enum LayerPaintPhase { | 553 enum LayerPaintPhase { |
554 LayerPaintPhaseAll = 0, | 554 LayerPaintPhaseAll = 0, |
555 LayerPaintPhaseBackground = -1, | 555 LayerPaintPhaseBackground = -1, |
556 LayerPaintPhaseForeground = 1 | 556 LayerPaintPhaseForeground = 1 |
557 }; | 557 }; |
558 | 558 |
559 static void write(TextStream& ts, DeprecatedPaintLayer& layer, | 559 static void write(TextStream& ts, DeprecatedPaintLayer& layer, |
560 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L
ayoutRect& clipRect, const LayoutRect& outlineClipRect, | 560 const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const L
ayoutRect& clipRect, |
561 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex
tBehavior behavior = LayoutAsTextBehaviorNormal) | 561 LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTex
tBehavior behavior = LayoutAsTextBehaviorNormal) |
562 { | 562 { |
563 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); | 563 IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds); |
564 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds; | 564 IntRect adjustedLayoutBoundsWithScrollbars = adjustedLayoutBounds; |
565 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect)
; | 565 IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect)
; |
566 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); | 566 IntRect adjustedClipRect = pixelSnappedIntRect(clipRect); |
567 IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect); | |
568 | 567 |
569 Settings* settings = layer.layoutObject()->document().settings(); | 568 Settings* settings = layer.layoutObject()->document().settings(); |
570 bool reportFrameScrollInfo = layer.layoutObject()->isLayoutView() && setting
s && !settings->rootLayerScrolls(); | 569 bool reportFrameScrollInfo = layer.layoutObject()->isLayoutView() && setting
s && !settings->rootLayerScrolls(); |
571 | 570 |
572 if (reportFrameScrollInfo) { | 571 if (reportFrameScrollInfo) { |
573 LayoutView* layoutView = toLayoutView(layer.layoutObject()); | 572 LayoutView* layoutView = toLayoutView(layer.layoutObject()); |
574 | 573 |
575 adjustedLayoutBoundsWithScrollbars.setWidth(layoutView->viewWidth(Includ
eScrollbars)); | 574 adjustedLayoutBoundsWithScrollbars.setWidth(layoutView->viewWidth(Includ
eScrollbars)); |
576 adjustedLayoutBoundsWithScrollbars.setHeight(layoutView->viewHeight(Incl
udeScrollbars)); | 575 adjustedLayoutBoundsWithScrollbars.setHeight(layoutView->viewHeight(Incl
udeScrollbars)); |
577 } | 576 } |
578 | 577 |
579 writeIndent(ts, indent); | 578 writeIndent(ts, indent); |
580 | 579 |
581 if (layer.layoutObject()->style()->visibility() == HIDDEN) | 580 if (layer.layoutObject()->style()->visibility() == HIDDEN) |
582 ts << "hidden "; | 581 ts << "hidden "; |
583 | 582 |
584 ts << "layer "; | 583 ts << "layer "; |
585 | 584 |
586 if (behavior & LayoutAsTextShowAddresses) | 585 if (behavior & LayoutAsTextShowAddresses) |
587 ts << static_cast<const void*>(&layer) << " "; | 586 ts << static_cast<const void*>(&layer) << " "; |
588 | 587 |
589 ts << adjustedLayoutBoundsWithScrollbars; | 588 ts << adjustedLayoutBoundsWithScrollbars; |
590 | 589 |
591 if (!adjustedLayoutBounds.isEmpty()) { | 590 if (!adjustedLayoutBounds.isEmpty()) { |
592 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) | 591 if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds)) |
593 ts << " backgroundClip " << adjustedBackgroundClipRect; | 592 ts << " backgroundClip " << adjustedBackgroundClipRect; |
594 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars)) | 593 if (!adjustedClipRect.contains(adjustedLayoutBoundsWithScrollbars)) |
595 ts << " clip " << adjustedClipRect; | 594 ts << " clip " << adjustedClipRect; |
596 if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds)) | |
597 ts << " outlineClip " << adjustedOutlineClipRect; | |
598 } | 595 } |
599 if (layer.isTransparent()) | 596 if (layer.isTransparent()) |
600 ts << " transparent"; | 597 ts << " transparent"; |
601 | 598 |
602 if (layer.layoutObject()->hasOverflowClip() || reportFrameScrollInfo) { | 599 if (layer.layoutObject()->hasOverflowClip() || reportFrameScrollInfo) { |
603 ScrollableArea* scrollableArea; | 600 ScrollableArea* scrollableArea; |
604 if (reportFrameScrollInfo) | 601 if (reportFrameScrollInfo) |
605 scrollableArea = toLayoutView(layer.layoutObject())->frameView(); | 602 scrollableArea = toLayoutView(layer.layoutObject())->frameView(); |
606 else | 603 else |
607 scrollableArea = layer.scrollableArea(); | 604 scrollableArea = layer.scrollableArea(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 while (DeprecatedPaintLayerStackingNode* normalFlowChild = it.next()) | 646 while (DeprecatedPaintLayerStackingNode* normalFlowChild = it.next()) |
650 vector.append(normalFlowChild); | 647 vector.append(normalFlowChild); |
651 return vector; | 648 return vector; |
652 } | 649 } |
653 | 650 |
654 void LayoutTreeAsText::writeLayers(TextStream& ts, const DeprecatedPaintLayer* r
ootLayer, DeprecatedPaintLayer* layer, | 651 void LayoutTreeAsText::writeLayers(TextStream& ts, const DeprecatedPaintLayer* r
ootLayer, DeprecatedPaintLayer* layer, |
655 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior) | 652 const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior) |
656 { | 653 { |
657 // Calculate the clip rects we should use. | 654 // Calculate the clip rects we should use. |
658 LayoutRect layerBounds; | 655 LayoutRect layerBounds; |
659 ClipRect damageRect, clipRectToApply, outlineRect; | 656 ClipRect damageRect, clipRectToApply; |
660 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect
s), paintRect, layerBounds, damageRect, clipRectToApply, outlineRect); | 657 layer->clipper().calculateRects(ClipRectsContext(rootLayer, UncachedClipRect
s), paintRect, layerBounds, damageRect, clipRectToApply); |
661 | 658 |
662 // Ensure our lists are up-to-date. | 659 // Ensure our lists are up-to-date. |
663 layer->stackingNode()->updateLayerListsIfNeeded(); | 660 layer->stackingNode()->updateLayerListsIfNeeded(); |
664 | 661 |
665 LayoutPoint offsetFromRoot; | 662 LayoutPoint offsetFromRoot; |
666 layer->convertToLayerCoords(rootLayer, offsetFromRoot); | 663 layer->convertToLayerCoords(rootLayer, offsetFromRoot); |
667 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), offsetFromRoot); | 664 bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) ? true : layer->in
tersectsDamageRect(layerBounds, damageRect.rect(), offsetFromRoot); |
668 | 665 |
669 Vector<DeprecatedPaintLayerStackingNode*>* negList = layer->stackingNode()->
negZOrderList(); | 666 Vector<DeprecatedPaintLayerStackingNode*>* negList = layer->stackingNode()->
negZOrderList(); |
670 bool paintsBackgroundSeparately = negList && negList->size() > 0; | 667 bool paintsBackgroundSeparately = negList && negList->size() > 0; |
671 if (shouldPaint && paintsBackgroundSeparately) | 668 if (shouldPaint && paintsBackgroundSeparately) |
672 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); | 669 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, LayerPaintPhaseBackground, indent, behavior); |
673 | 670 |
674 if (negList) { | 671 if (negList) { |
675 int currIndent = indent; | 672 int currIndent = indent; |
676 if (behavior & LayoutAsTextShowLayerNesting) { | 673 if (behavior & LayoutAsTextShowLayerNesting) { |
677 writeIndent(ts, indent); | 674 writeIndent(ts, indent); |
678 ts << " negative z-order list(" << negList->size() << ")\n"; | 675 ts << " negative z-order list(" << negList->size() << ")\n"; |
679 ++currIndent; | 676 ++currIndent; |
680 } | 677 } |
681 for (unsigned i = 0; i != negList->size(); ++i) | 678 for (unsigned i = 0; i != negList->size(); ++i) |
682 writeLayers(ts, rootLayer, negList->at(i)->layer(), paintRect, currI
ndent, behavior); | 679 writeLayers(ts, rootLayer, negList->at(i)->layer(), paintRect, currI
ndent, behavior); |
683 } | 680 } |
684 | 681 |
685 if (shouldPaint) | 682 if (shouldPaint) |
686 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, outlineRect.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : L
ayerPaintPhaseAll, indent, behavior); | 683 write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect()
, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, i
ndent, behavior); |
687 | 684 |
688 Vector<DeprecatedPaintLayerStackingNode*> normalFlowList = normalFlowListFor
(layer->stackingNode()); | 685 Vector<DeprecatedPaintLayerStackingNode*> normalFlowList = normalFlowListFor
(layer->stackingNode()); |
689 if (!normalFlowList.isEmpty()) { | 686 if (!normalFlowList.isEmpty()) { |
690 int currIndent = indent; | 687 int currIndent = indent; |
691 if (behavior & LayoutAsTextShowLayerNesting) { | 688 if (behavior & LayoutAsTextShowLayerNesting) { |
692 writeIndent(ts, indent); | 689 writeIndent(ts, indent); |
693 ts << " normal flow list(" << normalFlowList.size() << ")\n"; | 690 ts << " normal flow list(" << normalFlowList.size() << ")\n"; |
694 ++currIndent; | 691 ++currIndent; |
695 } | 692 } |
696 for (unsigned i = 0; i != normalFlowList.size(); ++i) | 693 for (unsigned i = 0; i != normalFlowList.size(); ++i) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 element->document().updateLayout(); | 841 element->document().updateLayout(); |
845 | 842 |
846 LayoutObject* layoutObject = element->layoutObject(); | 843 LayoutObject* layoutObject = element->layoutObject(); |
847 if (!layoutObject || !layoutObject->isListItem()) | 844 if (!layoutObject || !layoutObject->isListItem()) |
848 return String(); | 845 return String(); |
849 | 846 |
850 return toLayoutListItem(layoutObject)->markerText(); | 847 return toLayoutListItem(layoutObject)->markerText(); |
851 } | 848 } |
852 | 849 |
853 } // namespace blink | 850 } // namespace blink |
OLD | NEW |