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

Side by Side Diff: app/bidi_line_iterator.cc

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « app/bidi_line_iterator.h ('k') | app/event_synthesis_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "app/bidi_line_iterator.h"
6
7 #include "base/logging.h"
8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h"
10
11 BiDiLineIterator::~BiDiLineIterator() {
12 if (bidi_) {
13 ubidi_close(bidi_);
14 bidi_ = NULL;
15 }
16 }
17
18 UBool BiDiLineIterator::Open(const string16& text,
19 bool right_to_left,
20 bool url) {
21 DCHECK(bidi_ == NULL);
22 UErrorCode error = U_ZERO_ERROR;
23 bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error);
24 if (U_FAILURE(error))
25 return false;
26 if (right_to_left && url)
27 ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY);
28 ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()),
29 right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR,
30 NULL, &error);
31 return U_SUCCESS(error);
32 }
33
34 int BiDiLineIterator::CountRuns() {
35 DCHECK(bidi_ != NULL);
36 UErrorCode error = U_ZERO_ERROR;
37 const int runs = ubidi_countRuns(bidi_, &error);
38 return U_SUCCESS(error) ? runs : 0;
39 }
40
41 UBiDiDirection BiDiLineIterator::GetVisualRun(int index,
42 int* start,
43 int* length) {
44 DCHECK(bidi_ != NULL);
45 return ubidi_getVisualRun(bidi_, index, start, length);
46 }
47
48 void BiDiLineIterator::GetLogicalRun(int start,
49 int* end,
50 UBiDiLevel* level) {
51 DCHECK(bidi_ != NULL);
52 ubidi_getLogicalRun(bidi_, start, end, level);
53 }
OLDNEW
« no previous file with comments | « app/bidi_line_iterator.h ('k') | app/event_synthesis_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698