summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 00:24:36 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 00:24:36 +0000
commit75d78246ad3bff129539b8259e7b35f2d49117a8 (patch)
tree9a96830b5046cff95d1aa57ed7187dc39494db0a /app
parentf6ab5725d4fb9b8eac2f39f54308148388d5cfa3 (diff)
downloadchromium_src-75d78246ad3bff129539b8259e7b35f2d49117a8.zip
chromium_src-75d78246ad3bff129539b8259e7b35f2d49117a8.tar.gz
chromium_src-75d78246ad3bff129539b8259e7b35f2d49117a8.tar.bz2
Move BiDiLineIterator to base/i18n/ directory.
BUG=23581 TEST=trybots Review URL: http://codereview.chromium.org/6249007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app_base.gypi3
-rw-r--r--app/bidi_line_iterator.cc53
-rw-r--r--app/bidi_line_iterator.h43
3 files changed, 1 insertions, 98 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi
index f41dc61..e14edd3 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
@@ -159,7 +159,6 @@
'../ui/base/win/window_impl.h',
'active_window_watcher_x.cc',
'active_window_watcher_x.h',
- 'bidi_line_iterator.cc',
'data_pack.cc',
'data_pack.h',
'event_synthesis_gtk.cc',
diff --git a/app/bidi_line_iterator.cc b/app/bidi_line_iterator.cc
deleted file mode 100644
index 3312ef0..0000000
--- a/app/bidi_line_iterator.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2010 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 "app/bidi_line_iterator.h"
-
-#include "base/logging.h"
-#include "base/string16.h"
-#include "base/utf_string_conversions.h"
-
-BiDiLineIterator::~BiDiLineIterator() {
- if (bidi_) {
- ubidi_close(bidi_);
- bidi_ = NULL;
- }
-}
-
-UBool BiDiLineIterator::Open(const string16& text,
- bool right_to_left,
- bool url) {
- DCHECK(bidi_ == NULL);
- UErrorCode error = U_ZERO_ERROR;
- bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error);
- if (U_FAILURE(error))
- return false;
- if (right_to_left && url)
- ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY);
- ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()),
- right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR,
- NULL, &error);
- return U_SUCCESS(error);
-}
-
-int BiDiLineIterator::CountRuns() {
- DCHECK(bidi_ != NULL);
- UErrorCode error = U_ZERO_ERROR;
- const int runs = ubidi_countRuns(bidi_, &error);
- return U_SUCCESS(error) ? runs : 0;
-}
-
-UBiDiDirection BiDiLineIterator::GetVisualRun(int index,
- int* start,
- int* length) {
- DCHECK(bidi_ != NULL);
- return ubidi_getVisualRun(bidi_, index, start, length);
-}
-
-void BiDiLineIterator::GetLogicalRun(int start,
- int* end,
- UBiDiLevel* level) {
- DCHECK(bidi_ != NULL);
- ubidi_getLogicalRun(bidi_, start, end, level);
-}
diff --git a/app/bidi_line_iterator.h b/app/bidi_line_iterator.h
deleted file mode 100644
index a4faa2f..0000000
--- a/app/bidi_line_iterator.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2010 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.
-
-#ifndef APP_BIDI_LINE_ITERATOR_H_
-#define APP_BIDI_LINE_ITERATOR_H_
-#pragma once
-
-#include <string>
-
-#include "unicode/ubidi.h"
-
-#include "base/basictypes.h"
-#include "base/string16.h"
-
-// A simple wrapper class for the bidirectional iterator of ICU.
-// This class uses the bidirectional iterator of ICU to split a line of
-// bidirectional texts into visual runs in its display order.
-class BiDiLineIterator {
- public:
- BiDiLineIterator() : bidi_(NULL) { }
- ~BiDiLineIterator();
-
- // Initializes the bidirectional iterator with the specified text. Returns
- // whether initialization succeeded.
- UBool Open(const string16& text, bool right_to_left, bool url);
-
- // Returns the number of visual runs in the text, or zero on error.
- int CountRuns();
-
- // Gets the logical offset, length, and direction of the specified visual run.
- UBiDiDirection GetVisualRun(int index, int* start, int* length);
-
- // Given a start position, figure out where the run ends (and the BiDiLevel).
- void GetLogicalRun(int start, int* end, UBiDiLevel* level);
-
- private:
- UBiDi* bidi_;
-
- DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator);
-};
-
-#endif // APP_BIDI_LINE_ITERATOR_H_