From caa9e1e23f2dadcb33e531e23f0697efb41a3895 Mon Sep 17 00:00:00 2001 From: "xji@chromium.org" Date: Tue, 13 Mar 2012 20:47:04 +0000 Subject: Rename UpdateLayout() to ResetLayout() which is more accurate. Review URL: http://codereview.chromium.org/9691002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126460 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/render_text_linux.cc | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'ui/gfx/render_text_linux.cc') diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc index dafa9e1..4b14819 100644 --- a/ui/gfx/render_text_linux.cc +++ b/ui/gfx/render_text_linux.cc @@ -218,8 +218,26 @@ bool RenderTextLinux::IsCursorablePosition(size_t position) { return (offset < num_log_attrs_ && log_attrs_[offset].is_cursor_position); } -void RenderTextLinux::UpdateLayout() { - ResetLayout(); +void RenderTextLinux::ResetLayout() { + // set_cached_bounds_and_offset_valid(false) is done in RenderText for every + // operation that triggers ResetLayout(). + if (layout_) { + g_object_unref(layout_); + layout_ = NULL; + } + if (current_line_) { + pango_layout_line_unref(current_line_); + current_line_ = NULL; + } + if (log_attrs_) { + g_free(log_attrs_); + log_attrs_ = NULL; + num_log_attrs_ = 0; + } + if (!selection_visual_bounds_.empty()) + selection_visual_bounds_.clear(); + layout_text_ = NULL; + layout_text_len_ = 0; } void RenderTextLinux::EnsureLayout() { @@ -448,28 +466,6 @@ SelectionModel RenderTextLinux::LastSelectionModelInsideRun( return SelectionModel(caret, CURSOR_FORWARD); } -void RenderTextLinux::ResetLayout() { - // set_cached_bounds_and_offset_valid(false) is done in RenderText for every - // operation that triggers ResetLayout(). - if (layout_) { - g_object_unref(layout_); - layout_ = NULL; - } - if (current_line_) { - pango_layout_line_unref(current_line_); - current_line_ = NULL; - } - if (log_attrs_) { - g_free(log_attrs_); - log_attrs_ = NULL; - num_log_attrs_ = 0; - } - if (!selection_visual_bounds_.empty()) - selection_visual_bounds_.clear(); - layout_text_ = NULL; - layout_text_len_ = 0; -} - size_t RenderTextLinux::TextIndexToLayoutIndex(size_t text_index) const { // If the text is obscured then |layout_text_| is not the same as |text()|, // but whether or not the text is obscured, the character (code point) offset -- cgit v1.1