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

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

Issue 147373005: Move webkit/common/webpreferences to content/public/common/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 "ppapi/c/dev/ppb_font_dev.h" 9 #include "ppapi/c/dev/ppb_font_dev.h"
10 #include "ppapi/proxy/connection.h" 10 #include "ppapi/proxy/connection.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace content { 38 namespace content {
39 39
40 namespace { 40 namespace {
41 41
42 // Same as WebPreferences::kCommonScript. I'd use that directly here, but get an 42 // Same as WebPreferences::kCommonScript. I'd use that directly here, but get an
43 // undefined reference linker error. 43 // undefined reference linker error.
44 const char kCommonScript[] = "Zyyy"; 44 const char kCommonScript[] = "Zyyy";
45 45
46 base::string16 GetFontFromMap( 46 base::string16 GetFontFromMap(
47 const webkit_glue::ScriptFontFamilyMap& map, 47 const content::ScriptFontFamilyMap& map,
48 const std::string& script) { 48 const std::string& script) {
49 webkit_glue::ScriptFontFamilyMap::const_iterator it = 49 content::ScriptFontFamilyMap::const_iterator it =
50 map.find(script); 50 map.find(script);
51 if (it != map.end()) 51 if (it != map.end())
52 return it->second; 52 return it->second;
53 return base::string16(); 53 return base::string16();
54 } 54 }
55 55
56 // Splits a PP_BrowserFont_Trusted_TextRun into a sequence or LTR and RTL 56 // 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, 57 // 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 58 // 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. 59 // step. So for correct rendering of RTL content, we need to do it ourselves.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 // Advance to the next run. Note that we avoid doing this for the last run 421 // 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 422 // since it's unnecessary, measuring text is slow, and most of the time
423 // there will be only one run anyway. 423 // there will be only one run anyway.
424 if (i != runs.num_runs() - 1) 424 if (i != runs.num_runs() - 1)
425 web_position.x += font_->calculateWidth(run); 425 web_position.x += font_->calculateWidth(run);
426 } 426 }
427 } 427 }
428 428
429 } // namespace content 429 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698