| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 toLayoutView(m_currentObject).frame()->ownerLayoutItem())); | 244 toLayoutView(m_currentObject).frame()->ownerLayoutItem())); |
| 245 m_paintOffset += | 245 m_paintOffset += |
| 246 toLayoutBox(parentState.m_currentObject).contentBoxOffset(); | 246 toLayoutBox(parentState.m_currentObject).contentBoxOffset(); |
| 247 // a LayoutView paints with a defined size but a pixel-rounded offset. | 247 // a LayoutView paints with a defined size but a pixel-rounded offset. |
| 248 m_paintOffset = LayoutSize(roundedIntSize(m_paintOffset)); | 248 m_paintOffset = LayoutSize(roundedIntSize(m_paintOffset)); |
| 249 return; | 249 return; |
| 250 } | 250 } |
| 251 | 251 |
| 252 EPosition position = m_currentObject.styleRef().position(); | 252 EPosition position = m_currentObject.styleRef().position(); |
| 253 | 253 |
| 254 if (position == FixedPosition) { | 254 if (position == EPosition::kFixed) { |
| 255 // Use slow path to get the offset of the fixed-position, and enable fast | 255 // Use slow path to get the offset of the fixed-position, and enable fast |
| 256 // path for descendants. | 256 // path for descendants. |
| 257 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint( | 257 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint( |
| 258 FloatPoint(), m_paintInvalidationContainer, TraverseDocumentBoundaries); | 258 FloatPoint(), m_paintInvalidationContainer, TraverseDocumentBoundaries); |
| 259 if (m_paintInvalidationContainer->isBox()) { | 259 if (m_paintInvalidationContainer->isBox()) { |
| 260 const LayoutBox* box = toLayoutBox(m_paintInvalidationContainer); | 260 const LayoutBox* box = toLayoutBox(m_paintInvalidationContainer); |
| 261 if (box->hasOverflowClip()) | 261 if (box->hasOverflowClip()) |
| 262 fixedOffset.move(box->scrolledContentOffset()); | 262 fixedOffset.move(box->scrolledContentOffset()); |
| 263 } | 263 } |
| 264 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); | 264 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); |
| 265 // In the above way to get paint offset, we can't get accurate clip rect, so | 265 // In the above way to get paint offset, we can't get accurate clip rect, so |
| 266 // just assume no clip. Clip on fixed-position is rare, in case that | 266 // just assume no clip. Clip on fixed-position is rare, in case that |
| 267 // paintInvalidationContainer crosses frame boundary and the LayoutView is | 267 // paintInvalidationContainer crosses frame boundary and the LayoutView is |
| 268 // clipped by something in owner document. | 268 // clipped by something in owner document. |
| 269 if (m_clipped) { | 269 if (m_clipped) { |
| 270 m_clipped = false; | 270 m_clipped = false; |
| 271 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 271 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
| 272 m_canCheckFastPathSlowPathEquality = false; | 272 m_canCheckFastPathSlowPathEquality = false; |
| 273 #endif | 273 #endif |
| 274 } | 274 } |
| 275 return; | 275 return; |
| 276 } | 276 } |
| 277 | 277 |
| 278 if (position == AbsolutePosition) { | 278 if (position == EPosition::kAbsolute) { |
| 279 m_cachedOffsetsEnabled = m_cachedOffsetsForAbsolutePositionEnabled; | 279 m_cachedOffsetsEnabled = m_cachedOffsetsForAbsolutePositionEnabled; |
| 280 if (!m_cachedOffsetsEnabled) | 280 if (!m_cachedOffsetsEnabled) |
| 281 return; | 281 return; |
| 282 | 282 |
| 283 m_paintOffset = m_paintOffsetForAbsolutePosition; | 283 m_paintOffset = m_paintOffsetForAbsolutePosition; |
| 284 m_clipped = m_clippedForAbsolutePosition; | 284 m_clipped = m_clippedForAbsolutePosition; |
| 285 m_clipRect = m_clipRectForAbsolutePosition; | 285 m_clipRect = m_clipRectForAbsolutePosition; |
| 286 | 286 |
| 287 // Handle absolute-position block under relative-position inline. | 287 // Handle absolute-position block under relative-position inline. |
| 288 const LayoutObject& container = parentState.m_containerForAbsolutePosition; | 288 const LayoutObject& container = parentState.m_containerForAbsolutePosition; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 } | 629 } |
| 630 | 630 |
| 631 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( | 631 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( |
| 632 const LayoutObject& object, | 632 const LayoutObject& object, |
| 633 LayoutRect& rect) const { | 633 LayoutRect& rect) const { |
| 634 DCHECK(&object == &m_paintInvalidationState.currentObject()); | 634 DCHECK(&object == &m_paintInvalidationState.currentObject()); |
| 635 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); | 635 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace blink | 638 } // namespace blink |
| OLD | NEW |