Title: [118514] trunk
- Revision
- 118514
- Author
- [email protected]
- Date
- 2012-05-25 05:18:04 -0700 (Fri, 25 May 2012)
Log Message
[Qt] Broken controls rendering when transform is applied.
https://bugs.webkit.org/show_bug.cgi?id=87483
Patch by Zalan Bujtas <[email protected]> on 2012-05-25
Reviewed by Simon Hausmann.
.:
* ManualTests/qt/control_paiting_with_transforms.html: Added.
Source/WebCore:
Use only the scaling transform value to determine the size of
the control to be drawn. When other transforms present such as
rotate or skew, ignore them, unless scaling also involved. In
that case, calculate the scaling value out of the transformation.
* ManualTests/qt/control_paiting_with_transforms.html: Added.
* platform/qt/RenderThemeQtMobile.cpp:
(WebCore::painterScale):
(WebCore):
(WebCore::StylePainterMobile::sizeForPainterScale):
Modified Paths
Added Paths
Diff
Modified: trunk/ChangeLog (118513 => 118514)
--- trunk/ChangeLog 2012-05-25 12:05:41 UTC (rev 118513)
+++ trunk/ChangeLog 2012-05-25 12:18:04 UTC (rev 118514)
@@ -1,3 +1,12 @@
+2012-05-25 Zalan Bujtas <[email protected]>
+
+ [Qt] Broken controls rendering when transform is applied.
+ https://bugs.webkit.org/show_bug.cgi?id=87483
+
+ Reviewed by Simon Hausmann.
+
+ * ManualTests/qt/control_paiting_with_transforms.html: Added.
+
2012-05-24 Tim Horton <[email protected]>
Add feature defines for web-facing parts of CSS Regions and Exclusions
Added: trunk/ManualTests/qt/control_paiting_with_transforms.html (0 => 118514)
--- trunk/ManualTests/qt/control_paiting_with_transforms.html (rev 0)
+++ trunk/ManualTests/qt/control_paiting_with_transforms.html 2012-05-25 12:18:04 UTC (rev 118514)
@@ -0,0 +1,23 @@
+<html>
+<head>
+ <script>
+ var d = 0;
+
+ function rotate() {
+ d+=1;
+ document.getElementById('text_rotate').style.webkitTransform = "rotate(" + d + "deg)";
+ document.getElementById('button_rotate').style.webkitTransform = "rotate(" + (360 - d) + "deg)";
+ setTimeout('rotate()', 10);
+ }
+ </script>
+</head>
+<body>
+ <p>This tests the quality of the control drawing, while transform is applied.<br>
+ Click on the button and check for quality regression, while rotating.</p>
+ <input type='button' value='rotate' _onclick_='rotate();'>
+ <input id='text_rotate'; style='position:absolute; left:300px; top:100px; -webkit-transform: rotate(0deg);' type='text' value=''>
+ <input id='button_rotate'; style='position:absolute; left:300px; top:300px; -webkit-transform: rotate(0deg);' type='button' value=' '>
+</body>
+</html>
+
+
Modified: trunk/Source/WebCore/ChangeLog (118513 => 118514)
--- trunk/Source/WebCore/ChangeLog 2012-05-25 12:05:41 UTC (rev 118513)
+++ trunk/Source/WebCore/ChangeLog 2012-05-25 12:18:04 UTC (rev 118514)
@@ -1,3 +1,22 @@
+2012-05-25 Zalan Bujtas <[email protected]>
+
+ [Qt] Broken controls rendering when transform is applied.
+ https://bugs.webkit.org/show_bug.cgi?id=87483
+
+ Reviewed by Simon Hausmann.
+
+ Use only the scaling transform value to determine the size of
+ the control to be drawn. When other transforms present such as
+ rotate or skew, ignore them, unless scaling also involved. In
+ that case, calculate the scaling value out of the transformation.
+
+ * ManualTests/qt/control_paiting_with_transforms.html: Added.
+
+ * platform/qt/RenderThemeQtMobile.cpp:
+ (WebCore::painterScale):
+ (WebCore):
+ (WebCore::StylePainterMobile::sizeForPainterScale):
+
2012-05-17 Andrey Kosyakov <[email protected]>
[chromium] add instrumentation for compositing
Modified: trunk/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp (118513 => 118514)
--- trunk/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp 2012-05-25 12:05:41 UTC (rev 118513)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp 2012-05-25 12:18:04 UTC (rev 118514)
@@ -80,6 +80,24 @@
static QHash<KeyIdentifier, CacheKey> cacheKeys;
+static qreal painterScale(QPainter* painter)
+{
+ if (!painter)
+ return 1;
+
+ const QTransform& transform = painter->transform();
+ qreal scale = 1;
+
+ if (transform.type() == QTransform::TxScale)
+ scale = qAbs(transform.m11());
+ else if (transform.type() >= QTransform::TxRotate) {
+ const QLineF l1(0, 0, 1, 0);
+ const QLineF l2 = transform.map(l1);
+ scale = qAbs(l2.length() / l1.length());
+ }
+ return scale;
+}
+
uint qHash(const KeyIdentifier& id)
{
const quint32 value = id.trait1 + (id.trait2 << 1) + (uint(id.type) << 2) + (id.height << 5) + (id.width << 14) + (id.trait3 << 25);
@@ -132,11 +150,6 @@
return QRect(rect.topLeft(), QSize(side, side));
}
-static inline qreal painterScale(QPainter* painter)
-{
- return painter ? painter->transform().m11() : 1;
-}
-
static inline QPen borderPen(QPainter* painter = 0)
{
return QPen(darkColor, 0.4 * painterScale(painter), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
@@ -201,8 +214,10 @@
QSize StylePainterMobile::sizeForPainterScale(const QRect& rect) const
{
- const QRect mappedRect = painter->transform().mapRect(rect);
- return mappedRect.size();
+ qreal scale = painterScale(painter);
+ QTransform scaleTransform = QTransform::fromScale(scale, scale);
+
+ return scaleTransform.mapRect(rect).size();
}
void StylePainterMobile::drawChecker(QPainter* painter, const QRect& rect, const QColor& color) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes