- Revision
- 124434
- Author
- [email protected]
- Date
- 2012-08-02 03:14:04 -0700 (Thu, 02 Aug 2012)
Log Message
[Chromium] Implement hyphenation for Chromium
https://bugs.webkit.org/show_bug.cgi?id=48610
Reviewed by Eric Seidel.
This change adds a couple of methods canHyphenate and computeLastHyphenLocation
to Platform so Chromium can implement them. Also, this change uses these methods
to implement the hyphenation methods of WebCore. (This change does not change
any behaviors until Chromium implements these methods.)
Source/Platform:
* chromium/public/Platform.h:
(Platform):
(WebKit::Platform::canHyphenate): Added a stub method so Chromium can implement it.
(WebKit::Platform::computeLastHyphenLocation): ditto.
Source/WebCore:
No new tests because this change is for fixing a couple of existing layout tests
'fast/text/hyphenate-character.html' and 'fast/text/hyphens.html'.
* WebCore.gypi:
* platform/text/chromium/Hyphenation.cpp: Added.
(WebCore):
(WebCore::canHyphenate): Called Platform::canHyphenation().
(WebCore::lastHyphenLocation): Called Platform::computeLastHyphenLocation().
Modified Paths
Added Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (124433 => 124434)
--- trunk/Source/Platform/ChangeLog 2012-08-02 10:12:44 UTC (rev 124433)
+++ trunk/Source/Platform/ChangeLog 2012-08-02 10:14:04 UTC (rev 124434)
@@ -1,3 +1,20 @@
+2012-08-02 Hironori Bono <[email protected]>
+
+ [Chromium] Implement hyphenation for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=48610
+
+ Reviewed by Eric Seidel.
+
+ This change adds a couple of methods canHyphenate and computeLastHyphenLocation
+ to Platform so Chromium can implement them. Also, this change uses these methods
+ to implement the hyphenation methods of WebCore. (This change does not change
+ any behaviors until Chromium implements these methods.)
+
+ * chromium/public/Platform.h:
+ (Platform):
+ (WebKit::Platform::canHyphenate): Added a stub method so Chromium can implement it.
+ (WebKit::Platform::computeLastHyphenLocation): ditto.
+
2012-08-02 Tommy Widenflycht <[email protected]>
MediaStream API: Move RTCConfiguration to its proper place
Modified: trunk/Source/Platform/chromium/public/Platform.h (124433 => 124434)
--- trunk/Source/Platform/chromium/public/Platform.h 2012-08-02 10:12:44 UTC (rev 124433)
+++ trunk/Source/Platform/chromium/public/Platform.h 2012-08-02 10:14:04 UTC (rev 124434)
@@ -164,6 +164,15 @@
virtual bool isLinkVisited(unsigned long long linkHash) { return false; }
+ // Hyphenation ---------------------------------------------------------
+
+ // 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; }
+
+
// Keygen --------------------------------------------------------------
// Handle the <keygen> tag for generating client certificates
Modified: trunk/Source/WebCore/ChangeLog (124433 => 124434)
--- trunk/Source/WebCore/ChangeLog 2012-08-02 10:12:44 UTC (rev 124433)
+++ trunk/Source/WebCore/ChangeLog 2012-08-02 10:14:04 UTC (rev 124434)
@@ -1,3 +1,24 @@
+2012-08-02 Hironori Bono <[email protected]>
+
+ [Chromium] Implement hyphenation for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=48610
+
+ Reviewed by Eric Seidel.
+
+ This change adds a couple of methods canHyphenate and computeLastHyphenLocation
+ to Platform so Chromium can implement them. Also, this change uses these methods
+ to implement the hyphenation methods of WebCore. (This change does not change
+ any behaviors until Chromium implements these methods.)
+
+ No new tests because this change is for fixing a couple of existing layout tests
+ 'fast/text/hyphenate-character.html' and 'fast/text/hyphens.html'.
+
+ * WebCore.gypi:
+ * platform/text/chromium/Hyphenation.cpp: Added.
+ (WebCore):
+ (WebCore::canHyphenate): Called Platform::canHyphenation().
+ (WebCore::lastHyphenLocation): Called Platform::computeLastHyphenLocation().
+
2012-08-02 [email protected] <[email protected]>
[chromium] Improve garbage collector hint if page uses Canvas contexts
Modified: trunk/Source/WebCore/WebCore.gypi (124433 => 124434)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-02 10:12:44 UTC (rev 124433)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-02 10:14:04 UTC (rev 124434)
@@ -4415,7 +4415,6 @@
'platform/text/AtomicStringKeyedMRUCache.h',
'platform/text/BidiContext.cpp',
'platform/text/DateTimeFormat.cpp',
- 'platform/text/Hyphenation.cpp',
'platform/text/Hyphenation.h',
'platform/text/LineEnding.cpp',
'platform/text/LocaleICU.cpp',
@@ -4460,6 +4459,7 @@
'platform/text/cf/HyphenationCF.cpp',
'platform/text/cf/StringCF.cpp',
'platform/text/cf/StringImplCF.cpp',
+ 'platform/text/chromium/Hyphenation.cpp',
'platform/text/chromium/TextBreakIteratorInternalICUChromium.cpp',
'platform/text/efl/TextBreakIteratorInternalICUEfl.cpp',
'platform/text/gtk/TextBreakIteratorGtk.cpp',
Added: trunk/Source/WebCore/platform/text/chromium/Hyphenation.cpp (0 => 124434)
--- trunk/Source/WebCore/platform/text/chromium/Hyphenation.cpp (rev 0)
+++ trunk/Source/WebCore/platform/text/chromium/Hyphenation.cpp 2012-08-02 10:14:04 UTC (rev 124434)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#include "config.h"
+#include "Hyphenation.h"
+
+#include <public/Platform.h>
+
+namespace WebCore {
+
+bool canHyphenate(const AtomicString& localeIdentifier)
+{
+ return WebKit::Platform::current()->canHyphenate(localeIdentifier);
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier)
+{
+ return WebKit::Platform::current()->computeLastHyphenLocation(characters, length, beforeIndex, localeIdentifier);
+}
+
+} // namespace WebCore