OLD | NEW |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 m_svgTransform = AffineTransform(svgRoot.localToBorderBoxTransform()); | 149 m_svgTransform = AffineTransform(svgRoot.localToBorderBoxTransform()); |
150 if (svgRoot.shouldApplyViewportClip()) | 150 if (svgRoot.shouldApplyViewportClip()) |
151 addClipRectRelativeToPaintOffset(LayoutSize(svgRoot.pixelSnappedSize
())); | 151 addClipRectRelativeToPaintOffset(LayoutSize(svgRoot.pixelSnappedSize
())); |
152 } | 152 } |
153 | 153 |
154 applyClipIfNeeded(); | 154 applyClipIfNeeded(); |
155 | 155 |
156 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. | 156 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. |
157 } | 157 } |
158 | 158 |
159 void PaintInvalidationState::mapObjectRectToAncestor(const LayoutObject& object,
const LayoutBoxModelObject* ancestor, LayoutRect& rect) const | 159 bool PaintInvalidationState::mapObjectRectToAncestor(const LayoutObject& object,
const LayoutBoxModelObject* ancestor, LayoutRect& rect, VisibleRectFlags visibl
eRectFlags) const |
160 { | 160 { |
161 ASSERT(canMapToAncestor(ancestor)); | 161 ASSERT(canMapToAncestor(ancestor)); |
162 | 162 |
163 if (ancestor == &object) { | 163 if (ancestor == &object) { |
164 if (object.isBox() && object.styleRef().isFlippedBlocksWritingMode()) | 164 if (object.isBox() && object.styleRef().isFlippedBlocksWritingMode()) |
165 toLayoutBox(object).flipForWritingMode(rect); | 165 toLayoutBox(object).flipForWritingMode(rect); |
166 return; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 if (object.hasLayer()) { | 169 if (object.hasLayer()) { |
170 if (const TransformationMatrix* transform = toLayoutBoxModelObject(objec
t).layer()->transform()) | 170 if (const TransformationMatrix* transform = toLayoutBoxModelObject(objec
t).layer()->transform()) |
171 rect = LayoutRect(transform->mapRect(pixelSnappedIntRect(rect))); | 171 rect = LayoutRect(transform->mapRect(pixelSnappedIntRect(rect))); |
172 | 172 |
173 if (object.isInFlowPositioned()) | 173 if (object.isInFlowPositioned()) |
174 rect.move(toLayoutBoxModelObject(object).layer()->offsetForInFlowPos
ition()); | 174 rect.move(toLayoutBoxModelObject(object).layer()->offsetForInFlowPos
ition()); |
175 } | 175 } |
176 | 176 |
177 if (object.isBox()) | 177 if (object.isBox()) |
178 rect.moveBy(toLayoutBox(object).location()); | 178 rect.moveBy(toLayoutBox(object).location()); |
179 | 179 |
180 rect.move(m_paintOffset); | 180 rect.move(m_paintOffset); |
181 | 181 |
182 if (m_clipped) | 182 if (m_clipped) { |
| 183 if (visibleRectFlags & EdgeInclusive) |
| 184 return rect.inclusiveIntersect(m_clipRect); |
183 rect.intersect(m_clipRect); | 185 rect.intersect(m_clipRect); |
| 186 } |
| 187 |
| 188 return !rect.isEmpty(); |
184 } | 189 } |
185 | 190 |
186 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize&
clipSize) | 191 void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize&
clipSize) |
187 { | 192 { |
188 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); | 193 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); |
189 if (m_clipped) { | 194 if (m_clipped) { |
190 m_clipRect.intersect(clipRect); | 195 m_clipRect.intersect(clipRect); |
191 } else { | 196 } else { |
192 m_clipRect = clipRect; | 197 m_clipRect = clipRect; |
193 m_clipped = true; | 198 m_clipped = true; |
(...skipping 19 matching lines...) Expand all Loading... |
213 | 218 |
214 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec
t& layoutObject) const | 219 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec
t& layoutObject) const |
215 { | 220 { |
216 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP
aintingLayer()) | 221 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP
aintingLayer()) |
217 return *toLayoutBoxModelObject(layoutObject).layer(); | 222 return *toLayoutBoxModelObject(layoutObject).layer(); |
218 | 223 |
219 return m_enclosingSelfPaintingLayer; | 224 return m_enclosingSelfPaintingLayer; |
220 } | 225 } |
221 | 226 |
222 } // namespace blink | 227 } // namespace blink |
OLD | NEW |