Title: [247245] trunk/Source/WebKitLegacy/win
Revision
247245
Author
[email protected]
Date
2019-07-08 18:07:18 -0700 (Mon, 08 Jul 2019)

Log Message

[WinCairo] ASSERTION FAILED: info.bmBitsPixel == 32 in createCairoContextWithHDC
https://bugs.webkit.org/show_bug.cgi?id=198323

Reviewed by Per Arne Vollan.

WebView::paint binds m_backingStoreBitmap to a DC by using
SelectObject. WebView::paint can be called recursively, but
m_backingStoreBitmap can't be bound to multiple DCs at the same
time. Then, SelectObject was failing in such case.

Call WebCore::Page::updateRendering before binding
m_backingStoreBitmap instead of after it.

Reverted r202744 change which won't be needed since this change.

* WebView.cpp:
(WebView::scrollBackingStore): Removed r202744's change.
(WebView::updateBackingStore): Removed m_page->updateRendering().
(WebView::paint): Do m_page->updateRendering() before binding m_backingStoreBitmap.
* WebView.h: Removed unused WebView::isPainting.

Modified Paths

Diff

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (247244 => 247245)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2019-07-09 01:03:27 UTC (rev 247244)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2019-07-09 01:07:18 UTC (rev 247245)
@@ -1,3 +1,26 @@
+2019-07-08  Fujii Hironori  <[email protected]>
+
+        [WinCairo] ASSERTION FAILED: info.bmBitsPixel == 32 in createCairoContextWithHDC
+        https://bugs.webkit.org/show_bug.cgi?id=198323
+
+        Reviewed by Per Arne Vollan.
+
+        WebView::paint binds m_backingStoreBitmap to a DC by using
+        SelectObject. WebView::paint can be called recursively, but
+        m_backingStoreBitmap can't be bound to multiple DCs at the same
+        time. Then, SelectObject was failing in such case.
+
+        Call WebCore::Page::updateRendering before binding
+        m_backingStoreBitmap instead of after it.
+
+        Reverted r202744 change which won't be needed since this change.
+
+        * WebView.cpp:
+        (WebView::scrollBackingStore): Removed r202744's change.
+        (WebView::updateBackingStore): Removed m_page->updateRendering().
+        (WebView::paint): Do m_page->updateRendering() before binding m_backingStoreBitmap.
+        * WebView.h: Removed unused WebView::isPainting.
+
 2019-07-02  Devin Rousso  <[email protected]>
 
         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (247244 => 247245)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2019-07-09 01:03:27 UTC (rev 247244)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2019-07-09 01:07:18 UTC (rev 247245)
@@ -1015,15 +1015,7 @@
     HWndDC windowDC(m_viewWindow);
     auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(windowDC));
     HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap->get());
-    if (!oldBitmap) {
-        // The ::SelectObject call will fail if m_backingStoreBitmap is already selected into a device context.
-        // This happens when this method is called indirectly from WebView::updateBackingStore during normal WM_PAINT handling.
-        // There is no point continuing, since we would just be scrolling a 1x1 bitmap which is selected into the device context by default.
-        // We can just scroll by repainting the scroll rectangle.
-        RECT scrollRect(scrollViewRect);
-        ::InvalidateRect(m_viewWindow, &scrollRect, FALSE);
-        return;
-    }
+    ASSERT(oldBitmap);
 
     // Scroll the bitmap.
     RECT scrollRectWin(scrollViewRect);
@@ -1164,6 +1156,7 @@
         bitmapDCObject = adoptGDIObject(::CreateCompatibleDC(windowDC));
         bitmapDC = bitmapDCObject.get();
         oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->get());
+        ASSERT(oldBitmap);
 #if USE(DIRECT2D)
         HRESULT hr = m_backingStoreGdiInterop->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &bitmapDC);
         RELEASE_ASSERT(SUCCEEDED(hr));
@@ -1171,9 +1164,6 @@
     }
 
     if (m_backingStoreBitmap && (m_backingStoreDirtyRegion || backingStoreCompletelyDirty)) {
-        // Do a layout first so that everything we render to the backing store is always current.
-        m_page->updateRendering();
-
         Vector<IntRect> paintRects;
         if (!backingStoreCompletelyDirty && m_backingStoreDirtyRegion) {
             RECT regionBox;
@@ -1305,6 +1295,8 @@
         return;
     }
 
+    m_page->updateRendering();
+
     Frame* coreFrame = core(m_mainFrame);
     if (!coreFrame)
         return;
@@ -1341,8 +1333,6 @@
         return;
     }
 
-    m_paintCount++;
-
     auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(hdc));
     HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap->get());
 
@@ -1377,8 +1367,6 @@
     m_backingStoreGdiInterop->ReleaseDC(nullptr);
 #endif
 
-    m_paintCount--;
-
     if (active())
         cancelDeleteBackingStoreSoon();
     else

Modified: trunk/Source/WebKitLegacy/win/WebView.h (247244 => 247245)


--- trunk/Source/WebKitLegacy/win/WebView.h	2019-07-09 01:03:27 UTC (rev 247244)
+++ trunk/Source/WebKitLegacy/win/WebView.h	2019-07-09 01:07:18 UTC (rev 247245)
@@ -475,8 +475,6 @@
     const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent&);
 
-    bool isPainting() const { return m_paintCount > 0; }
-
     void setToolTip(const WTF::String&);
 
     void registerForIconNotification(bool listen);
@@ -670,7 +668,6 @@
     COMPtr<IDropTargetHelper> m_dropTargetHelper;
     UChar m_currentCharacterCode { 0 };
     bool m_isBeingDestroyed { false };
-    unsigned m_paintCount { 0 };
     bool m_hasSpellCheckerDocumentTag { false };
     bool m_didClose { false };
     bool m_hasCustomDropTarget { false };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to