summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-01 07:48:07 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-01 07:48:07 +0000
commitea315d056841c6ea0f30f17b2e61ce930c1c5ccd (patch)
tree1c44dc5e0e5810cd949a0c276bab437ab3add79a
parent9b2608479f2cca81e90ab4ab91ddae2fe9a0723c (diff)
downloadchromium_src-ea315d056841c6ea0f30f17b2e61ce930c1c5ccd.zip
chromium_src-ea315d056841c6ea0f30f17b2e61ce930c1c5ccd.tar.gz
chromium_src-ea315d056841c6ea0f30f17b2e61ce930c1c5ccd.tar.bz2
Switch from using individual methods for hyphenation to using the WebHyphantor interface
Also allow the content embedder to override the hyphenator used. BUG=178693 Review URL: https://codereview.chromium.org/12335128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185486 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/public/renderer/content_renderer_client.cc4
-rw-r--r--content/public/renderer/content_renderer_client.h5
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc86
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.h7
-rw-r--r--webkit/mocks/mock_webhyphenator.cc104
-rw-r--r--webkit/mocks/mock_webhyphenator.h45
-rw-r--r--webkit/support/test_webkit_platform_support.cc95
-rw-r--r--webkit/support/test_webkit_platform_support.h6
-rw-r--r--webkit/support/webkit_support.gypi2
9 files changed, 253 insertions, 101 deletions
diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc
index 5b1a301..8ea46ba 100644
--- a/content/public/renderer/content_renderer_client.cc
+++ b/content/public/renderer/content_renderer_client.cc
@@ -67,6 +67,10 @@ WebKit::WebMimeRegistry* ContentRendererClient::OverrideWebMimeRegistry() {
return NULL;
}
+WebKit::WebHyphenator* ContentRendererClient::OverrideWebHyphenator() {
+ return NULL;
+}
+
bool ContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
return true;
}
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
index 5e9b0e8..70a0eef 100644
--- a/content/public/renderer/content_renderer_client.h
+++ b/content/public/renderer/content_renderer_client.h
@@ -27,6 +27,7 @@ class FilePath;
namespace WebKit {
class WebClipboard;
class WebFrame;
+class WebHyphenator;
class WebMediaPlayerClient;
class WebMediaStreamCenter;
class WebMediaStreamCenterClient;
@@ -145,6 +146,10 @@ class CONTENT_EXPORT ContentRendererClient {
// returns NULL the content layer will provide its own mime registry.
virtual WebKit::WebMimeRegistry* OverrideWebMimeRegistry();
+ // Allows the embedder to override the WebKit::WebHyphenator used. If it
+ // returns NULL the content layer will handle hyphenation.
+ virtual WebKit::WebHyphenator* OverrideWebHyphenator();
+
// Returns true if the renderer process should schedule the idle handler when
// all widgets are hidden.
virtual bool RunIdleHandlerWhenWidgetsHidden();
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 3f88b32..14e9fab 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -39,6 +39,7 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebBlobRegistry.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCenter.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCenterClient.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
@@ -118,6 +119,24 @@ class RendererWebKitPlatformSupportImpl::FileUtilities
int mode);
};
+class RendererWebKitPlatformSupportImpl::Hyphenator
+ : public WebKit::WebHyphenator {
+ public:
+ Hyphenator();
+ virtual ~Hyphenator();
+
+ virtual bool canHyphenate(const WebKit::WebString& locale) OVERRIDE;
+ virtual size_t computeLastHyphenLocation(
+ const char16* characters,
+ size_t length,
+ size_t before_index,
+ const WebKit::WebString& locale) OVERRIDE;
+ private:
+ scoped_ptr<content::Hyphenator> hyphenator_;
+
+ DISALLOW_COPY_AND_ASSIGN(Hyphenator);
+};
+
#if defined(OS_ANDROID)
// WebKit doesn't use WebSandboxSupport on android so we don't need to
// implement anything here.
@@ -162,6 +181,7 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
: clipboard_client_(new RendererClipboardClient),
clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())),
mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry),
+ hyphenator_(new RendererWebKitPlatformSupportImpl::Hyphenator),
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
shared_worker_repository_(new WebSharedWorkerRepositoryImpl) {
@@ -429,6 +449,42 @@ base::PlatformFile RendererWebKitPlatformSupportImpl::FileUtilities::openFile(
//------------------------------------------------------------------------------
+RendererWebKitPlatformSupportImpl::Hyphenator::Hyphenator() {}
+
+RendererWebKitPlatformSupportImpl::Hyphenator::~Hyphenator() {}
+
+bool RendererWebKitPlatformSupportImpl::Hyphenator::canHyphenate(
+ const WebKit::WebString& locale) {
+ // Return false unless WebKit asks for US English dictionaries because WebKit
+ // can currently hyphenate only English words.
+ if (!locale.isEmpty() && !locale.equals("en-US"))
+ return false;
+
+ // Create a hyphenator object and attach it to the render thread so it can
+ // receive a dictionary file opened by a browser.
+ if (!hyphenator_.get()) {
+ hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue));
+ if (!hyphenator_.get())
+ return false;
+ return hyphenator_->Attach(RenderThreadImpl::current(), locale);
+ }
+ return hyphenator_->CanHyphenate(locale);
+}
+
+size_t RendererWebKitPlatformSupportImpl::Hyphenator::computeLastHyphenLocation(
+ const char16* characters,
+ size_t length,
+ size_t before_index,
+ const WebKit::WebString& locale) {
+ // Crash if WebKit calls this function when canHyphenate returns false.
+ DCHECK(locale.isEmpty() || locale.equals("en-US"));
+ DCHECK(hyphenator_.get());
+ return hyphenator_->ComputeLastHyphenLocation(string16(characters, length),
+ before_index);
+}
+
+//------------------------------------------------------------------------------
+
#if defined(OS_WIN)
bool RendererWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded(
@@ -778,22 +834,17 @@ RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
//------------------------------------------------------------------------------
+WebKit::WebHyphenator* RendererWebKitPlatformSupportImpl::hyphenator() {
+ WebKit::WebHyphenator* hyphenator =
+ GetContentClient()->renderer()->OverrideWebHyphenator();
+ if (hyphenator)
+ return hyphenator;
+ return hyphenator_.get();
+}
+
bool RendererWebKitPlatformSupportImpl::canHyphenate(
const WebKit::WebString& locale) {
- // Return false unless WebKit asks for US English dictionaries because WebKit
- // can currently hyphenate only English words.
- if (!locale.isEmpty() && !locale.equals("en-US"))
- return false;
-
- // Create a hyphenator object and attach it to the render thread so it can
- // receive a dictionary file opened by a browser.
- if (!hyphenator_.get()) {
- hyphenator_.reset(new Hyphenator(base::kInvalidPlatformFileValue));
- if (!hyphenator_.get())
- return false;
- return hyphenator_->Attach(RenderThreadImpl::current(), locale);
- }
- return hyphenator_->CanHyphenate(locale);
+ return hyphenator()->canHyphenate(locale);
}
size_t RendererWebKitPlatformSupportImpl::computeLastHyphenLocation(
@@ -801,11 +852,8 @@ size_t RendererWebKitPlatformSupportImpl::computeLastHyphenLocation(
size_t length,
size_t before_index,
const WebKit::WebString& locale) {
- // Crash if WebKit calls this function when canHyphenate returns false.
- DCHECK(locale.isEmpty() || locale.equals("en-US"));
- DCHECK(hyphenator_.get());
- return hyphenator_->ComputeLastHyphenLocation(string16(characters, length),
- before_index);
+ return hyphenator()->computeLastHyphenLocation(
+ characters, length, before_index, locale);
}
//------------------------------------------------------------------------------
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h
index d3c415f..2bfef45 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.h
+++ b/content/renderer/renderer_webkitplatformsupport_impl.h
@@ -20,7 +20,6 @@ class WebClipboardImpl;
namespace content {
class GamepadSharedMemoryReader;
-class Hyphenator;
class RendererClipboardClient;
class WebFileSystemImpl;
class WebSharedWorkerRepositoryImpl;
@@ -40,6 +39,7 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
virtual WebKit::WebFileUtilities* fileUtilities();
virtual WebKit::WebSandboxSupport* sandboxSupport();
virtual WebKit::WebCookieJar* cookieJar();
+ virtual WebKit::WebHyphenator* hyphenator();
virtual bool sandboxEnabled();
virtual unsigned long long visitedLinkHash(
const char* canonicalURL, size_t length);
@@ -135,6 +135,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
class SandboxSupport;
scoped_ptr<SandboxSupport> sandbox_support_;
+ class Hyphenator;
+ scoped_ptr<Hyphenator> hyphenator_;
+
// This counter keeps track of the number of times sudden termination is
// enabled or disabled. It starts at 0 (enabled) and for every disable
// increments by 1, for every enable decrements by 1. When it reaches 0,
@@ -155,8 +158,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
scoped_ptr<WebKit::WebBlobRegistry> blob_registry_;
scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_;
-
- scoped_ptr<content::Hyphenator> hyphenator_;
};
} // namespace content
diff --git a/webkit/mocks/mock_webhyphenator.cc b/webkit/mocks/mock_webhyphenator.cc
new file mode 100644
index 0000000..903197b
--- /dev/null
+++ b/webkit/mocks/mock_webhyphenator.cc
@@ -0,0 +1,104 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/mocks/mock_webhyphenator.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_handle.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/string_util.h"
+#include "third_party/hyphen/hyphen.h"
+
+namespace webkit_glue {
+
+MockWebHyphenator::MockWebHyphenator()
+ : hyphen_dictionary_(NULL) {
+}
+
+MockWebHyphenator::~MockWebHyphenator() {
+ if (hyphen_dictionary_)
+ hnj_hyphen_free(hyphen_dictionary_);
+}
+
+void MockWebHyphenator::LoadDictionary(base::PlatformFile dict_file) {
+ CHECK(!hyphen_dictionary_);
+ // Initialize the hyphen library with a sample dictionary. To avoid test
+ // flakiness, this code synchronously loads the dictionary.
+ if (dict_file == base::kInvalidPlatformFileValue) {
+ NOTREACHED();
+ return;
+ }
+ ScopedStdioHandle dict_handle(base::FdopenPlatformFile(dict_file, "r"));
+ if (!dict_handle.get()) {
+ NOTREACHED();
+ base::ClosePlatformFile(dict_file);
+ return;
+ }
+ hyphen_dictionary_ = hnj_hyphen_load_file(dict_handle.get());
+ DCHECK(hyphen_dictionary_);
+}
+
+bool MockWebHyphenator::canHyphenate(const WebKit::WebString& locale) {
+ return locale.isEmpty() || locale.equals("en") || locale.equals("en_US") ||
+ locale.equals("en_GB");
+}
+
+size_t MockWebHyphenator::computeLastHyphenLocation(
+ const char16* characters,
+ size_t length,
+ size_t before_index,
+ const WebKit::WebString& locale) {
+ DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") ||
+ locale.equals("en_GB"));
+ if (!hyphen_dictionary_)
+ return 0;
+
+ // Retrieve the positions where we can insert hyphens. This function assumes
+ // the input word is an English word so it can use the position returned by
+ // the hyphen library without conversion.
+ string16 word_utf16(characters, length);
+ if (!IsStringASCII(word_utf16))
+ return 0;
+ std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16));
+ scoped_array<char> hyphens(new char[word.length() + 5]);
+ char** rep = NULL;
+ int* pos = NULL;
+ int* cut = NULL;
+ int error = hnj_hyphen_hyphenate2(hyphen_dictionary_,
+ word.data(),
+ static_cast<int>(word.length()),
+ hyphens.get(),
+ NULL,
+ &rep,
+ &pos,
+ &cut);
+ if (error)
+ return 0;
+
+ // Release all resources allocated by the hyphen library now because they are
+ // not used when hyphenating English words.
+ if (rep) {
+ for (size_t i = 0; i < word.length(); ++i) {
+ if (rep[i])
+ free(rep[i]);
+ }
+ free(rep);
+ }
+ if (pos)
+ free(pos);
+ if (cut)
+ free(cut);
+
+ // Retrieve the last position where we can insert a hyphen before the given
+ // index.
+ if (before_index >= 2) {
+ for (size_t index = before_index - 2; index > 0; --index) {
+ if (hyphens[index] & 1)
+ return index + 1;
+ }
+ }
+ return 0;
+}
+
+} // namespace webkit_glue
diff --git a/webkit/mocks/mock_webhyphenator.h b/webkit/mocks/mock_webhyphenator.h
new file mode 100644
index 0000000..8615e16
--- /dev/null
+++ b/webkit/mocks/mock_webhyphenator.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_
+#define WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/platform_file.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h"
+
+typedef struct _HyphenDict HyphenDict;
+
+namespace webkit_glue {
+
+// Implements a simple WebHyphenator that only supports en-US. It is used for
+// layout tests that expect that hyphenator to be available synchronously.
+// Therefore, this class supports synchronous loading of the dictionary as well.
+class MockWebHyphenator : public WebKit::WebHyphenator {
+ public:
+ MockWebHyphenator();
+ virtual ~MockWebHyphenator();
+
+ // Loads the hyphenation dictionary. |dict_file| should be an open fd to
+ // third_party/hyphen/hyph_en_US.dic.
+ void LoadDictionary(base::PlatformFile dict_file);
+
+ // WebHyphenator implementation.
+ virtual bool canHyphenate(const WebKit::WebString& locale) OVERRIDE;
+ virtual size_t computeLastHyphenLocation(
+ const char16* characters,
+ size_t length,
+ size_t before_index,
+ const WebKit::WebString& locale) OVERRIDE;
+
+ private:
+ HyphenDict* hyphen_dictionary_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockWebHyphenator);
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index fd967ae..54b8358 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -7,10 +7,8 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/memory/scoped_handle.h"
#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
-#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "cc/context_provider.h"
#include "cc/thread_impl.h"
@@ -32,7 +30,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h"
-#include "third_party/hyphen/hyphen.h"
#include "v8/include/v8.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
#include "webkit/compositor_bindings/web_compositor_support_impl.h"
@@ -75,8 +72,7 @@ using WebKit::WebScriptController;
TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
WebKit::Platform* shadow_platform_delegate)
: unit_test_mode_(unit_test_mode),
- shadow_platform_delegate_(shadow_platform_delegate),
- hyphen_dictionary_(NULL) {
+ shadow_platform_delegate_(shadow_platform_delegate) {
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
WebKit::initialize(this);
@@ -139,6 +135,17 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
DCHECK(file_system_root_.path().empty());
}
+ {
+ // Initialize the hyphen library with a sample dictionary.
+ base::FilePath path = webkit_support::GetChromiumRootDirFilePath();
+ path = path.Append(FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic"));
+ base::PlatformFile dict_file = base::CreatePlatformFile(
+ path,
+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
+ NULL, NULL);
+ hyphenator_.LoadDictionary(dict_file);
+ }
+
#if defined(OS_WIN)
// Ensure we pick up the default theme engine.
SetThemeEngine(NULL);
@@ -158,8 +165,6 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
}
TestWebKitPlatformSupport::~TestWebKitPlatformSupport() {
- if (hyphen_dictionary_)
- hnj_hyphen_free(hyphen_dictionary_);
}
WebKit::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() {
@@ -192,6 +197,10 @@ WebKit::WebFileSystem* TestWebKitPlatformSupport::fileSystem() {
return &file_system_;
}
+WebKit::WebHyphenator* TestWebKitPlatformSupport::hyphenator() {
+ return &hyphenator_;
+}
+
bool TestWebKitPlatformSupport::sandboxEnabled() {
return true;
}
@@ -500,8 +509,7 @@ TestWebKitPlatformSupport::createRTCPeerConnectionHandler(
}
bool TestWebKitPlatformSupport::canHyphenate(const WebKit::WebString& locale) {
- return locale.isEmpty() || locale.equals("en") || locale.equals("en_US") ||
- locale.equals("en_GB");
+ return hyphenator()->canHyphenate(locale);
}
size_t TestWebKitPlatformSupport::computeLastHyphenLocation(
@@ -509,73 +517,8 @@ size_t TestWebKitPlatformSupport::computeLastHyphenLocation(
size_t length,
size_t before_index,
const WebKit::WebString& locale) {
- DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") ||
- locale.equals("en_GB"));
- if (!hyphen_dictionary_) {
- // Initialize the hyphen library with a sample dictionary. To avoid test
- // flakiness, this code synchronously loads the dictionary.
- base::FilePath path = webkit_support::GetChromiumRootDirFilePath();
- path = path.Append(FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic"));
- base::PlatformFile dict_file = base::CreatePlatformFile(
- path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
- NULL, NULL);
- if (dict_file == base::kInvalidPlatformFileValue)
- return 0;
- ScopedStdioHandle dict_handle(base::FdopenPlatformFile(dict_file, "r"));
- if (!dict_handle.get()) {
- base::ClosePlatformFile(dict_file);
- return 0;
- }
- hyphen_dictionary_ = hnj_hyphen_load_file(dict_handle.get());
- if (!hyphen_dictionary_)
- return 0;
- }
- // Retrieve the positions where we can insert hyphens. This function assumes
- // the input word is an English word so it can use the position returned by
- // the hyphen library without conversion.
- string16 word_utf16(characters, length);
- if (!IsStringASCII(word_utf16))
- return 0;
- std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16));
- scoped_array<char> hyphens(new char[word.length() + 5]);
- char** rep = NULL;
- int* pos = NULL;
- int* cut = NULL;
- int error = hnj_hyphen_hyphenate2(hyphen_dictionary_,
- word.data(),
- static_cast<int>(word.length()),
- hyphens.get(),
- NULL,
- &rep,
- &pos,
- &cut);
- if (error)
- return 0;
-
- // Release all resources allocated by the hyphen library now because they are
- // not used when hyphenating English words.
- if (rep) {
- for (size_t i = 0; i < word.length(); ++i) {
- if (rep[i])
- free(rep[i]);
- }
- free(rep);
- }
- if (pos)
- free(pos);
- if (cut)
- free(cut);
-
- // Retrieve the last position where we can insert a hyphen before the given
- // index.
- if (before_index >= 2) {
- for (size_t index = before_index - 2; index > 0; --index) {
- if (hyphens[index] & 1)
- return index + 1;
- }
- }
- return 0;
+ return hyphenator()->computeLastHyphenLocation(
+ characters, length, before_index, locale);
}
WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index fc7a673c..030e86f 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -11,6 +11,7 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebUnitTestSupport.h"
#include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
+#include "webkit/mocks/mock_webhyphenator.h"
#include "webkit/support/simple_database_system.h"
#include "webkit/support/weburl_loader_mock_factory.h"
#include "webkit/tools/test_shell/mock_webclipboard_impl.h"
@@ -31,8 +32,6 @@ class WebAudioDevice;
class WebLayerTreeView;
}
-typedef struct _HyphenDict HyphenDict;
-
// An implementation of WebKitPlatformSupport for tests.
class TestWebKitPlatformSupport :
public WebKit::WebUnitTestSupport,
@@ -49,6 +48,7 @@ class TestWebKitPlatformSupport :
virtual WebKit::WebCookieJar* cookieJar();
virtual WebKit::WebBlobRegistry* blobRegistry();
virtual WebKit::WebFileSystem* fileSystem();
+ virtual WebKit::WebHyphenator* hyphenator();
virtual bool sandboxEnabled();
virtual WebKit::Platform::FileHandle databaseOpenFile(
@@ -176,11 +176,11 @@ class TestWebKitPlatformSupport :
scoped_refptr<TestShellWebBlobRegistryImpl> blob_registry_;
SimpleFileSystem file_system_;
base::ScopedTempDir file_system_root_;
+ webkit_glue::MockWebHyphenator hyphenator_;
WebURLLoaderMockFactory url_loader_factory_;
bool unit_test_mode_;
WebKit::WebGamepads gamepad_data_;
WebKit::Platform* shadow_platform_delegate_;
- HyphenDict* hyphen_dictionary_;
scoped_refptr<cc::ContextProvider> main_thread_contexts_;
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index 9567a45..035cdeb 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -144,6 +144,8 @@
'<(DEPTH)/webkit/tools/test_shell/test_shell_webmimeregistry_impl.h',
'<(DEPTH)/webkit/fileapi/mock_file_system_options.cc',
'<(DEPTH)/webkit/fileapi/mock_file_system_options.h',
+ '<(DEPTH)/webkit/mocks/mock_webhyphenator.cc',
+ '<(DEPTH)/webkit/mocks/mock_webhyphenator.h',
'simple_database_system.cc',
'simple_database_system.h',
],