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

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

Issue 2388723004: [SPInvalidation] Fix PrePaintTreeWalk for multicol spanner (Closed)
Patch Set: fixes 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 based on the properties of 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 when
664 // the container is not in the normal tree walk order.
665 // For example:
666 // <div id="columns" style="columns: 2">
667 // <div id="relative" style="position: relative">
668 // <div id="spanner" style="column-span: all">
669 // <div id="absolute" style="position: absolute"></div>
670 // </div>
671 // </div>
672 // <div>
673 // The real container of "absolute" is "relative" which is not in the tree-walk
674 // order of "columns" -> spanner placeholder -> spanner -> absolute. Here we
675 // rebuild a ContainerContext based on the properties of "relative" for
676 // "absolute".
677 static void overrideContainerContextFromContainer(
678 const LayoutObject& container,
679 PaintPropertyTreeBuilderContext::ContainerContext& context) {
680 // The container is never a LayoutInline. In the above example, if we change
681 // the container to an inline, there must be an anonymous blocks created
682 // because the spanner is always a block.
683 DCHECK(container.isLayoutBlock());
684
685 const auto* properties =
686 container.objectPaintProperties()->localBorderBoxProperties();
687 DCHECK(properties);
688
689 context.transform = properties->propertyTreeState.transform();
690 context.paintOffset = properties->paintOffset;
691 context.shouldFlattenInheritedTransform =
692 context.transform && context.transform->flattensInheritedTransform();
693 context.renderingContextID =
694 context.transform ? context.transform->renderingContextID() : 0;
695 context.clip = properties->propertyTreeState.clip();
696 context.scroll = const_cast<ScrollPaintPropertyNode*>(
697 properties->propertyTreeState.scroll());
698 }
699
661 static void deriveBorderBoxFromContainerContext( 700 static void deriveBorderBoxFromContainerContext(
662 const LayoutObject& object, 701 const LayoutObject& object,
663 PaintPropertyTreeBuilderContext& context) { 702 PaintPropertyTreeBuilderContext& context) {
664 if (!object.isBoxModelObject()) 703 if (!object.isBoxModelObject())
665 return; 704 return;
666 705
667 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); 706 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object);
668 707
669 switch (object.styleRef().position()) { 708 switch (object.styleRef().position()) {
670 case StaticPosition: 709 case StaticPosition:
671 break; 710 break;
672 case RelativePosition: 711 case RelativePosition:
673 context.current.paintOffset += boxModelObject.offsetForInFlowPosition(); 712 context.current.paintOffset += boxModelObject.offsetForInFlowPosition();
674 break; 713 break;
675 case AbsolutePosition: { 714 case AbsolutePosition: {
676 context.current = context.absolutePosition; 715 if (context.isUnderMultiColumnSpanner) {
716 const LayoutObject* container = boxModelObject.container();
717 if (container != context.containerForAbsolutePosition) {
718 // The container of the absolute-position is not in the normal tree-
719 // walk order.
720 context.containerForAbsolutePosition =
721 toLayoutBoxModelObject(container);
722 overrideContainerContextFromContainer(*container, context.current);
723 }
724 } else {
725 DCHECK(context.containerForAbsolutePosition ==
726 boxModelObject.container());
727 context.current = context.absolutePosition;
728 }
677 729
678 // Absolutely positioned content in an inline should be positioned relativ e to the inline. 730 // Absolutely positioned content in an inline should be positioned
731 // relative to the inline.
679 const LayoutObject* container = context.containerForAbsolutePosition; 732 const LayoutObject* container = context.containerForAbsolutePosition;
680 if (container && container->isInFlowPositioned() && 733 if (container && container->isInFlowPositioned() &&
681 container->isLayoutInline()) { 734 container->isLayoutInline()) {
682 DCHECK(object.isBox()); 735 DCHECK(object.isBox());
683 context.current.paintOffset += 736 context.current.paintOffset +=
684 toLayoutInline(container)->offsetForInFlowPositionedInline( 737 toLayoutInline(container)->offsetForInFlowPositionedInline(
685 toLayoutBox(object)); 738 toLayoutBox(object));
686 } 739 }
687 break; 740 break;
688 } 741 }
689 case StickyPosition: 742 case StickyPosition:
690 context.current.paintOffset += boxModelObject.offsetForInFlowPosition(); 743 context.current.paintOffset += boxModelObject.offsetForInFlowPosition();
691 break; 744 break;
692 case FixedPosition: 745 case FixedPosition:
693 context.current = context.fixedPosition; 746 if (context.isUnderMultiColumnSpanner) {
747 // The container of the fixed-position object may or may not be in the
748 // normal tree-walk order.
749 overrideContainerContextFromContainer(*boxModelObject.container(),
750 context.current);
751 } else {
752 context.current = context.fixedPosition;
753 }
694 break; 754 break;
695 default: 755 default:
696 ASSERT_NOT_REACHED(); 756 ASSERT_NOT_REACHED();
697 } 757 }
698 758
699 // SVGForeignObject needs paint offset because its viewport offset is baked in to its location(), 759 // SVGForeignObject needs paint offset because its viewport offset is baked in to its location(),
700 // while its localSVGTransform() doesn't contain the offset. 760 // while its localSVGTransform() doesn't contain the offset.
701 if (boxModelObject.isBox() && 761 if (boxModelObject.isBox() &&
702 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() || 762 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() ||
703 boxModelObject.isSVGForeignObject())) { 763 boxModelObject.isSVGForeignObject())) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return; 802 return;
743 803
744 updateOverflowClip(object, context); 804 updateOverflowClip(object, context);
745 updatePerspective(object, context); 805 updatePerspective(object, context);
746 updateSvgLocalToBorderBoxTransform(object, context); 806 updateSvgLocalToBorderBoxTransform(object, context);
747 updateScrollAndScrollTranslation(object, context); 807 updateScrollAndScrollTranslation(object, context);
748 updateOutOfFlowContext(object, context); 808 updateOutOfFlowContext(object, context);
749 } 809 }
750 810
751 } // namespace blink 811 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698