| 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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 m_paintOffset += | 242 m_paintOffset += |
| 243 toLayoutBox(parentState.m_currentObject).contentBoxOffset(); | 243 toLayoutBox(parentState.m_currentObject).contentBoxOffset(); |
| 244 // a LayoutView paints with a defined size but a pixel-rounded offset. | 244 // a LayoutView paints with a defined size but a pixel-rounded offset. |
| 245 m_paintOffset = LayoutSize(roundedIntSize(m_paintOffset)); | 245 m_paintOffset = LayoutSize(roundedIntSize(m_paintOffset)); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 EPosition position = m_currentObject.styleRef().position(); | 249 EPosition position = m_currentObject.styleRef().position(); |
| 250 | 250 |
| 251 if (position == FixedPosition) { | 251 if (position == FixedPosition) { |
| 252 if (m_paintInvalidationContainer != m_currentObject.view() && | |
| 253 m_paintInvalidationContainer->view() == m_currentObject.view()) { | |
| 254 // TODO(crbug.com/598762): localToAncestorPoint() is incorrect for | |
| 255 // fixed-position when paintInvalidationContainer is under the containing | |
| 256 // LayoutView. | |
| 257 m_cachedOffsetsEnabled = false; | |
| 258 return; | |
| 259 } | |
| 260 // Use slow path to get the offset of the fixed-position, and enable fast | 252 // Use slow path to get the offset of the fixed-position, and enable fast |
| 261 // path for descendants. | 253 // path for descendants. |
| 262 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint( | 254 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint( |
| 263 FloatPoint(), m_paintInvalidationContainer, TraverseDocumentBoundaries); | 255 FloatPoint(), m_paintInvalidationContainer, TraverseDocumentBoundaries); |
| 264 if (m_paintInvalidationContainer->isBox()) { | 256 if (m_paintInvalidationContainer->isBox()) { |
| 265 const LayoutBox* box = toLayoutBox(m_paintInvalidationContainer); | 257 const LayoutBox* box = toLayoutBox(m_paintInvalidationContainer); |
| 266 if (box->hasOverflowClip()) | 258 if (box->hasOverflowClip()) |
| 267 fixedOffset.move(box->scrolledContentOffset()); | 259 fixedOffset.move(box->scrolledContentOffset()); |
| 268 } | 260 } |
| 269 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); | 261 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 626 } |
| 635 | 627 |
| 636 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( | 628 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( |
| 637 const LayoutObject& object, | 629 const LayoutObject& object, |
| 638 LayoutRect& rect) const { | 630 LayoutRect& rect) const { |
| 639 DCHECK(&object == &m_paintInvalidationState.currentObject()); | 631 DCHECK(&object == &m_paintInvalidationState.currentObject()); |
| 640 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); | 632 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); |
| 641 } | 633 } |
| 642 | 634 |
| 643 } // namespace blink | 635 } // namespace blink |
| OLD | NEW |