diff options
author | Steve Block <steveblock@google.com> | 2010-02-15 12:23:52 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-16 11:48:32 +0000 |
commit | 8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch) | |
tree | 73f9065f370435d6fde32ae129d458a8c77c8dff /WebCore/platform/wx | |
parent | bf14be70295513b8076f3fa47a268a7e42b2c478 (diff) | |
download | external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2 |
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebCore/platform/wx')
-rw-r--r-- | WebCore/platform/wx/ClipboardWx.cpp | 5 | ||||
-rw-r--r-- | WebCore/platform/wx/ClipboardWx.h | 2 | ||||
-rw-r--r-- | WebCore/platform/wx/MouseWheelEventWx.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/wx/ScrollViewWx.cpp | 16 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/fontprops.h | 1 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/gtk/fontprops.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm (renamed from WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp) | 16 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/win/fontprops.cpp | 50 | ||||
-rw-r--r-- | WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp | 2 |
9 files changed, 89 insertions, 12 deletions
diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp index 0b02009..6100831 100644 --- a/WebCore/platform/wx/ClipboardWx.cpp +++ b/WebCore/platform/wx/ClipboardWx.cpp @@ -133,4 +133,9 @@ bool ClipboardWx::hasData() return false; } +void ClipboardWx::writePlainText(const WebCore::String& text) +{ + Pasteboard::generalPasteboard()->writePlainText(text); +} + } diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h index 5e3ba86..b0c520b 100644 --- a/WebCore/platform/wx/ClipboardWx.h +++ b/WebCore/platform/wx/ClipboardWx.h @@ -59,6 +59,8 @@ namespace WebCore { virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*); virtual void writeURL(const KURL&, const String&, Frame*); virtual void writeRange(Range*, Frame*); + virtual void writePlainText(const WebCore::String&); + virtual bool hasData(); diff --git a/WebCore/platform/wx/MouseWheelEventWx.cpp b/WebCore/platform/wx/MouseWheelEventWx.cpp index 9f3923d..aa41df4 100644 --- a/WebCore/platform/wx/MouseWheelEventWx.cpp +++ b/WebCore/platform/wx/MouseWheelEventWx.cpp @@ -47,7 +47,7 @@ PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& , m_isAccepted(false) { // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event - m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep); + m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); } } diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp index 35acf68..35d62b2 100644 --- a/WebCore/platform/wx/ScrollViewWx.cpp +++ b/WebCore/platform/wx/ScrollViewWx.cpp @@ -84,27 +84,27 @@ public: } else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) { if (horiz) - pos.x += cScrollbarPixelsPerLineStep; + pos.x += Scrollbar::pixelsPerLineStep(); else - pos.y += cScrollbarPixelsPerLineStep; + pos.y += Scrollbar::pixelsPerLineStep(); } else if (scrollType == wxEVT_SCROLLWIN_LINEUP) { if (horiz) - pos.x -= cScrollbarPixelsPerLineStep; + pos.x -= Scrollbar::pixelsPerLineStep(); else - pos.y -= cScrollbarPixelsPerLineStep; + pos.y -= Scrollbar::pixelsPerLineStep(); } else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) { if (horiz) - pos.x -= m_scrollView->visibleWidth() * cFractionToStepWhenPaging; + pos.x -= max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages()); else - pos.y -= m_scrollView->visibleHeight() * cFractionToStepWhenPaging; + pos.y -= max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages()); } else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) { if (horiz) - pos.x += m_scrollView->visibleWidth() * cFractionToStepWhenPaging; + pos.x += max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages()); else - pos.y += m_scrollView->visibleHeight() * cFractionToStepWhenPaging; + pos.y += max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages()); } else return e.Skip(); diff --git a/WebCore/platform/wx/wxcode/fontprops.h b/WebCore/platform/wx/wxcode/fontprops.h index 7f38bcf..3f99462 100644 --- a/WebCore/platform/wx/wxcode/fontprops.h +++ b/WebCore/platform/wx/wxcode/fontprops.h @@ -48,3 +48,4 @@ private: }; +bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length); diff --git a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp b/WebCore/platform/wx/wxcode/gtk/fontprops.cpp index df14812..491458d 100644 --- a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp +++ b/WebCore/platform/wx/wxcode/gtk/fontprops.cpp @@ -24,6 +24,8 @@ */ #include "config.h" +// this needs to be included before fontprops.h for UChar* to be defined. +#include <wtf/unicode/Unicode.h> #include <wx/defs.h> #include <wx/gdicmn.h> @@ -92,6 +94,11 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) #endif } +bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length) +{ + return true; +} + void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading ) { diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm index 23dea6b..2312dec 100644 --- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp +++ b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm @@ -24,6 +24,9 @@ */ #include "config.h" +// this needs to be included before fontprops.h for UChar* to be defined. +#include <wtf/unicode/Unicode.h> + #include "fontprops.h" #include <ApplicationServices/ApplicationServices.h> @@ -89,6 +92,19 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) } +bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length) +{ +#if wxOSX_USE_COCOA + NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(characters) length:length freeWhenDone:NO]; + NSCharacterSet* set = [[font.GetNSFont() coveredCharacterSet] invertedSet]; + bool result = set && [string rangeOfCharacterFromSet:set].location == NSNotFound; + [string release]; + return result; +#else + return true; +#endif +} + void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading ) { diff --git a/WebCore/platform/wx/wxcode/win/fontprops.cpp b/WebCore/platform/wx/wxcode/win/fontprops.cpp index 531db08..d6ba964 100644 --- a/WebCore/platform/wx/wxcode/win/fontprops.cpp +++ b/WebCore/platform/wx/wxcode/win/fontprops.cpp @@ -24,15 +24,21 @@ */ #include "config.h" -#include <wx/defs.h> -#include <wx/gdicmn.h> +// this needs to be included before fontprops.h for UChar* to be defined. +#include <wtf/unicode/Unicode.h> + #include "fontprops.h" #include "math.h" #include "MathExtras.h" +#include <wx/defs.h> +#include <wx/gdicmn.h> #include <wx/wx.h> #include "wx/msw/private.h" +#include <mlang.h> +#include <usp10.h> + inline long my_round(double x) { return (long)(x < 0 ? x - 0.5 : x + 0.5); @@ -60,6 +66,46 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) ReleaseDC(0, dc); } +bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length) +{ + // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC + // merely by testing code page intersection. This seems suspect though. Can't a font only partially + // cover a given code page? + static IMultiLanguage *multiLanguage; + if (!multiLanguage) { + if (CoCreateInstance(CLSID_CMultiLanguage, 0, CLSCTX_ALL, IID_IMultiLanguage, (void**)&multiLanguage) != S_OK) + return true; + } + + static IMLangFontLink2* langFontLink; + if (!langFontLink) { + if (multiLanguage->QueryInterface(&langFontLink) != S_OK) + return true; + } + + HDC dc = GetDC(0); + + DWORD acpCodePages; + langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages); + + DWORD fontCodePages; + langFontLink->GetFontCodePages(dc, static_cast<HFONT>(font.GetHFONT()), &fontCodePages); + + DWORD actualCodePages; + long numCharactersProcessed; + long offset = 0; + while (offset < length) { + langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &numCharactersProcessed); + if ((actualCodePages & fontCodePages)) + return false; + offset += numCharactersProcessed; + } + + ReleaseDC(0, dc); + + return true; +} + void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading ) { diff --git a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp index 72fcc54..2fcd761 100644 --- a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp +++ b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp @@ -122,7 +122,7 @@ void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* // draw text with optional character widths array wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs); - ::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing); + ::ExtTextOut(hdc, x, y, ETO_GLYPH_INDEX, 0, reinterpret_cast<const WCHAR*>(glyphs), numGlyphs, spacing); ::SetBkMode(hdc, TRANSPARENT); |