Title: [221389] tags/Safari-605.1.4/Source/WebKit

Diff

Modified: tags/Safari-605.1.4/Source/WebKit/ChangeLog (221388 => 221389)


--- tags/Safari-605.1.4/Source/WebKit/ChangeLog	2017-08-30 19:06:49 UTC (rev 221388)
+++ tags/Safari-605.1.4/Source/WebKit/ChangeLog	2017-08-30 19:10:11 UTC (rev 221389)
@@ -1,3 +1,7 @@
+2017-08-30  Jason Marcell  <jmarc...@apple.com>
+
+        Revert r221149. rdar://problem/34029673
+
 2017-08-29  Carlos Garcia Campos  <cgar...@igalia.com>
 
         REGRESSION(r221064): [GTK] Editor not correctly working after r221064

Modified: tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.cpp (221388 => 221389)


--- tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.cpp	2017-08-30 19:06:49 UTC (rev 221388)
+++ tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.cpp	2017-08-30 19:10:11 UTC (rev 221389)
@@ -84,7 +84,7 @@
 
 RefPtr<ShareableBitmap> ShareableBitmap::create(const IntSize& size, Configuration configuration)
 {
-    auto numBytes = numBytesForSize(size, configuration);
+    auto numBytes = numBytesForSize(size, calculateBytesPerPixel(configuration));
     if (numBytes.hasOverflowed())
         return nullptr;
 
@@ -97,7 +97,7 @@
 
 RefPtr<ShareableBitmap> ShareableBitmap::createShareable(const IntSize& size, Configuration configuration)
 {
-    auto numBytes = numBytesForSize(size, configuration);
+    auto numBytes = numBytesForSize(size, calculateBytesPerPixel(configuration));
     if (numBytes.hasOverflowed())
         return nullptr;
 
@@ -112,7 +112,7 @@
 {
     ASSERT(sharedMemory);
 
-    auto numBytes = numBytesForSize(size, configuration);
+    auto numBytes = numBytesForSize(size, calculateBytesPerPixel(configuration));
     if (numBytes.hasOverflowed())
         return nullptr;
     if (sharedMemory->size() < numBytes.unsafeGet()) {
@@ -174,9 +174,11 @@
     return m_data;
 }
 
-Checked<unsigned, RecordOverflow> ShareableBitmap::numBytesForSize(WebCore::IntSize size, const ShareableBitmap::Configuration& configuration)
+#if !USE(CG)
+unsigned ShareableBitmap::calculateBytesPerPixel(const Configuration&)
 {
-    return calculateBytesPerRow(size, configuration) * size.height();
+    return 4;
 }
+#endif
 
 } // namespace WebKit

Modified: tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.h (221388 => 221389)


--- tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.h	2017-08-30 19:06:49 UTC (rev 221388)
+++ tags/Safari-605.1.4/Source/WebKit/Shared/ShareableBitmap.h	2017-08-30 19:10:11 UTC (rev 221389)
@@ -129,9 +129,12 @@
     ShareableBitmap(const WebCore::IntSize&, Configuration, void*);
     ShareableBitmap(const WebCore::IntSize&, Configuration, RefPtr<SharedMemory>);
 
-    static Checked<unsigned, RecordOverflow> numBytesForSize(WebCore::IntSize, const ShareableBitmap::Configuration&);
-    static Checked<unsigned, RecordOverflow> calculateBytesPerRow(WebCore::IntSize, const Configuration&);
-    static unsigned calculateBytesPerPixel(const Configuration&);
+#if USE(CAIRO)
+    static Checked<unsigned, RecordOverflow> numBytesForSize(const WebCore::IntSize&);
+    static Checked<unsigned, RecordOverflow> numBytesForSize(const WebCore::IntSize& size, unsigned bytesPerPixel) { return numBytesForSize(size); }
+#else
+    static Checked<unsigned, RecordOverflow> numBytesForSize(const WebCore::IntSize& size, unsigned bytesPerPixel) { return size.area<RecordOverflow>() * bytesPerPixel; }
+#endif
 
 #if USE(CG)
     RetainPtr<CGImageRef> createCGImage(CGDataProviderRef) const;
@@ -144,8 +147,14 @@
 #endif
 
     void* data() const;
-    size_t sizeInBytes() const { return numBytesForSize(m_size, m_configuration).unsafeGet(); }
+#if USE(CAIRO)
+    size_t sizeInBytes() const { return numBytesForSize(m_size).unsafeGet(); }
+#else
+    size_t sizeInBytes() const { return numBytesForSize(m_size, calculateBytesPerPixel(m_configuration)).unsafeGet(); }
+#endif
 
+    static unsigned calculateBytesPerPixel(const Configuration&);
+
     WebCore::IntSize m_size;
     Configuration m_configuration;
 

Modified: tags/Safari-605.1.4/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (221388 => 221389)


--- tags/Safari-605.1.4/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2017-08-30 19:06:49 UTC (rev 221388)
+++ tags/Safari-605.1.4/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2017-08-30 19:10:11 UTC (rev 221389)
@@ -40,16 +40,11 @@
 
 static const cairo_format_t cairoFormat = CAIRO_FORMAT_ARGB32;
 
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration&)
+Checked<unsigned, RecordOverflow> ShareableBitmap::numBytesForSize(const WebCore::IntSize& size)
 {
-    return cairo_format_stride_for_width(cairoFormat, size.width());
+    return Checked<unsigned, RecordOverflow>(cairo_format_stride_for_width(cairoFormat, size.width())) * size.height();
 }
 
-unsigned ShareableBitmap::calculateBytesPerPixel(const Configuration&)
-{
-    return 4;
-}
-
 static inline RefPtr<cairo_surface_t> createSurfaceFromData(void* data, const WebCore::IntSize& size)
 {
     const int stride = cairo_format_stride_for_width(cairoFormat, size.width());

Modified: tags/Safari-605.1.4/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp (221388 => 221389)


--- tags/Safari-605.1.4/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp	2017-08-30 19:06:49 UTC (rev 221388)
+++ tags/Safari-605.1.4/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp	2017-08-30 19:10:11 UTC (rev 221389)
@@ -30,7 +30,6 @@
 #include <WebCore/GraphicsContextCG.h>
 #include <WebCore/PlatformScreen.h>
 #include <pal/spi/cg/CoreGraphicsSPI.h>
-#include <pal/spi/cocoa/IOSurfaceSPI.h>
 #include <wtf/RetainPtr.h>
 #include "CGUtilities.h"
 
@@ -75,16 +74,6 @@
     return info;
 }
 
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration& configuration)
-{
-    unsigned bytesPerRow = calculateBytesPerPixel(configuration) * size.width();
-#if USE(IOSURFACE)
-    return IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, bytesPerRow);
-#else
-    return bytesPerRow;
-#endif
-}
-
 unsigned ShareableBitmap::calculateBytesPerPixel(const Configuration& configuration)
 {
     return wantsExtendedRange(configuration) ? 8 : 4;
@@ -95,7 +84,7 @@
     ref(); // Balanced by deref in releaseBitmapContextData.
 
     unsigned bytesPerPixel = calculateBytesPerPixel(m_configuration);
-    RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreateWithData(data(), m_size.width(), m_size.height(), bytesPerPixel * 8 / 4, calculateBytesPerRow(m_size, m_configuration).unsafeGet(), colorSpace(m_configuration), bitmapInfo(m_configuration), releaseBitmapContextData, this));
+    RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreateWithData(data(), m_size.width(), m_size.height(), bytesPerPixel * 8 / 4, m_size.width() * bytesPerPixel, colorSpace(m_configuration), bitmapInfo(m_configuration), releaseBitmapContextData, this));
     
     ASSERT(bitmapContext.get());
 
@@ -134,7 +123,7 @@
 {
     ASSERT_ARG(dataProvider, dataProvider);
     unsigned bytesPerPixel = calculateBytesPerPixel(m_configuration);
-    RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(m_size.width(), m_size.height(), bytesPerPixel * 8 / 4, bytesPerPixel * 8, calculateBytesPerRow(m_size, m_configuration).unsafeGet(), colorSpace(m_configuration), bitmapInfo(m_configuration), dataProvider, 0, false, kCGRenderingIntentDefault));
+    RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(m_size.width(), m_size.height(), bytesPerPixel * 8 / 4, bytesPerPixel * 8, m_size.width() * bytesPerPixel, colorSpace(m_configuration), bitmapInfo(m_configuration), dataProvider, 0, false, kCGRenderingIntentDefault));
     return image;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to