summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/wince
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebCore/platform/graphics/wince
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebCore/platform/graphics/wince')
-rw-r--r--Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp12
-rw-r--r--Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h3
-rw-r--r--Source/WebCore/platform/graphics/wince/FontWinCE.cpp8
-rw-r--r--Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp41
-rw-r--r--Source/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp10
-rw-r--r--Source/WebCore/platform/graphics/wince/SharedBitmap.cpp10
-rw-r--r--Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp17
7 files changed, 53 insertions, 48 deletions
diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
index f61ae8e..fb97fe1 100644
--- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
@@ -45,7 +45,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
g_customFontCache->unregisterFont(m_name);
}
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode renderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode renderingMode)
{
FontDescription fontDesc;
fontDesc.setComputedSize(size);
@@ -59,16 +59,14 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
// not allow access from CSS.
static String createUniqueFontName()
{
- Vector<char> fontUuid(sizeof(GUID));
+ GUID fontUuid;
- unsigned int* ptr = reinterpret_cast<unsigned int*>(fontUuid.data());
+ unsigned int* ptr = reinterpret_cast<unsigned int*>(&fontUuid);
for (int i = 0; i < sizeof(GUID) / sizeof(int) ; ++i)
*(ptr + i) = static_cast<unsigned int>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0));
- Vector<char> fontNameVector;
- base64Encode(fontUuid, fontNameVector);
- ASSERT(fontNameVector.size() < LF_FACESIZE);
- String fontName(fontNameVector.data(), fontNameVector.size());
+ String fontName = base64Encode(reinterpret_cast<char*>(&fontUuid), sizeof(fontUuid));
+ ASSERT(fontName.length() < LF_FACESIZE);
return fontName.replace('/', '_');
}
diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
index 0508246..fe7ee94 100644
--- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
+++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h
@@ -23,6 +23,7 @@
#include "FontDescription.h"
#include "FontRenderingMode.h"
+#include "FontWidthVariant.h"
#include "PlatformString.h"
#include <wtf/Noncopyable.h>
@@ -47,7 +48,7 @@ namespace WebCore {
~FontCustomPlatformData();
- FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation fontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode);
+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
static bool supportsFormat(const String&);
diff --git a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
index 5a4c8da..c3e6ce4 100644
--- a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp
@@ -86,6 +86,7 @@ public:
TextRunComponent::TextRunComponent(const UChar *start, int length, const TextRun& parentTextRun, const Font &font, int o)
: m_textRun(start, length, parentTextRun.allowTabs(), 0, 0
+ , parentTextRun.allowsTrailingExpansion() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion
, parentTextRun.rtl()
, parentTextRun.directionalOverride()
, parentTextRun.applyRunRounding()
@@ -112,7 +113,7 @@ static int generateComponents(TextRunComponents* components, const Font &font, c
{
int letterSpacing = font.letterSpacing();
int wordSpacing = font.wordSpacing();
- int padding = run.padding();
+ int padding = run.expansion();
int numSpaces = 0;
if (padding) {
for (int i = 0; i < run.length(); i++)
@@ -340,4 +341,9 @@ bool Font::canReturnFallbackFontsForComplexText()
return false;
}
+bool Font::canExpandAroundIdeographsInComplexText()
+{
+ return false;
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 9b672d2..7b1c27b 100644
--- a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -23,7 +23,6 @@
#include "GraphicsContext.h"
#include "AffineTransform.h"
-#include "CharacterNames.h"
#include "Font.h"
#include "GDIExtras.h"
#include "GlyphBuffer.h"
@@ -33,9 +32,9 @@
#include "PlatformPathWinCE.h"
#include "SharedBitmap.h"
#include "SimpleFontData.h"
-#include <wtf/OwnPtr.h>
-
#include <windows.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
@@ -62,7 +61,7 @@ static inline int stableRound(double d)
// Unlike enclosingIntRect(), this function does strict rounding.
static inline IntRect roundRect(const FloatRect& r)
{
- return IntRect(stableRound(r.x()), stableRound(r.y()), stableRound(r.right()) - stableRound(r.x()), stableRound(r.bottom()) - stableRound(r.y()));
+ return IntRect(stableRound(r.x()), stableRound(r.y()), stableRound(r.maxX()) - stableRound(r.x()), stableRound(r.maxY()) - stableRound(r.y()));
}
// Rotation transformation
@@ -129,8 +128,8 @@ template<class Transform, class Rect, class Value> static inline Rect mapRect(co
{
Value x[4], y[4];
Value l, t, r, b;
- r = rect.right() - 1;
- b = rect.bottom() - 1;
+ r = rect.maxX() - 1;
+ b = rect.maxY() - 1;
transform.map(rect.x(), rect.y(), x, y);
transform.map(rect.x(), b, x + 1, y + 1);
transform.map(r, b, x + 2, y + 2);
@@ -503,10 +502,10 @@ TransparentLayerDC::TransparentLayerDC(GraphicsContextPlatformPrivate* data, Int
m_rotation.m_postShiftX -= m_origRect.x();
m_rotation.m_postShiftY -= m_origRect.y();
- FloatPoint topLeft = m_data->m_transform.mapPoint(FloatPoint(rectBeforeTransform->topLeft()));
- FloatPoint topRight(rectBeforeTransform->right() - 1, rectBeforeTransform->y());
+ FloatPoint topLeft = m_data->m_transform.mapPoint(FloatPoint(rectBeforeTransform->location()));
+ FloatPoint topRight(rectBeforeTransform->maxX() - 1, rectBeforeTransform->y());
topRight = m_data->m_transform.mapPoint(topRight);
- FloatPoint bottomLeft(rectBeforeTransform->x(), rectBeforeTransform->bottom() - 1);
+ FloatPoint bottomLeft(rectBeforeTransform->x(), rectBeforeTransform->maxY() - 1);
bottomLeft = m_data->m_transform.mapPoint(bottomLeft);
FloatSize sideTop = topRight - topLeft;
FloatSize sideLeft = bottomLeft - topLeft;
@@ -656,7 +655,7 @@ void GraphicsContext::drawRect(const IntRect& rect)
if (trRect.height() <= 0)
trRect.setHeight(1);
- Rectangle(dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
+ Rectangle(dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
}
SelectObject(dc, oldPen);
@@ -726,7 +725,7 @@ void GraphicsContext::drawEllipse(const IntRect& rect)
oldPen = SelectObject(dc, GetStockObject(NULL_PEN));
if (brush || pen)
- Ellipse(dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
+ Ellipse(dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
SelectObject(dc, oldPen);
SelectObject(dc, oldBrush);
@@ -839,7 +838,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
}
HGDIOBJ oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
- Ellipse(dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
+ Ellipse(dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
SelectObject(dc, oldBrush);
if (newClip)
@@ -960,9 +959,9 @@ void GraphicsContext::clip(const FloatRect& rect)
OwnPtr<HRGN> clipRgn(CreateRectRgn(0, 0, 0, 0));
if (GetClipRgn(m_data->m_dc, clipRgn.get()) > 0)
- IntersectClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
+ IntersectClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
else {
- clipRgn.set(CreateRectRgn(trRect.x(), trRect.y(), trRect.right(), trRect.bottom()));
+ clipRgn.set(CreateRectRgn(trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY()));
SelectClipRgn(m_data->m_dc, clipRgn.get());
}
}
@@ -977,7 +976,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
IntRect trRect = m_data->mapRect(rect);
- ExcludeClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.right(), trRect.bottom());
+ ExcludeClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
}
void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
@@ -1093,8 +1092,8 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
HGDIOBJ oldPen = SelectObject(dc, pen.get());
- int right = trRect.right() - 1;
- int bottom = trRect.bottom() - 1;
+ int right = trRect.maxX() - 1;
+ int bottom = trRect.maxY() - 1;
const POINT intPoints[5] =
{
{ trRect.x(), trRect.y() },
@@ -1536,8 +1535,8 @@ void GraphicsContext::drawText(const Font& font, const TextRun& run, const IntPo
float oldOpacity = m_data->m_opacity;
m_data->m_opacity *= fillColor().alpha() / 255.0;
- FloatRect textRect = font.selectionRectForText(run, point, font.height(), from, to);
- textRect.setY(textRect.y() - font.ascent());
+ FloatRect textRect = font.selectionRectForText(run, point, font.fontMetrics().height(), from, to);
+ textRect.setY(textRect.y() - font.fontMetrics().ascent());
IntRect trRect = enclosingIntRect(m_data->mapRect(textRect));
RECT bmpRect;
AlphaPaintType alphaPaintType = mustSupportAlpha ? AlphaPaintOther : AlphaPaintNone;
@@ -1546,7 +1545,7 @@ void GraphicsContext::drawText(const Font& font, const TextRun& run, const IntPo
GraphicsContext gc(0);
gc.setBitmap(bmp);
gc.scale(FloatSize(m_data->m_transform.a(), m_data->m_transform.d()));
- font.drawText(&gc, run, IntPoint(0, font.ascent()), from, to);
+ font.drawText(&gc, run, IntPoint(0, font.fontMetrics().ascent()), from, to);
}
unsigned key1;
HDC memDC = bmp->getDC(&key1);
@@ -1591,7 +1590,7 @@ void GraphicsContext::drawText(const SimpleFontData* fontData, const GlyphBuffer
? fontData->platformData().getScaledFontHandle(height, scaleX == scaleY ? 0 : width)
: 0;
- FloatPoint startPoint(point.x(), point.y() - fontData->ascent());
+ FloatPoint startPoint(point.x(), point.y() - fontData->fontMetrics().ascent());
FloatPoint trPoint = m_data->mapPoint(startPoint);
int y = stableRound(trPoint.y());
diff --git a/Source/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp b/Source/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp
index 8534f89..8efe661 100644
--- a/Source/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp
@@ -119,7 +119,7 @@ static inline void bezier(int segments, Vector<PathPoint>& pts, const PathPoint*
static bool containsPoint(const FloatRect& r, const FloatPoint& p)
{
- return p.x() >= r.x() && p.y() >= r.y() && p.x() < r.right() && p.y() < r.bottom();
+ return p.x() >= r.x() && p.y() >= r.y() && p.x() < r.maxX() && p.y() < r.maxY();
}
static void normalizeAngle(float& angle)
@@ -146,7 +146,7 @@ static void inflateRectToContainPoint(FloatRect& r, float x, float y)
return;
}
if (x < r.x()) {
- r.setWidth(r.right() - x);
+ r.setWidth(r.maxX() - x);
r.setX(x);
} else {
float w = x - r.x() + 1;
@@ -154,7 +154,7 @@ static void inflateRectToContainPoint(FloatRect& r, float x, float y)
r.setWidth(w);
}
if (y < r.y()) {
- r.setHeight(r.bottom() - y);
+ r.setHeight(r.maxY() - y);
r.setY(y);
} else {
float h = y - r.y() + 1;
@@ -740,8 +740,8 @@ void PlatformPath::addRect(const FloatRect& r)
{
moveTo(r.location());
- float right = r.right() - 1;
- float bottom = r.bottom() - 1;
+ float right = r.maxX() - 1;
+ float bottom = r.maxY() - 1;
addLineTo(FloatPoint(right, r.y()));
addLineTo(FloatPoint(right, bottom));
addLineTo(FloatPoint(r.x(), bottom));
diff --git a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
index 168a5e2..2bf0028 100644
--- a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
+++ b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
@@ -135,7 +135,7 @@ bool SharedBitmap::to16bit()
int width = newBmpInfo.width();
int paddedWidth = newBmpInfo.paddedWidth();
int bufferSize = paddedWidth * newBmpInfo.height();
- OwnArrayPtr<unsigned> newPixelData(new unsigned[bufferSize / 2]);
+ OwnArrayPtr<unsigned> newPixelData = adoptArrayPtr(new unsigned[bufferSize / 2]);
void* newPixels = newPixelData.get();
if (!newPixels)
@@ -481,8 +481,8 @@ void SharedBitmap::drawPattern(HDC hdc, const AffineTransform& transform, const
RECT dstRectWin = {
stableRound(trRect.x()),
stableRound(trRect.y()),
- stableRound(trRect.right()),
- stableRound(trRect.bottom()),
+ stableRound(trRect.maxX()),
+ stableRound(trRect.maxY()),
};
if (dstRectWin.right <= dstRectWin.left || dstRectWin.bottom <= dstRectWin.top)
return;
@@ -497,8 +497,8 @@ void SharedBitmap::drawPattern(HDC hdc, const AffineTransform& transform, const
RECT srcRectWin = {
0,
0,
- stableRound(visibleDstRect.right()) - stableRound(visibleDstRect.x()),
- stableRound(visibleDstRect.bottom()) - stableRound(visibleDstRect.y())
+ stableRound(visibleDstRect.maxX()) - stableRound(visibleDstRect.x()),
+ stableRound(visibleDstRect.maxY()) - stableRound(visibleDstRect.y())
};
if (srcRectWin.right <= 0 || srcRectWin.bottom <= 0)
return;
diff --git a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
index 27a021e..8abafbd 100644
--- a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
@@ -27,7 +27,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "config.h"
#include "SimpleFontData.h"
@@ -35,9 +34,8 @@
#include "Font.h"
#include "FontCache.h"
#include "FontDescription.h"
-#include <wtf/MathExtras.h>
#include <mlang.h>
-#include <tchar.h>
+#include <wtf/MathExtras.h>
namespace WebCore {
@@ -51,11 +49,14 @@ void SimpleFontData::platformInit()
const TEXTMETRIC& tm = m_platformData.metrics();
m_isSystemFont = m_platformData.isSystemFont();
- m_ascent = (tm.tmAscent * m_platformData.size() + 36) / 72;
- m_descent = (tm.tmDescent * m_platformData.size() + 36) / 72;
- m_lineGap = (tm.tmExternalLeading * m_platformData.size() + 36) / 72;
- m_lineSpacing = m_ascent + m_descent + m_lineGap;
- m_xHeight = m_ascent * 0.56f;
+ float ascent = (tm.tmAscent * m_platformData.size() + 36) / 72.0f;
+ float descent = (tm.tmDescent * m_platformData.size() + 36) / 72.0f;
+ float lineGap = (tm.tmExternalLeading * m_platformData.size() + 36) / 72.0f;
+ m_fontMetrics.setAscent(ascent);
+ m_fontMetrics.setDescent(descent);
+ m_fontMetrics.setLineGap(lineGap);
+ m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
+ m_fontMetrics.setXHeight(ascent * 0.56f);
}
void SimpleFontData::platformDestroy()