Diff
Modified: trunk/Source/WebCore/ChangeLog (111599 => 111600)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 20:41:43 UTC (rev 111600)
@@ -1,3 +1,45 @@
+2012-03-21 Tim Horton <[email protected]>
+
+ Make use of CG rounded-rect primitives
+ https://bugs.webkit.org/show_bug.cgi?id=79932
+ <rdar://problem/9274953>
+
+ Reviewed by Simon Fraser.
+
+ Portions of patch by Nikolas Zimmermann and Mustafizur Rahaman.
+
+ Dispatch to potentially platform-specific rounded rectangle path
+ construction from addPathForRoundedRect. Make use of this to call
+ wkCGPathAddRoundedRect on Lion and above, as long as the rounded
+ corners are all equivalent.
+
+ The origin of the stroke dash differs between the bezier approach
+ and the path added by wkCGPathAddRoundedRect, so Path::addRoundedRect()
+ takes a new parameter allowing code which is sensitive to stroke dash
+ origin (i.e. SVG) to fall back to the old behavior if need be.
+
+ Make use of the new Path::addRoundedRect() parameter to fall back to
+ the old (bezier) rounded-rect behavior when constructing a dashed SVG path,
+ in order to continue complying with the spec.
+
+ No new tests, as this is covered by many that use rounded corners,
+ and is only a performance improvement.
+
+ * WebCore.exp.in:
+ * platform/graphics/Path.cpp:
+ (WebCore::Path::addRoundedRect):
+ (WebCore):
+ (WebCore::Path::addPathForRoundedRect):
+ * platform/graphics/Path.h:
+ (Path):
+ * platform/graphics/cg/PathCG.cpp:
+ (WebCore::Path::platformAddPathForRoundedRect):
+ (WebCore):
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+ * rendering/svg/SVGPathData.cpp:
+ (WebCore::updatePathFromRectElement):
+
2012-03-21 David Reveman <[email protected]>
[Chromium] GL_EXT_occlusion_query_boolean and GL_CHROMIUM_command_buffer_query support.
Modified: trunk/Source/WebCore/WebCore.exp.in (111599 => 111600)
--- trunk/Source/WebCore/WebCore.exp.in 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-03-21 20:41:43 UTC (rev 111600)
@@ -807,7 +807,7 @@
__ZN7WebCore4Page9initGroupEv
__ZN7WebCore4PageC1ERNS0_11PageClientsE
__ZN7WebCore4PageD1Ev
-__ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeE
+__ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeENS0_19RoundedRectStrategyE
__ZN7WebCore4PathC1Ev
__ZN7WebCore4PathD1Ev
__ZN7WebCore4coreEP20NSURLProtectionSpace
@@ -1526,6 +1526,9 @@
#endif
_wkCGContextGetShouldSmoothFonts
_wkCGContextResetClip
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+_wkCGPathAddRoundedRect
+#endif
_wkCGPatternCreateWithImageAndTransform
_wkCopyCFLocalizationPreferredName
_wkCopyCFURLResponseSuggestedFilename
Modified: trunk/Source/WebCore/platform/graphics/Path.cpp (111599 => 111600)
--- trunk/Source/WebCore/platform/graphics/Path.cpp 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/platform/graphics/Path.cpp 2012-03-21 20:41:43 UTC (rev 111600)
@@ -97,7 +97,7 @@
addRoundedRect(r.rect(), r.radii().topLeft(), r.radii().topRight(), r.radii().bottomLeft(), r.radii().bottomRight());
}
-void Path::addRoundedRect(const FloatRect& rect, const FloatSize& roundingRadii)
+void Path::addRoundedRect(const FloatRect& rect, const FloatSize& roundingRadii, RoundedRectStrategy strategy)
{
if (rect.isEmpty())
return;
@@ -115,10 +115,10 @@
if (radius.height() > halfSize.height())
radius.setHeight(halfSize.height());
- addBeziersForRoundedRect(rect, radius, radius, radius, radius);
+ addPathForRoundedRect(rect, radius, radius, radius, radius, strategy);
}
-void Path::addRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
+void Path::addRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy strategy)
{
if (rect.isEmpty())
return;
@@ -132,7 +132,21 @@
return;
}
+ addPathForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, strategy);
+}
+
+void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy strategy)
+{
+ if (strategy == PreferBezierRoundedRect) {
+ addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+ return;
+ }
+
+#if USE(CG)
+ platformAddPathForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+#else
addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+#endif
}
// Approximation of control point positions on a bezier to simulate a quarter of a circle.
Modified: trunk/Source/WebCore/platform/graphics/Path.h (111599 => 111600)
--- trunk/Source/WebCore/platform/graphics/Path.h 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/platform/graphics/Path.h 2012-03-21 20:41:43 UTC (rev 111600)
@@ -135,8 +135,14 @@
void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
void addRect(const FloatRect&);
void addEllipse(const FloatRect&);
- void addRoundedRect(const FloatRect&, const FloatSize& roundingRadii);
- void addRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
+
+ enum RoundedRectStrategy {
+ PreferNativeRoundedRect,
+ PreferBezierRoundedRect
+ };
+
+ void addRoundedRect(const FloatRect&, const FloatSize& roundingRadii, RoundedRectStrategy = PreferNativeRoundedRect);
+ void addRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect);
void addRoundedRect(const RoundedRect&);
void translate(const FloatSize&);
@@ -146,8 +152,13 @@
void apply(void* info, PathApplierFunction) const;
void transform(const AffineTransform&);
+ void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect);
void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
+#if USE(CG)
+ void platformAddPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
+#endif
+
private:
PlatformPathPtr m_path;
};
Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (111599 => 111600)
--- trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp 2012-03-21 20:41:43 UTC (rev 111600)
@@ -39,6 +39,14 @@
#include <wtf/MathExtras.h>
#include <wtf/RetainPtr.h>
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
namespace WebCore {
static size_t putBytesNowhere(void*, const void*, size_t count)
@@ -226,6 +234,21 @@
CGPathAddArcToPoint(m_path, 0, p1.x(), p1.y(), p2.x(), p2.y(), radius);
}
+void Path::platformAddPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
+{
+#if PLATFORM(MAC) && (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD))
+ bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width());
+ bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height());
+
+ if (equalWidths && equalHeights) {
+ wkCGPathAddRoundedRect(m_path, 0, rect, topLeftRadius.width(), topLeftRadius.height());
+ return;
+ }
+#endif
+
+ addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+}
+
void Path::closeSubpath()
{
CGPathCloseSubpath(m_path);
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (111599 => 111600)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2012-03-21 20:41:43 UTC (rev 111600)
@@ -41,6 +41,7 @@
typedef struct CGFont *CGFontRef;
typedef struct CGColorSpace *CGColorSpaceRef;
typedef struct CGPattern *CGPatternRef;
+typedef struct CGPath *CGMutablePathRef;
typedef unsigned short CGGlyph;
typedef struct __CFReadStream * CFReadStreamRef;
typedef struct __CFRunLoop * CFRunLoopRef;
@@ -306,6 +307,10 @@
extern bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
#endif
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+extern void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
+#endif
+
}
#endif
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (111599 => 111600)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2012-03-21 20:41:43 UTC (rev 111600)
@@ -186,3 +186,7 @@
NSString *(*wkGetMacOSXVersionString)(void);
bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
#endif
+
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
+#endif
Modified: trunk/Source/WebCore/rendering/svg/SVGPathData.cpp (111599 => 111600)
--- trunk/Source/WebCore/rendering/svg/SVGPathData.cpp 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebCore/rendering/svg/SVGPathData.cpp 2012-03-21 20:41:43 UTC (rev 111600)
@@ -133,7 +133,10 @@
rx = ry;
else if (!hasRy)
ry = rx;
- path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry));
+ // FIXME: We currently enforce using beziers here, as at least on CoreGraphics/Lion, as
+ // the native method uses a different line dash origin, causing svg/custom/dashOrigin.svg to fail.
+ // See bug https://bugs.webkit.org/show_bug.cgi?id=79932 which tracks this issue.
+ path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry), Path::PreferBezierRoundedRect);
return;
}
Modified: trunk/Source/WebKit/mac/ChangeLog (111599 => 111600)
--- trunk/Source/WebKit/mac/ChangeLog 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebKit/mac/ChangeLog 2012-03-21 20:41:43 UTC (rev 111600)
@@ -1,3 +1,18 @@
+2012-03-21 Tim Horton <[email protected]>
+
+ Make use of CG rounded-rect primitives
+ https://bugs.webkit.org/show_bug.cgi?id=79932
+ <rdar://problem/9274953>
+
+ Reviewed by Simon Fraser.
+
+ Portions of patch by Nikolas Zimmermann and Mustafizur Rahaman.
+
+ Add wkCGPathAddRoundedRect.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2012-03-20 Gyuyoung Kim <[email protected]>
Convert hasSpellingMarker to use Internals interface.
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (111599 => 111600)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2012-03-21 20:41:43 UTC (rev 111600)
@@ -180,5 +180,9 @@
INIT(ExecutableWasLinkedOnOrBeforeLion);
#endif
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ INIT(CGPathAddRoundedRect);
+#endif
+
didInit = true;
}
Modified: trunk/Source/WebKit2/ChangeLog (111599 => 111600)
--- trunk/Source/WebKit2/ChangeLog 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-21 20:41:43 UTC (rev 111600)
@@ -1,3 +1,18 @@
+2012-03-21 Tim Horton <[email protected]>
+
+ Make use of CG rounded-rect primitives
+ https://bugs.webkit.org/show_bug.cgi?id=79932
+ <rdar://problem/9274953>
+
+ Reviewed by Simon Fraser.
+
+ Portions of patch by Nikolas Zimmermann and Mustafizur Rahaman.
+
+ Add wkCGPathAddRoundedRect.
+
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2012-03-21 Jocelyn Turcotte <[email protected]>
[Qt] WebGraphicsLayer: Untie the layer updates and tile updates.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (111599 => 111600)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2012-03-21 20:29:02 UTC (rev 111599)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2012-03-21 20:41:43 UTC (rev 111600)
@@ -167,5 +167,9 @@
INIT(ExecutableWasLinkedOnOrBeforeLion);
#endif
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ INIT(CGPathAddRoundedRect);
+#endif
+
});
}