Title: [153062] trunk/Source/WebCore
Revision
153062
Author
[email protected]
Date
2013-07-23 14:53:33 -0700 (Tue, 23 Jul 2013)

Log Message

Use Checked<uint32_t, RecordOverflow> instead of CheckedInt in GraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=118988

Reviewed by Oliver Hunt.

Use the WTF's Checked class, with uint32_t as the numeric type and RecordOverflow as the overflow handler,
instead of the CheckedInt class. This removes a layering violation that's occurring due to including the CheckedInt
header that's currently located in the WebCore layer (alongside the HTML canvas code in Source/WebCore/html/canvas).

* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::computeImageSizeInBytes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153061 => 153062)


--- trunk/Source/WebCore/ChangeLog	2013-07-23 19:47:34 UTC (rev 153061)
+++ trunk/Source/WebCore/ChangeLog	2013-07-23 21:53:33 UTC (rev 153062)
@@ -1,3 +1,17 @@
+2013-07-23  Zan Dobersek  <[email protected]>
+
+        Use Checked<uint32_t, RecordOverflow> instead of CheckedInt in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=118988
+
+        Reviewed by Oliver Hunt.
+
+        Use the WTF's Checked class, with uint32_t as the numeric type and RecordOverflow as the overflow handler,
+        instead of the CheckedInt class. This removes a layering violation that's occurring due to including the CheckedInt
+        header that's currently located in the WebCore layer (alongside the HTML canvas code in Source/WebCore/html/canvas).
+
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::computeImageSizeInBytes):
+
 2013-07-23  Zalan Bujtas  <[email protected]>
 
         REGRESSION(r152313): Links in certain twitter postings don't warp correctly on page

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp (153061 => 153062)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2013-07-23 19:47:34 UTC (rev 153061)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2013-07-23 21:53:33 UTC (rev 153062)
@@ -31,7 +31,6 @@
 
 #include "GraphicsContext3D.h"
 
-#include "CheckedInt.h"
 #include "Extensions3D.h"
 #include "Image.h"
 #include "ImageData.h"
@@ -203,11 +202,11 @@
             *paddingInBytes = 0;
         return GraphicsContext3D::NO_ERROR;
     }
-    CheckedInt<uint32_t> checkedValue(bytesPerComponent * componentsPerPixel);
+    Checked<uint32_t, RecordOverflow> checkedValue = bytesPerComponent * componentsPerPixel;
     checkedValue *=  width;
-    if (!checkedValue.isValid())
+    if (checkedValue.hasOverflowed())
         return GraphicsContext3D::INVALID_VALUE;
-    unsigned int validRowSize = checkedValue.value();
+    unsigned int validRowSize = checkedValue.unsafeGet();
     unsigned int padding = 0;
     unsigned int residual = validRowSize % alignment;
     if (residual) {
@@ -217,9 +216,9 @@
     // Last row needs no padding.
     checkedValue *= (height - 1);
     checkedValue += validRowSize;
-    if (!checkedValue.isValid())
+    if (checkedValue.hasOverflowed())
         return GraphicsContext3D::INVALID_VALUE;
-    *imageSizeInBytes = checkedValue.value();
+    *imageSizeInBytes = checkedValue.unsafeGet();
     if (paddingInBytes)
         *paddingInBytes = padding;
     return GraphicsContext3D::NO_ERROR;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to