diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform')
87 files changed, 815 insertions, 322 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/AutodrainedPool.h b/src/3rdparty/webkit/WebCore/platform/AutodrainedPool.h index 1cbbec603..d44ee1eaa 100644 --- a/src/3rdparty/webkit/WebCore/platform/AutodrainedPool.h +++ b/src/3rdparty/webkit/WebCore/platform/AutodrainedPool.h @@ -39,7 +39,7 @@ class NSAutoreleasePool; namespace WebCore { -class AutodrainedPool : Noncopyable { +class AutodrainedPool : public Noncopyable { public: AutodrainedPool(int iterationLimit = 1); ~AutodrainedPool(); diff --git a/src/3rdparty/webkit/WebCore/platform/ContextMenu.h b/src/3rdparty/webkit/WebCore/platform/ContextMenu.h index 75899ba39..dc484b2b9 100644 --- a/src/3rdparty/webkit/WebCore/platform/ContextMenu.h +++ b/src/3rdparty/webkit/WebCore/platform/ContextMenu.h @@ -42,7 +42,7 @@ namespace WebCore { class ContextMenuController; - class ContextMenu : Noncopyable + class ContextMenu : public Noncopyable { public: ContextMenu(const HitTestResult&); diff --git a/src/3rdparty/webkit/WebCore/platform/EventLoop.h b/src/3rdparty/webkit/WebCore/platform/EventLoop.h index 6687c2319..b0507f729 100644 --- a/src/3rdparty/webkit/WebCore/platform/EventLoop.h +++ b/src/3rdparty/webkit/WebCore/platform/EventLoop.h @@ -30,7 +30,7 @@ namespace WebCore { - class EventLoop : Noncopyable { + class EventLoop : public Noncopyable { public: EventLoop() : m_ended(false) diff --git a/src/3rdparty/webkit/WebCore/platform/HostWindow.h b/src/3rdparty/webkit/WebCore/platform/HostWindow.h index 3e982e116..3a024decc 100644 --- a/src/3rdparty/webkit/WebCore/platform/HostWindow.h +++ b/src/3rdparty/webkit/WebCore/platform/HostWindow.h @@ -31,7 +31,7 @@ namespace WebCore { -class HostWindow : Noncopyable { +class HostWindow : public Noncopyable { public: virtual ~HostWindow() { } diff --git a/src/3rdparty/webkit/WebCore/platform/Logging.cpp b/src/3rdparty/webkit/WebCore/platform/Logging.cpp index e36935601..f3c6f1ca3 100644 --- a/src/3rdparty/webkit/WebCore/platform/Logging.cpp +++ b/src/3rdparty/webkit/WebCore/platform/Logging.cpp @@ -65,26 +65,65 @@ WTFLogChannel* getChannelFromName(const String& channelName) if (!(channelName.length() >= 2)) return 0; - if (channelName == String("BackForward")) return &LogBackForward; - if (channelName == String("Editing")) return &LogEditing; - if (channelName == String("Events")) return &LogEvents; - if (channelName == String("Frames")) return &LogFrames; - if (channelName == String("FTP")) return &LogFTP; - if (channelName == String("History")) return &LogHistory; - if (channelName == String("IconDatabase")) return &LogIconDatabase; - if (channelName == String("Loading")) return &LogLoading; - if (channelName == String("Media")) return &LogMedia; - if (channelName == String("Network")) return &LogNetwork; - if (channelName == String("NotYetImplemented")) return &LogNotYetImplemented; - if (channelName == String("PageCache")) return &LogPageCache; - if (channelName == String("PlatformLeaks")) return &LogPlatformLeaks; - if (channelName == String("Plugins")) return &LogPlugins; - if (channelName == String("PopupBlocking")) return &LogPopupBlocking; - if (channelName == String("SpellingAndGrammar")) return &LogSpellingAndGrammar; - if (channelName == String("SQLDatabase")) return &LogSQLDatabase; - if (channelName == String("StorageAPI")) return &LogStorageAPI; - if (channelName == String("TextConversion")) return &LogTextConversion; - if (channelName == String("Threading")) return &LogThreading; + if (equalIgnoringCase(channelName, String("BackForward"))) + return &LogBackForward; + + if (equalIgnoringCase(channelName, String("Editing"))) + return &LogEditing; + + if (equalIgnoringCase(channelName, String("Events"))) + return &LogEvents; + + if (equalIgnoringCase(channelName, String("Frames"))) + return &LogFrames; + + if (equalIgnoringCase(channelName, String("FTP"))) + return &LogFTP; + + if (equalIgnoringCase(channelName, String("History"))) + return &LogHistory; + + if (equalIgnoringCase(channelName, String("IconDatabase"))) + return &LogIconDatabase; + + if (equalIgnoringCase(channelName, String("Loading"))) + return &LogLoading; + + if (equalIgnoringCase(channelName, String("Media"))) + return &LogMedia; + + if (equalIgnoringCase(channelName, String("Network"))) + return &LogNetwork; + + if (equalIgnoringCase(channelName, String("NotYetImplemented"))) + return &LogNotYetImplemented; + + if (equalIgnoringCase(channelName, String("PageCache"))) + return &LogPageCache; + + if (equalIgnoringCase(channelName, String("PlatformLeaks"))) + return &LogPlatformLeaks; + + if (equalIgnoringCase(channelName, String("Plugins"))) + return &LogPlugins; + + if (equalIgnoringCase(channelName, String("PopupBlocking"))) + return &LogPopupBlocking; + + if (equalIgnoringCase(channelName, String("SpellingAndGrammar"))) + return &LogSpellingAndGrammar; + + if (equalIgnoringCase(channelName, String("SQLDatabase"))) + return &LogSQLDatabase; + + if (equalIgnoringCase(channelName, String("StorageAPI"))) + return &LogStorageAPI; + + if (equalIgnoringCase(channelName, String("TextConversion"))) + return &LogTextConversion; + + if (equalIgnoringCase(channelName, String("Threading"))) + return &LogThreading; return 0; } diff --git a/src/3rdparty/webkit/WebCore/platform/Pasteboard.h b/src/3rdparty/webkit/WebCore/platform/Pasteboard.h index f98683f97..883364ab7 100644 --- a/src/3rdparty/webkit/WebCore/platform/Pasteboard.h +++ b/src/3rdparty/webkit/WebCore/platform/Pasteboard.h @@ -76,7 +76,7 @@ class Node; class Range; class String; -class Pasteboard : Noncopyable { +class Pasteboard : public Noncopyable { public: #if PLATFORM(MAC) //Helper functions to allow Clipboard to share code diff --git a/src/3rdparty/webkit/WebCore/platform/PurgeableBuffer.h b/src/3rdparty/webkit/WebCore/platform/PurgeableBuffer.h index 9c8e3cb6f..c487eb994 100644 --- a/src/3rdparty/webkit/WebCore/platform/PurgeableBuffer.h +++ b/src/3rdparty/webkit/WebCore/platform/PurgeableBuffer.h @@ -31,7 +31,7 @@ namespace WebCore { - class PurgeableBuffer : Noncopyable { + class PurgeableBuffer : public Noncopyable { public: static PurgeableBuffer* create(const char* data, size_t); static PurgeableBuffer* create(const Vector<char>& v) { return create(v.data(), v.size()); } diff --git a/src/3rdparty/webkit/WebCore/platform/RunLoopTimer.h b/src/3rdparty/webkit/WebCore/platform/RunLoopTimer.h index 96eb8d82f..65f253e7d 100644 --- a/src/3rdparty/webkit/WebCore/platform/RunLoopTimer.h +++ b/src/3rdparty/webkit/WebCore/platform/RunLoopTimer.h @@ -37,7 +37,7 @@ namespace WebCore { // Time intervals are all in seconds. -class RunLoopTimerBase : Noncopyable { +class RunLoopTimerBase : public Noncopyable { public: virtual ~RunLoopTimerBase(); diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp index ba6b61c1c..b1cff4f05 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp @@ -797,6 +797,28 @@ void ScrollView::paint(GraphicsContext* context, const IntRect& rect) } } +bool ScrollView::isPointInScrollbarCorner(const IntPoint& windowPoint) +{ + if (!scrollbarCornerPresent()) + return false; + + IntPoint viewPoint = convertFromContainingWindow(windowPoint); + + if (m_horizontalScrollbar) { + int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y(); + int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m_horizontalScrollbar->frameRect().height(); + int horizontalScrollbarXMin = m_horizontalScrollbar->frameRect().x() + m_horizontalScrollbar->frameRect().width(); + + return viewPoint.y() > horizontalScrollbarYMin && viewPoint.y() < horizontalScrollbarYMax && viewPoint.x() > horizontalScrollbarXMin; + } + + int verticalScrollbarXMin = m_verticalScrollbar->frameRect().x(); + int verticalScrollbarXMax = m_verticalScrollbar->frameRect().x() + m_verticalScrollbar->frameRect().width(); + int verticalScrollbarYMin = m_verticalScrollbar->frameRect().y() + m_verticalScrollbar->frameRect().height(); + + return viewPoint.x() > verticalScrollbarXMin && viewPoint.x() < verticalScrollbarXMax && viewPoint.y() > verticalScrollbarYMin; +} + bool ScrollView::scrollbarCornerPresent() const { return (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) || diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h index b95032766..4678ad09b 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h @@ -218,6 +218,7 @@ public: void addPanScrollIcon(const IntPoint&); void removePanScrollIcon(); + virtual bool isPointInScrollbarCorner(const IntPoint&); virtual bool scrollbarCornerPresent() const; virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const; diff --git a/src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.h b/src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.h index e0aa09208..68f5ec04a 100644 --- a/src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.h +++ b/src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.h @@ -38,7 +38,7 @@ namespace WebCore { struct TECConverterWrapper; class ThreadTimers; - class ThreadGlobalData : Noncopyable { + class ThreadGlobalData : public Noncopyable { public: ThreadGlobalData(); ~ThreadGlobalData(); diff --git a/src/3rdparty/webkit/WebCore/platform/ThreadTimers.h b/src/3rdparty/webkit/WebCore/platform/ThreadTimers.h index 366c32073..ea0a366f4 100644 --- a/src/3rdparty/webkit/WebCore/platform/ThreadTimers.h +++ b/src/3rdparty/webkit/WebCore/platform/ThreadTimers.h @@ -37,7 +37,7 @@ namespace WebCore { class TimerBase; // A collection of timers per thread. Kept in ThreadGlobalData. - class ThreadTimers : Noncopyable { + class ThreadTimers : public Noncopyable { public: ThreadTimers(); diff --git a/src/3rdparty/webkit/WebCore/platform/Timer.h b/src/3rdparty/webkit/WebCore/platform/Timer.h index 87235155b..9221df07d 100644 --- a/src/3rdparty/webkit/WebCore/platform/Timer.h +++ b/src/3rdparty/webkit/WebCore/platform/Timer.h @@ -35,7 +35,7 @@ namespace WebCore { class TimerHeapElement; -class TimerBase : Noncopyable { +class TimerBase : public Noncopyable { public: TimerBase(); virtual ~TimerBase(); diff --git a/src/3rdparty/webkit/WebCore/platform/TreeShared.h b/src/3rdparty/webkit/WebCore/platform/TreeShared.h index aaa26aa54..1ac1b3379 100644 --- a/src/3rdparty/webkit/WebCore/platform/TreeShared.h +++ b/src/3rdparty/webkit/WebCore/platform/TreeShared.h @@ -26,7 +26,7 @@ namespace WebCore { -template<class T> class TreeShared : Noncopyable { +template<class T> class TreeShared : public Noncopyable { public: TreeShared() : m_refCount(0) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/FontData.h b/src/3rdparty/webkit/WebCore/platform/graphics/FontData.h index cb799197e..76927f5a5 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/FontData.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/FontData.h @@ -32,8 +32,9 @@ namespace WebCore { class SimpleFontData; +class String; -class FontData : Noncopyable { +class FontData : public Noncopyable { public: FontData() : m_maxGlyphPageTreeLevel(0) @@ -51,6 +52,10 @@ public: void setMaxGlyphPageTreeLevel(unsigned level) const { m_maxGlyphPageTreeLevel = level; } unsigned maxGlyphPageTreeLevel() const { return m_maxGlyphPageTreeLevel; } +#ifndef NDEBUG + virtual String description() const = 0; +#endif + private: mutable unsigned m_maxGlyphPageTreeLevel; }; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.cpp index a34a1921e..6419e0c4e 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "GlyphPageTreeNode.h" +#include "CString.h" #include "CharacterNames.h" #include "SegmentedFontData.h" #include "SimpleFontData.h" @@ -377,4 +378,41 @@ void GlyphPageTreeNode::pruneFontData(const SimpleFontData* fontData, unsigned l it->second->pruneFontData(fontData, level); } +#ifndef NDEBUG + void GlyphPageTreeNode::showSubtree() + { + Vector<char> indent(level()); + indent.fill('\t', level()); + indent.append(0); + + HashMap<const FontData*, GlyphPageTreeNode*>::iterator end = m_children.end(); + for (HashMap<const FontData*, GlyphPageTreeNode*>::iterator it = m_children.begin(); it != end; ++it) { + printf("%s\t%p %s\n", indent.data(), it->first, it->first->description().utf8().data()); + it->second->showSubtree(); + } + if (m_systemFallbackChild) { + printf("%s\t* fallback\n", indent.data()); + m_systemFallbackChild->showSubtree(); + } + } +#endif + } + +#ifndef NDEBUG +void showGlyphPageTrees() +{ + printf("Page 0:\n"); + showGlyphPageTree(0); + HashMap<int, WebCore::GlyphPageTreeNode*>::iterator end = WebCore::GlyphPageTreeNode::roots->end(); + for (HashMap<int, WebCore::GlyphPageTreeNode*>::iterator it = WebCore::GlyphPageTreeNode::roots->begin(); it != end; ++it) { + printf("\nPage %d:\n", it->first); + showGlyphPageTree(it->first); + } +} + +void showGlyphPageTree(unsigned pageNumber) +{ + WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree(); +} +#endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.h b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.h index 80e87aa66..7918ac5f3 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.h @@ -35,6 +35,11 @@ #include <wtf/RefCounted.h> #include <wtf/unicode/Unicode.h> +#ifndef NDEBUG +void showGlyphPageTrees(); +void showGlyphPageTree(unsigned pageNumber); +#endif + namespace WebCore { class FontData; @@ -210,6 +215,10 @@ private: static GlyphPageTreeNode* getRoot(unsigned pageNumber); void initializePage(const FontData*, unsigned pageNumber); +#ifndef NDEBUG + void showSubtree(); +#endif + GlyphPageTreeNode* m_parent; RefPtr<GlyphPage> m_page; unsigned m_level; @@ -220,6 +229,8 @@ private: #ifndef NDEBUG unsigned m_pageNumber; + + friend void ::showGlyphPageTree(unsigned pageNumber); #endif }; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphWidthMap.h b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphWidthMap.h index e194ecf3b..66dea1fb2 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GlyphWidthMap.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GlyphWidthMap.h @@ -39,7 +39,7 @@ typedef unsigned short Glyph; const float cGlyphWidthUnknown = -1; -class GlyphWidthMap : Noncopyable { +class GlyphWidthMap : public Noncopyable { public: GlyphWidthMap() : m_filledPrimaryPage(false) { } ~GlyphWidthMap() { if (m_pages) { deleteAllValues(*m_pages); } } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.cpp index 51c716274..77a0d21a6 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.cpp @@ -155,4 +155,17 @@ void Gradient::setSpreadMethod(GradientSpreadMethod spreadMethod) m_spreadMethod = spreadMethod; } +void Gradient::setGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation) +{ + m_gradientSpaceTransformation = gradientSpaceTransformation; + setPlatformGradientSpaceTransform(gradientSpaceTransformation); +} + +#if !PLATFORM(SKIA) +void Gradient::setPlatformGradientSpaceTransform(const TransformationMatrix&) +{ +} +#endif + + } //namespace diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.h b/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.h index efcf0408f..a74b1ef56 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/Gradient.h @@ -90,11 +90,12 @@ namespace WebCore { void setSpreadMethod(GradientSpreadMethod); GradientSpreadMethod spreadMethod() { return m_spreadMethod; } - void setGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation) { m_gradientSpaceTransformation = gradientSpaceTransformation; } + void setGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation); // Qt and CG transform the gradient at draw time TransformationMatrix gradientSpaceTransform() { return m_gradientSpaceTransformation; } virtual void fill(GraphicsContext*, const FloatRect&); + void setPlatformGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation); private: Gradient(const FloatPoint& p0, const FloatPoint& p1); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.cpp index 4dae3d276..3e36f7316 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.cpp @@ -214,6 +214,7 @@ void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern) } m_common->state.strokeColorSpace = PatternColorSpace; m_common->state.strokePattern = pattern; + setPlatformStrokePattern(m_common->state.strokePattern.get()); } void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) @@ -225,6 +226,7 @@ void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) } m_common->state.fillColorSpace = PatternColorSpace; m_common->state.fillPattern = pattern; + setPlatformFillPattern(m_common->state.fillPattern.get()); } void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient) @@ -236,6 +238,7 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient) } m_common->state.strokeColorSpace = GradientColorSpace; m_common->state.strokeGradient = gradient; + setPlatformStrokeGradient(m_common->state.strokeGradient.get()); } void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) @@ -247,6 +250,7 @@ void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) } m_common->state.fillColorSpace = GradientColorSpace; m_common->state.fillGradient = gradient; + setPlatformFillGradient(m_common->state.fillGradient.get()); } Gradient* GraphicsContext::fillGradient() const @@ -508,6 +512,24 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator) generator.fill(this, rect); } +#if !PLATFORM(SKIA) +void GraphicsContext::setPlatformFillGradient(Gradient*) +{ +} + +void GraphicsContext::setPlatformFillPattern(Pattern*) +{ +} + +void GraphicsContext::setPlatformStrokeGradient(Gradient*) +{ +} + +void GraphicsContext::setPlatformStrokePattern(Pattern*) +{ +} +#endif + #if !PLATFORM(CG) && !PLATFORM(SKIA) // Implement this if you want to go ahead and push the drawing mode into your native context // immediately. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.h b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.h index 01e2fe634..0237abf78 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.h @@ -137,7 +137,7 @@ namespace WebCore { InterpolationHigh }; - class GraphicsContext : Noncopyable { + class GraphicsContext : public Noncopyable { public: GraphicsContext(PlatformGraphicsContext*); ~GraphicsContext(); @@ -364,8 +364,12 @@ namespace WebCore { void setPlatformStrokeColor(const Color&); void setPlatformStrokeStyle(const StrokeStyle&); void setPlatformStrokeThickness(float); + void setPlatformStrokeGradient(Gradient*); + void setPlatformStrokePattern(Pattern*); void setPlatformFillColor(const Color&); + void setPlatformFillGradient(Gradient*); + void setPlatformFillPattern(Pattern*); void setPlatformShouldAntialias(bool b); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp index 2b85bfa30..b1825481e 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp @@ -449,6 +449,31 @@ void GraphicsLayer::setZPosition(float position) } #endif +float GraphicsLayer::accumulatedOpacity() const +{ + if (!preserves3D()) + return 1; + + return m_opacity * (parent() ? parent()->accumulatedOpacity() : 1); +} + +void GraphicsLayer::distributeOpacity(float accumulatedOpacity) +{ + // If this is a transform layer we need to distribute our opacity to all our children + + // Incoming accumulatedOpacity is the contribution from our parent(s). We mutiply this by our own + // opacity to get the total contribution + accumulatedOpacity *= m_opacity; + + setOpacityInternal(accumulatedOpacity); + + if (preserves3D()) { + size_t numChildren = children().size(); + for (size_t i = 0; i < numChildren; ++i) + children()[i]->distributeOpacity(accumulatedOpacity); + } +} + static void writeIndent(TextStream& ts, int indent) { for (int i = 0; i != indent; ++i) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h index 9407563ea..3cc11286b 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h @@ -316,7 +316,12 @@ public: static String propertyIdToString(AnimatedPropertyID); + virtual void distributeOpacity(float); + virtual float accumulatedOpacity() const; + protected: + virtual void setOpacityInternal(float) { } + GraphicsLayer(GraphicsLayerClient*); void dumpProperties(TextStream&, int indent) const; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Image.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/Image.cpp index 08d96b450..80b54575d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/Image.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/Image.cpp @@ -119,7 +119,6 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(), scaledTileSize.height() / intrinsicTileSize.height()); - TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height()); FloatRect oneTileRect; oneTileRect.setX(destRect.x() + fmodf(fmodf(-srcPoint.x(), scaledTileSize.width()) - scaledTileSize.width(), scaledTileSize.width())); @@ -137,6 +136,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl return; } + TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height()); FloatRect tileRect(FloatPoint(), intrinsicTileSize); drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), op, destRect); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.h b/src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.h index 573e274a5..841a8914d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.h @@ -43,7 +43,7 @@ namespace WebCore { class IntRect; class String; - class ImageBuffer : Noncopyable { + class ImageBuffer : public Noncopyable { public: // Will return a null pointer on allocation failure. static PassOwnPtr<ImageBuffer> create(const IntSize& size, bool grayScale) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h b/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h index e9f066e5e..acb64de84 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h @@ -83,7 +83,7 @@ typedef NativeImageSkia* NativeImagePtr; const int cAnimationLoopOnce = -1; const int cAnimationNone = -2; -class ImageSource : Noncopyable { +class ImageSource : public Noncopyable { public: ImageSource(); ~ImageSource(); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp index 21ce22d92..d4fab5235 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp @@ -229,7 +229,7 @@ void MediaPlayer::load(const String& url, const ContentType& contentType) engine = chooseBestEngineForTypeAndCodecs(type, codecs); // if we didn't find an engine that claims the MIME type, just use the first engine - if (!engine) + if (!engine && !installedMediaEngines().isEmpty()) engine = installedMediaEngines()[0]; // don't delete and recreate the player unless it comes from a different engine @@ -306,6 +306,11 @@ bool MediaPlayer::supportsFullscreen() const return m_private->supportsFullscreen(); } +bool MediaPlayer::supportsSave() const +{ + return m_private->supportsSave(); +} + IntSize MediaPlayer::naturalSize() { return m_private->naturalSize(); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h index 9d9370b7d..7f5f2a04b 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h @@ -96,7 +96,7 @@ public: #endif }; -class MediaPlayer : Noncopyable { +class MediaPlayer : public Noncopyable { public: MediaPlayer(MediaPlayerClient*); virtual ~MediaPlayer(); @@ -108,6 +108,7 @@ public: static bool isAvailable(); bool supportsFullscreen() const; + bool supportsSave() const; IntSize naturalSize(); bool hasVideo(); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h index 753ccd2e5..6d1359b35 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h @@ -46,7 +46,8 @@ public: virtual void play() = 0; virtual void pause() = 0; - virtual bool supportsFullscreen() const { return false; }; + virtual bool supportsFullscreen() const { return false; } + virtual bool supportsSave() const { return false; } virtual IntSize naturalSize() const = 0; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/Path.h b/src/3rdparty/webkit/WebCore/platform/graphics/Path.h index 9e2163bb3..04717246d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/Path.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/Path.h @@ -103,6 +103,9 @@ namespace WebCore { void clear(); bool isEmpty() const; + // Gets the current point of the current path, which is conceptually the final point reached by the path so far. + // Note the Path can be empty (isEmpty() == true) and still have a current point. + bool hasCurrentPoint() const; void moveTo(const FloatPoint&); void addLineTo(const FloatPoint&); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.cpp index 1731d16a7..7e1004072 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "SegmentedFontData.h" +#include "PlatformString.h" #include "SimpleFontData.h" #include <wtf/Assertions.h> @@ -87,4 +88,11 @@ bool SegmentedFontData::isSegmented() const return true; } +#ifndef NDEBUG +String SegmentedFontData::description() const +{ + return "[segmented font]"; +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.h b/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.h index 0a7832178..645dc0d5f 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.h @@ -59,6 +59,10 @@ public: unsigned numRanges() const { return m_ranges.size(); } const FontDataRange& rangeAt(unsigned i) const { return m_ranges[i]; } +#ifndef NDEBUG + virtual String description() const; +#endif + private: virtual const SimpleFontData* fontDataForCharacter(UChar32) const; virtual bool containsCharacters(const UChar*, int length) const; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.cpp index bab7d993d..c879228a7 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.cpp @@ -190,4 +190,16 @@ bool SimpleFontData::isSegmented() const return false; } +#ifndef NDEBUG +String SimpleFontData::description() const +{ + if (isSVGFont()) + return "[SVG font]"; + if (isCustomFont()) + return "[custom font]"; + + return platformData().description(); +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.h b/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.h index aab642948..cb472b073 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.h @@ -105,6 +105,10 @@ public: const GlyphData& missingGlyphData() const { return m_missingGlyphData; } +#ifndef NDEBUG + virtual String description() const; +#endif + #if PLATFORM(MAC) NSFont* getNSFont() const { return m_platformData.font(); } #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp index 668912ece..5d29389c9 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp @@ -1,6 +1,8 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -26,10 +28,13 @@ #include "FontDescription.h" #include "FontPlatformData.h" #include "Font.h" +#include "PlatformString.h" #include "StringHash.h" +#include <utility> +#include <wtf/ListHashSet.h> #include <wtf/StdLibExtras.h> -#include <QHash> +using namespace WTF; namespace WebCore { @@ -47,36 +52,173 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne { } -typedef QHash<FontDescription, FontPlatformData*> FontPlatformDataCache; +// This type must be consistent with FontPlatformData's ctor - the one which +// gets FontDescription as it's parameter. +class FontPlatformDataCacheKey { +public: + FontPlatformDataCacheKey(const FontDescription& description) + : m_familyName() + , m_bold(false) + , m_size(description.computedPixelSize()) + , m_italic(description.italic()) + , m_smallCaps(description.smallCaps()) + , m_hash(0) + { + // FIXME: Map all FontWeight values to QFont weights in FontPlatformData's ctor and follow it here + if (FontPlatformData::toQFontWeight(description.weight()) > QFont::Normal) + m_bold = true; -// using Q_GLOBAL_STATIC leads to crash. TODO investigate the way to fix this. -static FontPlatformDataCache* gFontPlatformDataCache; + const FontFamily* family = &description.family(); + while (family) { + m_familyName.append(family->family()); + family = family->next(); + if (family) + m_familyName.append(','); + } -uint qHash(const FontDescription& key) -{ - uint value = CaseFoldingHash::hash(key.family().family()); - value ^= key.computedPixelSize(); - value ^= static_cast<int>(key.weight()); - return value; -} + computeHash(); + } + + FontPlatformDataCacheKey(const FontPlatformData& fontData) + : m_familyName(static_cast<String>(fontData.family())) + , m_size(fontData.pixelSize()) + , m_bold(fontData.bold()) + , m_italic(fontData.italic()) + , m_smallCaps(fontData.smallCaps()) + , m_hash(0) + { + computeHash(); + } + + FontPlatformDataCacheKey(HashTableDeletedValueType) : m_size(hashTableDeletedSize()) { } + bool isHashTableDeletedValue() const { return m_size == hashTableDeletedSize(); } + + enum HashTableEmptyValueType { HashTableEmptyValue }; + + FontPlatformDataCacheKey(HashTableEmptyValueType) + : m_familyName() + , m_size(0) + , m_bold(false) + , m_italic(false) + , m_smallCaps(false) + , m_hash(0) + { + } + + bool operator==(const FontPlatformDataCacheKey& other) const + { + if (m_hash != other.m_hash) + return false; + + return equalIgnoringCase(m_familyName, other.m_familyName) && m_size == other.m_size && + m_bold == other.m_bold && m_italic == other.m_italic && m_smallCaps == other.m_smallCaps; + } + + unsigned hash() const + { + return m_hash; + } + + void computeHash() + { + unsigned hashCodes[] = { + CaseFoldingHash::hash(m_familyName), + m_size | static_cast<unsigned>(m_bold << sizeof(unsigned) * 8 - 1) + | static_cast<unsigned>(m_italic) << sizeof(unsigned) *8 - 2 + | static_cast<unsigned>(m_smallCaps) << sizeof(unsigned) * 8 - 3 + }; + m_hash = StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar)); + } + +private: + String m_familyName; + int m_size; + bool m_bold; + bool m_italic; + bool m_smallCaps; + unsigned m_hash; + + static unsigned hashTableDeletedSize() { return 0xFFFFFFFFU; } +}; + +struct FontPlatformDataCacheKeyHash { + static unsigned hash(const FontPlatformDataCacheKey& key) + { + return key.hash(); + } + + static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b) + { + return a == b; + } + + static const bool safeToCompareToEmptyOrDeleted = true; +}; + +struct FontPlatformDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformDataCacheKey> { + static const bool needsDestruction = true; + static const FontPlatformDataCacheKey& emptyValue() + { + DEFINE_STATIC_LOCAL(FontPlatformDataCacheKey, key, (FontPlatformDataCacheKey::HashTableEmptyValue)); + return key; + } + static void constructDeletedValue(FontPlatformDataCacheKey& slot) + { + new (&slot) FontPlatformDataCacheKey(HashTableDeletedValue); + } + static bool isDeletedValue(const FontPlatformDataCacheKey& value) + { + return value.isHashTableDeletedValue(); + } +}; + +typedef HashMap<FontPlatformDataCacheKey, FontPlatformData*, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache; + +// using Q_GLOBAL_STATIC leads to crash. TODO investigate the way to fix this. +static FontPlatformDataCache* gFontPlatformDataCache = 0; FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& description, const AtomicString& family, bool checkingAlternateName) { if (!gFontPlatformDataCache) gFontPlatformDataCache = new FontPlatformDataCache; - FontPlatformData* fontData = gFontPlatformDataCache->value(description, 0); - if (!fontData) { - fontData = new FontPlatformData(description); - gFontPlatformDataCache->insert(description, fontData); + FontPlatformDataCacheKey key(description); + FontPlatformData* platformData = gFontPlatformDataCache->get(key); + if (!platformData) { + platformData = new FontPlatformData(description); + gFontPlatformDataCache->add(key, platformData); } - - return fontData; + return platformData; } -SimpleFontData* FontCache::getCachedFontData(const FontPlatformData*) +typedef HashMap<FontPlatformDataCacheKey, std::pair<SimpleFontData*, unsigned>, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontDataCache; + +static FontDataCache* gFontDataCache = 0; + +static const int cMaxInactiveFontData = 40; +static const int cTargetInactiveFontData = 32; + +static ListHashSet<const SimpleFontData*>* gInactiveFontDataSet = 0; + +SimpleFontData* FontCache::getCachedFontData(const FontPlatformData* fontPlatformData) { - return 0; + if (!gFontDataCache) { + gFontDataCache = new FontDataCache; + gInactiveFontDataSet = new ListHashSet<const SimpleFontData*>; + } + + FontPlatformDataCacheKey key(*fontPlatformData); + FontDataCache::iterator it = gFontDataCache->find(key); + if (it == gFontDataCache->end()) { + SimpleFontData* fontData = new SimpleFontData(*fontPlatformData); + gFontDataCache->add(key, std::pair<SimpleFontData*, unsigned>(fontData, 1)); + return fontData; + } + if (!it->second.second++) { + ASSERT(gInactiveFontDataSet->contains(it->second.first)); + gInactiveFontDataSet->remove(it->second.first); + } + return it->second.first; } FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription&) @@ -84,8 +226,52 @@ FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription&) return 0; } -void FontCache::releaseFontData(const WebCore::SimpleFontData*) +void FontCache::releaseFontData(const WebCore::SimpleFontData* fontData) { + ASSERT(gFontDataCache); + ASSERT(!fontData->isCustomFont()); + + FontPlatformDataCacheKey key(fontData->platformData()); + FontDataCache::iterator it = gFontDataCache->find(key); + ASSERT(it != gFontDataCache->end()); + if (!--it->second.second) { + gInactiveFontDataSet->add(it->second.first); + if (gInactiveFontDataSet->size() > cMaxInactiveFontData) + purgeInactiveFontData(gInactiveFontDataSet->size() - cTargetInactiveFontData); + } +} + +void FontCache::purgeInactiveFontData(int count) +{ + static bool isPurging; // Guard against reentry when e.g. a deleted FontData releases its small caps FontData. + if (isPurging) + return; + + isPurging = true; + + ListHashSet<const SimpleFontData*>::iterator it = gInactiveFontDataSet->begin(); + ListHashSet<const SimpleFontData*>::iterator end = gInactiveFontDataSet->end(); + for (int i = 0; i < count && it != end; ++i, ++it) { + FontPlatformDataCacheKey key = (*it)->platformData(); + pair<SimpleFontData*, unsigned> fontDataPair = gFontDataCache->take(key); + ASSERT(fontDataPair.first != 0); + ASSERT(!fontDataPair.second); + delete fontDataPair.first; + + FontPlatformData* platformData = gFontPlatformDataCache->take(key); + if (platformData) + delete platformData; + } + + if (it == end) { + // Removed everything + gInactiveFontDataSet->clear(); + } else { + for (int i = 0; i < count; ++i) + gInactiveFontDataSet->remove(gInactiveFontDataSet->begin()); + } + + isPurging = false; } void FontCache::addClient(FontSelector*) @@ -98,10 +284,10 @@ void FontCache::removeClient(FontSelector*) void FontCache::invalidate() { - if (!gFontPlatformDataCache) + if (!gFontPlatformDataCache || !gFontDataCache) return; - gFontPlatformDataCache->clear(); + purgeInactiveFontData(); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp index 29e77189f..c29fd56f3 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp @@ -25,6 +25,7 @@ #include "FontFallbackList.h" #include "Font.h" +#include "FontCache.h" #include "SegmentedFontData.h" #include <QDebug> @@ -58,9 +59,15 @@ void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSel void FontFallbackList::releaseFontData() { - if (m_fontList.size()) - delete m_fontList[0].first; - m_fontList.clear(); + unsigned numFonts = m_fontList.size(); + for (unsigned i = 0; i < numFonts; ++i) { + if (m_fontList[i].second) + delete m_fontList[i].first; + else { + ASSERT(!m_fontList[i].first->isSegmented()); + fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_fontList[i].first)); + } + } } void FontFallbackList::determinePitch(const WebCore::Font* font) const @@ -83,6 +90,14 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne if (index != 0) return 0; + // Search for the WebCore font that is already in the list + for (int i = m_fontList.size() - 1; i >= 0; --i) { + pair<const FontData*, bool> item = m_fontList[i]; + // item.second means that the item was created locally or not + if (!item.second) + return item.first; + } + // Use the FontSelector to get a WebCore font and then fallback to Qt const FontDescription& description = _font->fontDescription(); const FontFamily* family = &description.family(); @@ -92,6 +107,10 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne if (data) { if (data->isLoading()) m_loadingCustomFonts = true; + if (!data->isCustomFont()) { + // Custom fonts can be freed anytime so we must not hold them + m_fontList.append(pair<const FontData*, bool>(data, false)); + } return data; } } @@ -101,8 +120,8 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne if (m_fontList.size()) return m_fontList[0].first; - const FontData* result = new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing()); - m_fontList.append(pair<const FontData*, bool>(result, result->isCustomFont())); + const FontData* result = new SimpleFontData(FontPlatformData(description, _font->wordSpacing(), _font->letterSpacing()), true); + m_fontList.append(pair<const FontData*, bool>(result, true)); return result; } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h index 5e97678b8..92219fde6 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -24,11 +25,12 @@ #define FontPlatformData_h #include "FontDescription.h" - #include <QFont> namespace WebCore { +class String; + class FontPlatformData { public: @@ -39,8 +41,38 @@ public: FontPlatformData(const FontDescription&, int wordSpacing = 0, int letterSpacing = 0); FontPlatformData(const QFont&, bool bold); + static inline QFont::Weight toQFontWeight(FontWeight fontWeight) + { + switch (fontWeight) { + case FontWeight100: + case FontWeight200: + return QFont::Light; // QFont::Light == Weight of 25 + case FontWeight600: + return QFont::DemiBold; // QFont::DemiBold == Weight of 63 + case FontWeight700: + case FontWeight800: + return QFont::Bold; // QFont::Bold == Weight of 75 + case FontWeight900: + return QFont::Black; // QFont::Black == Weight of 87 + case FontWeight300: + case FontWeight400: + case FontWeight500: + default: + return QFont::Normal; // QFont::Normal == Weight of 50 + } + } + QFont font() const { return m_font; } float size() const { return m_size; } + QString family() const { return m_font.family(); } + bool bold() const { return m_bold; } + bool italic() const { return m_font.italic(); } + bool smallCaps() const { return m_font.capitalization() == QFont::SmallCaps; } + int pixelSize() const { return m_font.pixelSize(); } + +#ifndef NDEBUG + String description() const; +#endif float m_size; bool m_bold; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp index f0dd3ea4a..7709be6b4 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -21,6 +22,8 @@ #include "config.h" #include "FontPlatformData.h" +#include "PlatformString.h" + namespace WebCore { FontPlatformData::FontPlatformData(const FontDescription& description, int wordSpacing, int letterSpacing) @@ -40,11 +43,9 @@ FontPlatformData::FontPlatformData(const FontDescription& description, int wordS m_font.setFamily(familyName); m_font.setPixelSize(qRound(description.computedSize())); m_font.setItalic(description.italic()); - // FIXME: Map all FontWeight values to QFont weights. - if (description.weight() >= FontWeight600) - m_font.setWeight(QFont::Bold); - else - m_font.setWeight(QFont::Normal); + + m_font.setWeight(toQFontWeight(description.weight())); + m_bold = m_font.bold(); bool smallCaps = description.smallCaps(); m_font.setCapitalization(smallCaps ? QFont::SmallCaps : QFont::MixedCase); @@ -77,4 +78,11 @@ FontPlatformData::FontPlatformData() { } +#ifndef NDEBUG +String FontPlatformData::description() const +{ + return String(); +} +#endif + } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp index 5a4b7b254..f89ff9f94 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp @@ -47,8 +47,8 @@ namespace WebCore { static const QString qstring(const TextRun& run) { - //We don't detach - return QString::fromRawData((const QChar *)run.characters(), run.length()); + // We don't detach + return QString::fromRawData(reinterpret_cast<const QChar*>(run.characters()), run.length()); } static const QString fixSpacing(const QString &string) @@ -57,11 +57,10 @@ static const QString fixSpacing(const QString &string) QString possiblyDetached = string; for (int i = 0; i < string.length(); ++i) { const QChar c = string.at(i); - if (c.unicode() != 0x20 && Font::treatAsSpace(c.unicode())) { - possiblyDetached[i] = 0x20; //detach - } else if (c.unicode() != 0x200c && Font::treatAsZeroWidthSpace(c.unicode())) { - possiblyDetached[i] = 0x200c; //detach - } + if (c.unicode() != 0x20 && Font::treatAsSpace(c.unicode())) + possiblyDetached[i] = 0x20; // detach + else if (c.unicode() != 0x200c && Font::treatAsZeroWidthSpace(c.unicode())) + possiblyDetached[i] = 0x200c; // detach } return possiblyDetached; } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp index 137b7c97a..45bf05d49 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp @@ -105,9 +105,9 @@ static int generateComponents(Vector<TextRunComponent, 1024>* components, const offset += add + letterSpacing + components->last().width; start = 1; // qDebug() << "space at 0" << offset; - } else if (smallCaps) { + } else if (smallCaps) f = (QChar::category(run[0]) == QChar::Letter_Lowercase ? &font.scFont() : &font.font()); - } + for (int i = 1; i < run.length(); ++i) { uint ch = run[i]; if (QChar(ch).isHighSurrogate() && QChar(run[i-1]).isLowSurrogate()) @@ -263,7 +263,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool if (!l.isValid()) return offset; - l.setLineWidth(INT_MAX/256); + l.setLineWidth(INT_MAX / 256); layout.endLayout(); if (position - xs >= l.width()) @@ -272,9 +272,8 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool if (cursor > 1) --cursor; return offset + cursor; - } else { + } else offset += components.at(i).string.length() - 1; - } } } else { for (int i = 0; i < components.size(); ++i) { @@ -287,7 +286,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool if (!l.isValid()) return offset; - l.setLineWidth(INT_MAX/256); + l.setLineWidth(INT_MAX / 256); layout.endLayout(); if (position - xs >= l.width()) @@ -296,9 +295,8 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool if (cursor > 1) --cursor; return offset + cursor; - } else { + } else offset += components.at(i).string.length() - 1; - } } } return run.length(); @@ -321,7 +319,7 @@ static float cursorToX(const Vector<TextRunComponent, 1024>& components, int wid if (!l.isValid()) return 0; - l.setLineWidth(INT_MAX/256); + l.setLineWidth(INT_MAX / 256); layout.endLayout(); return xs + l.cursorToX(cursor - start + 1); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp index 1e71f5860..9b9acc28b 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp @@ -67,7 +67,7 @@ QGradient* Gradient::platformGradient() ++stopIterator; } - switch(m_spreadMethod) { + switch (m_spreadMethod) { case SpreadMethodPad: m_gradient->setSpread(QGradient::PadSpread); break; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 8503fb521..a35c5ac26 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -155,7 +155,7 @@ static Qt::PenStyle toQPenStyle(StrokeStyle style) static inline Qt::FillRule toQtFillRule(WindRule rule) { - switch(rule) { + switch (rule) { case RULE_EVENODD: return Qt::OddEvenFill; case RULE_NONZERO: @@ -165,8 +165,7 @@ static inline Qt::FillRule toQtFillRule(WindRule rule) return Qt::OddEvenFill; } -struct TransparencyLayer -{ +struct TransparencyLayer { TransparencyLayer(const QPainter* p, const QRect &rect) : pixmap(rect.width(), rect.height()) { @@ -198,8 +197,7 @@ private: TransparencyLayer & operator=(const TransparencyLayer &) { return *this; } }; -class GraphicsContextPlatformPrivate -{ +class GraphicsContextPlatformPrivate { public: GraphicsContextPlatformPrivate(QPainter* painter); ~GraphicsContextPlatformPrivate(); @@ -217,7 +215,7 @@ public: bool antiAliasingForRectsAndLines; - QStack<TransparencyLayer *> layers; + QStack<TransparencyLayer*> layers; QPainter* redirect; QBrush solidColor; @@ -242,9 +240,8 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p) antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing); // FIXME: Maybe only enable in SVG mode? painter->setRenderHint(QPainter::Antialiasing, true); - } else { + } else antiAliasingForRectsAndLines = false; - } } GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() @@ -265,7 +262,7 @@ GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) GraphicsContext::~GraphicsContext() { - while(!m_data->layers.isEmpty()) + while (!m_data->layers.isEmpty()) endTransparencyLayer(); destroyGraphicsContextPrivate(m_common); @@ -280,7 +277,7 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const TransformationMatrix GraphicsContext::getCTM() const { QTransform matrix(platformContext()->combinedTransform()); - return TransformationMatrix(matrix.m11(), matrix.m12(), 0, matrix.m13(), + return TransformationMatrix(matrix.m11(), matrix.m12(), 0, matrix.m13(), matrix.m21(), matrix.m22(), 0, matrix.m23(), 0, 0, 1, 0, matrix.m31(), matrix.m32(), 0, matrix.m33()); @@ -1126,8 +1123,9 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform) 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. + // 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; @@ -1210,7 +1208,7 @@ HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlpha bitmapInfo.bmiHeader.biClrImportant = 0; void* pixels = 0; - HBITMAP bitmap = ::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); + HBITMAP bitmap = ::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); if (!bitmap) return 0; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/IconQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/IconQt.cpp index c9f3ced7e..34c3c472a 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/IconQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/IconQt.cpp @@ -39,7 +39,7 @@ Icon::Icon() Icon::~Icon() { } - + PassRefPtr<Icon> Icon::createIconForFile(const String& filename) { RefPtr<Icon> i = adoptRef(new Icon); @@ -57,9 +57,8 @@ void Icon::paint(GraphicsContext* ctx, const IntRect& rect) { QPixmap px = m_icon.pixmap(rect.size()); QPainter *p = static_cast<QPainter*>(ctx->platformContext()); - if (p && !px.isNull()) { + if (p && !px.isNull()) p->drawPixmap(rect.x(), rect.y(), px); - } } } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index 9a7fd75ed..669be1c0d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -118,7 +118,7 @@ ImageDecoderQt::ReadContext::ReadResult // Attempt to construct an empty image of the matching size and format // for efficient reading QImage newImage = m_dataFormat != QImage::Format_Invalid ? - QImage(m_size,m_dataFormat) : QImage(); + QImage(m_size, m_dataFormat) : QImage(); m_target.push_back(ImageData(newImage)); } @@ -137,8 +137,8 @@ ImageDecoderQt::ReadContext::ReadResult const bool supportsAnimation = m_reader.supportsAnimation(); if (debugImageDecoderQt) - qDebug() << "readImage(): #" << m_target.size() << " complete, " << m_size << " format " << m_dataFormat - << " supportsAnimation=" << supportsAnimation ; + qDebug() << "readImage(): #" << m_target.size() << " complete, " << m_size + << " format " << m_dataFormat << " supportsAnimation=" << supportsAnimation; // No point in readinfg further if (!supportsAnimation) return ReadComplete; @@ -158,7 +158,7 @@ ImageDecoderQt::ReadContext::IncrementalReadResult // set state to reflect complete header, etc. // For now, we read the whole image. - const qint64 startPos = m_buffer.pos (); + const qint64 startPos = m_buffer.pos(); // Oops, failed. Rewind. if (!m_reader.read(&imageData.m_image)) { m_buffer.seek(startPos); @@ -236,7 +236,7 @@ void ImageDecoderQt::setData(const IncomingData &data, bool allDataReceived) if (debugImageDecoderQt) qDebug() << " read returns " << readResult; - switch ( readResult) { + switch (readResult) { case ReadContext::ReadFailed: m_failed = true; break; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp index a2e96f340..5d40e26ad 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp @@ -83,7 +83,6 @@ bool FrameData::clear(bool clearMetadata) } - // ================================================ // Image Class // ================================================ @@ -93,7 +92,6 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name) return StillImage::create(loadResourcePixmap(name)); } - void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect) { @@ -103,9 +101,8 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const QPixmap pixmap = *framePixmap; QRect tr = QRectF(tileRect).toRect(); - if (tr.x() || tr.y() || tr.width() != pixmap.width() || tr.height() != pixmap.height()) { + if (tr.x() || tr.y() || tr.width() != pixmap.width() || tr.height() != pixmap.height()) pixmap = pixmap.copy(tr); - } QBrush b(pixmap); b.setTransform(patternTransform); @@ -129,7 +126,7 @@ void BitmapImage::initPlatformData() void BitmapImage::invalidatePlatformData() { } - + // Drawing Routines void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, CompositeOperator op) @@ -139,7 +136,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, QPixmap* image = nativeImageForCurrentFrame(); if (!image) return; - + if (mayFillWithSolidColor()) { fillWithSolidColor(ctxt, dst, solidColor(), op); return; @@ -158,7 +155,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, painter->setCompositionMode(QPainter::CompositionMode_Source); // Test using example site at - // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html + // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html painter->drawPixmap(dst, *image, src); ctxt->restore(); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageSourceQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageSourceQt.cpp index 621728e72..1ffc1eb37 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageSourceQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageSourceQt.cpp @@ -124,7 +124,7 @@ float ImageSource::frameDurationAtIndex(size_t index) { if (!m_decoder) return 0; - + // Many annoying ads specify a 0 duration to make an image flash as quickly // as possible. We follow WinIE's behavior and use a duration of 100 ms // for any frames that specify a duration of <= 50 ms. See @@ -138,17 +138,17 @@ bool ImageSource::frameHasAlphaAtIndex(size_t index) { if (!m_decoder || !m_decoder->supportsAlpha()) return false; - - const QPixmap* source = m_decoder->imageAtIndex( index); + + const QPixmap* source = m_decoder->imageAtIndex(index); if (!source) return false; - + return source->hasAlphaChannel(); } bool ImageSource::frameIsCompleteAtIndex(size_t index) { - return (m_decoder && m_decoder->imageAtIndex(index) != 0); + return (m_decoder && m_decoder->imageAtIndex(index)); } void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index 896e3b8fc..76b14943a 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -43,7 +43,7 @@ using namespace Phonon; -#define LOG_MEDIAOBJECT() (LOG(Media,"%s", debugMediaObject(this, *m_mediaObject).constData())) +#define LOG_MEDIAOBJECT() (LOG(Media, "%s", debugMediaObject(this, *m_mediaObject).constData())) static QByteArray debugMediaObject(WebCore::MediaPlayerPrivate* mediaPlayer, const MediaObject& mediaObject) { @@ -97,9 +97,8 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) // Make sure we get updates for each frame m_videoWidget->installEventFilter(this); - foreach(QWidget* widget, qFindChildren<QWidget*>(m_videoWidget)) { + foreach (QWidget* widget, qFindChildren<QWidget*>(m_videoWidget)) widget->installEventFilter(this); - } connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); @@ -114,8 +113,8 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) connect(m_mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); } -MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player) -{ +MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player) +{ return new MediaPlayerPrivate(player); } @@ -266,7 +265,7 @@ float MediaPlayerPrivate::maxTimeSeekable() const } unsigned MediaPlayerPrivate::bytesLoaded() const -{ +{ notImplemented(); return 0; } @@ -346,9 +345,8 @@ void MediaPlayerPrivate::updateStates() m_networkState = MediaPlayer::NetworkError; m_readyState = MediaPlayer::HaveNothing; cancelLoad(); - } else { + } else m_mediaObject->pause(); - } } if (seeking()) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp index fde6ea30b..39e243ecb 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp @@ -170,8 +170,8 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) return; } - FloatPoint p1p0((p0.x() - p1.x()),(p0.y() - p1.y())); - FloatPoint p1p2((p2.x() - p1.x()),(p2.y() - p1.y())); + FloatPoint p1p0((p0.x() - p1.x()), (p0.y() - p1.y())); + FloatPoint p1p2((p2.x() - p1.x()), (p2.y() - p1.y())); float p1p0_length = sqrtf(p1p0.x() * p1p0.x() + p1p0.y() * p1p0.y()); float p1p2_length = sqrtf(p1p2.x() * p1p2.x() + p1p2.y() * p1p2.y()); @@ -216,7 +216,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) float factor_p1p2 = tangent / p1p2_length; FloatPoint t_p1p2((p1.x() + factor_p1p2 * p1p2.x()), (p1.y() + factor_p1p2 * p1p2.y())); - FloatPoint orth_p1p2((t_p1p2.x() - p.x()),(t_p1p2.y() - p.y())); + FloatPoint orth_p1p2((t_p1p2.x() - p.x()), (t_p1p2.y() - p.y())); float orth_p1p2_length = sqrtf(orth_p1p2.x() * orth_p1p2.x() + orth_p1p2.y() * orth_p1p2.y()); float ea = acos(orth_p1p2.x() / orth_p1p2_length); if (orth_p1p2.y() < 0) @@ -300,7 +300,12 @@ bool Path::isEmpty() const { // Don't use QPainterPath::isEmpty(), as that also returns true if there's only // one initial MoveTo element in the path. - return m_path->elementCount() == 0; + return !m_path->elementCount(); +} + +bool Path::hasCurrentPoint() const +{ + return !isEmpty(); } String Path::debugString() const diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp index 15f0cc539..37b86f30f 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp @@ -32,7 +32,7 @@ namespace WebCore { TransformationMatrix::operator QTransform() const -{ +{ return QTransform(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44()); } diff --git a/src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.h b/src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.h index 1c5cae7f4..90beb401f 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.h @@ -31,7 +31,7 @@ class GraphicsContext; // This class automatically saves and restores the current NSGraphicsContext for // functions which call out into AppKit and rely on the currentContext being set -class LocalCurrentGraphicsContext : Noncopyable { +class LocalCurrentGraphicsContext : public Noncopyable { public: LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); ~LocalCurrentGraphicsContext(); diff --git a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h index 44eedfad5..f9c7079ed 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h @@ -30,6 +30,7 @@ namespace WebCore { bool applicationIsAppleMail(); bool applicationIsSafari(); +bool applicationIsMicrosoftMessenger(); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm index 16701853f..a3c4aa5ee 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm @@ -41,4 +41,10 @@ bool applicationIsSafari() return isSafari; } +bool applicationIsMicrosoftMessenger() +{ + static bool isMicrosoftMessenger = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.microsoft.Messenger"]; + return isMicrosoftMessenger; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.h b/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.h index 666f0c18e..286f59f54 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.h +++ b/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.h @@ -30,7 +30,7 @@ class CString; class Document; class TextEncoding; -class FormDataBuilder : Noncopyable { +class FormDataBuilder : public Noncopyable { public: FormDataBuilder(); ~FormDataBuilder(); diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.h index f0e1e944f..4cb3561b8 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.h @@ -191,12 +191,6 @@ public: void fireFailure(Timer<ResourceHandle>*); private: -#if USE(SOUP) - bool startData(String urlString); - bool startHttp(String urlString); - bool startGio(KURL url); -#endif - void scheduleFailure(FailureType); bool start(Frame*); diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h index 676129a42..091a26b0d 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h @@ -75,7 +75,7 @@ class NSURLConnection; namespace WebCore { class ResourceHandleClient; - class ResourceHandleInternal : Noncopyable { + class ResourceHandleInternal : public Noncopyable { public: ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle) : m_client(c) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.cpp index fddda0146..82b12a8cd 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.cpp @@ -61,9 +61,9 @@ ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, const QMimeData* readable : Clipboard(policy, true) , m_readableData(readableClipboard) , m_writableData(0) -{ +{ Q_ASSERT(policy == ClipboardReadable || policy == ClipboardTypesReadable); -} +} ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging) : Clipboard(policy, forDragging) @@ -76,7 +76,7 @@ ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging) if (policy != ClipboardWritable) { Q_ASSERT(!forDragging); m_readableData = QApplication::clipboard()->mimeData(); - } + } #endif } @@ -104,7 +104,7 @@ void ClipboardQt::clearData(const String& type) if (format != toClearType) formats[format] = m_writableData->data(format); } - + m_writableData->clear(); QMap<QString, QByteArray>::const_iterator it, end = formats.constEnd(); for (it = formats.begin(); it != end; ++it) @@ -122,11 +122,11 @@ void ClipboardQt::clearData(const String& type) #endif } -void ClipboardQt::clearAllData() +void ClipboardQt::clearAllData() { if (policy() != ClipboardWritable) return; - + #ifndef QT_NO_CLIPBOARD if (!isForDragging()) QApplication::clipboard()->setMimeData(0); @@ -136,21 +136,21 @@ void ClipboardQt::clearAllData() m_writableData = 0; } -String ClipboardQt::getData(const String& type, bool& success) const +String ClipboardQt::getData(const String& type, bool& success) const { if (policy() != ClipboardReadable) { success = false; return String(); } - + ASSERT(m_readableData); QByteArray data = m_readableData->data(QString(type)); success = !data.isEmpty(); return String(data.data(), data.size()); } -bool ClipboardQt::setData(const String& type, const String& data) +bool ClipboardQt::setData(const String& type, const String& data) { if (policy() != ClipboardWritable) return false; @@ -187,7 +187,7 @@ PassRefPtr<FileList> ClipboardQt::files() const return 0; } -void ClipboardQt::setDragImage(CachedImage* image, const IntPoint& point) +void ClipboardQt::setDragImage(CachedImage* image, const IntPoint& point) { setDragImage(image, 0, point); } @@ -207,7 +207,7 @@ void ClipboardQt::setDragImage(CachedImage* image, Node *node, const IntPoint &l m_dragImage = image; if (m_dragImage) m_dragImage->addClient(this); - + m_dragLoc = loc; m_dragImageElement = node; } @@ -226,9 +226,9 @@ static CachedImage* getCachedImage(Element* element) // Attempt to pull CachedImage from element ASSERT(element); RenderObject* renderer = element->renderer(); - if (!renderer || !renderer->isImage()) + if (!renderer || !renderer->isImage()) return 0; - + RenderImage* image = static_cast<RenderImage*>(renderer); if (image->cachedImage() && !image->cachedImage()->errorOccurred()) return image->cachedImage(); @@ -236,7 +236,7 @@ static CachedImage* getCachedImage(Element* element) return 0; } -void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame) +void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame) { ASSERT(frame); Q_UNUSED(url); @@ -254,11 +254,11 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co m_writableData->setImageData(*pixmap); AtomicString imageURL = element->getAttribute(HTMLNames::srcAttr); - if (imageURL.isEmpty()) + if (imageURL.isEmpty()) return; - KURL fullURL = frame->document()->completeURL(parseURL(imageURL)); - if (fullURL.isEmpty()) + KURL fullURL = frame->document()->completeURL(deprecatedParseURL(imageURL)); + if (fullURL.isEmpty()) return; QList<QUrl> urls; @@ -274,7 +274,7 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co void ClipboardQt::writeURL(const KURL& url, const String& title, Frame* frame) { ASSERT(frame); - + QList<QUrl> urls; urls.append(frame->document()->completeURL(url.string())); if (!m_writableData) @@ -287,11 +287,11 @@ void ClipboardQt::writeURL(const KURL& url, const String& title, Frame* frame) #endif } -void ClipboardQt::writeRange(Range* range, Frame* frame) +void ClipboardQt::writeRange(Range* range, Frame* frame) { ASSERT(range); ASSERT(frame); - + if (!m_writableData) m_writableData = new QMimeData; QString text = frame->selectedText(); @@ -304,7 +304,7 @@ void ClipboardQt::writeRange(Range* range, Frame* frame) #endif } -bool ClipboardQt::hasData() +bool ClipboardQt::hasData() { const QMimeData *data = m_readableData ? m_readableData : m_writableData; if (!data) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.h b/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.h index 44324f2f8..9a918ed96 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.h @@ -49,12 +49,12 @@ namespace WebCore { return adoptRef(new ClipboardQt(policy, forDragging)); } virtual ~ClipboardQt(); - + void clearData(const String& type); void clearAllData(); String getData(const String& type, bool& success) const; bool setData(const String& type, const String& data); - + // extensions beyond IE's API virtual HashSet<String> types() const; virtual PassRefPtr<FileList> files() const; @@ -68,10 +68,10 @@ namespace WebCore { virtual void writeRange(Range*, Frame*); virtual bool hasData(); - + QMimeData* clipboardData() const { return m_writableData; } void invalidateWritableData() { m_writableData = 0; } - + private: ClipboardQt(ClipboardAccessPolicy, const QMimeData* readableClipboard); @@ -79,10 +79,10 @@ namespace WebCore { ClipboardQt(ClipboardAccessPolicy, bool forDragging); void setDragImage(CachedImage*, Node*, const IntPoint& loc); - + const QMimeData* m_readableData; QMimeData* m_writableData; }; -} +} #endif // ClipboardQt_h diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ContextMenuItemQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ContextMenuItemQt.cpp index c71eacd85..cf2358736 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ContextMenuItemQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ContextMenuItemQt.cpp @@ -68,7 +68,7 @@ void ContextMenuItem::setType(ContextMenuItemType type) } ContextMenuAction ContextMenuItem::action() const -{ +{ return m_platformDescription.action; } @@ -77,7 +77,7 @@ void ContextMenuItem::setAction(ContextMenuAction action) m_platformDescription.action = action; } -String ContextMenuItem::title() const +String ContextMenuItem::title() const { return m_platformDescription.title; } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp index 0d7e10098..aad84be12 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp @@ -254,7 +254,7 @@ const Cursor& rowResizeCursor() { return Cursors::self()->SplitVCursor; } - + const Cursor& middlePanningCursor() { return moveCursor(); @@ -298,7 +298,7 @@ const Cursor& southWestPanningCursor() const Cursor& westPanningCursor() { return westResizeCursor(); -} +} const Cursor& verticalTextCursor() { @@ -342,7 +342,7 @@ const Cursor& noneCursor() const Cursor& notAllowedCursor() { - return Cursors::self()->NoDropCursor; + return Cursors::self()->NoDropCursor; } const Cursor& zoomInCursor() diff --git a/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp index bc5cce12f..7b1eff8ce 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp @@ -42,7 +42,7 @@ bool DragData::canSmartReplace() const { return false; } - + bool DragData::containsColor() const { if (!m_platformDragData) @@ -55,11 +55,11 @@ bool DragData::containsFiles() const if (!m_platformDragData) return false; QList<QUrl> urls = m_platformDragData->urls(); - foreach(const QUrl &url, urls) { + foreach (const QUrl &url, urls) { if (!url.toLocalFile().isEmpty()) return true; } - return false; + return false; } void DragData::asFilenames(Vector<String>& result) const @@ -67,7 +67,7 @@ void DragData::asFilenames(Vector<String>& result) const if (!m_platformDragData) return; QList<QUrl> urls = m_platformDragData->urls(); - foreach(const QUrl &url, urls) { + foreach (const QUrl &url, urls) { QString file = url.toLocalFile(); if (!file.isEmpty()) result.append(file); @@ -88,12 +88,11 @@ String DragData::asPlainText() const String text = m_platformDragData->text(); if (!text.isEmpty()) return text; - + // FIXME: Should handle rich text here - return asURL(0); } - + Color DragData::asColor() const { if (!m_platformDragData) @@ -105,21 +104,21 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co { return ClipboardQt::create(policy, m_platformDragData); } - + bool DragData::containsCompatibleContent() const { if (!m_platformDragData) return false; return containsColor() || containsURL() || m_platformDragData->hasHtml() || m_platformDragData->hasText(); } - + bool DragData::containsURL() const { if (!m_platformDragData) return false; return m_platformDragData->hasUrls(); } - + String DragData::asURL(String* title) const { if (!m_platformDragData) @@ -131,15 +130,14 @@ String DragData::asURL(String* title) const return urls.first().toString(); } - - + PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const { if (m_platformDragData && m_platformDragData->hasHtml()) return createFragmentFromMarkup(doc, m_platformDragData->html(), ""); - + return 0; } - + } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/DragImageQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/DragImageQt.cpp index c9cdd8dd8..3a077e1c0 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/DragImageQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/DragImageQt.cpp @@ -44,20 +44,20 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize) { return image; } - + DragImageRef dissolveDragImageToFraction(DragImageRef image, float) { return image; } - + DragImageRef createDragImageFromImage(Image*) { return 0; } - + DragImageRef createDragImageIconForCachedImage(CachedImage*) { - return 0; + return 0; } - + } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp index bc9d2f4f3..28d3ca7b4 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp @@ -64,7 +64,7 @@ bool getFileSize(const String& path, long long& result) { QFileInfo info(path); result = info.size(); - return info.exists(); + return info.exists(); } bool getFileModificationTime(const String& path, time_t& result) @@ -156,7 +156,7 @@ bool unloadModule(PlatformModule module) delete module; return true; } - + return false; #endif } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp index 57a5e99db..d1853fc5e 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp @@ -60,7 +60,7 @@ String searchableIndexIntroduction() { return QCoreApplication::translate("QWebPage", "This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); } - + String fileButtonChooseFileLabel() { return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms"); @@ -183,7 +183,7 @@ String contextMenuItemTagSpellingMenu() String contextMenuItemTagShowSpellingPanel(bool show) { - return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") : + return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") : QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title"); } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/MIMETypeRegistryQt.cpp index 2b5968a3d..22cee6f76 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/MIMETypeRegistryQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/MIMETypeRegistryQt.cpp @@ -36,7 +36,7 @@ struct ExtensionMap { const char* mimeType; }; -static const ExtensionMap extensionMap [] = { +static const ExtensionMap extensionMap[] = { { "bmp", "image/bmp" }, { "css", "text/css" }, { "gif", "image/gif" }, diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PasteboardQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PasteboardQt.cpp index b535a74e3..8a377ad70 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PasteboardQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PasteboardQt.cpp @@ -44,8 +44,8 @@ #define methodDebug() qDebug() << "PasteboardQt: " << __FUNCTION__; namespace WebCore { - -Pasteboard::Pasteboard() + +Pasteboard::Pasteboard() : m_selectionMode(false) { } @@ -71,7 +71,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame) md->setHtml(html); #ifndef QT_NO_CLIPBOARD - QApplication::clipboard()->setMimeData(md, m_selectionMode ? + QApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard); #endif } @@ -84,7 +84,7 @@ bool Pasteboard::canSmartReplace() String Pasteboard::plainText(Frame*) { #ifndef QT_NO_CLIPBOARD - return QApplication::clipboard()->text(m_selectionMode ? + return QApplication::clipboard()->text(m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard); #else return String(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp index 955da9bd5..43a294ba1 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp @@ -493,7 +493,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event) m_autoRepeat = event->isAutoRepeat(); m_ctrlKey = (state & Qt::ControlModifier) != 0; m_altKey = (state & Qt::AltModifier) != 0; - m_metaKey = (state & Qt::MetaModifier) != 0; + m_metaKey = (state & Qt::MetaModifier) != 0; m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key()); m_nativeVirtualKeyCode = event->nativeVirtualKey(); m_isKeypad = (state & Qt::KeypadModifier) != 0; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PlatformMouseEventQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PlatformMouseEventQt.cpp index ba7a4ad80..6c1d82d45 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PlatformMouseEventQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PlatformMouseEventQt.cpp @@ -38,9 +38,9 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount) { m_timestamp = WTF::currentTime(); - QMouseEvent *me = 0; + QMouseEvent* me = 0; - switch(event->type()) { + switch (event->type()) { case QEvent::MouseMove: m_eventType = MouseEventMoved; me = static_cast<QMouseEvent *>(event); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp index a7d664342..867e4ea4b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp @@ -68,8 +68,7 @@ void PopupMenu::populate(const IntRect& r) if (client()->itemIsSeparator(i)) { //FIXME: better seperator item m_popup->insertItem(i, QString::fromLatin1("---")); - } - else { + } else { //PopupMenuStyle style = client()->itemStyle(i); m_popup->insertItem(i, client()->itemText(i)); #if 0 diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 0b42e5c62..5f64219c5 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -143,10 +143,10 @@ RenderThemeQt::~RenderThemeQt() // for some widget painting, we need to fallback to Windows style QStyle* RenderThemeQt::fallbackStyle() { - if(!m_fallbackStyle) + if (!m_fallbackStyle) m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); - if(!m_fallbackStyle) + if (!m_fallbackStyle) m_fallbackStyle = QApplication::style(); return m_fallbackStyle; @@ -227,9 +227,8 @@ static QRect inflateButtonRect(const QRect& originalRect, QStyle* style) int paddingBottom = originalRect.bottom() - layoutRect.bottom(); return originalRect.adjusted(-paddingLeft, -paddingTop, paddingRight, paddingBottom); - } else { + } else return originalRect; - } } void RenderThemeQt::adjustRepaintRect(const RenderObject* o, IntRect& rect) @@ -252,18 +251,6 @@ void RenderThemeQt::adjustRepaintRect(const RenderObject* o, IntRect& rect) } } -bool RenderThemeQt::isControlStyled(const RenderStyle* style, const BorderData& border, - const FillLayer& background, const Color& backgroundColor) const -{ - if (style->appearance() == TextFieldPart - || style->appearance() == TextAreaPart - || style->appearance() == ListboxPart) { - return style->border() != border; - } - - return RenderTheme::isControlStyled(style, border, background, backgroundColor); -} - Color RenderThemeQt::platformActiveSelectionBackgroundColor() const { QPalette pal = QApplication::palette(); @@ -337,11 +324,10 @@ void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const // If the style supports layout rects we use that, and compensate accordingly // in paintButton() below. - if (!layoutRect.isNull()) { + if (!layoutRect.isNull()) size.setHeight(layoutRect.height()); - } else { + else size.setHeight(pushButtonSize.height()); - } break; } @@ -492,14 +478,13 @@ bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo& option.state |= QStyle::State_Small; ControlPart appearance = applyTheme(option, o); - if(appearance == PushButtonPart || appearance == ButtonPart) { + if (appearance == PushButtonPart || appearance == ButtonPart) { option.rect = inflateButtonRect(option.rect, qStyle()); p.drawControl(QStyle::CE_PushButton, option); - } else if(appearance == RadioPart) { + } else if (appearance == RadioPart) p.drawControl(QStyle::CE_RadioButton, option); - } else if(appearance == CheckboxPart) { + else if (appearance == CheckboxPart) p.drawControl(QStyle::CE_CheckBox, option); - } return false; } @@ -597,7 +582,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo const QPoint topLeft = r.topLeft(); p.painter->translate(topLeft); - opt.rect.moveTo(QPoint(0,0)); + opt.rect.moveTo(QPoint(0, 0)); opt.rect.setSize(r.size()); p.drawComplexControl(QStyle::CC_ComboBox, opt); @@ -777,7 +762,7 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con } } - if(result == RadioPart || result == CheckboxPart) + if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); // If the webview has a custom palette, use it @@ -805,10 +790,10 @@ String RenderThemeQt::extraMediaControlsStyleSheet() } // Helper class to transform the painter's world matrix to the object's content area, scaled to 0,0,100,100 -class WorldMatrixTransformer -{ +class WorldMatrixTransformer { public: - WorldMatrixTransformer(QPainter* painter, RenderObject* renderObject, const IntRect& r) : m_painter(painter) { + WorldMatrixTransformer(QPainter* painter, RenderObject* renderObject, const IntRect& r) : m_painter(painter) + { RenderStyle* style = renderObject->style(); m_originalTransform = m_painter->transform(); m_painter->translate(r.x() + style->paddingLeft().value(), r.y() + style->paddingTop().value()); @@ -836,7 +821,7 @@ HTMLMediaElement* RenderThemeQt::getMediaElementFromRenderObject(RenderObject* o void RenderThemeQt::paintMediaBackground(QPainter* painter, const IntRect& r) const { painter->setPen(Qt::NoPen); - static QColor transparentBlack(0,0,0,100); + static QColor transparentBlack(0, 0, 0, 100); painter->setBrush(transparentBlack); painter->drawRoundedRect(r.x(), r.y(), r.width(), r.height(), 5.0, 5.0); } @@ -851,7 +836,7 @@ QColor RenderThemeQt::getMediaControlForegroundColor(RenderObject* o) const bool RenderThemeQt::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - return RenderTheme::paintMediaFullscreenButton(o, paintInfo, r); + return RenderTheme::paintMediaFullscreenButton(o, paintInfo, r); } bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 19d2d3343..617c87594 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -36,8 +36,7 @@ namespace WebCore { class RenderStyle; class HTMLMediaElement; -class RenderThemeQt : public RenderTheme -{ +class RenderThemeQt : public RenderTheme { private: RenderThemeQt(Page* page); virtual ~RenderThemeQt(); @@ -58,9 +57,6 @@ public: virtual void adjustRepaintRect(const RenderObject* o, IntRect& r); - virtual bool isControlStyled(const RenderStyle*, const BorderData&, - const FillLayer&, const Color&) const; - // The platform selection color. virtual Color platformActiveSelectionBackgroundColor() const; virtual Color platformInactiveSelectionBackgroundColor() const; @@ -154,8 +150,7 @@ private: QStyle* m_fallbackStyle; }; -class StylePainter -{ +class StylePainter { public: explicit StylePainter(const RenderObject::PaintInfo& paintInfo); explicit StylePainter(GraphicsContext* context); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScreenQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScreenQt.cpp index eda14463c..def199512 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScreenQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScreenQt.cpp @@ -51,14 +51,14 @@ static QWidget* qwidgetForPage(const Page* page) return frameView->qwidget(); } - + FloatRect screenRect(const Page* page) { QWidget* qw = qwidgetForPage(page); if (!qw) return FloatRect(); - // Taken from KGlobalSettings::desktopGeometry + // Taken from KGlobalSettings::desktopGeometry QDesktopWidget* dw = QApplication::desktop(); if (!dw) return FloatRect(); @@ -81,7 +81,7 @@ FloatRect usableScreenRect(const Page* page) if (!qw) return FloatRect(); - // Taken from KGlobalSettings::desktopGeometry + // Taken from KGlobalSettings::desktopGeometry QDesktopWidget* dw = QApplication::desktop(); if (!dw) return FloatRect(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarQt.cpp index 29a999784..8eac15f9f 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarQt.cpp @@ -72,8 +72,8 @@ bool Scrollbar::contextMenu(const PlatformMouseEvent& event) const QPoint globalPos = QPoint(event.globalX(), event.globalY()); QAction* actionSelected = menu.exec(globalPos); - if (actionSelected == 0) - /* Do nothing */ ; + if (!actionSelected) + { /* Do nothing */ } else if (actionSelected == actScrollHere) { const QPoint pos = convertFromContainingWindow(event.pos()); moveThumb(horizontal ? pos.x() : pos.y()); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp index 3851dfe31..561e55f81 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp @@ -71,29 +71,29 @@ static QStyle::SubControl scPart(const ScrollbarPart& part) case ForwardButtonEndPart: return QStyle::SC_ScrollBarAddLine; } - + return QStyle::SC_None; } -static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc) -{ - switch (sc) { - case QStyle::SC_None: - return NoPart; - case QStyle::SC_ScrollBarSubLine: - return BackButtonStartPart; - case QStyle::SC_ScrollBarSubPage: - return BackTrackPart; - case QStyle::SC_ScrollBarSlider: - return ThumbPart; - case QStyle::SC_ScrollBarAddPage: - return ForwardTrackPart; - case QStyle::SC_ScrollBarAddLine: - return ForwardButtonStartPart; +static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc) +{ + switch (sc) { + case QStyle::SC_None: + return NoPart; + case QStyle::SC_ScrollBarSubLine: + return BackButtonStartPart; + case QStyle::SC_ScrollBarSubPage: + return BackTrackPart; + case QStyle::SC_ScrollBarSlider: + return ThumbPart; + case QStyle::SC_ScrollBarAddPage: + return ForwardTrackPart; + case QStyle::SC_ScrollBarAddLine: + return ForwardButtonStartPart; } - return NoPart; + return NoPart; } - + static QStyleOptionSlider* styleOptionSlider(Scrollbar* scrollbar, QWidget* widget = 0) { static QStyleOptionSlider opt; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h index 787b15add..6ca44eada 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h @@ -40,7 +40,7 @@ public: virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&); virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&); - + virtual void invalidatePart(Scrollbar*, ScrollbarPart); virtual int thumbPosition(Scrollbar*); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/SharedBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/SharedBufferQt.cpp index 38ba6d10e..8d62226fd 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/SharedBufferQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/SharedBufferQt.cpp @@ -31,7 +31,7 @@ namespace WebCore { PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fileName) -{ +{ if (fileName.isEmpty()) return 0; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp b/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp index f76eb43dd..8ef598fa2 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp @@ -75,22 +75,49 @@ using namespace WebCore; #if defined(Q_OS_WINCE) -Vector<String> PluginDatabase::defaultPluginDirectories() { notImplemented(); return Vector<String>(); } -void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const { notImplemented(); } -bool PluginDatabase::isPreferredPluginDirectory(const String& directory) { notImplemented(); return false; } +Vector<String> PluginDatabase::defaultPluginDirectories() +{ + notImplemented(); + return Vector<String>(); +} + +void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const +{ + notImplemented(); +} + +bool PluginDatabase::isPreferredPluginDirectory(const String& directory) +{ + notImplemented(); + return false; +} #endif namespace WebCore { -void getSupportedKeySizes(Vector<String>&) { notImplemented(); } -String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); } +void getSupportedKeySizes(Vector<String>&) +{ + notImplemented(); +} + +String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) +{ + return String(); +} #if !defined(Q_OS_WIN) // defined in win/SystemTimeWin.cpp, which is compiled for the Qt/Windows port -float userIdleTime() { notImplemented(); return FLT_MAX; } // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed +float userIdleTime() +{ + notImplemented(); + return FLT_MAX; // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed +} #endif -void prefetchDNS(const String& hostname) { notImplemented(); } +void prefetchDNS(const String& hostname) +{ + notImplemented(); +} } diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp index d9b57b2a6..9a4e32a36 100644 --- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp @@ -150,6 +150,18 @@ int SQLiteDatabase::pageSize() return m_pageSize; } +int64_t SQLiteDatabase::freeSpaceSize() +{ + MutexLocker locker(m_authorizerLock); + enableAuthorizer(false); + // Note: freelist_count was added in SQLite 3.4.1. + SQLiteStatement statement(*this, "PRAGMA freelist_count"); + int64_t size = statement.getColumnInt64(0) * pageSize(); + + enableAuthorizer(true); + return size; +} + void SQLiteDatabase::setSynchronous(SynchronousPragma sync) { executeCommand(String::format("PRAGMA synchronous = %i", sync)); diff --git a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.h b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.h index 76700dc0c..d31343581 100644 --- a/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.h +++ b/src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.h @@ -83,6 +83,9 @@ public: int64_t maximumSize(); void setMaximumSize(int64_t); + // Gets the number of unused bytes in the database file. + int64_t freeSpaceSize(); + // The SQLite SYNCHRONOUS pragma can be either FULL, NORMAL, or OFF // FULL - Any writing calls to the DB block until the data is actually on the disk surface // NORMAL - SQLite pauses at some critical moments when writing, but much less than FULL diff --git a/src/3rdparty/webkit/WebCore/platform/text/CharacterNames.h b/src/3rdparty/webkit/WebCore/platform/text/CharacterNames.h index 5b1a33780..cd0944739 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/CharacterNames.h +++ b/src/3rdparty/webkit/WebCore/platform/text/CharacterNames.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,22 +37,26 @@ namespace WebCore { const UChar blackSquare = 0x25A0; const UChar bullet = 0x2022; + const UChar hebrewPunctuationGeresh = 0x05F3; const UChar hebrewPunctuationGershayim = 0x05F4; const UChar horizontalEllipsis = 0x2026; - const UChar ideographicSpace = 0x3000; const UChar ideographicComma = 0x3001; const UChar ideographicFullStop = 0x3002; - const UChar leftToRightMark = 0x200E; + const UChar ideographicSpace = 0x3000; + const UChar leftDoubleQuotationMark = 0x201C; + const UChar leftSingleQuotationMark = 0x2018; const UChar leftToRightEmbed = 0x202A; + const UChar leftToRightMark = 0x200E; const UChar leftToRightOverride = 0x202D; const UChar newlineCharacter = 0x000A; const UChar noBreakSpace = 0x00A0; const UChar objectReplacementCharacter = 0xFFFC; const UChar popDirectionalFormatting = 0x202C; const UChar replacementCharacter = 0xFFFD; + const UChar rightDoubleQuotationMark = 0x201D; const UChar rightSingleQuotationMark = 0x2019; - const UChar rightToLeftMark = 0x200F; const UChar rightToLeftEmbed = 0x202B; + const UChar rightToLeftMark = 0x200F; const UChar rightToLeftOverride = 0x202E; const UChar softHyphen = 0x00AD; const UChar whiteBullet = 0x25E6; diff --git a/src/3rdparty/webkit/WebCore/platform/text/StringBuffer.h b/src/3rdparty/webkit/WebCore/platform/text/StringBuffer.h index 28d4e897b..353a44a0c 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/StringBuffer.h +++ b/src/3rdparty/webkit/WebCore/platform/text/StringBuffer.h @@ -35,7 +35,7 @@ namespace WebCore { -class StringBuffer : Noncopyable { +class StringBuffer : public Noncopyable { public: explicit StringBuffer(unsigned length) : m_length(length) diff --git a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.cpp b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.cpp index cd8fdbd00..8cbcc0d95 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.cpp @@ -205,24 +205,26 @@ bool StringImpl::containsOnlyWhitespace() return true; } -PassRefPtr<StringImpl> StringImpl::substring(unsigned pos, unsigned len) +PassRefPtr<StringImpl> StringImpl::substring(unsigned start, unsigned length) { - if (pos >= m_length) + if (start >= m_length) return empty(); - if (len > m_length - pos) - len = m_length - pos; - return create(m_data + pos, len); + unsigned maxLength = m_length - start; + if (length >= maxLength) { + if (!start) + return this; + length = maxLength; + } + return create(m_data + start, length); } -PassRefPtr<StringImpl> StringImpl::substringCopy(unsigned pos, unsigned len) +PassRefPtr<StringImpl> StringImpl::substringCopy(unsigned start, unsigned length) { - if (pos >= m_length) - pos = m_length; - if (len > m_length - pos) - len = m_length - pos; - if (!len) + start = min(start, m_length); + length = min(length, m_length - start); + if (!length) return adoptRef(new StringImpl); - return substring(pos, len); + return create(m_data + start, length); } UChar32 StringImpl::characterStartingAt(unsigned i) diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorICU.cpp b/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorICU.cpp index c4fc1b0ee..c922fbc84 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorICU.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorICU.cpp @@ -160,7 +160,7 @@ TextBreakIterator* cursorMovementIterator(const UChar* string, int length) "$LF = [\\p{Grapheme_Cluster_Break = LF}];" "$Control = [\\p{Grapheme_Cluster_Break = Control}];" "$VoiceMarks = [\\uFF9E\\uFF9F];" // Japanese half-width katakana voiced marks - "$Extend = [\\p{Grapheme_Cluster_Break = Extend} $VoiceMarks];" + "$Extend = [\\p{Grapheme_Cluster_Break = Extend} $VoiceMarks - [\\u0E30 \\u0E32 \\u0E45 \\u0EB0 \\u0EB2]];" "$SpacingMark = [[\\p{General_Category = Spacing Mark}] - $Extend];" "$L = [\\p{Grapheme_Cluster_Break = L}];" "$V = [\\p{Grapheme_Cluster_Break = V}];" diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h index df4258294..3c74165d3 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h +++ b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h @@ -56,7 +56,7 @@ namespace WebCore { typedef char UnencodableReplacementArray[32]; - class TextCodec : Noncopyable { + class TextCodec : public Noncopyable { public: virtual ~TextCodec(); diff --git a/src/3rdparty/webkit/WebCore/platform/text/qt/StringQt.cpp b/src/3rdparty/webkit/WebCore/platform/text/qt/StringQt.cpp index 97bbf40b1..62aa9794e 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/qt/StringQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/qt/StringQt.cpp @@ -41,7 +41,7 @@ String::String(const QString& qstr) String::String(const QStringRef& ref) { - if (!ref.string()) + if (!ref.string()) return; m_impl = StringImpl::create(reinterpret_cast<const UChar*>(ref.unicode()), ref.length()); } diff --git a/src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp b/src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp index bdc851b93..ffc4c44bd 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp @@ -39,8 +39,7 @@ #if QT_VERSION >= 0x040400 #include <qtextboundaryfinder.h> -namespace WebCore -{ +namespace WebCore { int findNextWordFromIndex(UChar const* buffer, int len, int position, bool forward) { @@ -78,9 +77,8 @@ void findWordBoundary(UChar const* buffer, int len, int position, int* start, in } #else -namespace WebCore -{ - +namespace WebCore { + int findNextWordFromIndex(UChar const* buffer, int len, int position, bool forward) { QString str(reinterpret_cast<QChar const*>(buffer), len); diff --git a/src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp index 06e8f3741..d80e270b7 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp @@ -36,8 +36,7 @@ namespace WebCore { - class TextBreakIterator : public QTextBoundaryFinder - { + class TextBreakIterator : public QTextBoundaryFinder { }; static QTextBoundaryFinder* iterator = 0; static unsigned char buffer[1024]; @@ -138,17 +137,18 @@ namespace WebCore { namespace WebCore { - class TextBreakIterator - { + class TextBreakIterator { public: virtual int first() = 0; virtual int next() = 0; virtual int previous() = 0; - inline int following(int pos) { + inline int following(int pos) + { currentPos = pos; return next(); } - inline int preceding(int pos) { + inline int preceding(int pos) + { currentPos = pos; return previous(); } @@ -157,16 +157,14 @@ namespace WebCore { int length; }; - class WordBreakIteratorQt : public TextBreakIterator - { + class WordBreakIteratorQt : public TextBreakIterator { public: virtual int first(); virtual int next(); virtual int previous(); }; - class CharBreakIteratorQt : public TextBreakIterator - { + class CharBreakIteratorQt : public TextBreakIterator { public: virtual int first(); virtual int next(); @@ -174,12 +172,14 @@ namespace WebCore { QTextLayout layout; }; - int WordBreakIteratorQt::first() { + int WordBreakIteratorQt::first() + { currentPos = 0; return currentPos; } - int WordBreakIteratorQt::next() { + int WordBreakIteratorQt::next() + { if (currentPos >= length) { currentPos = -1; return currentPos; @@ -194,7 +194,9 @@ namespace WebCore { } return currentPos; } - int WordBreakIteratorQt::previous() { + + int WordBreakIteratorQt::previous() + { if (currentPos <= 0) { currentPos = -1; return currentPos; @@ -210,18 +212,22 @@ namespace WebCore { return currentPos; } - int CharBreakIteratorQt::first() { + int CharBreakIteratorQt::first() + { currentPos = 0; return currentPos; } - int CharBreakIteratorQt::next() { + int CharBreakIteratorQt::next() + { if (currentPos >= length) return -1; currentPos = layout.nextCursorPosition(currentPos); return currentPos; } - int CharBreakIteratorQt::previous() { + + int CharBreakIteratorQt::previous() + { if (currentPos <= 0) return -1; currentPos = layout.previousCursorPosition(currentPos); @@ -252,7 +258,7 @@ TextBreakIterator* characterBreakIterator(const UChar* string, int length) iterator->length = length; iterator->currentPos = 0; iterator->layout.setText(QString(reinterpret_cast<const QChar*>(string), length)); - + return iterator; } |