WebKit1 Clients Are Not Reliably Repainted
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Mar 2015 23:01:21 +0000 (23:01 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Mar 2015 23:01:21 +0000 (23:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142750
<rdar://problem/20042453>

Reviewed by Simon Fraser.

Source/WebCore:

* page/FrameView.cpp:
(WebCore::FrameView::paintContents): Move "Red Rect" debug painting before
the early return so we can see when this happening in debug builds.
* page/FrameView.h:
(WebCore::FrameView::inPaintableState): Added.

Source/WebKit/mac:

Check with the FrameView to see if we are in an immediately paintable state. If we are not,
mark the view as dirty once the _immediateScrollToPoint operation is complete so that the
region will be painted properly.

* WebView/WebClipView.mm:
(-[WebClipView _immediateScrollToPoint:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181587 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebClipView.mm

index d4ed578..c9db22d 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-16  Brent Fulgham  <bfulgham@apple.com>
+
+        WebKit1 Clients Are Not Reliably Repainted
+        https://bugs.webkit.org/show_bug.cgi?id=142750
+        <rdar://problem/20042453>
+
+        Reviewed by Simon Fraser.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintContents): Move "Red Rect" debug painting before
+        the early return so we can see when this happening in debug builds.
+        * page/FrameView.h:
+        (WebCore::FrameView::inPaintableState): Added.
+
 2015-03-16  Chris Dumez  <cdumez@apple.com>
 
         Make DatabaseContext suspendable if there is no pending database activity
index 9f4f960..a0e0ae8 100644 (file)
@@ -3849,11 +3849,6 @@ void FrameView::didPaintContents(GraphicsContext* context, const IntRect& dirtyR
 
 void FrameView::paintContents(GraphicsContext* context, const IntRect& dirtyRect)
 {
-    if (m_layoutPhase == InViewSizeAdjust)
-        return;
-
-    ASSERT(m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout);
-
 #ifndef NDEBUG
     bool fillWithRed;
     if (frame().document()->printing())
@@ -3873,6 +3868,11 @@ void FrameView::paintContents(GraphicsContext* context, const IntRect& dirtyRect
         context->fillRect(dirtyRect, Color(0xFF, 0, 0), ColorSpaceDeviceRGB);
 #endif
 
+    if (m_layoutPhase == InViewSizeAdjust)
+        return;
+    
+    ASSERT(m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout);
+    
     RenderView* renderView = this->renderView();
     if (!renderView) {
         LOG_ERROR("called FrameView::paint with nil renderer");
index 3cd219e..a6f5810 100644 (file)
@@ -113,6 +113,7 @@ public:
     void unscheduleRelayout();
     bool layoutPending() const;
     bool isInLayout() const { return m_layoutPhase == InLayout; }
+    WEBCORE_EXPORT bool inPaintableState() { return m_layoutPhase != InLayout && m_layoutPhase != InViewSizeAdjust && m_layoutPhase != InPostLayout; }
 
     RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
     void clearLayoutRoot() { m_layoutRoot = nullptr; }
index a1d3f3c..dd41a9a 100644 (file)
@@ -1,3 +1,18 @@
+2015-03-16  Brent Fulgham  <bfulgham@apple.com>
+
+        WebKit1 Clients Are Not Reliably Repainted
+        https://bugs.webkit.org/show_bug.cgi?id=142750
+        <rdar://problem/20042453>
+
+        Reviewed by Simon Fraser.
+
+        Check with the FrameView to see if we are in an immediately paintable state. If we are not,
+        mark the view as dirty once the _immediateScrollToPoint operation is complete so that the
+        region will be painted properly.
+
+        * WebView/WebClipView.mm:
+        (-[WebClipView _immediateScrollToPoint:]): 
+
 2015-03-16  Conrad Shultz  <conrad_shultz@apple.com>
 
         Allow clients to selectively disable plug-ins
index 8a15751..2254de6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Inc.  All rights reserved.
+ * Copyright (C) 2005, 2015 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -111,6 +111,18 @@ using namespace WebCore;
 
     [[self window] _enableDelayedWindowDisplay];
 
+    // We may hit this immediate scrolling code during a layout operation trigged by an AppKit call. When
+    // this happens, WebCore will not paint. So, we need to mark this region dirty so that it paints properly.
+    WebFrameView *webFrameView = (WebFrameView *)[[self superview] superview];
+    if ([webFrameView isKindOfClass:[WebFrameView class]]) {
+        if (Frame* coreFrame = core([webFrameView webFrame])) {
+            if (FrameView* frameView = coreFrame->view()) {
+                if (!frameView->inPaintableState())
+                    [self setNeedsDisplay:YES];
+            }
+        }
+    }
+
     _isScrolling = NO;
 }