Diff
Modified: trunk/Source/WebCore/ChangeLog (222602 => 222603)
--- trunk/Source/WebCore/ChangeLog 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/ChangeLog 2017-09-28 06:16:52 UTC (rev 222603)
@@ -1,3 +1,50 @@
+2017-09-27 Zan Dobersek <[email protected]>
+
+ [Cairo] Drop cairo_matrix_t conversion operators for AffineTransform, TransformationMatrix
+ https://bugs.webkit.org/show_bug.cgi?id=177539
+
+ Reviewed by Carlos Garcia Campos.
+
+ Remove the cairo_matrix_t conversion operators from the AffineTransform
+ and TransformationMatrix classes. These are rarely used, but enforce
+ including the cairo.h header in both headers, which leads to the Cairo
+ headers being included in around 800 build targets.
+
+ Instead, the toCairoMatrix() function is added to CairoUtilities.h that
+ creates a cairo_matrix_t object for the given AffineTransform. No
+ toCairoMatrix() is needed for TransformationMatrix since objects of
+ that type aren't converted to cairo_matrix_t anywhere in the codebase.
+
+ This patch excludes unnecessary Cairo headers from about 550 build
+ targets (with those headers being included in the other affected 250
+ targets by some other header inclusion chain). CairoUtilities.h header
+ is now included where necessary to make toCairoMatrix() available, and
+ duplicated cairo.h inclusions are removed.
+
+ No new tests -- no change in behavior.
+
+ * editing/gtk/EditorGtk.cpp: Explicitly include <cairo.h> since it's
+ necessary for Cairo operations used there.
+ * platform/Cairo.cmake:
+ * platform/graphics/cairo/CairoUtilities.cpp:
+ (WebCore::drawPatternToCairoContext):
+ (WebCore::toCairoMatrix):
+ * platform/graphics/cairo/CairoUtilities.h:
+ * platform/graphics/cairo/GradientCairo.cpp:
+ (WebCore::Gradient::platformGradient):
+ (WebCore::Gradient::setPlatformGradientSpaceTransform):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::concatCTM):
+ (WebCore::GraphicsContext::setCTM):
+ * platform/graphics/cairo/PathCairo.cpp: No need to include AffineTransform.h.
+ (WebCore::Path::addPath):
+ (WebCore::Path::transform):
+ * platform/graphics/cairo/PatternCairo.cpp: Ditto.
+ (WebCore::Pattern::createPlatformPattern const):
+ * platform/graphics/cairo/TransformationMatrixCairo.cpp: Removed.
+ * platform/graphics/transforms/AffineTransform.h:
+ * platform/graphics/transforms/TransformationMatrix.h:
+
2017-09-27 Alex Christensen <[email protected]>
Add WKContentRuleList notify action type
Modified: trunk/Source/WebCore/editing/gtk/EditorGtk.cpp (222602 => 222603)
--- trunk/Source/WebCore/editing/gtk/EditorGtk.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/editing/gtk/EditorGtk.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -45,6 +45,7 @@
#include "SelectionData.h"
#include "XLinkNames.h"
#include "markup.h"
+#include <cairo.h>
namespace WebCore {
Modified: trunk/Source/WebCore/platform/Cairo.cmake (222602 => 222603)
--- trunk/Source/WebCore/platform/Cairo.cmake 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/Cairo.cmake 2017-09-28 06:16:52 UTC (rev 222603)
@@ -20,7 +20,6 @@
platform/graphics/cairo/PlatformContextCairo.cpp
platform/graphics/cairo/PlatformPathCairo.cpp
platform/graphics/cairo/RefPtrCairo.cpp
- platform/graphics/cairo/TransformationMatrixCairo.cpp
)
list(APPEND WebCore_LIBRARIES
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -254,7 +254,7 @@
// are drawing a repeated pattern. This means that, assuming that (w, h) is the size of the pattern, samplig it at (x, y) is the same
// than sampling it at (x mod w, y mod h), so we transform the translation component of the pattern matrix in that way.
- cairo_matrix_t patternMatrix = cairo_matrix_t(patternTransform);
+ cairo_matrix_t patternMatrix = toCairoMatrix(patternTransform);
// dx and dy are added here as well to compensate the previous translation of the destination rectangle.
double phaseOffsetX = phase.x() + tileRect.x() * patternTransform.a() + dx;
double phaseOffsetY = phase.y() + tileRect.y() * patternTransform.d() + dy;
@@ -385,6 +385,11 @@
return cairoRegion;
}
+cairo_matrix_t toCairoMatrix(const AffineTransform& transform)
+{
+ return cairo_matrix_t { transform.a(), transform.b(), transform.c(), transform.d(), transform.e(), transform.f() };
+}
+
} // namespace WebCore
#endif // USE(CAIRO)
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2017-09-28 06:16:52 UTC (rev 222603)
@@ -95,6 +95,8 @@
RefPtr<cairo_region_t> toCairoRegion(const Region&);
+cairo_matrix_t toCairoMatrix(const AffineTransform&);
+
} // namespace WebCore
#endif // USE(CAIRO)
Modified: trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -29,9 +29,9 @@
#if USE(CAIRO)
+#include "CairoUtilities.h"
#include "GraphicsContext.h"
#include "PlatformContextCairo.h"
-#include <cairo.h>
namespace WebCore {
@@ -84,7 +84,7 @@
break;
}
- cairo_matrix_t matrix = m_gradientSpaceTransformation;
+ cairo_matrix_t matrix = toCairoMatrix(m_gradientSpaceTransformation);
cairo_matrix_invert(&matrix);
cairo_pattern_set_matrix(m_gradient, &matrix);
@@ -94,7 +94,7 @@
void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)
{
if (m_gradient) {
- cairo_matrix_t matrix = gradientSpaceTransformation;
+ cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransformation);
cairo_matrix_invert(&matrix);
cairo_pattern_set_matrix(m_gradient, &matrix);
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -822,7 +822,7 @@
}
cairo_t* cr = platformContext()->cr();
- const cairo_matrix_t matrix = cairo_matrix_t(transform);
+ const cairo_matrix_t matrix = toCairoMatrix(transform);
cairo_transform(cr, &matrix);
m_data->concatCTM(transform);
}
@@ -838,7 +838,7 @@
}
cairo_t* cr = platformContext()->cr();
- const cairo_matrix_t matrix = cairo_matrix_t(transform);
+ const cairo_matrix_t matrix = toCairoMatrix(transform);
cairo_set_matrix(cr, &matrix);
m_data->setCTM(transform);
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -28,12 +28,11 @@
#if USE(CAIRO)
-#include "AffineTransform.h"
+#include "CairoUtilities.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "PlatformPathCairo.h"
#include "StrokeStyleApplier.h"
-#include <cairo.h>
#include <math.h>
#include <wtf/MathExtras.h>
#include <wtf/text/WTFString.h>
@@ -317,7 +316,7 @@
if (path.isNull())
return;
- cairo_matrix_t matrix(transform);
+ cairo_matrix_t matrix = toCairoMatrix(transform);
if (cairo_matrix_invert(&matrix) != CAIRO_STATUS_SUCCESS)
return;
@@ -431,12 +430,12 @@
cairo_path_destroy(pathCopy);
}
-void Path::transform(const AffineTransform& trans)
+void Path::transform(const AffineTransform& transform)
{
cairo_t* cr = ensurePlatformPath()->context();
- cairo_matrix_t c_matrix = cairo_matrix_t(trans);
- cairo_matrix_invert(&c_matrix);
- cairo_transform(cr, &c_matrix);
+ cairo_matrix_t matrix = toCairoMatrix(transform);
+ cairo_matrix_invert(&matrix);
+ cairo_transform(cr, &matrix);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/cairo/PatternCairo.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/PatternCairo.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/PatternCairo.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -28,9 +28,8 @@
#if USE(CAIRO)
-#include "AffineTransform.h"
+#include "CairoUtilities.h"
#include "GraphicsContext.h"
-#include <cairo.h>
namespace WebCore {
@@ -43,7 +42,7 @@
cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface.get());
// cairo merges patter space and user space itself
- cairo_matrix_t matrix = m_patternSpaceTransformation;
+ cairo_matrix_t matrix = toCairoMatrix(m_patternSpaceTransformation);
cairo_matrix_invert(&matrix);
cairo_pattern_set_matrix(pattern, &matrix);
Deleted: trunk/Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp 2017-09-28 06:16:52 UTC (rev 222603)
@@ -1,67 +0,0 @@
-/*
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "TransformationMatrix.h"
-
-#if USE(CAIRO)
-
-#include "AffineTransform.h"
-#include "FloatRect.h"
-#include "IntRect.h"
-#include <cairo.h>
-
-namespace WebCore {
-
-TransformationMatrix::operator cairo_matrix_t() const
-{
- cairo_matrix_t m;
-
- cairo_matrix_init (&m,
- a(),
- b(),
- c(),
- d(),
- e(),
- f());
- return m;
-}
-
-AffineTransform::operator cairo_matrix_t() const
-{
- cairo_matrix_t m;
-
- cairo_matrix_init (&m,
- a(),
- b(),
- c(),
- d(),
- e(),
- f());
- return m;
-}
-
-} // namespace WebCore
-
-#endif // USE(CAIRO)
Modified: trunk/Source/WebCore/platform/graphics/transforms/AffineTransform.h (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/transforms/AffineTransform.h 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/transforms/AffineTransform.h 2017-09-28 06:16:52 UTC (rev 222603)
@@ -34,8 +34,6 @@
#if USE(CG)
typedef struct CGAffineTransform CGAffineTransform;
-#elif USE(CAIRO)
-#include <cairo.h>
#endif
#if PLATFORM(WIN)
@@ -181,8 +179,6 @@
#if USE(CG)
WEBCORE_EXPORT operator CGAffineTransform() const;
-#elif USE(CAIRO)
- operator cairo_matrix_t() const;
#endif
#if PLATFORM(WIN)
Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h (222602 => 222603)
--- trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h 2017-09-28 05:43:39 UTC (rev 222602)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h 2017-09-28 06:16:52 UTC (rev 222603)
@@ -37,8 +37,6 @@
#endif
#if USE(CG)
typedef struct CGAffineTransform CGAffineTransform;
-#elif USE(CAIRO)
-#include <cairo.h>
#endif
#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
@@ -360,8 +358,6 @@
#if USE(CG)
WEBCORE_EXPORT TransformationMatrix(const CGAffineTransform&);
WEBCORE_EXPORT operator CGAffineTransform() const;
-#elif USE(CAIRO)
- operator cairo_matrix_t() const;
#endif
#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))