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

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: 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
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 25 matching lines...) Expand all
36 using blink::WebCanvas; 36 using blink::WebCanvas;
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(const ScriptFontFamilyMap& map,
47 const webkit_glue::ScriptFontFamilyMap& map, 47 const std::string& script) {
48 const std::string& script) { 48 ScriptFontFamilyMap::const_iterator it = map.find(script);
49 webkit_glue::ScriptFontFamilyMap::const_iterator it =
50 map.find(script);
51 if (it != map.end()) 49 if (it != map.end())
52 return it->second; 50 return it->second;
53 return base::string16(); 51 return base::string16();
54 } 52 }
55 53
56 // Splits a PP_BrowserFont_Trusted_TextRun into a sequence or LTR and RTL 54 // 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, 55 // 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 56 // 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. 57 // step. So for correct rendering of RTL content, we need to do it ourselves.
60 class TextRunCollection { 58 class TextRunCollection {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 418
421 // Advance to the next run. Note that we avoid doing this for the last run 419 // 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 420 // since it's unnecessary, measuring text is slow, and most of the time
423 // there will be only one run anyway. 421 // there will be only one run anyway.
424 if (i != runs.num_runs() - 1) 422 if (i != runs.num_runs() - 1)
425 web_position.x += font_->calculateWidth(run); 423 web_position.x += font_->calculateWidth(run);
426 } 424 }
427 } 425 }
428 426
429 } // namespace content 427 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698