[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
yael.aharon at nokia.com
yael.aharon at nokia.com
Wed Dec 22 18:38:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 274d759239957d5639ac2ea793cc5cc899e3e8b8
Author: yael.aharon at nokia.com <yael.aharon at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 15 00:27:10 2010 +0000
[Qt] Focus rings are ugly, rects should be united instead of drawn individually
https://bugs.webkit.org/show_bug.cgi?id=49953
Reviewed by Andreas Kling.
WebCore:
Create a QPainterPath and add to it the focus rects, one at a time.
Combine the 2 drawFocusRing functions into one function drawFocusRingForPath.
Tests: fast/css/focus-ring-detached.html
fast/css/focus-ring-multiline.html
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::drawFocusRingForPath):
(WebCore::GraphicsContext::drawFocusRing):
LayoutTests:
* fast/css/focus-ring-detached.html: Added.
* fast/css/focus-ring-multiline.html: Added.
* platform/mac-snowleopard/fast/css/focus-ring-detached-expected.checksum: Added.
* platform/mac-snowleopard/fast/css/focus-ring-detached-expected.png: Added.
* platform/mac-snowleopard/fast/css/focus-ring-detached-expected.txt: Added.
* platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.checksum: Added.
* platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.png: Added.
* platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.txt: Added.
* platform/qt/fast/css/focus-ring-detached-expected.checksum: Added.
* platform/qt/fast/css/focus-ring-detached-expected.png: Added.
* platform/qt/fast/css/focus-ring-detached-expected.txt: Added.
* platform/qt/fast/css/focus-ring-multiline-expected.checksum: Added.
* platform/qt/fast/css/focus-ring-multiline-expected.png: Added.
* platform/qt/fast/css/focus-ring-multiline-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 16ee217..40a3725 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2010-12-14 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Focus rings are ugly, rects should be united instead of drawn individually
+ https://bugs.webkit.org/show_bug.cgi?id=49953
+
+ * fast/css/focus-ring-detached.html: Added.
+ * fast/css/focus-ring-multiline.html: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-detached-expected.checksum: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-detached-expected.png: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-detached-expected.txt: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.checksum: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.png: Added.
+ * platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.txt: Added.
+ * platform/qt/fast/css/focus-ring-detached-expected.checksum: Added.
+ * platform/qt/fast/css/focus-ring-detached-expected.png: Added.
+ * platform/qt/fast/css/focus-ring-detached-expected.txt: Added.
+ * platform/qt/fast/css/focus-ring-multiline-expected.checksum: Added.
+ * platform/qt/fast/css/focus-ring-multiline-expected.png: Added.
+ * platform/qt/fast/css/focus-ring-multiline-expected.txt: Added.
+
2010-12-14 David Hyatt <hyatt at apple.com>
Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/css/focus-ring-detached.html b/LayoutTests/fast/css/focus-ring-detached.html
new file mode 100644
index 0000000..cf35760
--- /dev/null
+++ b/LayoutTests/fast/css/focus-ring-detached.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script>
+window.onload = function()
+{
+ document.getElementById("detached").focus();
+}
+</script>
+</head>
+<body>
+<table>
+<tr>
+<td width=100px >This is some filler text. This is some filler text.This is some filler text. </td>
+<td width=350px> The text in this anchor element <a href="#" id="detached">should <br>contain</a> 2 detached pieces. This test shows how the link would look text.</td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/LayoutTests/fast/css/focus-ring-multiline.html b/LayoutTests/fast/css/focus-ring-multiline.html
new file mode 100644
index 0000000..6637c6a
--- /dev/null
+++ b/LayoutTests/fast/css/focus-ring-multiline.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script>
+window.onload = function()
+{
+ document.getElementById("multiline").focus();
+}
+</script>
+</head>
+<body>
+<table>
+<tr>
+<td width=100px>The <a href="#" id="multiline">text in this anchor element should spawn multiple lines. This test shows how multiline link would look</a>like. </td>
+<td width=350px>This is some filler text. This is some filler text. This is some filler text. This is some filler text. </td>
+</tr>
+</table>
+</body>
+</html>
+
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.checksum b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.checksum
new file mode 100644
index 0000000..aeb07a9
--- /dev/null
+++ b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.checksum
@@ -0,0 +1 @@
+07562578d7d94e74260b1bf3a4061e06
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.png b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.png
new file mode 100644
index 0000000..3db5b3b
Binary files /dev/null and b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.png differ
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.txt b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.txt
new file mode 100644
index 0000000..d45ed77
--- /dev/null
+++ b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-detached-expected.txt
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderTable {TABLE} at (0,0) size 460x96
+ RenderTableSection {TBODY} at (0,0) size 460x96
+ RenderTableRow {TR} at (0,2) size 460x92
+ RenderTableCell {TD} at (2,2) size 102x92 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 97x90
+ text run at (1,1) width 79: "This is some"
+ text run at (1,19) width 92: "filler text. This"
+ text run at (1,37) width 80: "is some filler"
+ text run at (1,55) width 69: "text.This is"
+ text run at (1,73) width 97: "some filler text."
+ RenderTableCell {TD} at (106,20) size 352x56 [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 198x18
+ text run at (1,1) width 198: "The text in this anchor element "
+ RenderInline {A} at (0,0) size 244x36 [color=#0000EE]
+ RenderText {#text} at (199,1) size 46x18
+ text run at (199,1) width 46: "should "
+ RenderBR {BR} at (245,15) size 0x0
+ RenderText {#text} at (1,19) size 46x18
+ text run at (1,19) width 46: "contain"
+ RenderText {#text} at (47,19) size 349x36
+ text run at (47,19) width 303: " 2 detached pieces. This test shows how the link"
+ text run at (1,37) width 103: "would look text."
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.checksum b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.checksum
new file mode 100644
index 0000000..35c07d1
--- /dev/null
+++ b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.checksum
@@ -0,0 +1 @@
+b129efac6f1bea707ca32e8de70bf80f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.png b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.png
new file mode 100644
index 0000000..906b65b
Binary files /dev/null and b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.png differ
diff --git a/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.txt b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.txt
new file mode 100644
index 0000000..91a570c
--- /dev/null
+++ b/LayoutTests/platform/mac-snowleopard/fast/css/focus-ring-multiline-expected.txt
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderTable {TABLE} at (0,0) size 460x150
+ RenderTableSection {TBODY} at (0,0) size 460x150
+ RenderTableRow {TR} at (0,2) size 460x146
+ RenderTableCell {TD} at (2,2) size 102x146 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 29x18
+ text run at (1,1) width 29: "The "
+ RenderInline {A} at (0,0) size 97x144 [color=#0000EE]
+ RenderText {#text} at (30,1) size 97x144
+ text run at (30,1) width 65: "text in this"
+ text run at (1,19) width 96: "anchor element"
+ text run at (1,37) width 87: "should spawn"
+ text run at (1,55) width 88: "multiple lines."
+ text run at (1,73) width 97: "This test shows"
+ text run at (1,91) width 87: "how multiline"
+ text run at (1,109) width 68: "link would"
+ text run at (1,127) width 28: "look"
+ RenderText {#text} at (29,127) size 27x18
+ text run at (29,127) width 27: "like."
+ RenderTableCell {TD} at (106,56) size 352x38 [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 336x36
+ text run at (1,1) width 336: "This is some filler text. This is some filler text. This is"
+ text run at (1,19) width 244: "some filler text. This is some filler text."
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.checksum b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.checksum
new file mode 100644
index 0000000..27743a1
--- /dev/null
+++ b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.checksum
@@ -0,0 +1 @@
+bcd5f62beffa6db07893fe356de221c2
\ No newline at end of file
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.png b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.png
new file mode 100644
index 0000000..b5e1281
Binary files /dev/null and b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.png differ
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.txt b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.txt
new file mode 100644
index 0000000..50f2b60
--- /dev/null
+++ b/LayoutTests/platform/qt/fast/css/focus-ring-detached-expected.txt
@@ -0,0 +1,28 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderTable {TABLE} at (0,0) size 460x132
+ RenderTableSection {TBODY} at (0,0) size 460x132
+ RenderTableRow {TR} at (0,2) size 460x128
+ RenderTableCell {TD} at (2,2) size 102x128 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 98x126
+ text run at (1,1) width 82: "This is some"
+ text run at (1,22) width 98: "filler text. This"
+ text run at (1,43) width 83: "is some filler"
+ text run at (1,64) width 73: "text.This is"
+ text run at (1,85) width 69: "some filler"
+ text run at (1,106) width 29: "text."
+ RenderTableCell {TD} at (106,33) size 352x65 [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 213x21
+ text run at (1,1) width 213: "The text in this anchor element "
+ RenderInline {A} at (0,0) size 262x42 [color=#0000EE]
+ RenderText {#text} at (214,1) size 49x21
+ text run at (214,1) width 49: "should "
+ RenderBR {BR} at (263,17) size 0x0
+ RenderText {#text} at (1,22) size 50x21
+ text run at (1,22) width 50: "contain"
+ RenderText {#text} at (51,22) size 339x42
+ text run at (51,22) width 289: " 2 detached pieces. This test shows how the"
+ text run at (1,43) width 138: "link would look text."
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.checksum b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.checksum
new file mode 100644
index 0000000..1918f9c
--- /dev/null
+++ b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.checksum
@@ -0,0 +1 @@
+b8b6f516a3f1da2ec7fa5060580bfc9d
\ No newline at end of file
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.png b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.png
new file mode 100644
index 0000000..32d014b
Binary files /dev/null and b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.png differ
diff --git a/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.txt b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.txt
new file mode 100644
index 0000000..3a40050
--- /dev/null
+++ b/LayoutTests/platform/qt/fast/css/focus-ring-multiline-expected.txt
@@ -0,0 +1,29 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderTable {TABLE} at (0,0) size 460x216
+ RenderTableSection {TBODY} at (0,0) size 460x216
+ RenderTableRow {TR} at (0,2) size 460x212
+ RenderTableCell {TD} at (2,2) size 102x212 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 31x21
+ text run at (1,1) width 31: "The "
+ RenderInline {A} at (0,0) size 93x210 [color=#0000EE]
+ RenderText {#text} at (32,1) size 93x210
+ text run at (32,1) width 42: "text in"
+ text run at (1,22) width 76: "this anchor"
+ text run at (1,43) width 52: "element"
+ text run at (1,64) width 93: "should spawn"
+ text run at (1,85) width 93: "multiple lines."
+ text run at (1,106) width 57: "This test"
+ text run at (1,127) width 74: "shows how"
+ text run at (1,148) width 89: "multiline link"
+ text run at (1,169) width 42: "would"
+ text run at (1,190) width 29: "look"
+ RenderText {#text} at (30,190) size 28x21
+ text run at (30,190) width 28: "like."
+ RenderTableCell {TD} at (106,86) size 352x44 [r=0 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 338x42
+ text run at (1,1) width 338: "This is some filler text. This is some filler text. This"
+ text run at (1,22) width 270: "is some filler text. This is some filler text."
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 412e1d2..7a94e40 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-14 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Focus rings are ugly, rects should be united instead of drawn individually
+ https://bugs.webkit.org/show_bug.cgi?id=49953
+
+ Create a QPainterPath and add to it the focus rects, one at a time.
+ Combine the 2 drawFocusRing functions into one function drawFocusRingForPath.
+
+ Tests: fast/css/focus-ring-detached.html
+ fast/css/focus-ring-multiline.html
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::drawFocusRingForPath):
+ (WebCore::GraphicsContext::drawFocusRing):
+
2010-12-14 Mark Rowe <mrowe at apple.com>
Fix the Qt build.
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 254235e..2f8a91f 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -818,16 +818,10 @@ void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
p->setClipPath(platformPath, Qt::IntersectClip);
}
-void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
+void drawFocusRingForPath(QPainter* p, const QPainterPath& path, int width, const Color& color, bool antiAliasing)
{
- // FIXME: Use 'width' and 'offset' for something? http://webkit.org/b/49909
-
- if (paintingDisabled() || !color.isValid())
- return;
-
- QPainter* p = m_data->p();
const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
- p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines);
+ p->setRenderHint(QPainter::Antialiasing, antiAliasing);
const QPen oldPen = p->pen();
const QBrush oldBrush = p->brush();
@@ -838,13 +832,23 @@ void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, con
p->setBrush(Qt::NoBrush);
nPen.setStyle(Qt::SolidLine);
- p->strokePath(path.platformPath(), nPen);
+ p->strokePath(path, nPen);
p->setBrush(oldBrush);
p->setPen(oldPen);
p->setRenderHint(QPainter::Antialiasing, antiAlias);
}
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
+{
+ // FIXME: Use 'offset' for something? http://webkit.org/b/49909
+
+ if (paintingDisabled() || !color.isValid())
+ return;
+
+ drawFocusRingForPath(m_data->p(), path.platformPath(), width, color, m_data->antiAliasingForRectsAndLines);
+}
+
/**
* Focus ring handling for form controls is not handled here. Qt style in
* RenderTheme handles drawing focus on widgets which
@@ -860,40 +864,18 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
if (!rects.size())
return;
- QPainter* p = m_data->p();
- const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
- p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines);
-
- const QPen oldPen = p->pen();
- const QBrush oldBrush = p->brush();
-
- QPen nPen = p->pen();
int radius = (width - 1) / 2;
-
- nPen.setColor(QColor(color.red(), color.green(), color.blue(), 127));
- nPen.setWidth(width);
-
- p->setBrush(Qt::NoBrush);
- nPen.setStyle(Qt::SolidLine);
- p->setPen(nPen);
-#if 0
- // FIXME How do we do a bounding outline with Qt?
QPainterPath path;
- for (int i = 0; i < rectCount; ++i)
- path.addRect(QRectF(rects[i]));
- QPainterPathStroker stroker;
- QPainterPath newPath = stroker.createStroke(path);
- p->strokePath(newPath, nPen);
-#else
for (unsigned i = 0; i < rectCount; ++i) {
QRect rect = QRect((rects[i])).adjusted(-offset - radius, -offset - radius, offset + radius, offset + radius);
- p->drawRoundedRect(rect, radius, radius);
+ // This is not the most efficient way to add a rect to a path, but if we don't create the tmpPath,
+ // we will end up with ugly lines in between rows of text on anchors with multiple lines.
+ QPainterPath tmpPath;
+ tmpPath.addRoundedRect(rect, radius, radius);
+ path = path.united(tmpPath);
}
-#endif
- p->setPen(oldPen);
- p->setBrush(oldBrush);
- p->setRenderHint(QPainter::Antialiasing, antiAlias);
+ drawFocusRingForPath(m_data->p(), path, width, color, m_data->antiAliasingForRectsAndLines);
}
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list