| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ObjectPaintInvalidator.h" | 5 #include "core/paint/ObjectPaintInvalidator.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/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/layout/api/LayoutPartItem.h" | 10 #include "core/layout/api/LayoutPartItem.h" |
| 11 #include "core/layout/compositing/CompositedLayerMapping.h" | 11 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 12 #include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h" | 12 #include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h" |
| 13 #include "core/paint/PaintInvalidator.h" | 13 #include "core/paint/PaintInvalidator.h" |
| 14 #include "core/paint/PaintLayer.h" | 14 #include "core/paint/PaintLayer.h" |
| 15 #include "platform/HostWindow.h" | 15 #include "platform/PlatformChromeClient.h" |
| 16 #include "platform/graphics/GraphicsLayer.h" | 16 #include "platform/graphics/GraphicsLayer.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 static bool g_disable_paint_invalidation_state_asserts = false; | 20 static bool g_disable_paint_invalidation_state_asserts = false; |
| 21 | 21 |
| 22 typedef HashMap<const LayoutObject*, LayoutRect> SelectionVisualRectMap; | 22 typedef HashMap<const LayoutObject*, LayoutRect> SelectionVisualRectMap; |
| 23 static SelectionVisualRectMap& GetSelectionVisualRectMap() { | 23 static SelectionVisualRectMap& GetSelectionVisualRectMap() { |
| 24 DEFINE_STATIC_LOCAL(SelectionVisualRectMap, map, ()); | 24 DEFINE_STATIC_LOCAL(SelectionVisualRectMap, map, ()); |
| 25 return map; | 25 return map; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 !RuntimeEnabledFeatures::printBrowserEnabled()) | 290 !RuntimeEnabledFeatures::printBrowserEnabled()) |
| 291 return; | 291 return; |
| 292 | 292 |
| 293 DCHECK(frame_view->GetFrame().OwnerLayoutItem().IsNull()); | 293 DCHECK(frame_view->GetFrame().OwnerLayoutItem().IsNull()); |
| 294 | 294 |
| 295 IntRect paint_rect = dirty_rect; | 295 IntRect paint_rect = dirty_rect; |
| 296 paint_rect.Intersect(frame_view->VisibleContentRect()); | 296 paint_rect.Intersect(frame_view->VisibleContentRect()); |
| 297 if (paint_rect.IsEmpty()) | 297 if (paint_rect.IsEmpty()) |
| 298 return; | 298 return; |
| 299 | 299 |
| 300 if (HostWindow* window = frame_view->GetHostWindow()) | 300 if (PlatformChromeClient* client = frame_view->GetChromeClient()) |
| 301 window->InvalidateRect(frame_view->ContentsToRootFrame(paint_rect)); | 301 client->InvalidateRect(frame_view->ContentsToRootFrame(paint_rect)); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void ObjectPaintInvalidator::SetBackingNeedsPaintInvalidationInRect( | 304 void ObjectPaintInvalidator::SetBackingNeedsPaintInvalidationInRect( |
| 305 const LayoutBoxModelObject& paint_invalidation_container, | 305 const LayoutBoxModelObject& paint_invalidation_container, |
| 306 const LayoutRect& rect, | 306 const LayoutRect& rect, |
| 307 PaintInvalidationReason reason) { | 307 PaintInvalidationReason reason) { |
| 308 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible | 308 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible |
| 309 // crash here, so assert but check that the layer is composited. | 309 // crash here, so assert but check that the layer is composited. |
| 310 DCHECK(paint_invalidation_container.GetCompositingState() != kNotComposited); | 310 DCHECK(paint_invalidation_container.GetCompositingState() != kNotComposited); |
| 311 | 311 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 666 |
| 667 context_.painting_layer->SetNeedsRepaint(); | 667 context_.painting_layer->SetNeedsRepaint(); |
| 668 object_.InvalidateDisplayItemClients(reason); | 668 object_.InvalidateDisplayItemClients(reason); |
| 669 return reason; | 669 return reason; |
| 670 } | 670 } |
| 671 | 671 |
| 672 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 672 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 673 : disabler_(&g_disable_paint_invalidation_state_asserts, true) {} | 673 : disabler_(&g_disable_paint_invalidation_state_asserts, true) {} |
| 674 | 674 |
| 675 } // namespace blink | 675 } // namespace blink |
| OLD | NEW |