Title: [144231] trunk/Source/Platform
- Revision
- 144231
- Author
- [email protected]
- Date
- 2013-02-27 13:20:38 -0800 (Wed, 27 Feb 2013)
Log Message
[chromium] Introduce WebHyphenator class to consolidate hyphenation related method on WebKit::Platform
https://bugs.webkit.org/show_bug.cgi?id=110953
Reviewed by Adam Barth.
This patch makes it easier to mock the hyphenation related methods.
* Platform.gypi:
* chromium/public/Platform.h:
(WebKit):
(Platform):
(WebKit::Platform::hyphenator):
* chromium/public/WebHyphenator.h: Added.
(WebKit):
(WebHyphenator):
(WebKit::WebHyphenator::canHyphenate):
(WebKit::WebHyphenator::computeLastHyphenLocation):
(WebKit::WebHyphenator::~WebHyphenator):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (144230 => 144231)
--- trunk/Source/Platform/ChangeLog 2013-02-27 20:58:05 UTC (rev 144230)
+++ trunk/Source/Platform/ChangeLog 2013-02-27 21:20:38 UTC (rev 144231)
@@ -1,3 +1,24 @@
+2013-02-27 Jochen Eisinger <[email protected]>
+
+ [chromium] Introduce WebHyphenator class to consolidate hyphenation related method on WebKit::Platform
+ https://bugs.webkit.org/show_bug.cgi?id=110953
+
+ Reviewed by Adam Barth.
+
+ This patch makes it easier to mock the hyphenation related methods.
+
+ * Platform.gypi:
+ * chromium/public/Platform.h:
+ (WebKit):
+ (Platform):
+ (WebKit::Platform::hyphenator):
+ * chromium/public/WebHyphenator.h: Added.
+ (WebKit):
+ (WebHyphenator):
+ (WebKit::WebHyphenator::canHyphenate):
+ (WebKit::WebHyphenator::computeLastHyphenLocation):
+ (WebKit::WebHyphenator::~WebHyphenator):
+
2013-02-27 Mark Pilgrim <[email protected]>
[Chromium] Remove unused WebKitPlatformSupport class
Modified: trunk/Source/Platform/Platform.gypi (144230 => 144231)
--- trunk/Source/Platform/Platform.gypi 2013-02-27 20:58:05 UTC (rev 144230)
+++ trunk/Source/Platform/Platform.gypi 2013-02-27 21:20:38 UTC (rev 144231)
@@ -74,6 +74,7 @@
'chromium/public/WebHTTPBody.h',
'chromium/public/WebHTTPHeaderVisitor.h',
'chromium/public/WebHTTPLoadInfo.h',
+ 'chromium/public/WebHyphenator.h',
'chromium/public/WebImage.h',
'chromium/public/WebImageLayer.h',
'chromium/public/WebIOSurfaceLayer.h',
Modified: trunk/Source/Platform/chromium/public/Platform.h (144230 => 144231)
--- trunk/Source/Platform/chromium/public/Platform.h 2013-02-27 20:58:05 UTC (rev 144230)
+++ trunk/Source/Platform/chromium/public/Platform.h 2013-02-27 21:20:38 UTC (rev 144231)
@@ -59,6 +59,7 @@
class WebFlingAnimator;
class WebGestureCurveTarget;
class WebGestureCurve;
+class WebHyphenator;
class WebMediaStreamCenter;
class WebMediaStreamCenterClient;
class WebMessagePortChannel;
@@ -111,7 +112,10 @@
// May return null on some platforms.
virtual WebThemeEngine* themeEngine() { return 0; }
+ // Must return non-null.
+ virtual WebHyphenator* hyphenator() { return 0; }
+
// Audio --------------------------------------------------------------
virtual double audioHardwareSampleRate() { return 0; }
@@ -182,6 +186,8 @@
// Hyphenation ---------------------------------------------------------
+ // FIXME: Remove deprecated API.
+
// Returns whether we can support hyphenation for the given locale.
virtual bool canHyphenate(const WebString& locale) { return false; }
Added: trunk/Source/Platform/chromium/public/WebHyphenator.h (0 => 144231)
--- trunk/Source/Platform/chromium/public/WebHyphenator.h (rev 0)
+++ trunk/Source/Platform/chromium/public/WebHyphenator.h 2013-02-27 21:20:38 UTC (rev 144231)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebHyphenator_h
+#define WebHyphenator_h
+
+#include "WebCommon.h"
+#include "WebString.h"
+
+namespace WebKit {
+
+class WebHyphenator {
+public:
+ // Returns whether we can support hyphenation for the given locale.
+ virtual bool canHyphenate(const WebString& locale) { return false; }
+
+ // Returns the last position where we can add a hyphen before the given position.
+ virtual size_t computeLastHyphenLocation(const WebUChar* characters, size_t length, size_t beforeIndex, const WebString& locale) { return 0; }
+
+protected:
+ ~WebHyphenator() { }
+};
+
+} // namespace WebKit
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes