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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2388723004: [SPInvalidation] Fix PrePaintTreeWalk for multicol spanner (Closed)
Patch Set: Positioned descendants of spanner; Unit test Created 4 years, 2 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 cssClip->clipRect()); 651 cssClip->clipRect());
652 return; 652 return;
653 } 653 }
654 } 654 }
655 655
656 if (ObjectPaintProperties* properties = 656 if (ObjectPaintProperties* properties =
657 object.getMutableForPainting().objectPaintProperties()) 657 object.getMutableForPainting().objectPaintProperties())
658 properties->clearCssClipFixedPosition(); 658 properties->clearCssClipFixedPosition();
659 } 659 }
660 660
661 // Override ContainerContext for normal tree-walk from a container that was
662 // previously walked in a subtree other than the current subtree being walked.
663 // Used for out-of-flow positioned descendants of multi-column spanner, whose
664 // containers may be not be in the normal tree walk order.
665 static void overrideContainerContextFromContainer(
666 const LayoutObject& container,
667 PaintPropertyTreeBuilderContext::ContainerContext& context) {
668 const auto* properties =
669 container.objectPaintProperties()->localBorderBoxProperties();
chrishtr 2016/10/05 00:48:17 DCHECK(properties && container.isBox())
Xianzhu 2016/10/05 17:29:40 Done.
670 context.transform = properties->propertyTreeState.transform();
671 context.paintOffset = properties->paintOffset;
672 context.shouldFlattenInheritedTransform =
673 context.transform && context.transform->flattensInheritedTransform();
674 context.renderingContextID =
675 context.transform ? context.transform->renderingContextID() : 0;
676 context.clip = properties->propertyTreeState.clip();
677 context.scroll = const_cast<ScrollPaintPropertyNode*>(
678 properties->propertyTreeState.scroll());
679 }
680
661 static void deriveBorderBoxFromContainerContext( 681 static void deriveBorderBoxFromContainerContext(
662 const LayoutObject& object, 682 const LayoutObject& object,
663 PaintPropertyTreeBuilderContext& context) { 683 PaintPropertyTreeBuilderContext& context) {
664 if (!object.isBoxModelObject()) 684 if (!object.isBoxModelObject())
665 return; 685 return;
666 686
667 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); 687 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object);
668 688
669 switch (object.styleRef().position()) { 689 switch (object.styleRef().position()) {
670 case StaticPosition: 690 case StaticPosition:
671 break; 691 break;
672 case RelativePosition: 692 case RelativePosition:
673 context.current.paintOffset += boxModelObject.offsetForInFlowPosition(); 693 context.current.paintOffset += boxModelObject.offsetForInFlowPosition();
674 break; 694 break;
675 case AbsolutePosition: { 695 case AbsolutePosition: {
676 context.current = context.absolutePosition; 696 if (context.isUnderMultiColumnSpanner) {
697 // The container of the absolute-position object may be not in the
698 // normal tree-walk order.
699 const LayoutObject* container = boxModelObject.container();
700 if (container != context.containerForAbsolutePosition) {
701 context.containerForAbsolutePosition =
702 toLayoutBoxModelObject(container);
703 overrideContainerContextFromContainer(*container, context.current);
704 }
705 } else {
706 DCHECK(context.containerForAbsolutePosition ==
707 boxModelObject.container());
708 context.current = context.absolutePosition;
709 }
677 710
678 // Absolutely positioned content in an inline should be positioned relativ e to the inline. 711 // Absolutely positioned content in an inline should be positioned relativ e to the inline.
679 const LayoutObject* container = context.containerForAbsolutePosition; 712 const LayoutObject* container = context.containerForAbsolutePosition;
680 if (container && container->isInFlowPositioned() && 713 if (container && container->isInFlowPositioned() &&
681 container->isLayoutInline()) { 714 container->isLayoutInline()) {
682 DCHECK(object.isBox()); 715 DCHECK(object.isBox());
683 context.current.paintOffset += 716 context.current.paintOffset +=
684 toLayoutInline(container)->offsetForInFlowPositionedInline( 717 toLayoutInline(container)->offsetForInFlowPositionedInline(
685 toLayoutBox(object)); 718 toLayoutBox(object));
686 } 719 }
687 break; 720 break;
688 } 721 }
689 case StickyPosition: 722 case StickyPosition:
690 context.current.paintOffset += boxModelObject.offsetForInFlowPosition(); 723 context.current.paintOffset += boxModelObject.offsetForInFlowPosition();
691 break; 724 break;
692 case FixedPosition: 725 case FixedPosition:
693 context.current = context.fixedPosition; 726 if (context.isUnderMultiColumnSpanner) {
727 // The container of the fixed-position object may be not in the normal
728 // tree-walk order.
729 overrideContainerContextFromContainer(*boxModelObject.container(),
730 context.current);
731 } else {
732 context.current = context.fixedPosition;
733 }
694 break; 734 break;
695 default: 735 default:
696 ASSERT_NOT_REACHED(); 736 ASSERT_NOT_REACHED();
697 } 737 }
698 738
699 // SVGForeignObject needs paint offset because its viewport offset is baked in to its location(), 739 // SVGForeignObject needs paint offset because its viewport offset is baked in to its location(),
700 // while its localSVGTransform() doesn't contain the offset. 740 // while its localSVGTransform() doesn't contain the offset.
701 if (boxModelObject.isBox() && 741 if (boxModelObject.isBox() &&
702 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() || 742 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() ||
703 boxModelObject.isSVGForeignObject())) { 743 boxModelObject.isSVGForeignObject())) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return; 782 return;
743 783
744 updateOverflowClip(object, context); 784 updateOverflowClip(object, context);
745 updatePerspective(object, context); 785 updatePerspective(object, context);
746 updateSvgLocalToBorderBoxTransform(object, context); 786 updateSvgLocalToBorderBoxTransform(object, context);
747 updateScrollAndScrollTranslation(object, context); 787 updateScrollAndScrollTranslation(object, context);
748 updateOutOfFlowContext(object, context); 788 updateOutOfFlowContext(object, context);
749 } 789 }
750 790
751 } // namespace blink 791 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698