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

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

Issue 1786513002: Fix paint invalidation of paintInvalidationContainer itself (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layout/PaintInvalidationState.h" 5 #include "core/layout/PaintInvalidationState.h"
6 6
7 #include "core/layout/LayoutInline.h" 7 #include "core/layout/LayoutInline.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/layout/svg/LayoutSVGModelObject.h" 9 #include "core/layout/svg/LayoutSVGModelObject.h"
10 #include "core/layout/svg/LayoutSVGRoot.h" 10 #include "core/layout/svg/LayoutSVGRoot.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (fixed) { 66 if (fixed) {
67 FloatPoint fixedOffset = layoutObject.localToAncestorPoint(Float Point(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); 67 FloatPoint fixedOffset = layoutObject.localToAncestorPoint(Float Point(), &m_paintInvalidationContainer, TraverseDocumentBoundaries);
68 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); 68 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y());
69 } else { 69 } else {
70 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize(); 70 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize();
71 m_paintOffset = next.m_paintOffset + offset; 71 m_paintOffset = next.m_paintOffset + offset;
72 } 72 }
73 73
74 if (layoutObject.isOutOfFlowPositioned() && !fixed) { 74 if (layoutObject.isOutOfFlowPositioned() && !fixed) {
75 if (LayoutObject* container = layoutObject.container()) { 75 if (LayoutObject* container = layoutObject.container()) {
76 if (container->style()->hasInFlowPosition() && container->is LayoutInline()) 76 if (container->isInFlowPositioned() && container->isLayoutIn line())
77 m_paintOffset += toLayoutInline(container)->offsetForInF lowPositionedInline(toLayoutBox(layoutObject)); 77 m_paintOffset += toLayoutInline(container)->offsetForInF lowPositionedInline(toLayoutBox(layoutObject));
78 } 78 }
79 } 79 }
80 80
81 if (layoutObject.style()->hasInFlowPosition() && layoutObject.hasLay er()) 81 if (layoutObject.isInFlowPositioned() && layoutObject.hasLayer())
82 m_paintOffset += layoutObject.layer()->offsetForInFlowPosition() ; 82 m_paintOffset += layoutObject.layer()->offsetForInFlowPosition() ;
83 } 83 }
84 84
85 m_clipped = !fixed && next.m_clipped; 85 m_clipped = !fixed && next.m_clipped;
86 if (m_clipped) 86 if (m_clipped)
87 m_clipRect = next.m_clipRect; 87 m_clipRect = next.m_clipRect;
88 } 88 }
89 89
90 if (m_cachedOffsetsEnabled && layoutObject.isSVGRoot()) { 90 if (m_cachedOffsetsEnabled && layoutObject.isSVGRoot()) {
91 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(layoutObject); 91 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(layoutObject);
(...skipping 18 matching lines...) Expand all
110 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) 110 , m_paintInvalidationContainer(next.m_paintInvalidationContainer)
111 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 111 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
112 , m_enclosingSelfPaintingLayer(next.enclosingSelfPaintingLayer(layoutObject) ) 112 , m_enclosingSelfPaintingLayer(next.enclosingSelfPaintingLayer(layoutObject) )
113 { 113 {
114 ASSERT(layoutObject != m_paintInvalidationContainer); 114 ASSERT(layoutObject != m_paintInvalidationContainer);
115 115
116 if (m_cachedOffsetsEnabled) 116 if (m_cachedOffsetsEnabled)
117 m_svgTransform = AffineTransform(next.svgTransform() * layoutObject.loca lToParentTransform()); 117 m_svgTransform = AffineTransform(next.svgTransform() * layoutObject.loca lToParentTransform());
118 } 118 }
119 119
120 void PaintInvalidationState::mapObjectRectToAncestor(const LayoutObject& object, const LayoutBoxModelObject* ancestor, LayoutRect& rect) const
121 {
122 ASSERT(canMapToAncestor(ancestor));
123
124 if (ancestor == &object) {
125 if (object.isBox() && object.styleRef().isFlippedBlocksWritingMode())
126 toLayoutBox(object).flipForWritingMode(rect);
127 return;
128 }
129
130 if (object.hasLayer()) {
131 if (const TransformationMatrix* transform = toLayoutBoxModelObject(objec t).layer()->transform())
132 rect = LayoutRect(transform->mapRect(pixelSnappedIntRect(rect)));
133
134 if (object.isInFlowPositioned())
135 rect.move(toLayoutBoxModelObject(object).layer()->offsetForInFlowPos ition());
136 }
137
138 if (object.isBox())
139 rect.moveBy(toLayoutBox(object).location());
140
141 rect.move(m_paintOffset);
142
143 if (m_clipped)
144 rect.intersect(m_clipRect);
145 }
146
120 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize& clipSize) 147 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize& clipSize)
121 { 148 {
122 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); 149 LayoutRect clipRect(toPoint(m_paintOffset), clipSize);
123 if (m_clipped) { 150 if (m_clipped) {
124 m_clipRect.intersect(clipRect); 151 m_clipRect.intersect(clipRect);
125 } else { 152 } else {
126 m_clipRect = clipRect; 153 m_clipRect = clipRect;
127 m_clipped = true; 154 m_clipped = true;
128 } 155 }
129 } 156 }
(...skipping 17 matching lines...) Expand all
147 174
148 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const 175 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const
149 { 176 {
150 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer()) 177 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer())
151 return *toLayoutBoxModelObject(layoutObject).layer(); 178 return *toLayoutBoxModelObject(layoutObject).layer();
152 179
153 return m_enclosingSelfPaintingLayer; 180 return m_enclosingSelfPaintingLayer;
154 } 181 }
155 182
156 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698