Changeset 166015 in webkit
- Timestamp:
- Mar 20, 2014, 4:14:31 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r166007 r166015 1 2014-03-20 Simon Fraser <simon.fraser@apple.com> 2 3 FrameView::paintContents() is not called for composited content 4 https://bugs.webkit.org/show_bug.cgi?id=130541 5 6 Reviewed by Beth Dakin. 7 8 FrameView::paintContents() is not called for frames that have 9 composited contents, yet it contains code that is expected 10 to run for all Frames. 11 12 Fix by factoring into will/didPaintContents(), and calling 13 the will/did functions from RenderLayerBacking::paintIntoLayer(). 14 15 Also add a SetLayoutNeededForbiddenScope check for composited-layer 16 painting. 17 18 * page/FrameView.cpp: 19 (WebCore::FrameView::updateControlTints): 20 (WebCore::FrameView::willPaintContents): 21 (WebCore::FrameView::didPaintContents): 22 (WebCore::FrameView::paintContents): 23 * page/FrameView.h: 24 * rendering/RenderLayerBacking.cpp: 25 (WebCore::RenderLayerBacking::paintIntoLayer): 26 1 27 2014-03-20 Tim Horton <timothy_horton@apple.com> 2 28 -
trunk/Source/WebCore/page/FrameView.cpp
r165652 r166015 3462 3462 } 3463 3463 3464 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) 3464 void FrameView::willPaintContents(GraphicsContext* context, const IntRect& dirtyRect, PaintingState& paintingState) 3465 { 3466 Document* document = frame().document(); 3467 3468 if (!context->paintingDisabled()) 3469 InspectorInstrumentation::willPaint(renderView()); 3470 3471 paintingState.isTopLevelPainter = !sCurrentPaintTimeStamp; 3472 3473 #if PLATFORM(IOS) 3474 // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to MemoryPressureHandler.h. 3475 if (isTopLevelPainter && memoryPressureHandler().hasReceivedMemoryPressure()) { 3476 LOG(MemoryPressure, "Under memory pressure: %s", __PRETTY_FUNCTION__); 3477 3478 // To avoid unnecessary image decoding, we don't prune recently-decoded live resources here since 3479 // we might need some live bitmaps on painting. 3480 memoryCache()->prune(); 3481 } 3482 #endif 3483 if (paintingState.isTopLevelPainter) 3484 sCurrentPaintTimeStamp = monotonicallyIncreasingTime(); 3485 3486 if (!context->paintingDisabled() && !document->printing()) 3487 flushCompositingStateForThisFrame(&frame()); 3488 3489 paintingState.paintBehavior = m_paintBehavior; 3490 3491 if (FrameView* parentView = parentFrameView()) { 3492 if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers) 3493 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers; 3494 } 3495 3496 if (m_paintBehavior == PaintBehaviorNormal) 3497 document->markers().invalidateRenderedRectsForMarkersInRect(dirtyRect); 3498 3499 if (document->printing()) 3500 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers; 3501 3502 paintingState.isFlatteningPaintOfRootFrame = (m_paintBehavior & PaintBehaviorFlattenCompositingLayers) && !frame().ownerElement(); 3503 if (paintingState.isFlatteningPaintOfRootFrame) 3504 notifyWidgetsInAllFrames(WillPaintFlattened); 3505 3506 ASSERT(!m_isPainting); 3507 m_isPainting = true; 3508 } 3509 3510 void FrameView::didPaintContents(GraphicsContext* context, const IntRect& dirtyRect, PaintingState& paintingState) 3511 { 3512 m_isPainting = false; 3513 3514 if (paintingState.isFlatteningPaintOfRootFrame) 3515 notifyWidgetsInAllFrames(DidPaintFlattened); 3516 3517 m_paintBehavior = paintingState.paintBehavior; 3518 m_lastPaintTime = monotonicallyIncreasingTime(); 3519 3520 #if PLATFORM(IOS) 3521 // Painting can lead to decoding of large amounts of bitmaps 3522 // If we are low on memory, wipe them out after the paint. 3523 // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to MemoryPressureHandler.h. 3524 if (isTopLevelPainter && memoryPressureHandler().hasReceivedMemoryPressure()) 3525 memoryCache()->pruneLiveResources(true); 3526 #endif 3527 3528 Document* document = frame().document(); 3529 // Regions may have changed as a result of the visibility/z-index of element changing. 3530 #if ENABLE(DASHBOARD_SUPPORT) 3531 if (document->annotatedRegionsDirty()) 3532 updateAnnotatedRegions(); 3533 #endif 3534 3535 if (paintingState.isTopLevelPainter) 3536 sCurrentPaintTimeStamp = 0; 3537 3538 if (!context->paintingDisabled()) { 3539 InspectorInstrumentation::didPaint(renderView(), context, dirtyRect); 3540 // FIXME: should probably not fire milestones for snapshot painting. https://bugs.webkit.org/show_bug.cgi?id=117623 3541 firePaintRelatedMilestonesIfNeeded(); 3542 } 3543 } 3544 3545 void FrameView::paintContents(GraphicsContext* context, const IntRect& dirtyRect) 3465 3546 { 3466 3547 Document* document = frame().document(); … … 3482 3563 3483 3564 if (fillWithRed) 3484 p->fillRect(rect, Color(0xFF, 0, 0), ColorSpaceDeviceRGB);3565 context->fillRect(dirtyRect, Color(0xFF, 0, 0), ColorSpaceDeviceRGB); 3485 3566 #endif 3486 3567 … … 3495 3576 return; 3496 3577 3497 if (!p->paintingDisabled()) 3498 InspectorInstrumentation::willPaint(renderView); 3499 3500 bool isTopLevelPainter = !sCurrentPaintTimeStamp; 3501 #if PLATFORM(IOS) 3502 // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to MemoryPressureHandler.h. 3503 if (isTopLevelPainter && memoryPressureHandler().hasReceivedMemoryPressure()) { 3504 LOG(MemoryPressure, "Under memory pressure: %s", __PRETTY_FUNCTION__); 3505 3506 // To avoid unnecessary image decoding, we don't prune recently-decoded live resources here since 3507 // we might need some live bitmaps on painting. 3508 memoryCache()->prune(); 3509 } 3510 #endif 3511 if (isTopLevelPainter) 3512 sCurrentPaintTimeStamp = monotonicallyIncreasingTime(); 3578 PaintingState paintingState; 3579 willPaintContents(context, dirtyRect, paintingState); 3513 3580 3514 3581 FontCachePurgePreventer fontCachePurgePreventer; 3515 3516 if (!p->paintingDisabled() && !document->printing())3517 flushCompositingStateForThisFrame(&frame());3518 3519 PaintBehavior oldPaintBehavior = m_paintBehavior;3520 3521 if (FrameView* parentView = parentFrameView()) {3522 if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)3523 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;3524 }3525 3526 if (m_paintBehavior == PaintBehaviorNormal)3527 document->markers().invalidateRenderedRectsForMarkersInRect(rect);3528 3529 if (document->printing())3530 m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;3531 3532 bool flatteningPaint = m_paintBehavior & PaintBehaviorFlattenCompositingLayers;3533 bool isRootFrame = !frame().ownerElement();3534 if (flatteningPaint && isRootFrame)3535 notifyWidgetsInAllFrames(WillPaintFlattened);3536 3537 ASSERT(!m_isPainting);3538 m_isPainting = true;3539 3582 3540 3583 // m_nodeToDraw is used to draw only one element (and its descendants) … … 3546 3589 #endif 3547 3590 3548 rootLayer->paint(p, rect, m_paintBehavior, eltRenderer); 3549 3591 rootLayer->paint(context, dirtyRect, m_paintBehavior, eltRenderer); 3550 3592 if (rootLayer->containsDirtyOverlayScrollbars()) 3551 rootLayer->paintOverlayScrollbars(p, rect, m_paintBehavior, eltRenderer); 3552 3553 m_isPainting = false; 3554 3555 if (flatteningPaint && isRootFrame) 3556 notifyWidgetsInAllFrames(DidPaintFlattened); 3557 3558 m_paintBehavior = oldPaintBehavior; 3559 m_lastPaintTime = monotonicallyIncreasingTime(); 3560 3561 #if PLATFORM(IOS) 3562 // Painting can lead to decoding of large amounts of bitmaps 3563 // If we are low on memory, wipe them out after the paint. 3564 // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to MemoryPressureHandler.h. 3565 if (isTopLevelPainter && memoryPressureHandler().hasReceivedMemoryPressure()) 3566 memoryCache()->pruneLiveResources(true); 3567 #endif 3568 3569 // Regions may have changed as a result of the visibility/z-index of element changing. 3570 #if ENABLE(DASHBOARD_SUPPORT) 3571 if (document->annotatedRegionsDirty()) 3572 updateAnnotatedRegions(); 3573 #endif 3574 3575 if (isTopLevelPainter) 3576 sCurrentPaintTimeStamp = 0; 3577 3578 if (!p->paintingDisabled()) { 3579 InspectorInstrumentation::didPaint(renderView, p, rect); 3580 // FIXME: should probably not fire milestones for snapshot painting. https://bugs.webkit.org/show_bug.cgi?id=117623 3581 firePaintRelatedMilestonesIfNeeded(); 3582 } 3593 rootLayer->paintOverlayScrollbars(context, dirtyRect, m_paintBehavior, eltRenderer); 3594 3595 didPaintContents(context, dirtyRect, paintingState); 3583 3596 } 3584 3597 -
trunk/Source/WebCore/page/FrameView.h
r165652 r166015 298 298 void removeEmbeddedObjectToUpdate(RenderEmbeddedObject&); 299 299 300 virtual void paintContents(GraphicsContext*, const IntRect& damageRect) override; 300 virtual void paintContents(GraphicsContext*, const IntRect& dirtyRect) override; 301 302 struct PaintingState { 303 PaintBehavior paintBehavior; 304 bool isTopLevelPainter; 305 bool isFlatteningPaintOfRootFrame; 306 PaintingState() 307 : paintBehavior() 308 , isTopLevelPainter(false) 309 , isFlatteningPaintOfRootFrame(false) 310 { 311 } 312 }; 313 314 void willPaintContents(GraphicsContext*, const IntRect& dirtyRect, PaintingState&); 315 void didPaintContents(GraphicsContext*, const IntRect& dirtyRect, PaintingState&); 316 301 317 void setPaintBehavior(PaintBehavior); 302 318 PaintBehavior paintBehavior() const; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r165977 r166015 2158 2158 else if (compositor().fixedRootBackgroundLayer()) 2159 2159 paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground; 2160 2160 2161 #ifndef NDEBUG 2162 RenderElement::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(&m_owningLayer.renderer()); 2163 #endif 2164 2165 FrameView::PaintingState paintingState; 2166 if (m_owningLayer.isRootLayer()) 2167 m_owningLayer.renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState); 2168 2161 2169 // FIXME: GraphicsLayers need a way to split for RenderRegions. 2162 2170 RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, m_devicePixelFractionFromRenderer); … … 2165 2173 if (m_owningLayer.containsDirtyOverlayScrollbars()) 2166 2174 m_owningLayer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars); 2175 2176 if (m_owningLayer.isRootLayer()) 2177 m_owningLayer.renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState); 2167 2178 2168 2179 compositor().didPaintBacking(this);
Note:
See TracChangeset
for help on using the changeset viewer.