summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-01-05 12:15:11 +0000
committerSteve Block <steveblock@google.com>2011-01-06 14:14:00 +0000
commitd06194330da2bb8da887d2e1adeacb3a5c1504b2 (patch)
treee0af8413af65a8e30630563441af7bdb8478e513 /WebCore/platform
parent419a5cf2f8db6ca014df624865197ffb82caad37 (diff)
downloadexternal_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.zip
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.gz
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.bz2
Merge WebKit at r72805: Initial merge by Git
Note that this is a backwards merge from Chromium release 9.0.600.0 to 9.0.597.0, to align with the Chromium 9 stable release branch. Change-Id: I5d2bb4e8cee9d39ae8485abf48bdb55ecf8b3790
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/ScrollView.cpp60
-rw-r--r--WebCore/platform/ScrollView.h21
-rw-r--r--WebCore/platform/audio/Cone.cpp8
-rw-r--r--WebCore/platform/audio/Cone.h4
-rw-r--r--WebCore/platform/graphics/ContextShadow.h2
-rw-r--r--WebCore/platform/graphics/FloatPoint3D.h22
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h12
-rw-r--r--WebCore/platform/graphics/GraphicsContextPrivate.h3
-rw-r--r--WebCore/platform/graphics/MediaPlayer.cpp1
-rw-r--r--WebCore/platform/graphics/TextRun.h5
-rw-r--r--WebCore/platform/graphics/cairo/ContextShadowCairo.cpp16
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp48
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h2
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextCG.cpp99
-rw-r--r--WebCore/platform/graphics/chromium/ContentLayerChromium.cpp23
-rw-r--r--WebCore/platform/graphics/chromium/FontLinux.cpp9
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp49
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h9
-rw-r--r--WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp14
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextController.cpp4
-rw-r--r--WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp26
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp151
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp18
-rw-r--r--WebCore/platform/graphics/skia/ImageSkia.cpp22
-rw-r--r--WebCore/platform/graphics/win/cairo/FontPlatformData.h8
-rw-r--r--WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp12
-rw-r--r--WebCore/platform/graphics/wx/GraphicsContextWx.cpp20
-rw-r--r--WebCore/platform/graphics/wx/ImageBufferWx.cpp2
-rw-r--r--WebCore/platform/gtk/PopupMenuGtk.cpp112
-rw-r--r--WebCore/platform/gtk/PopupMenuGtk.h11
-rw-r--r--WebCore/platform/mac/ScrollViewMac.mm10
-rw-r--r--WebCore/platform/network/NetworkingContext.h9
-rw-r--r--WebCore/platform/network/android/CookieJarAndroid.cpp16
-rw-r--r--WebCore/platform/network/android/ProxyServerAndroid.cpp40
-rw-r--r--WebCore/platform/network/android/ResourceHandleAndroid.cpp32
-rw-r--r--WebCore/platform/network/android/ResourceRequestAndroid.cpp7
-rw-r--r--WebCore/platform/network/soup/cache/soup-http-input-stream.c1
-rw-r--r--WebCore/platform/network/soup/cache/webkit/soup-cache.c20
-rw-r--r--WebCore/platform/text/TextBoundaries.cpp28
-rw-r--r--WebCore/platform/text/TextBoundaries.h3
-rw-r--r--WebCore/platform/text/TextCodecUTF16.cpp11
-rw-r--r--WebCore/platform/win/FileSystemWin.cpp5
-rw-r--r--WebCore/platform/wince/FileSystemWinCE.cpp42
-rw-r--r--WebCore/platform/wx/LocalizedStringsWx.cpp2
44 files changed, 355 insertions, 664 deletions
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index d6184e9..57fbaa1 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -308,21 +308,9 @@ int ScrollView::actualScrollY() const
IntPoint ScrollView::maximumScrollPosition() const
{
- IntPoint maximumOffset(contentsWidth() - visibleWidth() - m_scrollOrigin.x(), contentsHeight() - visibleHeight() - m_scrollOrigin.y());
+ IntSize maximumOffset = contentsSize() - visibleContentRect().size();
maximumOffset.clampNegativeToZero();
- return maximumOffset;
-}
-
-IntPoint ScrollView::minimumScrollPosition() const
-{
- return IntPoint(-m_scrollOrigin.x(), -m_scrollOrigin.y());
-}
-
-IntPoint ScrollView::adjustScrollPositionWithinRange(const IntPoint& scrollPoint) const
-{
- IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition());
- newScrollPosition = newScrollPosition.expandedTo(minimumScrollPosition());
- return newScrollPosition;
+ return IntPoint(maximumOffset.width(), maximumOffset.height());
}
int ScrollView::scrollSize(ScrollbarOrientation orientation) const
@@ -345,9 +333,9 @@ void ScrollView::valueChanged(Scrollbar* scrollbar)
IntSize newOffset = m_scrollOffset;
if (scrollbar) {
if (scrollbar->orientation() == HorizontalScrollbar)
- newOffset.setWidth(scrollbar->value() - m_scrollOrigin.x());
+ newOffset.setWidth(scrollbar->value());
else if (scrollbar->orientation() == VerticalScrollbar)
- newOffset.setHeight(scrollbar->value() - m_scrollOrigin.y());
+ newOffset.setHeight(scrollbar->value());
}
IntSize scrollDelta = newOffset - m_scrollOffset;
@@ -390,7 +378,8 @@ void ScrollView::setScrollPosition(const IntPoint& scrollPoint)
}
#endif
- IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
+ IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition());
+ newScrollPosition.clampNegativeToZero();
if (newScrollPosition == scrollPosition())
return;
@@ -481,15 +470,11 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
newHasHorizontalScrollbar = false;
if (hasHorizontalScrollbar != newHasHorizontalScrollbar) {
- if (m_scrollOrigin.y() && !newHasHorizontalScrollbar)
- m_scrollOrigin.setY(m_scrollOrigin.y() - m_horizontalScrollbar->height());
setHasHorizontalScrollbar(newHasHorizontalScrollbar);
sendContentResizedNotification = true;
}
if (hasVerticalScrollbar != newHasVerticalScrollbar) {
- if (m_scrollOrigin.x() && !newHasVerticalScrollbar)
- m_scrollOrigin.setX(m_scrollOrigin.x() - m_verticalScrollbar->width());
setHasVerticalScrollbar(newHasVerticalScrollbar);
sendContentResizedNotification = true;
}
@@ -515,10 +500,10 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
return;
m_inUpdateScrollbars = true;
-
- IntPoint scrollPoint = adjustScrollPositionWithinRange(IntPoint(desiredOffset.width(), desiredOffset.height()));
- IntSize scroll(scrollPoint.x(), scrollPoint.y());
-
+ IntSize maxScrollPosition(contentsWidth() - visibleWidth(), contentsHeight() - visibleHeight());
+ IntSize scroll = desiredOffset.shrunkTo(maxScrollPosition);
+ scroll.clampNegativeToZero();
+
if (m_horizontalScrollbar) {
int clientWidth = visibleWidth();
m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
@@ -536,7 +521,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_horizontalScrollbar->setSuppressInvalidation(true);
m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_horizontalScrollbar->setProportion(clientWidth, contentsWidth());
- m_horizontalScrollbar->setValue(scroll.width() + m_scrollOrigin.x(), Scrollbar::NotFromScrollAnimator);
+ m_horizontalScrollbar->setValue(scroll.width(), Scrollbar::NotFromScrollAnimator);
if (m_scrollbarsSuppressed)
m_horizontalScrollbar->setSuppressInvalidation(false);
}
@@ -558,7 +543,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_verticalScrollbar->setSuppressInvalidation(true);
m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
- m_verticalScrollbar->setValue(scroll.height() + m_scrollOrigin.y(), Scrollbar::NotFromScrollAnimator);
+ m_verticalScrollbar->setValue(scroll.height(), Scrollbar::NotFromScrollAnimator);
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(false);
}
@@ -1063,23 +1048,6 @@ void ScrollView::removePanScrollIcon()
hostWindow()->invalidateContentsAndWindow(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
}
-void ScrollView::setScrollOrigin(const IntPoint& origin, bool updatePosition)
-{
- if (m_scrollOrigin == origin)
- return;
-
- m_scrollOrigin = origin;
-
- if (platformWidget()) {
- platformSetScrollOrigin(origin, updatePosition);
- return;
- }
-
- // Update if the scroll origin changes, since our position will be different if the content size did not change.
- if (updatePosition)
- updateScrollbars(scrollOffset());
-}
-
#if !PLATFORM(WX) && !PLATFORM(GTK) && !PLATFORM(EFL)
void ScrollView::platformInit()
@@ -1110,10 +1078,6 @@ void ScrollView::platformSetScrollbarsSuppressed(bool)
{
}
-void ScrollView::platformSetScrollOrigin(const IntPoint&, bool updatePosition)
-{
-}
-
#endif
#if !PLATFORM(MAC) && !PLATFORM(WX)
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index e9c7feb..660cfc6 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -167,9 +167,6 @@ public:
IntPoint scrollPosition() const { return visibleContentRect().location(); }
IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to.
- IntPoint minimumScrollPosition() const; // The minimum position we can be scrolled to.
- // Adjust the passed in scroll position to keep it between the minimum and maximum positions.
- IntPoint adjustScrollPositionWithinRange(const IntPoint&) const;
int scrollX() const { return scrollPosition().x(); }
int scrollY() const { return scrollPosition().y(); }
@@ -289,9 +286,6 @@ protected:
// Scroll the content by invalidating everything.
virtual void scrollContentsSlowPath(const IntRect& updateRect);
- void setScrollOrigin(const IntPoint&, bool updatePosition);
- IntPoint scrollOrigin() { return m_scrollOrigin; }
-
private:
RefPtr<Scrollbar> m_horizontalScrollbar;
RefPtr<Scrollbar> m_verticalScrollbar;
@@ -327,19 +321,6 @@ private:
bool m_paintsEntireContents;
bool m_delegatesScrolling;
- // There are 8 possible combinations of writing mode and direction. Scroll origin will be non-zero in the x or y axis
- // if there is any reversed direction or writing-mode. The combinations are:
- // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set
- // horizontal-tb / ltr NO NO
- // horizontal-tb / rtl YES NO
- // horizontal-bt / ltr NO YES
- // horizontal-bt / rtl YES YES
- // vertical-lr / ltr NO NO
- // vertical-lr / rtl NO YES
- // vertical-rl / ltr YES NO
- // vertical-rl / rtl YES YES
- IntPoint m_scrollOrigin;
-
void init();
void destroy();
@@ -367,8 +348,6 @@ private:
void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
void platformRepaintContentRectangle(const IntRect&, bool now);
bool platformIsOffscreen() const;
-
- void platformSetScrollOrigin(const IntPoint&, bool updatePosition);
#if PLATFORM(ANDROID)
int platformActualWidth() const;
diff --git a/WebCore/platform/audio/Cone.cpp b/WebCore/platform/audio/Cone.cpp
index 843b3cc..91813ab 100644
--- a/WebCore/platform/audio/Cone.cpp
+++ b/WebCore/platform/audio/Cone.cpp
@@ -41,20 +41,20 @@ ConeEffect::ConeEffect()
{
}
-double ConeEffect::gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition)
+double ConeEffect::gain(Vector3 sourcePosition, Vector3 sourceOrientation, Vector3 listenerPosition)
{
if (sourceOrientation.isZero() || ((m_innerAngle == 360.0) && (m_outerAngle == 360.0)))
return 1.0; // no cone specified - unity gain
// Normalized source-listener vector
- FloatPoint3D sourceToListener = listenerPosition - sourcePosition;
+ Vector3 sourceToListener = listenerPosition - sourcePosition;
sourceToListener.normalize();
- FloatPoint3D normalizedSourceOrientation = sourceOrientation;
+ Vector3 normalizedSourceOrientation = sourceOrientation;
normalizedSourceOrientation.normalize();
// Angle between the source orientation vector and the source-listener vector
- double dotProduct = sourceToListener.dot(normalizedSourceOrientation);
+ double dotProduct = dot(sourceToListener, normalizedSourceOrientation);
double angle = 180.0 * acos(dotProduct) / M_PI;
double absAngle = fabs(angle);
diff --git a/WebCore/platform/audio/Cone.h b/WebCore/platform/audio/Cone.h
index f566018..9936f28 100644
--- a/WebCore/platform/audio/Cone.h
+++ b/WebCore/platform/audio/Cone.h
@@ -29,7 +29,7 @@
#ifndef Cone_h
#define Cone_h
-#include "FloatPoint3D.h"
+#include <wtf/Vector3.h>
namespace WebCore {
@@ -40,7 +40,7 @@ public:
ConeEffect();
// Returns scalar gain for the given source/listener positions/orientations
- double gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition);
+ double gain(Vector3 sourcePosition, Vector3 sourceOrientation, Vector3 listenerPosition);
// Angles in degrees
void setInnerAngle(double innerAngle) { m_innerAngle = innerAngle; }
diff --git a/WebCore/platform/graphics/ContextShadow.h b/WebCore/platform/graphics/ContextShadow.h
index fa778af..26f0a36 100644
--- a/WebCore/platform/graphics/ContextShadow.h
+++ b/WebCore/platform/graphics/ContextShadow.h
@@ -120,8 +120,10 @@ private:
PlatformImage m_layerImage;
PlatformContext m_layerContext;
+#if PLATFORM(QT)
// Used for reference when canvas scale(x,y) was called.
FloatRect m_unscaledLayerRect;
+#endif
void blurLayerImage(unsigned char*, const IntSize& imageSize, int stride);
void calculateLayerBoundingRect(const FloatRect& layerArea, const IntRect& clipRect);
diff --git a/WebCore/platform/graphics/FloatPoint3D.h b/WebCore/platform/graphics/FloatPoint3D.h
index ba0ee9d..b6cbaa8 100644
--- a/WebCore/platform/graphics/FloatPoint3D.h
+++ b/WebCore/platform/graphics/FloatPoint3D.h
@@ -84,11 +84,6 @@ public:
m_z *= sz;
}
- bool isZero() const
- {
- return !m_x && !m_y && !m_z;
- }
-
void normalize();
float dot(const FloatPoint3D& a) const
@@ -120,8 +115,6 @@ public:
float lengthSquared() const { return this->dot(*this); }
float length() const { return sqrtf(lengthSquared()); }
-
- float distanceTo(const FloatPoint3D& a) const;
private:
float m_x;
@@ -167,21 +160,6 @@ inline float operator*(const FloatPoint3D& a, const FloatPoint3D& b)
return a.dot(b);
}
-inline FloatPoint3D operator*(float k, const FloatPoint3D& v)
-{
- return FloatPoint3D(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline FloatPoint3D operator*(const FloatPoint3D& v, float k)
-{
- return FloatPoint3D(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline float FloatPoint3D::distanceTo(const FloatPoint3D& a) const
-{
- return (*this - a).length();
-}
-
} // namespace WebCore
#endif // FloatPoint3D_h
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 76e897e..1029c90 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -135,6 +135,7 @@ namespace WebCore {
class GraphicsContextPrivate;
class ImageBuffer;
class KURL;
+ class Path;
class Pattern;
class SharedGraphicsContext3D;
class TextRun;
@@ -203,7 +204,6 @@ namespace WebCore {
#if PLATFORM(CG)
void applyStrokePattern();
void applyFillPattern();
- void drawPath(const Path&);
#endif
#if PLATFORM(ANDROID)
@@ -245,8 +245,9 @@ namespace WebCore {
void drawEllipse(const IntRect&);
void drawConvexPolygon(size_t numPoints, const FloatPoint*, bool shouldAntialias = false);
- void fillPath(const Path&);
- void strokePath(const Path&);
+ void drawPath();
+ void fillPath();
+ void strokePath();
// Arc drawing (used by border-radius in CSS) just supports stroking at the moment.
void strokeArc(const IntRect&, int startAngle, int angleSpan);
@@ -287,7 +288,7 @@ namespace WebCore {
void addInnerRoundedRectClip(const IntRect&, int thickness);
void clipOut(const IntRect&);
void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
- void clipPath(const Path&, WindRule);
+ void clipPath(WindRule);
void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
void clipToImageBuffer(ImageBuffer*, const FloatRect&);
@@ -336,10 +337,8 @@ namespace WebCore {
void setCompositeOperation(CompositeOperator);
-#if PLATFORM(SKIA) || PLATFORM(WX) || PLATFORM(OPENVG) || OS(WINCE)
void beginPath();
void addPath(const Path&);
-#endif
void clip(const Path&);
@@ -429,6 +428,7 @@ namespace WebCore {
#if PLATFORM(QT)
bool inTransparencyLayer() const;
+ PlatformPath* currentPath();
void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
void takeOwnershipOfPlatformContext();
static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op);
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 696932e..985cad9 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -29,6 +29,7 @@
#include "Gradient.h"
#include "GraphicsContext.h"
#include "Pattern.h"
+#include "TransformationMatrix.h"
namespace WebCore {
@@ -78,6 +79,8 @@ namespace WebCore {
bool shadowsIgnoreTransforms;
#if PLATFORM(CAIRO)
float globalAlpha;
+#elif PLATFORM(QT)
+ TransformationMatrix pathTransform;
#endif
};
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index c9deb4c..dc743bf 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -274,7 +274,6 @@ MediaPlayer::MediaPlayer(MediaPlayerClient* client)
MediaPlayer::~MediaPlayer()
{
- m_mediaPlayerClient = 0;
}
void MediaPlayer::load(const String& url, const ContentType& contentType)
diff --git a/WebCore/platform/graphics/TextRun.h b/WebCore/platform/graphics/TextRun.h
index dce5535..79b6cb3 100644
--- a/WebCore/platform/graphics/TextRun.h
+++ b/WebCore/platform/graphics/TextRun.h
@@ -117,10 +117,7 @@ private:
const UChar* m_characters;
int m_len;
- // m_xpos is the x position relative to the left start of the text line, not relative to the left
- // start of the containing block. In the case of right alignment or center alignment, left start of
- // the text line is not the same as left start of the containing block.
- int m_xpos;
+ int m_xpos;
int m_padding;
#if ENABLE(SVG)
float m_horizontalGlyphStretch;
diff --git a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
index 699edf7..8299b6a 100644
--- a/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp
@@ -84,8 +84,6 @@ static cairo_surface_t* getScratchBuffer(const IntSize& size)
PlatformContext ContextShadow::beginShadowLayer(PlatformContext context, const FloatRect& layerArea)
{
- m_unscaledLayerRect = layerArea;
-
double x1, x2, y1, y2;
cairo_clip_extents(context, &x1, &y1, &x2, &y2);
calculateLayerBoundingRect(layerArea, IntRect(x1, y1, x2 - x1, y2 - y1));
@@ -122,19 +120,7 @@ void ContextShadow::endShadowLayer(cairo_t* cr)
cairo_save(cr);
setSourceRGBAFromColor(cr, m_color);
-
- cairo_matrix_t transform;
- cairo_get_matrix(cr, &transform);
- double x = m_layerRect.x();
- double y = m_layerRect.y();
-
- double xScale = sqrt(transform.xx * transform.xx + transform.yx * transform.yx);
- double yScale = sqrt(transform.xy * transform.xy + transform.yy * transform.yy);
- if (xScale != 1 || yScale != 1) {
- x = m_unscaledLayerRect.x() + m_offset.width() / transform.xx - m_blurDistance;
- y = m_unscaledLayerRect.y() + m_offset.height() / transform.yy - m_blurDistance;
- }
- cairo_mask_surface(cr, m_layerImage, x, y);
+ cairo_mask_surface(cr, m_layerImage, m_layerRect.x(), m_layerRect.y());
cairo_restore(cr);
// Schedule a purge of the scratch buffer. We do not need to destroy the surface.
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 9c2ff82..1032dc2 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -531,26 +531,44 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
cairo_set_fill_rule(cr, savedFillRule);
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
- setPathOnCairoContext(cr, path.platformPath()->context());
+
+ setPathOnCairoContext(cr, m_data->m_pendingPath.context());
fillCurrentCairoPath(this, m_common, cr);
}
-void GraphicsContext::strokePath(const Path& path)
+void GraphicsContext::strokePath()
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
- setPathOnCairoContext(cr, path.platformPath()->context());
+ setPathOnCairoContext(cr, m_data->m_pendingPath.context());
strokeCurrentCairoPath(this, m_common, cr);
}
+void GraphicsContext::drawPath()
+{
+ if (paintingDisabled())
+ return;
+
+ cairo_t* cr = m_data->cr;
+
+ setPathOnCairoContext(cr, m_data->m_pendingPath.context());
+
+ cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
+ drawPathShadow(this, m_common, FillAndStroke);
+
+ setPlatformFill(this, cr, m_common);
+ setPlatformStroke(this, cr, m_common);
+ cairo_new_path(cr);
+}
+
void GraphicsContext::fillRect(const FloatRect& rect)
{
if (paintingDisabled())
@@ -589,13 +607,12 @@ void GraphicsContext::clip(const FloatRect& rect)
m_data->clip(rect);
}
-void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
+void GraphicsContext::clipPath(WindRule clipRule)
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
- setPathOnCairoContext(cr, path.platformPath()->context());
cairo_set_fill_rule(cr, clipRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
cairo_clip(cr);
}
@@ -977,6 +994,25 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op)
cairo_set_operator(m_data->cr, toCairoOperator(op));
}
+void GraphicsContext::beginPath()
+{
+ if (paintingDisabled())
+ return;
+
+ cairo_new_path(m_data->m_pendingPath.context());
+}
+
+void GraphicsContext::addPath(const Path& path)
+{
+ if (paintingDisabled())
+ return;
+
+ cairo_matrix_t currentMatrix;
+ cairo_get_matrix(m_data->cr, &currentMatrix);
+ cairo_set_matrix(m_data->m_pendingPath.context(), &currentMatrix);
+ appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path);
+}
+
void GraphicsContext::clip(const Path& path)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
index 494b40d..527cb72 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
+++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
@@ -27,6 +27,7 @@
#include "GraphicsContext.h"
+#include "CairoPath.h"
#include "ContextShadow.h"
#include <cairo.h>
#include <math.h>
@@ -96,6 +97,7 @@ public:
cairo_t* cr;
Vector<float> layers;
+ CairoPath m_pendingPath;
ContextShadow shadow;
Vector<ContextShadow> shadowStack;
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 2eb929e..8d72b85 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -299,12 +299,21 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
// This method is only used to draw the little circles used in lists.
void GraphicsContext::drawEllipse(const IntRect& rect)
{
+ // FIXME: CG added CGContextAddEllipseinRect in Tiger, so we should be able to quite easily draw an ellipse.
+ // This code can only handle circles, not ellipses. But khtml only
+ // uses it for circles.
+ ASSERT(rect.width() == rect.height());
+
if (paintingDisabled())
return;
- Path path;
- path.addEllipse(rect);
- drawPath(path);
+ CGContextRef context = platformContext();
+ CGContextBeginPath(context);
+ float r = (float)rect.width() / 2;
+ CGContextAddArc(context, rect.x() + r, rect.y() + r, r, 0.0f, 2.0f * piFloat, 0);
+ CGContextClosePath(context);
+
+ drawPath();
}
@@ -396,22 +405,21 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
CGContextRestoreGState(context);
}
-static void addConvexPolygonToPath(Path& path, size_t numberOfPoints, const FloatPoint* points)
+static void addConvexPolygonToContext(CGContextRef context, size_t numPoints, const FloatPoint* points)
{
- ASSERT(numberOfPoints > 0);
-
- path.moveTo(points[0]);
- for (size_t i = 1; i < numberOfPoints; ++i)
- path.addLineTo(points[i]);
- path.closeSubpath();
+ CGContextBeginPath(context);
+ CGContextMoveToPoint(context, points[0].x(), points[0].y());
+ for (size_t i = 1; i < numPoints; i++)
+ CGContextAddLineToPoint(context, points[i].x(), points[i].y());
+ CGContextClosePath(context);
}
-void GraphicsContext::drawConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialiased)
+void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool antialiased)
{
if (paintingDisabled())
return;
- if (numberOfPoints <= 1)
+ if (npoints <= 1)
return;
CGContextRef context = platformContext();
@@ -419,30 +427,28 @@ void GraphicsContext::drawConvexPolygon(size_t numberOfPoints, const FloatPoint*
if (antialiased != shouldAntialias())
CGContextSetShouldAntialias(context, antialiased);
- Path path;
- addConvexPolygonToPath(path, numberOfPoints, points);
- drawPath(path);
+ addConvexPolygonToContext(context, npoints, points);
+ drawPath();
if (antialiased != shouldAntialias())
CGContextSetShouldAntialias(context, shouldAntialias());
}
-void GraphicsContext::clipConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialias)
+void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* points, bool antialias)
{
if (paintingDisabled())
return;
- if (numberOfPoints <= 1)
+ if (numPoints <= 1)
return;
CGContextRef context = platformContext();
if (antialias != shouldAntialias())
CGContextSetShouldAntialias(context, antialias);
-
- Path path;
- addConvexPolygonToPath(path, numberOfPoints, points);
- clipPath(path, RULE_NONZERO);
+
+ addConvexPolygonToContext(context, numPoints, points);
+ clipPath(RULE_NONZERO);
if (antialias != shouldAntialias())
CGContextSetShouldAntialias(context, shouldAntialias());
@@ -505,7 +511,7 @@ static inline bool calculateDrawingMode(const GraphicsContextState& state, CGPat
return shouldFill || shouldStroke;
}
-void GraphicsContext::drawPath(const Path& path)
+void GraphicsContext::drawPath()
{
if (paintingDisabled())
return;
@@ -515,15 +521,11 @@ void GraphicsContext::drawPath(const Path& path)
if (state.fillGradient || state.strokeGradient) {
// We don't have any optimized way to fill & stroke a path using gradients
- // FIXME: Be smarter about this.
- fillPath(path);
- strokePath(path);
+ fillPath();
+ strokePath();
return;
}
- CGContextBeginPath(context);
- CGContextAddPath(context, path.platformPath());
-
if (state.fillPattern)
applyFillPattern();
if (state.strokePattern)
@@ -542,16 +544,13 @@ static inline void fillPathWithFillRule(CGContextRef context, WindRule fillRule)
CGContextFillPath(context);
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
CGContextRef context = platformContext();
- CGContextBeginPath(context);
- CGContextAddPath(context, path.platformPath());
-
if (m_common->state.fillGradient) {
CGContextSaveGState(context);
if (fillRule() == RULE_EVENODD)
@@ -569,16 +568,13 @@ void GraphicsContext::fillPath(const Path& path)
fillPathWithFillRule(context, fillRule());
}
-void GraphicsContext::strokePath(const Path& path)
+void GraphicsContext::strokePath()
{
if (paintingDisabled())
return;
CGContextRef context = platformContext();
- CGContextBeginPath(context);
- CGContextAddPath(context, path.platformPath());
-
if (m_common->state.strokeGradient) {
CGContextSaveGState(context);
CGContextReplacePathWithStrokedPath(context);
@@ -647,7 +643,8 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
Path path;
path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
- fillPath(path);
+ addPath(path);
+ fillPath();
if (oldFillColor != color || oldColorSpace != colorSpace)
setCGFillColor(context, oldFillColor, oldColorSpace);
@@ -672,23 +669,19 @@ void GraphicsContext::clipOut(const IntRect& rect)
CGContextEOClip(platformContext());
}
-void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
+void GraphicsContext::clipPath(WindRule clipRule)
{
if (paintingDisabled())
return;
- if (path.isEmpty())
- return;
-
CGContextRef context = platformContext();
- CGContextBeginPath(platformContext());
- CGContextAddPath(platformContext(), path.platformPath());
-
- if (clipRule == RULE_EVENODD)
- CGContextEOClip(context);
- else
- CGContextClip(context);
+ if (!CGContextIsPathEmpty(context)) {
+ if (clipRule == RULE_EVENODD)
+ CGContextEOClip(context);
+ else
+ CGContextClip(context);
+ }
}
void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)
@@ -870,6 +863,16 @@ void GraphicsContext::setLineJoin(LineJoin join)
}
}
+void GraphicsContext::beginPath()
+{
+ CGContextBeginPath(platformContext());
+}
+
+void GraphicsContext::addPath(const Path& path)
+{
+ CGContextAddPath(platformContext(), path.platformPath());
+}
+
void GraphicsContext::clip(const Path& path)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 7dab01f..375a74b 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -41,7 +41,6 @@
#if PLATFORM(SKIA)
#include "NativeImageSkia.h"
#include "PlatformContextSkia.h"
-#include "SkColorPriv.h"
#include "skia/ext/platform_canvas.h"
#elif PLATFORM(CG)
#include <CoreGraphics/CGBitmapContext.h>
@@ -69,22 +68,8 @@ ContentLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
" v_texCoord = a_texCoord; \n"
"} \n";
-#if PLATFORM(SKIA)
- // Color is in RGBA order.
- char rgbaFragmentShaderString[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "uniform float alpha; \n"
- "void main() \n"
- "{ \n"
- " vec4 texColor = texture2D(s_texture, v_texCoord); \n"
- " gl_FragColor = texColor * alpha; \n"
- "} \n";
-#endif
-
// Color is in BGRA order.
- char bgraFragmentShaderString[] =
+ char fragmentShaderString[] =
"precision mediump float; \n"
"varying vec2 v_texCoord; \n"
"uniform sampler2D s_texture; \n"
@@ -95,12 +80,6 @@ ContentLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
" gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; \n"
"} \n";
-#if PLATFORM(SKIA)
- // Assuming the packing is either Skia default RGBA or Chromium default BGRA.
- char* fragmentShaderString = SK_B32_SHIFT ? rgbaFragmentShaderString : bgraFragmentShaderString;
-#else
- char* fragmentShaderString = bgraFragmentShaderString;
-#endif
m_contentShaderProgram = createShaderProgram(m_context, vertexShaderString, fragmentShaderString);
if (!m_contentShaderProgram) {
LOG_ERROR("ContentLayerChromium: Failed to create shader program");
diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index 82b9df7..79b2caf 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -341,6 +341,7 @@ void TextRunWalker::setPadding(int padding)
// amount to each space. The last space gets the smaller amount, if
// any.
unsigned numWordBreaks = 0;
+ bool isRTL = m_iterateBackwards;
for (unsigned i = 0; i < m_item.stringLength; i++) {
if (isWordBreak(i))
@@ -523,7 +524,7 @@ void TextRunWalker::setGlyphXPositions(bool isRTL)
// Whitespace must be laid out in logical order, so when inserting
// spaces in RTL (but iterating in LTR order) we must insert spaces
// _before_ the next glyph.
- if (static_cast<unsigned>(i + 1) >= m_item.num_glyphs || m_item.attributes[i + 1].clusterStart)
+ if (i + 1 >= m_item.num_glyphs || m_item.attributes[i + 1].clusterStart)
position += m_letterSpacing;
position += determineWordBreakSpacing(logClustersIndex);
@@ -540,7 +541,7 @@ void TextRunWalker::setGlyphXPositions(bool isRTL)
position += truncateFixedPointToInteger(m_item.advances[i]);
}
} else {
- for (size_t i = 0; i < m_item.num_glyphs; ++i) {
+ for (int i = 0; i < m_item.num_glyphs; ++i) {
m_glyphs16[i] = m_item.glyphs[i];
double offsetX = truncateFixedPointToInteger(m_item.offsets[i].x);
m_xPositions[i] = m_offsetX + position + offsetX;
@@ -555,7 +556,7 @@ void TextRunWalker::setGlyphXPositions(bool isRTL)
if (m_item.attributes[i].clusterStart)
advance += m_letterSpacing;
- while (static_cast<unsigned>(logClustersIndex) < m_item.item.length && logClusters()[logClustersIndex] == i)
+ while (logClustersIndex < m_item.item.length && logClusters()[logClustersIndex] == i)
logClustersIndex++;
position += advance;
@@ -707,7 +708,7 @@ static int glyphIndexForXPositionInScriptRun(const TextRunWalker& walker, int x)
for (glyphIndex = walker.length() - 1; glyphIndex >= 0; --glyphIndex) {
// When iterating LTR over RTL text, we must include the whitespace
// _before_ the glyph, so no + 1 here.
- if (x < (static_cast<int>(walker.length()) - glyphIndex) * letterSpacing + truncateFixedPointToInteger(advances[glyphIndex]))
+ if (x < (walker.length() - glyphIndex) * letterSpacing + truncateFixedPointToInteger(advances[glyphIndex]))
break;
x -= truncateFixedPointToInteger(advances[glyphIndex]);
}
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index dbef4c9..695d1f7 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -177,13 +177,6 @@ void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec
mp->volumeChanged();
}
-gboolean mediaPlayerPrivateVolumeChangeTimeoutCallback(MediaPlayerPrivateGStreamer* player)
-{
- // This is the callback of the timeout source created in ::volumeChanged.
- player->notifyPlayerOfVolumeChange();
- return FALSE;
-}
-
void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
{
// This is called when playbin receives the notify::mute signal.
@@ -191,13 +184,6 @@ void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec,
mp->muteChanged();
}
-gboolean mediaPlayerPrivateMuteChangeTimeoutCallback(MediaPlayerPrivateGStreamer* player)
-{
- // This is the callback of the timeout source created in ::muteChanged.
- player->notifyPlayerOfMute();
- return FALSE;
-}
-
static float playbackPosition(GstElement* playbin)
{
@@ -341,18 +327,8 @@ MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer()
if (m_playBin) {
gst_element_set_state(m_playBin, GST_STATE_NULL);
gst_object_unref(GST_OBJECT(m_playBin));
- m_playBin = 0;
}
- m_player = 0;
-
- if (m_muteTimerHandler)
- g_source_remove(m_muteTimerHandler);
- m_muteTimerHandler = 0;
-
- if (m_volumeTimerHandler)
- g_source_remove(m_volumeTimerHandler);
- m_volumeTimerHandler = 0;
}
void MediaPlayerPrivateGStreamer::load(const String& url)
@@ -608,12 +584,8 @@ void MediaPlayerPrivateGStreamer::setVolume(float volume)
g_object_set(m_playBin, "volume", static_cast<double>(volume), NULL);
}
-void MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange()
+void MediaPlayerPrivateGStreamer::volumeChangedTimerFired(Timer<MediaPlayerPrivateGStreamer>*)
{
- m_volumeTimerHandler = 0;
-
- if (!m_player || !m_playBin)
- return;
double volume;
g_object_get(m_playBin, "volume", &volume, NULL);
m_player->volumeChanged(static_cast<float>(volume));
@@ -621,9 +593,8 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange()
void MediaPlayerPrivateGStreamer::volumeChanged()
{
- if (m_volumeTimerHandler)
- g_source_remove(m_volumeTimerHandler);
- m_volumeTimerHandler = g_timeout_add(0, reinterpret_cast<GSourceFunc>(mediaPlayerPrivateVolumeChangeTimeoutCallback), this);
+ Timer<MediaPlayerPrivateGStreamer> volumeChangedTimer(this, &MediaPlayerPrivateGStreamer::volumeChangedTimerFired);
+ volumeChangedTimer.startOneShot(0);
}
void MediaPlayerPrivateGStreamer::setRate(float rate)
@@ -1187,13 +1158,8 @@ void MediaPlayerPrivateGStreamer::setMuted(bool muted)
g_object_set(m_playBin, "mute", muted, NULL);
}
-void MediaPlayerPrivateGStreamer::notifyPlayerOfMute()
+void MediaPlayerPrivateGStreamer::muteChangedTimerFired(Timer<MediaPlayerPrivateGStreamer>*)
{
- m_muteTimerHandler = 0;
-
- if (!m_player || !m_playBin)
- return;
-
gboolean muted;
g_object_get(m_playBin, "mute", &muted, NULL);
m_player->muteChanged(static_cast<bool>(muted));
@@ -1201,9 +1167,8 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfMute()
void MediaPlayerPrivateGStreamer::muteChanged()
{
- if (m_muteTimerHandler)
- g_source_remove(m_muteTimerHandler);
- m_muteTimerHandler = g_timeout_add(0, reinterpret_cast<GSourceFunc>(mediaPlayerPrivateMuteChangeTimeoutCallback), this);
+ Timer<MediaPlayerPrivateGStreamer> muteChangedTimer(this, &MediaPlayerPrivateGStreamer::muteChangedTimerFired);
+ muteChangedTimer.startOneShot(0);
}
void MediaPlayerPrivateGStreamer::loadingFailed(MediaPlayer::NetworkState error)
@@ -1436,8 +1401,6 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
g_signal_connect(bus, "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
gst_object_unref(bus);
- g_object_set(m_playBin, "mute", m_player->muted(), "volume", m_player->volume(), NULL);
-
g_signal_connect(m_playBin, "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
g_signal_connect(m_playBin, "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this);
g_signal_connect(m_playBin, "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this);
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index 23095ec..800ca6d 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -43,14 +43,11 @@ class GraphicsContext;
class IntSize;
class IntRect;
class GStreamerGWorld;
-class MediaPlayerPrivateGStreamer;
gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
void mediaPlayerPrivateVolumeChangedCallback(GObject* element, GParamSpec* pspec, gpointer data);
void mediaPlayerPrivateMuteChangedCallback(GObject* element, GParamSpec* pspec, gpointer data);
void mediaPlayerPrivateSourceChangedCallback(GObject* element, GParamSpec* pspec, gpointer data);
-gboolean mediaPlayerPrivateVolumeChangeTimeoutCallback(MediaPlayerPrivateGStreamer*);
-gboolean mediaPlayerPrivateMuteChangeTimeoutCallback(MediaPlayerPrivateGStreamer*);
class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
friend gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
@@ -84,12 +81,12 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
void setVolume(float);
void volumeChanged();
- void notifyPlayerOfVolumeChange();
+ void volumeChangedTimerFired(Timer<MediaPlayerPrivateGStreamer>*);
bool supportsMuting() const;
void setMuted(bool);
void muteChanged();
- void notifyPlayerOfMute();
+ void muteChangedTimerFired(Timer<MediaPlayerPrivateGStreamer>*);
void setPreload(MediaPlayer::Preload);
void fillTimerFired(Timer<MediaPlayerPrivateGStreamer>*);
@@ -179,8 +176,6 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
bool m_delayingLoad;
bool m_mediaDurationKnown;
RefPtr<GStreamerGWorld> m_gstGWorld;
- guint m_volumeTimerHandler;
- guint m_muteTimerHandler;
};
}
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 7dda245..05012e8 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -132,7 +132,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
m_data->m_view->StrokeArc(rect, startAngle, angleSpan, getHaikuStrokeStyle());
}
-void GraphicsContext::strokePath(const Path&)
+void GraphicsContext::strokePath()
{
notImplemented();
}
@@ -191,7 +191,17 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
// FillRect and FillArc calls are needed.
}
-void GraphicsContext::fillPath(const Path&)
+void GraphicsContext::fillPath()
+{
+ notImplemented();
+}
+
+void GraphicsContext::beginPath()
+{
+ notImplemented();
+}
+
+void GraphicsContext::addPath(const Path& path)
{
notImplemented();
}
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp
index d353d55..e6a7bef 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -462,7 +462,7 @@ void ComplexTextController::adjustGlyphsAndAdvances()
if (ch == '\t' && m_run.allowTabs()) {
float tabWidth = m_font.tabWidth(*fontData);
advance.width = tabWidth - fmodf(m_run.xPos() + m_totalWidth + widthSinceLastRounding, tabWidth);
- } else if (ch == zeroWidthSpace || (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace)) {
+ } else if (ch == zeroWidthSpace || Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
advance.width = 0;
glyph = fontData->spaceGlyph();
}
@@ -518,7 +518,7 @@ void ComplexTextController::adjustGlyphsAndAdvances()
// Check to see if the next character is a "rounding hack character", if so, adjust the
// width so that the total run width will be on an integer boundary.
- if ((m_run.applyWordRounding() && !lastGlyph && Font::isRoundingHackCharacter(nextCh)) || (m_run.applyRunRounding() && lastGlyph)) {
+ if (m_run.applyWordRounding() && !lastGlyph && Font::isRoundingHackCharacter(nextCh) || m_run.applyRunRounding() && lastGlyph) {
CGFloat totalWidth = widthSinceLastRounding + advance.width;
widthSinceLastRounding = ceilCGFloat(totalWidth);
CGFloat extraWidth = widthSinceLastRounding - totalWidth;
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 04a5e26..0d16d4d 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -139,30 +139,30 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints, const FloatPoint* poin
UNUSED_PARAM(shouldAntialias); // FIXME
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
m_data->drawPath(VG_FILL_PATH, m_common->state.fillRule);
}
-void GraphicsContext::strokePath(const Path& path)
+void GraphicsContext::strokePath()
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
m_data->drawPath(VG_STROKE_PATH, m_common->state.fillRule);
}
+void GraphicsContext::drawPath()
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->drawPath(VG_FILL_PATH | VG_STROKE_PATH, m_common->state.fillRule);
+}
+
void GraphicsContext::fillRect(const FloatRect& rect)
{
if (paintingDisabled())
@@ -221,15 +221,11 @@ void GraphicsContext::clip(const FloatRect& rect)
m_data->intersectClipRect(rect);
}
-void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
+void GraphicsContext::clipPath(WindRule clipRule)
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
m_data->clipPath(*(m_data->currentPath()), PainterOpenVG::IntersectClip, clipRule);
}
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index a840525..b399f4e 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -51,6 +51,7 @@
#include "NotImplemented.h"
#include "Path.h"
#include "Pattern.h"
+#include "Pen.h"
#include "TransparencyLayer.h"
#include <QBrush>
@@ -200,6 +201,9 @@ public:
InterpolationQuality imageInterpolationQuality;
+ // Only used by SVG for now.
+ QPainterPath currentPath;
+
ContextShadow shadow;
QStack<ContextShadow> shadowStack;
@@ -208,6 +212,13 @@ public:
return shadow.m_type != ContextShadow::NoShadow;
}
+ inline void clearCurrentPath()
+ {
+ if (!currentPath.elementCount())
+ return;
+ currentPath = QPainterPath();
+ }
+
QRectF clipBoundingRect() const
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
@@ -247,8 +258,8 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
if (!platformContextIsOwned)
return;
- QPaintDevice* device = painter->device();
painter->end();
+ QPaintDevice* device = painter->device();
delete painter;
delete device;
}
@@ -308,6 +319,11 @@ void GraphicsContext::restorePlatformState()
m_data->p()->restore();
+ if (!m_data->currentPath.isEmpty() && m_common->state.pathTransform.isInvertible()) {
+ QTransform matrix = m_common->state.pathTransform;
+ m_data->currentPath = m_data->currentPath * matrix;
+ }
+
if (m_data->shadowStack.isEmpty())
m_data->shadow = ContextShadow();
else
@@ -498,40 +514,28 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
p->setRenderHint(QPainter::Antialiasing, painterWasAntialiased);
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
QPainter* p = m_data->p();
- QPainterPath platformPath = path.platformPath();
- platformPath.setFillRule(toQtFillRule(fillRule()));
+ QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
+ path.setFillRule(toQtFillRule(fillRule()));
if (m_data->hasShadow()) {
ContextShadow* shadow = contextShadow();
if (shadow->m_type != ContextShadow::BlurShadow
&& !m_common->state.fillPattern && !m_common->state.fillGradient)
{
- QPointF offset = shadow->offset();
- const QTransform& transform = p->transform();
- if (transform.isScaling()) {
- // If scaling is required, find the new coord for shadow origin,
- // so that the relative offset to its shape is kept.
- QPointF translatedOffset(offset.x() / transform.m11(),
- offset.y() / transform.m22());
- platformPath.translate(translatedOffset);
- p->fillPath(platformPath, QColor(shadow->m_color));
- platformPath.translate(-translatedOffset);
- } else {
- p->translate(offset);
- p->fillPath(platformPath, QColor(shadow->m_color));
- p->translate(-offset);
- }
+ p->translate(m_data->shadow.offset());
+ p->fillPath(path, QColor(m_data->shadow.m_color));
+ p->translate(-m_data->shadow.offset());
} else {
- QPainter* shadowPainter = shadow->beginShadowLayer(p, platformPath.controlPointRect());
+ QPainter* shadowPainter = shadow->beginShadowLayer(p, path.controlPointRect());
if (shadowPainter) {
shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
- shadowPainter->fillPath(platformPath, QColor(m_data->shadow.m_color));
+ shadowPainter->fillPath(path, QColor(m_data->shadow.m_color));
shadow->endShadowLayer(p);
}
}
@@ -539,24 +543,26 @@ void GraphicsContext::fillPath(const Path& path)
}
if (m_common->state.fillPattern) {
AffineTransform affine;
- p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
+ p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
} else if (m_common->state.fillGradient) {
QBrush brush(*m_common->state.fillGradient->platformGradient());
brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
- p->fillPath(platformPath, brush);
+ p->fillPath(path, brush);
} else
- p->fillPath(platformPath, p->brush());
+ p->fillPath(path, p->brush());
+
+ m_data->clearCurrentPath();
}
-void GraphicsContext::strokePath(const Path& path)
+void GraphicsContext::strokePath()
{
if (paintingDisabled())
return;
QPainter* p = m_data->p();
QPen pen(p->pen());
- QPainterPath platformPath = path.platformPath();
- platformPath.setFillRule(toQtFillRule(fillRule()));
+ QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
+ path.setFillRule(toQtFillRule(fillRule()));
if (m_data->hasShadow()) {
ContextShadow* shadow = contextShadow();
@@ -566,28 +572,16 @@ void GraphicsContext::strokePath(const Path& path)
{
QPen shadowPen(pen);
shadowPen.setColor(m_data->shadow.m_color);
- QPointF offset = shadow->offset();
- const QTransform& transform = p->transform();
- if (transform.isScaling()) {
- // If scaling is required, find the new coord for shadow origin,
- // so that the relative offset to its shape is kept.
- QPointF translatedOffset(offset.x() / transform.m11(),
- offset.y() / transform.m22());
- platformPath.translate(translatedOffset);
- p->strokePath(platformPath, shadowPen);
- platformPath.translate(-translatedOffset);
- } else {
- p->translate(offset);
- p->strokePath(platformPath, shadowPen);
- p->translate(-offset);
- }
+ p->translate(m_data->shadow.offset());
+ p->strokePath(path, shadowPen);
+ p->translate(-m_data->shadow.offset());
} else {
- FloatRect boundingRect = platformPath.controlPointRect();
+ FloatRect boundingRect = path.controlPointRect();
boundingRect.inflate(pen.miterLimit() + pen.widthF());
QPainter* shadowPainter = shadow->beginShadowLayer(p, boundingRect);
if (shadowPainter) {
shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255);
- shadowPainter->strokePath(platformPath, pen);
+ shadowPainter->strokePath(path, pen);
shadow->endShadowLayer(p);
}
}
@@ -597,15 +591,16 @@ void GraphicsContext::strokePath(const Path& path)
AffineTransform affine;
pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
p->setPen(pen);
- p->strokePath(platformPath, pen);
+ p->strokePath(path, pen);
} else if (m_common->state.strokeGradient) {
QBrush brush(*m_common->state.strokeGradient->platformGradient());
brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
pen.setBrush(brush);
p->setPen(pen);
- p->strokePath(platformPath, pen);
+ p->strokePath(path, pen);
} else
- p->strokePath(platformPath, pen);
+ p->strokePath(path, pen);
+ m_data->clearCurrentPath();
}
static inline void drawRepeatPattern(QPainter* p, QPixmap* image, const FloatRect& rect, const bool repeatX, const bool repeatY)
@@ -721,7 +716,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
// without using the shadow layer at all.
QColor shadowColor = shadow->m_color;
shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
- const QTransform& transform = p->transform();
+ const QTransform transform = p->transform();
if (transform.isScaling()) {
p->fillRect(normalizedRect.translated(static_cast<qreal>(shadow->offset().x()) / transform.m11(),
static_cast<qreal>(shadow->offset().y() / transform.m22())),
@@ -792,11 +787,30 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
p->fillPath(path.platformPath(), QColor(color));
}
+void GraphicsContext::beginPath()
+{
+ m_data->clearCurrentPath();
+}
+
+void GraphicsContext::addPath(const Path& path)
+{
+ if (!m_data->currentPath.elementCount()) {
+ m_data->currentPath = path.platformPath();
+ return;
+ }
+ m_data->currentPath.addPath(path.platformPath());
+}
+
bool GraphicsContext::inTransparencyLayer() const
{
return m_data->layerCount;
}
+PlatformPath* GraphicsContext::currentPath()
+{
+ return &m_data->currentPath;
+}
+
ContextShadow* GraphicsContext::contextShadow()
{
return &m_data->shadow;
@@ -810,15 +824,15 @@ void GraphicsContext::clip(const FloatRect& rect)
m_data->p()->setClipRect(rect, Qt::IntersectClip);
}
-void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
+void GraphicsContext::clipPath(WindRule clipRule)
{
if (paintingDisabled())
return;
QPainter* p = m_data->p();
- QPainterPath platformPath = path.platformPath();
- platformPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);
- p->setClipPath(platformPath, Qt::IntersectClip);
+ QPainterPath newPath = m_data->currentPath;
+ newPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);
+ p->setClipPath(newPath, Qt::IntersectClip);
}
void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
@@ -1047,10 +1061,12 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
if (paintingDisabled())
return;
- Path path;
+ QPainterPath path;
path.addRect(rect);
setStrokeThickness(width);
- strokePath(path);
+ m_data->currentPath = path;
+
+ strokePath();
}
void GraphicsContext::setLineCap(LineCap lc)
@@ -1170,6 +1186,12 @@ void GraphicsContext::translate(float x, float y)
return;
m_data->p()->translate(x, y);
+
+ if (!m_data->currentPath.isEmpty()) {
+ QTransform matrix;
+ m_data->currentPath = m_data->currentPath * matrix.translate(-x, -y);
+ m_common->state.pathTransform.translate(x, y);
+ }
}
void GraphicsContext::rotate(float radians)
@@ -1178,6 +1200,12 @@ void GraphicsContext::rotate(float radians)
return;
m_data->p()->rotate(180 / M_PI*radians);
+
+ if (!m_data->currentPath.isEmpty()) {
+ QTransform matrix;
+ m_data->currentPath = m_data->currentPath * matrix.rotate(-180 / M_PI*radians);
+ m_common->state.pathTransform.rotate(radians);
+ }
}
void GraphicsContext::scale(const FloatSize& s)
@@ -1186,6 +1214,12 @@ void GraphicsContext::scale(const FloatSize& s)
return;
m_data->p()->scale(s.width(), s.height());
+
+ if (!m_data->currentPath.isEmpty()) {
+ QTransform matrix;
+ m_data->currentPath = m_data->currentPath * matrix.scale(1 / s.width(), 1 / s.height());
+ m_common->state.pathTransform.scaleNonUniform(s.width(), s.height());
+ }
}
void GraphicsContext::clipOut(const IntRect& rect)
@@ -1242,6 +1276,15 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
return;
m_data->p()->setWorldTransform(transform, true);
+
+ // Transformations to the context shouldn't transform the currentPath.
+ // We have to undo every change made to the context from the currentPath
+ // to avoid wrong drawings.
+ if (!m_data->currentPath.isEmpty() && transform.isInvertible()) {
+ QTransform matrix = transform.inverse();
+ m_data->currentPath = m_data->currentPath * matrix;
+ m_common->state.pathTransform.multiply(transform.toTransformationMatrix());
+ }
}
void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 6f6dce8..7c0bcd1 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -420,15 +420,11 @@ void GraphicsContext::clipOut(const Path& p)
platformContext()->canvas()->clipPath(path, SkRegion::kDifference_Op);
}
-void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
+void GraphicsContext::clipPath(WindRule clipRule)
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(pathToClip);
-
SkPath path = platformContext()->currentPathInLocalCoordinates();
if (!isPathSkiaSafe(getCTM(), path))
return;
@@ -727,15 +723,11 @@ void GraphicsContext::drawRect(const IntRect& rect)
platformContext()->drawRect(r);
}
-void GraphicsContext::fillPath(const Path& pathToFill)
+void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(pathToFill);
-
SkPath path = platformContext()->currentPathInLocalCoordinates();
if (!isPathSkiaSafe(getCTM(), path))
return;
@@ -1185,15 +1177,11 @@ void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan)
platformContext()->canvas()->drawPath(path, paint);
}
-void GraphicsContext::strokePath(const Path& pathToStroke)
+void GraphicsContext::strokePath()
{
if (paintingDisabled())
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(pathToStroke);
-
SkPath path = platformContext()->currentPathInLocalCoordinates();
if (!isPathSkiaSafe(getCTM(), path))
return;
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index ae2653a..fee64ca 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -143,7 +143,9 @@ static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext
// Everything else gets resampled.
// If the platform context permits high quality interpolation, use it.
- if (platformContext->interpolationQuality() == InterpolationHigh)
+ // High quality interpolation only enabled for scaling and translation.
+ if (platformContext->interpolationQuality() == InterpolationHigh
+ && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
return RESAMPLE_AWESOME;
return RESAMPLE_LINEAR;
@@ -178,9 +180,17 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
SkIRect resizedImageRect = // Represents the size of the resized image.
{ 0, 0, destRectRounded.width(), destRectRounded.height() };
- if (srcIsFull && bitmap.hasResizedBitmap(destRectRounded.width(), destRectRounded.height())) {
+ // Apply forward transform to destRect to estimate required size of
+ // re-sampled bitmap, and use only in calls required to resize, or that
+ // check for the required size.
+ SkRect destRectTransformed;
+ canvas.getTotalMatrix().mapRect(&destRectTransformed, destRect);
+ SkIRect destRectTransformedRounded;
+ destRectTransformed.round(&destRectTransformedRounded);
+
+ if (srcIsFull && bitmap.hasResizedBitmap(destRectTransformedRounded.width(), destRectTransformedRounded.height())) {
// Yay, this bitmap frame already has a resized version.
- SkBitmap resampled = bitmap.resizedBitmap(destRectRounded.width(), destRectRounded.height());
+ SkBitmap resampled = bitmap.resizedBitmap(destRectTransformedRounded.width(), destRectTransformedRounded.height());
canvas.drawBitmapRect(resampled, 0, destRect, &paint);
return;
}
@@ -207,8 +217,8 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
destBitmapSubsetSkI.height())) {
// We're supposed to resize the entire image and cache it, even though
// we don't need all of it.
- SkBitmap resampled = bitmap.resizedBitmap(destRectRounded.width(),
- destRectRounded.height());
+ SkBitmap resampled = bitmap.resizedBitmap(destRectTransformedRounded.width(),
+ destRectTransformedRounded.height());
canvas.drawBitmapRect(resampled, 0, destRect, &paint);
} else {
// We should only resize the exposed part of the bitmap to do the
@@ -217,7 +227,7 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
// Resample the needed part of the image.
SkBitmap resampled = skia::ImageOperations::Resize(subset,
skia::ImageOperations::RESIZE_LANCZOS3,
- destRectRounded.width(), destRectRounded.height(),
+ destRectTransformedRounded.width(), destRectTransformedRounded.height(),
destBitmapSubsetSkI);
// Compute where the new bitmap should be drawn. Since our new bitmap
diff --git a/WebCore/platform/graphics/win/cairo/FontPlatformData.h b/WebCore/platform/graphics/win/cairo/FontPlatformData.h
index d8f538a..05f9eab 100644
--- a/WebCore/platform/graphics/win/cairo/FontPlatformData.h
+++ b/WebCore/platform/graphics/win/cairo/FontPlatformData.h
@@ -3,7 +3,6 @@
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2007 Pioneer Research Center USA, Inc.
- * Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org>
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@ -26,7 +25,7 @@
#ifndef FontPlatformDataCairoWin_h
#define FontPlatformDataCairoWin_h
-#include "FontOrientation.h"
+#include "FontDescription.h"
#include "GlyphBuffer.h"
#include "RefCountedGDIHandle.h"
#include "StringImpl.h"
@@ -38,8 +37,6 @@ typedef struct HFONT__* HFONT;
namespace WebCore {
-class FontDescription;
-
class FontPlatformData {
public:
FontPlatformData(WTF::HashTableDeletedValueType)
@@ -76,9 +73,6 @@ public:
void setSize(float size) { m_size = size; }
bool syntheticBold() const { return m_syntheticBold; }
bool syntheticOblique() const { return m_syntheticOblique; }
-
- FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
-
cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
unsigned hash() const
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 4faa29d..0802826 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -1325,12 +1325,8 @@ Color gradientAverageColor(const Gradient* gradient)
, (stop.alpha + lastStop.alpha) * 0.5f);
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
Color c = m_common->state.fillGradient
? gradientAverageColor(m_common->state.fillGradient.get())
: fillColor();
@@ -1380,10 +1376,6 @@ void GraphicsContext::strokePath()
if (!m_data->m_dc)
return;
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
if (m_data->m_opacity < 1.0f || m_data->hasAlpha()) {
@@ -1908,7 +1900,7 @@ void GraphicsContext::setLineDash(const DashArray&, float)
notImplemented();
}
-void GraphicsContext::clipPath(const Path&, WindRule)
+void GraphicsContext::clipPath(WindRule)
{
notImplemented();
}
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index ba96352..5007ffe 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -337,7 +337,7 @@ void GraphicsContext::clipOut(const IntRect&)
notImplemented();
}
-void GraphicsContext::clipPath(const Path&, WindRule)
+void GraphicsContext::clipPath(WindRule)
{
notImplemented();
}
@@ -533,32 +533,30 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
return InterpolationDefault;
}
-void GraphicsContext::fillPath(const Path& path)
+void GraphicsContext::fillPath()
{
#if USE(WXGC)
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
if (gc)
gc->FillPath(m_data->currentPath);
#endif
}
-void GraphicsContext::strokePath(const Path& path)
+void GraphicsContext::strokePath()
{
#if USE(WXGC)
- // FIXME: Be smarter about this.
- beginPath();
- addPath(path);
-
wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
if (gc)
gc->StrokePath(m_data->currentPath);
#endif
}
+void GraphicsContext::drawPath()
+{
+ fillPath();
+ strokePath();
+}
+
void GraphicsContext::fillRect(const FloatRect& rect)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp
index dd45f31..2522cbd 100644
--- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp
+++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp
@@ -37,7 +37,7 @@ ImageBufferData::ImageBufferData(const IntSize&)
{
}
-ImageBuffer::ImageBuffer(const IntSize&, ColorSpace imageColorSpace, bool& success) :
+ImageBuffer::ImageBuffer(const IntSize&, ImageColorSpace imageColorSpace, bool& success) :
m_data(IntSize())
{
notImplemented();
diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp
index b2466c5..e7ff78e 100644
--- a/WebCore/platform/gtk/PopupMenuGtk.cpp
+++ b/WebCore/platform/gtk/PopupMenuGtk.cpp
@@ -5,7 +5,6 @@
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2008 Collabora Ltd.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2010 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -28,22 +27,16 @@
#include "PopupMenuGtk.h"
#include "FrameView.h"
-#include "GOwnPtr.h"
#include "GtkVersioning.h"
#include "HostWindow.h"
#include "PlatformString.h"
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
#include <wtf/text/CString.h>
+#include <gtk/gtk.h>
namespace WebCore {
-static const uint32_t gSearchTimeoutMs = 1000;
-
PopupMenuGtk::PopupMenuGtk(PopupMenuClient* client)
: m_popupClient(client)
- , m_previousKeyEventCharacter(0)
- , m_currentlySelectedMenuItem(0)
{
}
@@ -61,16 +54,12 @@ void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index)
if (!m_popup) {
m_popup = GTK_MENU(gtk_menu_new());
- g_signal_connect(m_popup.get(), "unmap", G_CALLBACK(PopupMenuGtk::menuUnmapped), this);
- g_signal_connect(m_popup.get(), "key-press-event", G_CALLBACK(PopupMenuGtk::keyPressEventCallback), this);
+ g_signal_connect(m_popup.get(), "unmap", G_CALLBACK(menuUnmapped), this);
} else
gtk_container_foreach(GTK_CONTAINER(m_popup.get()), reinterpret_cast<GtkCallback>(menuRemoveItem), this);
- int x = 0;
- int y = 0;
- GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient()));
- if (window)
- gdk_window_get_origin(window, &x, &y);
+ int x, y;
+ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y);
m_menuPosition = view->contentsToWindow(rect.location());
m_menuPosition = IntPoint(m_menuPosition.x() + x, m_menuPosition.y() + y + rect.height());
m_indexMap.clear();
@@ -84,8 +73,7 @@ void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index)
item = gtk_menu_item_new_with_label(client()->itemText(i).utf8().data());
m_indexMap.add(item, i);
- g_signal_connect(item, "activate", G_CALLBACK(PopupMenuGtk::menuItemActivated), this);
- g_signal_connect(item, "select", G_CALLBACK(PopupMenuGtk::selectItemCallback), this);
+ g_signal_connect(item, "activate", G_CALLBACK(menuItemActivated), this);
// FIXME: Apply the PopupMenuStyle from client()->itemStyle(i)
gtk_widget_set_sensitive(item, client()->itemIsEnabled(i));
@@ -150,77 +138,6 @@ void PopupMenuGtk::disconnectClient()
m_popupClient = 0;
}
-bool PopupMenuGtk::typeAheadFind(GdkEventKey* event)
-{
- // If we were given a non-printable character just skip it.
- gunichar unicodeCharacter = gdk_keyval_to_unicode(event->keyval);
- if (!unicodeCharacter) {
- resetTypeAheadFindState();
- return false;
- }
-
- glong charactersWritten;
- GOwnPtr<gunichar2> utf16String(g_ucs4_to_utf16(&unicodeCharacter, 1, 0, &charactersWritten, 0));
- if (!utf16String) {
- resetTypeAheadFindState();
- return false;
- }
-
- // If the character is the same as the last character, the user is probably trying to
- // cycle through the menulist entries. This matches the WebCore behavior for collapsed
- // menulists.
- bool repeatingCharacter = unicodeCharacter != m_previousKeyEventCharacter;
- if (event->time - m_previousKeyEventTimestamp > gSearchTimeoutMs)
- m_currentSearchString = String(static_cast<UChar*>(utf16String.get()), charactersWritten);
- else if (repeatingCharacter)
- m_currentSearchString.append(String(static_cast<UChar*>(utf16String.get()), charactersWritten));
-
- m_previousKeyEventTimestamp = event->time;
- m_previousKeyEventCharacter = unicodeCharacter;
-
- // Like the Chromium port, we case fold before searching, because
- // strncmp does not handle non-ASCII characters.
- GOwnPtr<gchar> searchStringWithCaseFolded(g_utf8_casefold(m_currentSearchString.utf8().data(), -1));
- size_t prefixLength = strlen(searchStringWithCaseFolded.get());
-
- GList* children = gtk_container_get_children(GTK_CONTAINER(m_popup.get()));
- if (!children)
- return true;
-
- // If a menu item has already been selected, start searching from the current
- // item down the list. This will make multiple key presses of the same character
- // advance the selection.
- GList* currentChild = children;
- if (m_currentlySelectedMenuItem) {
- currentChild = g_list_find(children, m_currentlySelectedMenuItem);
- if (!currentChild) {
- m_currentlySelectedMenuItem = 0;
- currentChild = children;
- }
-
- // Repeating characters should iterate.
- if (repeatingCharacter) {
- if (GList* nextChild = g_list_next(currentChild))
- currentChild = nextChild;
- }
- }
-
- GList* firstChild = currentChild;
- do {
- currentChild = g_list_next(currentChild);
- if (!currentChild)
- currentChild = children;
-
- GOwnPtr<gchar> itemText(g_utf8_casefold(gtk_menu_item_get_label(GTK_MENU_ITEM(currentChild->data)), -1));
- if (!strncmp(searchStringWithCaseFolded.get(), itemText.get(), prefixLength)) {
- gtk_menu_shell_select_item(GTK_MENU_SHELL(m_popup.get()), GTK_WIDGET(currentChild->data));
- return true;
- }
- } while (currentChild != firstChild);
-
- return true;
-}
-
void PopupMenuGtk::menuItemActivated(GtkMenuItem* item, PopupMenuGtk* that)
{
ASSERT(that->client());
@@ -231,7 +148,6 @@ void PopupMenuGtk::menuItemActivated(GtkMenuItem* item, PopupMenuGtk* that)
void PopupMenuGtk::menuUnmapped(GtkWidget*, PopupMenuGtk* that)
{
ASSERT(that->client());
- that->resetTypeAheadFindState();
that->client()->popupDidHide();
}
@@ -242,29 +158,11 @@ void PopupMenuGtk::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pu
*pushIn = true;
}
-void PopupMenuGtk::resetTypeAheadFindState()
-{
- m_currentlySelectedMenuItem = 0;
- m_previousKeyEventCharacter = 0;
- m_currentSearchString = "";
-}
-
void PopupMenuGtk::menuRemoveItem(GtkWidget* widget, PopupMenuGtk* that)
{
ASSERT(that->m_popup);
gtk_container_remove(GTK_CONTAINER(that->m_popup.get()), widget);
}
-int PopupMenuGtk::selectItemCallback(GtkMenuItem* item, PopupMenuGtk* that)
-{
- that->m_currentlySelectedMenuItem = GTK_WIDGET(item);
- return FALSE;
-}
-
-int PopupMenuGtk::keyPressEventCallback(GtkWidget* widget, GdkEventKey* event, PopupMenuGtk* that)
-{
- return that->typeAheadFind(event);
-}
-
}
diff --git a/WebCore/platform/gtk/PopupMenuGtk.h b/WebCore/platform/gtk/PopupMenuGtk.h
index e47fda6..8848e06 100644
--- a/WebCore/platform/gtk/PopupMenuGtk.h
+++ b/WebCore/platform/gtk/PopupMenuGtk.h
@@ -24,12 +24,11 @@
#include "IntRect.h"
#include "PopupMenu.h"
#include "PopupMenuClient.h"
+#include <glib.h>
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-typedef struct _GdkEventKey GdkEventKey;
-
namespace WebCore {
class FrameView;
@@ -44,27 +43,19 @@ public:
virtual void hide();
virtual void updateFromElement();
virtual void disconnectClient();
- bool typeAheadFind(GdkEventKey*);
private:
PopupMenuClient* client() const { return m_popupClient; }
- void resetTypeAheadFindState();
static void menuItemActivated(GtkMenuItem* item, PopupMenuGtk*);
static void menuUnmapped(GtkWidget*, PopupMenuGtk*);
static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenuGtk*);
static void menuRemoveItem(GtkWidget*, PopupMenuGtk*);
- static int selectItemCallback(GtkMenuItem*, PopupMenuGtk*);
- static int keyPressEventCallback(GtkWidget*, GdkEventKey*, PopupMenuGtk*);
PopupMenuClient* m_popupClient;
IntPoint m_menuPosition;
PlatformRefPtr<GtkMenu> m_popup;
HashMap<GtkWidget*, int> m_indexMap;
- String m_currentSearchString;
- uint32_t m_previousKeyEventTimestamp;
- unsigned int m_previousKeyEventCharacter;
- GtkWidget* m_currentlySelectedMenuItem;
};
}
diff --git a/WebCore/platform/mac/ScrollViewMac.mm b/WebCore/platform/mac/ScrollViewMac.mm
index 93ec971..7ef5dc4 100644
--- a/WebCore/platform/mac/ScrollViewMac.mm
+++ b/WebCore/platform/mac/ScrollViewMac.mm
@@ -147,8 +147,7 @@ void ScrollView::platformSetScrollbarsSuppressed(bool repaintOnUnsuppress)
void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- NSPoint floatPoint = scrollPoint;
- NSPoint tempPoint = { max(-[scrollView() scrollOrigin].x, floatPoint.x), max(-[scrollView() scrollOrigin].y, floatPoint.y) }; // Don't use NSMakePoint to work around 4213314.
+ NSPoint tempPoint = { max(0, scrollPoint.x()), max(0, scrollPoint.y()) }; // Don't use NSMakePoint to work around 4213314.
[documentView() scrollPoint:tempPoint];
END_BLOCK_OBJC_EXCEPTIONS;
}
@@ -203,11 +202,4 @@ bool ScrollView::platformIsOffscreen() const
return ![platformWidget() window] || ![[platformWidget() window] isVisible];
}
-void ScrollView::platformSetScrollOrigin(const IntPoint& origin, bool updatePosition)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [scrollView() setScrollOrigin:origin updatePosition:updatePosition];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
} // namespace WebCore
diff --git a/WebCore/platform/network/NetworkingContext.h b/WebCore/platform/network/NetworkingContext.h
index e0cb4c5..a7d40dc 100644
--- a/WebCore/platform/network/NetworkingContext.h
+++ b/WebCore/platform/network/NetworkingContext.h
@@ -33,10 +33,6 @@ class QNetworkAccessManager;
namespace WebCore {
-#if PLATFORM(ANDROID)
-class FrameLoaderClient;
-class MainResourceLoader;
-#endif
class ResourceError;
class ResourceRequest;
@@ -64,11 +60,6 @@ public:
virtual ResourceError blockedError(const ResourceRequest&) const = 0;
#endif
-#if PLATFORM(ANDROID)
- virtual MainResourceLoader* mainResourceLoader() const = 0;
- virtual FrameLoaderClient* frameLoaderClient() const = 0;
-#endif
-
protected:
NetworkingContext() { }
};
diff --git a/WebCore/platform/network/android/CookieJarAndroid.cpp b/WebCore/platform/network/android/CookieJarAndroid.cpp
index f3b343e..dd324c5 100644
--- a/WebCore/platform/network/android/CookieJarAndroid.cpp
+++ b/WebCore/platform/network/android/CookieJarAndroid.cpp
@@ -31,25 +31,25 @@
namespace WebCore {
-void setCookies(Document* document, const KURL& url, const String& value)
+void setCookies(Document*, const KURL& url, const String& value)
{
- PlatformBridge::setCookies(document, url, value);
+ PlatformBridge::setCookies(url, value);
}
-String cookies(const Document* document, const KURL& url)
+String cookies(const Document*, const KURL& url)
{
- return PlatformBridge::cookies(document, url);
+ return PlatformBridge::cookies(url);
}
-String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
{
// FIXME: include HttpOnly cookie.
- return PlatformBridge::cookies(document, url);
+ return PlatformBridge::cookies(url);
}
-bool cookiesEnabled(const Document* document)
+bool cookiesEnabled(const Document*)
{
- return PlatformBridge::cookiesEnabled(document);
+ return PlatformBridge::cookiesEnabled();
}
}
diff --git a/WebCore/platform/network/android/ProxyServerAndroid.cpp b/WebCore/platform/network/android/ProxyServerAndroid.cpp
deleted file mode 100644
index 2f813b5..0000000
--- a/WebCore/platform/network/android/ProxyServerAndroid.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * All rights reserved.
- *
- * 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 THE COPYRIGHT HOLDERS ``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 COMPUTER, 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 "ProxyServer.h"
-
-#include "NotImplemented.h"
-
-namespace WebCore {
-
-Vector<ProxyServer> proxyServersForURL(const KURL&, const NetworkingContext*)
-{
- notImplemented();
- return Vector<ProxyServer>();
-}
-
-}
diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
index 8837cf8..d3a8a17 100644
--- a/WebCore/platform/network/android/ResourceHandleAndroid.cpp
+++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
@@ -24,6 +24,7 @@
*/
#include "config.h"
+
#include "ResourceHandle.h"
#include "CachedResourceLoader.h"
@@ -35,7 +36,6 @@
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
#include "ResourceLoaderAndroid.h"
-#include "Settings.h"
#include <wtf/text/CString.h>
namespace WebCore {
@@ -48,14 +48,16 @@ ResourceHandle::~ResourceHandle()
{
}
-bool ResourceHandle::start(NetworkingContext* context)
+bool ResourceHandle::start(Frame* frame)
{
- MainResourceLoader* mainLoader = context->mainResourceLoader();
- bool isMainResource = static_cast<void*>(mainLoader) == static_cast<void*>(client());
- RefPtr<ResourceLoaderAndroid> loader = ResourceLoaderAndroid::start(this, d->m_firstRequest, context->frameLoaderClient(), isMainResource, false);
+ DocumentLoader* documentLoader = frame->loader()->activeDocumentLoader();
+ MainResourceLoader* mainLoader = documentLoader->mainResourceLoader();
+ bool isMainResource = mainLoader && (mainLoader->handle() == this);
+
+ PassRefPtr<ResourceLoaderAndroid> loader = ResourceLoaderAndroid::start(this, d->m_request, frame->loader()->client(), isMainResource, false);
if (loader) {
- d->m_loader = loader.release();
+ d->m_loader = loader;
return true;
}
@@ -108,11 +110,11 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
return ResourceLoaderAndroid::willLoadFromCache(request.url(), formData ? formData->identifier() : 0);
}
-bool ResourceHandle::loadsBlocked()
+bool ResourceHandle::loadsBlocked()
{
// FIXME, need to check whether connection pipe is blocked.
// return false for now
- return false;
+ return false;
}
// Class to handle synchronized loading of resources.
@@ -147,17 +149,15 @@ private:
WTF::Vector<char>* m_data;
};
-void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request,
- StoredCredentials, ResourceError& error, ResourceResponse& response, WTF::Vector<char>& data)
+void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
+ StoredCredentials /*storedCredentials*/,
+ ResourceError& error, ResourceResponse& response, WTF::Vector<char>& data,
+ Frame* frame)
{
SyncLoader s(error, response, data);
- RefPtr<ResourceHandle> h = adoptRef(new ResourceHandle(request, &s, false, false));
+ RefPtr<ResourceHandle> h = adoptRef(new ResourceHandle(request, &s, false, false, false));
// This blocks until the load is finished.
- // Use the request owned by the ResourceHandle. This has had the username
- // and password (if present) stripped from the URL in
- // ResourceHandleInternal::ResourceHandleInternal(). This matches the
- // behaviour in the asynchronous case.
- ResourceLoaderAndroid::start(h.get(), request, context->frameLoaderClient(), false, true);
+ ResourceLoaderAndroid::start(h.get(), request, frame->loader()->client(), false, true);
}
} // namespace WebCore
diff --git a/WebCore/platform/network/android/ResourceRequestAndroid.cpp b/WebCore/platform/network/android/ResourceRequestAndroid.cpp
index 00735f3..7f4bccb 100644
--- a/WebCore/platform/network/android/ResourceRequestAndroid.cpp
+++ b/WebCore/platform/network/android/ResourceRequestAndroid.cpp
@@ -30,17 +30,10 @@ namespace WebCore {
unsigned initializeMaximumHTTPConnectionCountPerHost()
{
-#if USE(CHROME_NETWORK_STACK)
- // The chromium network stack already handles limiting the number of
- // parallel requests per host, so there's no need to do it here. Therefore,
- // this is set to a high value that should never be hit in practice.
- return 10000;
-#else
// This is used by the loader to control the number of parallel load
// requests. Our java framework has 4 threads that can each pipeline up to
// 5 requests. Use 20 as a maximum number.
return 20;
-#endif
}
} // namespace WebCore
diff --git a/WebCore/platform/network/soup/cache/soup-http-input-stream.c b/WebCore/platform/network/soup/cache/soup-http-input-stream.c
index 195c458..dc95d6e 100644
--- a/WebCore/platform/network/soup/cache/soup-http-input-stream.c
+++ b/WebCore/platform/network/soup/cache/soup-http-input-stream.c
@@ -598,7 +598,6 @@ send_async_finished (GInputStream *stream)
g_error_free (error);
}
g_simple_async_result_complete (result);
- g_object_unref (result);
}
static void
diff --git a/WebCore/platform/network/soup/cache/webkit/soup-cache.c b/WebCore/platform/network/soup/cache/webkit/soup-cache.c
index b916468..4835750 100644
--- a/WebCore/platform/network/soup/cache/webkit/soup-cache.c
+++ b/WebCore/platform/network/soup/cache/webkit/soup-cache.c
@@ -147,8 +147,6 @@ get_cacheability (WebKitSoupCache *cache, SoupMessage *msg)
soup_header_free_param_list (hash);
return WEBKIT_SOUP_CACHE_UNCACHEABLE;
}
-
- soup_header_free_param_list (hash);
}
switch (msg->status_code) {
@@ -286,12 +284,14 @@ webkit_soup_cache_entry_set_freshness (WebKitSoupCacheEntry *entry, SoupMessage
{
const char *cache_control;
const char *expires, *date, *last_modified;
+ GHashTable *hash;
+
+ hash = NULL;
cache_control = soup_message_headers_get (entry->headers, "Cache-Control");
if (cache_control) {
const char *max_age, *s_maxage;
gint64 freshness_lifetime = 0;
- GHashTable *hash;
WebKitSoupCachePrivate *priv = WEBKIT_SOUP_CACHE_GET_PRIVATE (cache);
hash = soup_header_parse_param_list (cache_control);
@@ -323,9 +323,10 @@ webkit_soup_cache_entry_set_freshness (WebKitSoupCacheEntry *entry, SoupMessage
soup_header_free_param_list (hash);
return;
}
+ }
+ if (hash != NULL)
soup_header_free_param_list (hash);
- }
/* If the 'Expires' response header is present, use its value
* minus the value of the 'Date' response header
@@ -997,7 +998,6 @@ webkit_soup_cache_send_response (WebKitSoupCache *cache, SoupMessage *msg)
key = soup_message_get_cache_key (msg);
entry = g_hash_table_lookup (cache->priv->cache, key);
- g_free (key);
g_return_val_if_fail (entry, NULL);
/* If we are told to send a response from cache any validation
@@ -1257,6 +1257,7 @@ webkit_soup_cache_has_response (WebKitSoupCache *cache, SoupMessage *msg)
char *key;
WebKitSoupCacheEntry *entry;
const char *cache_control;
+ GHashTable *hash;
gpointer value;
gboolean must_revalidate;
int max_age, max_stale, min_fresh;
@@ -1264,7 +1265,6 @@ webkit_soup_cache_has_response (WebKitSoupCache *cache, SoupMessage *msg)
key = soup_message_get_cache_key (msg);
entry = g_hash_table_lookup (cache->priv->cache, key);
- g_free (key);
/* 1. The presented Request-URI and that of stored response
* match
@@ -1321,10 +1321,10 @@ webkit_soup_cache_has_response (WebKitSoupCache *cache, SoupMessage *msg)
cache_control = soup_message_headers_get (msg->request_headers, "Cache-Control");
if (cache_control) {
- GHashTable *hash = soup_header_parse_param_list (cache_control);
+ hash = soup_header_parse_param_list (cache_control);
if (g_hash_table_lookup_extended (hash, "no-store", NULL, NULL)) {
- soup_header_free_param_list (hash);
+ g_hash_table_destroy (hash);
return WEBKIT_SOUP_CACHE_RESPONSE_STALE;
}
@@ -1348,7 +1348,7 @@ webkit_soup_cache_has_response (WebKitSoupCache *cache, SoupMessage *msg)
if (value)
min_fresh = (int)MIN (g_ascii_strtoll (value, NULL, 10), G_MAXINT32);
- soup_header_free_param_list (hash);
+ g_hash_table_destroy (hash);
if (max_age != -1) {
guint current_age = webkit_soup_cache_entry_get_current_age (entry);
@@ -1609,7 +1609,7 @@ webkit_soup_cache_load (WebKitSoupCache *cache)
g_free (filename);
variant_format = g_variant_type_new (WEBKIT_SOUP_CACHE_ENTRIES_FORMAT);
- cache_variant = g_variant_new_from_data (variant_format, (const gchar *)contents, length, FALSE, g_free, contents);
+ cache_variant = g_variant_new_from_data (variant_format, (const gchar *)contents, length, FALSE, NULL, NULL);
g_variant_type_free (variant_format);
g_variant_get (cache_variant, WEBKIT_SOUP_CACHE_ENTRIES_FORMAT, &entries_iter);
diff --git a/WebCore/platform/text/TextBoundaries.cpp b/WebCore/platform/text/TextBoundaries.cpp
index fbb261b..8eaffca 100644
--- a/WebCore/platform/text/TextBoundaries.cpp
+++ b/WebCore/platform/text/TextBoundaries.cpp
@@ -36,32 +36,6 @@ using namespace Unicode;
namespace WebCore {
-int endOfFirstWordBoundaryContext(const UChar* characters, int length)
-{
- for (int i = 0; i < length; ) {
- int first = i;
- UChar32 ch;
- U16_NEXT(characters, i, length, ch);
- if (!requiresContextForWordBoundary(ch))
- return first;
- }
- return length;
-}
-
-int startOfLastWordBoundaryContext(const UChar* characters, int length)
-{
- for (int i = length; i > 0; ) {
- int last = i;
- UChar32 ch;
- U16_PREV(characters, 0, i, ch);
- if (!requiresContextForWordBoundary(ch))
- return last;
- }
- return 0;
-}
-
-#if !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT)
-
int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
{
TextBreakIterator* it = wordBreakIterator(chars, len);
@@ -102,6 +76,4 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int
*start = textBreakPrevious(it);
}
-#endif // !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT)
-
} // namespace WebCore
diff --git a/WebCore/platform/text/TextBoundaries.h b/WebCore/platform/text/TextBoundaries.h
index 870ab62..7eb9cab 100644
--- a/WebCore/platform/text/TextBoundaries.h
+++ b/WebCore/platform/text/TextBoundaries.h
@@ -35,9 +35,6 @@ namespace WebCore {
return WTF::Unicode::hasLineBreakingPropertyComplexContext(ch);
}
- int endOfFirstWordBoundaryContext(const UChar* characters, int length);
- int startOfLastWordBoundaryContext(const UChar* characters, int length);
-
void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
diff --git a/WebCore/platform/text/TextCodecUTF16.cpp b/WebCore/platform/text/TextCodecUTF16.cpp
index e88e83b..95f4dc4 100644
--- a/WebCore/platform/text/TextCodecUTF16.cpp
+++ b/WebCore/platform/text/TextCodecUTF16.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -117,13 +117,8 @@ String TextCodecUTF16::decode(const char* bytes, size_t length, bool, bool, bool
CString TextCodecUTF16::encode(const UChar* characters, size_t length, UnencodableHandling)
{
- // We need to be sure we can double the length without overflowing.
- // Since the passed-in length is the length of an actual existing
- // character buffer, each character is two bytes, and we know
- // the buffer doesn't occupy the entire address space, we can
- // assert here that doubling the length does not overflow size_t
- // and there's no need for a runtime check.
- ASSERT(length <= numeric_limits<size_t>::max() / 2);
+ if (length > numeric_limits<size_t>::max() / 2)
+ CRASH();
char* bytes;
CString string = CString::newUninitialized(length * 2, bytes);
diff --git a/WebCore/platform/win/FileSystemWin.cpp b/WebCore/platform/win/FileSystemWin.cpp
index 5ee3b8e..cef7196 100644
--- a/WebCore/platform/win/FileSystemWin.cpp
+++ b/WebCore/platform/win/FileSystemWin.cpp
@@ -134,7 +134,10 @@ String pathGetFileName(const String& path)
String directoryName(const String& path)
{
- return path.left(path.length() - pathGetFileName(path).length());
+ String fileName = pathGetFileName(path);
+ String dirName = String(path);
+ dirName.truncate(dirName.length() - pathGetFileName(path).length());
+ return dirName;
}
static String bundleName()
diff --git a/WebCore/platform/wince/FileSystemWinCE.cpp b/WebCore/platform/wince/FileSystemWinCE.cpp
index 49acf12..90b278e 100644
--- a/WebCore/platform/wince/FileSystemWinCE.cpp
+++ b/WebCore/platform/wince/FileSystemWinCE.cpp
@@ -33,25 +33,12 @@
#include "NotImplemented.h"
#include "PlatformString.h"
-#include <wincrypt.h>
-#include <windows.h>
#include <wtf/text/CString.h>
-namespace WebCore {
-
-static size_t reverseFindPathSeparator(const String& path, unsigned start = UINT_MAX)
-{
- size_t positionSlash = path.reverseFind('/', start);
- size_t positionBackslash = path.reverseFind('\\', start);
-
- if (positionSlash == notFound)
- return positionBackslash;
-
- if (positionBackslash == notFound)
- return positionSlash;
+#include <windows.h>
+#include <wincrypt.h>
- return std::max(positionSlash, positionBackslash);
-}
+namespace WebCore {
static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo)
{
@@ -146,14 +133,14 @@ CString fileSystemRepresentation(const String&)
bool makeAllDirectories(const String& path)
{
- size_t lastDivPos = reverseFindPathSeparator(path);
- unsigned endPos = path.length();
- if (lastDivPos == endPos - 1) {
- --endPos;
- lastDivPos = reverseFindPathSeparator(path, lastDivPos);
+ int lastDivPos = std::max(path.reverseFind('/'), path.reverseFind('\\'));
+ int endPos = path.length();
+ if (lastDivPos == path.length() - 1) {
+ endPos -= 1;
+ lastDivPos = std::max(path.reverseFind('/', lastDivPos), path.reverseFind('\\', lastDivPos));
}
- if (lastDivPos != notFound) {
+ if (lastDivPos > 0) {
if (!makeAllDirectories(path.substring(0, lastDivPos)))
return false;
}
@@ -173,18 +160,13 @@ String homeDirectoryPath()
String pathGetFileName(const String& path)
{
- size_t pos = reverseFindPathSeparator(path);
- if (pos == notFound)
- return path;
- return path.substring(pos + 1);
+ return path.substring(std::max(path.reverseFind('/'), path.reverseFind('\\')) + 1);
}
String directoryName(const String& path)
{
- size_t pos = reverseFindPathSeparator(path);
- if (pos == notFound)
- return String();
- return path.left(pos);
+ notImplemented();
+ return String();
}
CString openTemporaryFile(const char*, PlatformFileHandle& handle)
diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp
index 4b56394..3c90f6b 100644
--- a/WebCore/platform/wx/LocalizedStringsWx.cpp
+++ b/WebCore/platform/wx/LocalizedStringsWx.cpp
@@ -47,7 +47,7 @@ String resetButtonDefaultLabel()
return String("Reset");
}
-String platformDefaultLanguage()
+String defaultLanguage()
{
return String("en");
}