summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/font_impl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:17:48 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:17:48 +0000
commit7a1f7c6f6c982287b3f6bb2acded619f3824416c (patch)
tree82ff404c4bcf84520c21ea7f0526ad5a40661641 /ppapi/shared_impl/font_impl.cc
parentbafaee12825a06890f114a282880e135a8b0b1ae (diff)
downloadchromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.zip
chromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.tar.gz
chromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.tar.bz2
Make the Pepper proxy support in-process font rendering.
This implements a WebKit thread in the PPAPI plugin process so we can do the font calls without IPC. The existing font support was refactored into a virtual class (to prevent PPAPI from depending on WebKit and creating a circular GYP dependency). This moves the renderer sandbox support into content/common so that it can be used by the PPAPI process. Review URL: http://codereview.chromium.org/6981001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/font_impl.cc')
-rw-r--r--ppapi/shared_impl/font_impl.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/ppapi/shared_impl/font_impl.cc b/ppapi/shared_impl/font_impl.cc
new file mode 100644
index 0000000..3feaf9f
--- /dev/null
+++ b/ppapi/shared_impl/font_impl.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 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 "ppapi/shared_impl/font_impl.h"
+
+#include "ppapi/c/dev/ppb_font_dev.h"
+
+namespace pp {
+namespace shared_impl {
+
+// static
+bool FontImpl::IsPPFontDescriptionValid(const PP_FontDescription_Dev& desc) {
+ // Check validity of string. We can't check the actual text since we could
+ // be on the wrong thread and don't know if we're in the plugin or the host.
+ if (desc.face.type != PP_VARTYPE_STRING &&
+ desc.face.type != PP_VARTYPE_UNDEFINED)
+ return false;
+
+ // Check enum ranges.
+ if (static_cast<int>(desc.family) < PP_FONTFAMILY_DEFAULT ||
+ static_cast<int>(desc.family) > PP_FONTFAMILY_MONOSPACE)
+ return false;
+ if (static_cast<int>(desc.weight) < PP_FONTWEIGHT_100 ||
+ static_cast<int>(desc.weight) > PP_FONTWEIGHT_900)
+ return false;
+
+ // Check for excessive sizes which may cause layout to get confused.
+ if (desc.size > 200)
+ return false;
+
+ return true;
+}
+
+} // namespace shared_impl
+} // namespace pp