Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: webkit/mocks/mock_webhyphenator.h

Issue 12335128: Switch from using individual methods for hyphenation to using the WebHyphantor interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | webkit/mocks/mock_webhyphenator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/mocks/mock_webhyphenator.h
diff --git a/webkit/mocks/mock_webhyphenator.h b/webkit/mocks/mock_webhyphenator.h
new file mode 100644
index 0000000000000000000000000000000000000000..8615e16258870e7bbd2133e49404af2afd48e4e0
--- /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_
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | webkit/mocks/mock_webhyphenator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698