summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/win
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/platform/graphics/win
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/platform/graphics/win')
-rw-r--r--Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp4
-rw-r--r--Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp9
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp14
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h6
-rw-r--r--Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp5
-rw-r--r--Source/WebCore/platform/graphics/win/QTMovie.cpp24
-rw-r--r--Source/WebCore/platform/graphics/win/QTMovie.h2
-rw-r--r--Source/WebCore/platform/graphics/win/UniscribeController.cpp54
8 files changed, 58 insertions, 60 deletions
diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
index d3c6b58..d0bd4e9 100644
--- a/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
+++ b/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
@@ -184,7 +184,7 @@ static const Color& grammarPatternColor() {
return grammarColor;
}
-void GraphicsContext::drawLineForTextChecking(const IntPoint& point, int width, TextCheckingLineStyle style)
+void GraphicsContext::drawLineForTextChecking(const FloatPoint& point, float width, TextCheckingLineStyle style)
{
if (paintingDisabled())
return;
@@ -204,7 +204,7 @@ void GraphicsContext::drawLineForTextChecking(const IntPoint& point, int width,
// bounds (e.g. when at the edge of a view) and could make it appear that the
// space between adjacent misspelled words was underlined.
// allow slightly more considering that the pattern ends with a transparent pixel
- int widthMod = width % patternWidth;
+ float widthMod = fmodf(width, patternWidth);
if (patternWidth - widthMod > cMisspellingLinePatternGapWidth)
width -= widthMod;
diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
index bb22024..f2850e4 100644
--- a/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
+++ b/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
@@ -197,4 +197,13 @@ void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform)
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
}
+void GraphicsContextPlatformPrivate::setCTM(const AffineTransform& transform)
+{
+ if (!m_hdc)
+ return;
+
+ XFORM xform = transform.toTransformationMatrix();
+ SetWorldTransform(m_hdc, &xform);
+}
+
}
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
index d47de2b..40fe1d1 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple, Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,7 +46,9 @@
#include "TimeRanges.h"
#include "Timer.h"
#include <AssertMacros.h>
+#include <CoreGraphics/CGAffineTransform.h>
#include <CoreGraphics/CGContext.h>
+#include <QuartzCore/CATransform3D.h>
#include <Wininet.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
@@ -151,7 +153,7 @@ MediaPlayerPrivateInterface* MediaPlayerPrivateQuickTimeVisualContext::create(Me
void MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
}
MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext(MediaPlayer* player)
@@ -175,6 +177,7 @@ MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualConte
#endif
, m_visualContextClient(new MediaPlayerPrivateQuickTimeVisualContext::VisualContextClient(this))
, m_delayingLoad(false)
+ , m_privateBrowsing(false)
, m_preload(MediaPlayer::Auto)
{
}
@@ -1244,6 +1247,13 @@ void MediaPlayerPrivateQuickTimeVisualContext::acceleratedRenderingStateChanged(
setUpVideoRendering();
}
+void MediaPlayerPrivateQuickTimeVisualContext::setPrivateBrowsingMode(bool privateBrowsing)
+{
+ m_privateBrowsing = privateBrowsing;
+ if (m_movie)
+ m_movie->setPrivateBrowsingMode(m_privateBrowsing);
+}
+
#endif
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
index a12d79e..0dc97cd 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,6 +30,7 @@
#include "MediaPlayerPrivate.h"
#include "Timer.h"
+#include <CoreGraphics/CGAffineTransform.h>
#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/RetainPtr.h>
@@ -153,6 +154,8 @@ private:
void visualContextTimerFired(Timer<MediaPlayerPrivateQuickTimeVisualContext>*);
void retrieveCurrentImage();
+ virtual void setPrivateBrowsingMode(bool);
+
class MovieClient;
friend class MovieClient;
OwnPtr<MovieClient> m_movieClient;
@@ -196,6 +199,7 @@ private:
bool m_newFrameAvailable;
bool m_delayingLoad;
String m_movieURL;
+ bool m_privateBrowsing;
MediaPlayer::Preload m_preload;
#if DRAW_FRAME_RATE
double m_frameCountWhilePlaying;
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
index 07b7621..5156cd3 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
@@ -40,6 +40,9 @@
#include "SoftLinking.h"
#include "TimeRanges.h"
#include "Timer.h"
+#include <CoreGraphics/CGColorSpace.h>
+#include <CoreGraphics/CGContext.h>
+#include <CoreGraphics/CGImage.h>
#include <Wininet.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
@@ -76,7 +79,7 @@ MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
}
MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
diff --git a/Source/WebCore/platform/graphics/win/QTMovie.cpp b/Source/WebCore/platform/graphics/win/QTMovie.cpp
index 4cd8161..05fbb86 100644
--- a/Source/WebCore/platform/graphics/win/QTMovie.cpp
+++ b/Source/WebCore/platform/graphics/win/QTMovie.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple, Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -96,6 +96,7 @@ public:
CFURLRef m_currentURL;
float m_timeToRestore;
float m_rateToRestore;
+ bool m_privateBrowsing;
#if !ASSERT_DISABLED
bool m_scaleCached;
#endif
@@ -121,6 +122,7 @@ QTMoviePrivate::QTMoviePrivate()
, m_timeToRestore(-1.0f)
, m_rateToRestore(-1.0f)
, m_disabled(false)
+ , m_privateBrowsing(false)
#if !ASSERT_DISABLED
, m_scaleCached(false)
#endif
@@ -466,8 +468,8 @@ void QTMovie::load(CFURLRef url, bool preservesPitch)
m_private->m_loadState = 0;
}
- // Define a property array for NewMovieFromProperties. 8 should be enough for our needs.
- QTNewMoviePropertyElement movieProps[8];
+ // Define a property array for NewMovieFromProperties.
+ QTNewMoviePropertyElement movieProps[9];
ItemCount moviePropCount = 0;
bool boolTrue = true;
@@ -550,6 +552,14 @@ void QTMovie::load(CFURLRef url, bool preservesPitch)
movieProps[moviePropCount].propStatus = 0;
moviePropCount++;
+ bool allowCaching = !m_private->m_privateBrowsing;
+ movieProps[moviePropCount].propClass = kQTPropertyClass_MovieInstantiation;
+ movieProps[moviePropCount].propID = 'pers';
+ movieProps[moviePropCount].propValueSize = sizeof(allowCaching);
+ movieProps[moviePropCount].propValueAddress = &allowCaching;
+ movieProps[moviePropCount].propStatus = 0;
+ moviePropCount++;
+
ASSERT(moviePropCount <= WTF_ARRAY_LENGTH(movieProps));
m_private->m_loadError = NewMovieFromProperties(moviePropCount, movieProps, 0, 0, &m_private->m_movie);
@@ -846,6 +856,14 @@ void QTMovie::resetTransform()
m_private->cacheMovieScale();
}
+void QTMovie::setPrivateBrowsingMode(bool privateBrowsing)
+{
+ m_private->m_privateBrowsing = privateBrowsing;
+ if (m_private->m_movie) {
+ bool allowCaching = !m_private->m_privateBrowsing;
+ QTSetMovieProperty(m_private->m_movie, 'cach', 'pers', sizeof(allowCaching), &allowCaching);
+ }
+}
bool QTMovie::initializeQuickTime()
{
diff --git a/Source/WebCore/platform/graphics/win/QTMovie.h b/Source/WebCore/platform/graphics/win/QTMovie.h
index 5e4c4e7..e97d16d 100644
--- a/Source/WebCore/platform/graphics/win/QTMovie.h
+++ b/Source/WebCore/platform/graphics/win/QTMovie.h
@@ -117,6 +117,8 @@ public:
long timeScale() const;
+ void setPrivateBrowsingMode(bool);
+
private:
QTMoviePrivate* m_private;
friend class QTMoviePrivate;
diff --git a/Source/WebCore/platform/graphics/win/UniscribeController.cpp b/Source/WebCore/platform/graphics/win/UniscribeController.cpp
index ebbed51..a850882 100644
--- a/Source/WebCore/platform/graphics/win/UniscribeController.cpp
+++ b/Source/WebCore/platform/graphics/win/UniscribeController.cpp
@@ -261,18 +261,13 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
return true;
// Convert all chars that should be treated as spaces to use the space glyph.
- // We also create a map that allows us to quickly go from space glyphs or rounding
- // hack glyphs back to their corresponding characters.
+ // We also create a map that allows us to quickly go from space glyphs back to their corresponding characters.
Vector<int> spaceCharacters(glyphs.size());
spaceCharacters.fill(-1);
- Vector<int> roundingHackCharacters(glyphs.size());
- roundingHackCharacters.fill(-1);
- Vector<int> roundingHackWordBoundaries(glyphs.size());
- roundingHackWordBoundaries.fill(-1);
const float cLogicalScale = fontData->platformData().useGDI() ? 1.0f : 32.0f;
unsigned logicalSpaceWidth = fontData->spaceWidth() * cLogicalScale;
- float roundedSpaceWidth = roundf(fontData->spaceWidth());
+ float spaceWidth = fontData->spaceWidth();
for (int k = 0; k < len; k++) {
UChar ch = *(str + k);
@@ -286,21 +281,6 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
if (treatAsSpace)
spaceCharacters[clusters[k]] = m_currentCharacter + k + item.iCharPos;
}
-
- if (Font::isRoundingHackCharacter(ch))
- roundingHackCharacters[clusters[k]] = m_currentCharacter + k + item.iCharPos;
-
- int boundary = k + m_currentCharacter + item.iCharPos;
- if (boundary < m_run.length()) {
- // When at the last character in the str, don't look one past the end for a rounding hack character.
- // Instead look ahead to the first character of next item, if there is a next one.
- if (k + 1 == len) {
- if (i + 2 < m_items.size() // Check for at least 2 items remaining. The last item is a terminating item containing no characters.
- && Font::isRoundingHackCharacter(*(cp + m_items[i + 1].iCharPos)))
- roundingHackWordBoundaries[clusters[k]] = boundary;
- } else if (Font::isRoundingHackCharacter(*(str + k + 1)))
- roundingHackWordBoundaries[clusters[k]] = boundary;
- }
}
// Populate our glyph buffer with this information.
@@ -324,14 +304,6 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
advance += fontData->syntheticBoldOffset();
- // We special case spaces in two ways when applying word rounding.
- // First, we round spaces to an adjusted width in all fonts.
- // Second, in fixed-pitch fonts we ensure that all glyphs that
- // match the width of the space glyph have the same width as the space glyph.
- if (roundedAdvance == roundedSpaceWidth && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph()) &&
- m_run.applyWordRounding())
- advance = fontData->adjustedSpaceWidth();
-
if (hasExtraSpacing) {
// If we're a glyph with an advance, go ahead and add in letter-spacing.
// That way we weed out zero width lurkers. This behavior matches the fast text code path.
@@ -350,9 +322,8 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
advance += m_padding;
m_padding = 0;
} else {
- float previousPadding = m_padding;
m_padding -= m_padPerSpace;
- advance += roundf(previousPadding) - roundf(m_padding);
+ advance += m_padPerSpace;
}
}
@@ -362,25 +333,6 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
}
}
- // Deal with the float/integer impedance mismatch between CG and WebCore. "Words" (characters
- // followed by a character defined by isRoundingHackCharacter()) are always an integer width.
- // We adjust the width of the last character of a "word" to ensure an integer width.
- // Force characters that are used to determine word boundaries for the rounding hack
- // to be integer width, so the following words will start on an integer boundary.
- int roundingHackIndex = roundingHackCharacters[k];
- if (m_run.applyWordRounding() && roundingHackIndex != -1)
- advance = ceilf(advance);
-
- // Check to see if the next character is a "rounding hack character", if so, adjust the
- // width so that the total run width will be on an integer boundary.
- int position = m_currentCharacter + len;
- bool lastGlyph = (k == glyphs.size() - 1) && (m_run.rtl() ? i == 0 : i == m_items.size() - 2) && (position >= m_end);
- if ((m_run.applyWordRounding() && roundingHackWordBoundaries[k] != -1) ||
- (m_run.applyRunRounding() && lastGlyph)) {
- float totalWidth = m_runWidthSoFar + advance;
- advance += ceilf(totalWidth) - totalWidth;
- }
-
m_runWidthSoFar += advance;
// FIXME: We need to take the GOFFSETS for combining glyphs and store them in the glyph buffer