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

Side by Side Diff: content/child/browser_font_resource_trusted.cc

Issue 357203003: Move webpreferences.* from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android fix - webview() -> web_view Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/browser_font_resource_trusted.h" 5 #include "content/child/browser_font_resource_trusted.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/common/web_preferences.h"
9 #include "ppapi/c/dev/ppb_font_dev.h" 10 #include "ppapi/c/dev/ppb_font_dev.h"
10 #include "ppapi/proxy/connection.h" 11 #include "ppapi/proxy/connection.h"
11 #include "ppapi/shared_impl/ppapi_preferences.h" 12 #include "ppapi/shared_impl/ppapi_preferences.h"
12 #include "ppapi/shared_impl/var.h" 13 #include "ppapi/shared_impl/var.h"
13 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
14 #include "ppapi/thunk/ppb_image_data_api.h" 15 #include "ppapi/thunk/ppb_image_data_api.h"
15 #include "ppapi/thunk/thunk.h" 16 #include "ppapi/thunk/thunk.h"
16 #include "skia/ext/platform_canvas.h" 17 #include "skia/ext/platform_canvas.h"
17 #include "third_party/WebKit/public/platform/WebCanvas.h" 18 #include "third_party/WebKit/public/platform/WebCanvas.h"
18 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 19 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
(...skipping 17 matching lines...) Expand all
36 using blink::WebCanvas; 37 using blink::WebCanvas;
37 38
38 namespace content { 39 namespace content {
39 40
40 namespace { 41 namespace {
41 42
42 // Same as WebPreferences::kCommonScript. I'd use that directly here, but get an 43 // Same as WebPreferences::kCommonScript. I'd use that directly here, but get an
43 // undefined reference linker error. 44 // undefined reference linker error.
44 const char kCommonScript[] = "Zyyy"; 45 const char kCommonScript[] = "Zyyy";
45 46
46 base::string16 GetFontFromMap( 47 base::string16 GetFontFromMap(const ScriptFontFamilyMap& map,
47 const webkit_glue::ScriptFontFamilyMap& map, 48 const std::string& script) {
48 const std::string& script) { 49 ScriptFontFamilyMap::const_iterator it = map.find(script);
49 webkit_glue::ScriptFontFamilyMap::const_iterator it =
50 map.find(script);
51 if (it != map.end()) 50 if (it != map.end())
52 return it->second; 51 return it->second;
53 return base::string16(); 52 return base::string16();
54 } 53 }
55 54
56 // Splits a PP_BrowserFont_Trusted_TextRun into a sequence or LTR and RTL 55 // Splits a PP_BrowserFont_Trusted_TextRun into a sequence or LTR and RTL
57 // WebTextRuns that can be used for WebKit. Normally WebKit does this for us, 56 // WebTextRuns that can be used for WebKit. Normally WebKit does this for us,
58 // but the font drawing and measurement routines we call happen after this 57 // but the font drawing and measurement routines we call happen after this
59 // step. So for correct rendering of RTL content, we need to do it ourselves. 58 // step. So for correct rendering of RTL content, we need to do it ourselves.
60 class TextRunCollection { 59 class TextRunCollection {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 419
421 // Advance to the next run. Note that we avoid doing this for the last run 420 // Advance to the next run. Note that we avoid doing this for the last run
422 // since it's unnecessary, measuring text is slow, and most of the time 421 // since it's unnecessary, measuring text is slow, and most of the time
423 // there will be only one run anyway. 422 // there will be only one run anyway.
424 if (i != runs.num_runs() - 1) 423 if (i != runs.num_runs() - 1)
425 web_position.x += font_->calculateWidth(run); 424 web_position.x += font_->calculateWidth(run);
426 } 425 }
427 } 426 }
428 427
429 } // namespace content 428 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698