[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andreas.kling at nokia.com
andreas.kling at nokia.com
Wed Dec 22 16:20:56 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e77b42120f77d26bd3391fdb4f2d4a745953a392
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 22 15:52:38 2010 +0000
2010-11-22 Andreas Kling <kling at webkit.org>
Reviewed by Nikolas Zimmermann.
GraphicsContext: Make drawFocusRing() take a Path instead of a Vector<Path>
https://bugs.webkit.org/show_bug.cgi?id=49840
This avoid copying a Path object when drawing focus rings.
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/haiku/GraphicsContextHaiku.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::drawFocusRing):
* rendering/RenderImage.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paint):
(WebCore::RenderImage::paintFocusRing):
Renamed from paintFocusRings since it only paints one ring.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6ca6d42..a1eae97 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-11-22 Andreas Kling <kling at webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ GraphicsContext: Make drawFocusRing() take a Path instead of a Vector<Path>
+ https://bugs.webkit.org/show_bug.cgi?id=49840
+
+ This avoid copying a Path object when drawing focus rings.
+
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/skia/GraphicsContextSkia.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/win/GraphicsContextCGWin.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/wince/GraphicsContextWinCE.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/wx/GraphicsContextWx.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * rendering/RenderImage.h:
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paint):
+ (WebCore::RenderImage::paintFocusRing):
+ Renamed from paintFocusRings since it only paints one ring.
+
2010-11-22 Renata Hodovan <reni at webkit.org>
Reviewed by Andreas Kling.
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 71a4c48..6adc90b 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -288,7 +288,7 @@ namespace WebCore {
void clearShadow();
void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
- void drawFocusRing(const Vector<Path>&, int width, int offset, const Color&);
+ void drawFocusRing(const Path&, int width, int offset, const Color&);
void setLineCap(LineCap);
void setLineDash(const DashArray&, float dashOffset);
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 755adff..1032dc2 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -617,7 +617,7 @@ void GraphicsContext::clipPath(WindRule clipRule)
cairo_clip(cr);
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 6911b31..05012e8 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -215,7 +215,7 @@ void GraphicsContext::clip(const FloatRect& rect)
m_data->m_view->ConstrainClippingRegion(®ion);
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
index 15cae20..c149d70 100644
--- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
@@ -57,23 +57,19 @@ static void drawFocusRingToContext(CGContextRef context, CGPathRef focusRingPath
#endif
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+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())
return;
-
+
int radius = (width - 1) / 2;
- offset += radius;
CGColorRef colorRef = color.isValid() ? cachedCGColor(color, ColorSpaceDeviceRGB) : 0;
- RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable());
- unsigned pathCount = paths.size();
- for (unsigned i = 0; i < pathCount; i++)
- CGPathAddPath(focusRingPath.get(), 0, paths[i].platformPath());
-
- drawFocusRingToContext(platformContext(), focusRingPath.get(), colorRef, radius);
-}
-
+ drawFocusRingToContext(platformContext(), path.platformPath(), colorRef, radius);
+}
+
void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index a4e49da..10a7f89 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -816,36 +816,25 @@ void GraphicsContext::clipPath(WindRule clipRule)
p->setClipPath(newPath, Qt::IntersectClip);
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
- if (paintingDisabled() || !color.isValid())
- return;
-
- unsigned pathCount = paths.size();
+ // FIXME: Use 'width' and 'offset' for something? http://webkit.org/b/49909
- if (!pathCount)
+ if (paintingDisabled() || !color.isValid())
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();
nPen.setColor(color);
p->setBrush(Qt::NoBrush);
nPen.setStyle(Qt::DotLine);
- p->setPen(nPen);
- QPainterPath path;
- for (int i = 0; i < pathCount; ++i)
- path.addPath(paths[i].platformPath());
- QPainterPathStroker stroker;
- QPainterPath newPath = stroker.createStroke(path);
- p->strokePath(newPath, nPen);
- p->setPen(oldPen);
+ p->strokePath(path.platformPath(), nPen);
p->setBrush(oldBrush);
p->setRenderHint(QPainter::Antialiasing, antiAlias);
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index e506e5d..7c0bcd1 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -513,7 +513,7 @@ void GraphicsContext::drawEllipse(const IntRect& elipseRect)
}
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
index ab3b5bb..1ad6bc1 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
@@ -124,7 +124,7 @@ void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& po
CGContextDrawImage(m_data->m_cgContext.get(), CGRectMake(point.x(), point.y(), image->size().width(), image->size().height()), cgImage.get());
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 8af6ef7..0802826 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -982,7 +982,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
ExcludeClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 53a9ccd..5007ffe 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -289,7 +289,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
notImplemented();
}
-void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
{
// FIXME: implement
}
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index cdd47c3..376ffef 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -322,10 +322,10 @@ void RenderImage::paint(PaintInfo& paintInfo, int tx, int ty)
RenderReplaced::paint(paintInfo, tx, ty);
if (paintInfo.phase == PaintPhaseOutline)
- paintFocusRings(paintInfo, style());
+ paintFocusRing(paintInfo, style());
}
-void RenderImage::paintFocusRings(PaintInfo& paintInfo, const RenderStyle* style)
+void RenderImage::paintFocusRing(PaintInfo& paintInfo, const RenderStyle* style)
{
// Don't draw focus rings if printing.
if (document()->printing() || !frame()->selection()->isFocusedAndActive())
@@ -358,9 +358,7 @@ void RenderImage::paintFocusRings(PaintInfo& paintInfo, const RenderStyle* style
if (focusedNode != areaElement)
continue;
- Vector<Path> focusRingPaths;
- focusRingPaths.append(areaElement->getPath(this));
- paintInfo.context->drawFocusRing(focusRingPaths, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
+ paintInfo.context->drawFocusRing(areaElement->getPath(this), style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
break;
}
}
diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h
index 86f5621..16ae7ec 100644
--- a/WebCore/rendering/RenderImage.h
+++ b/WebCore/rendering/RenderImage.h
@@ -57,7 +57,7 @@ protected:
virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
virtual void paintIntoRect(GraphicsContext*, const IntRect&);
- void paintFocusRings(PaintInfo&, const RenderStyle*);
+ void paintFocusRing(PaintInfo&, const RenderStyle*);
virtual void paint(PaintInfo&, int tx, int ty);
bool isLogicalWidthSpecified() const;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list