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

Unified Diff: ui/gfx/render_text_linux.h

Issue 8536047: Separate selection highlight from pango layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: address comments Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_linux.h
===================================================================
--- ui/gfx/render_text_linux.h (revision 112051)
+++ ui/gfx/render_text_linux.h (working copy)
@@ -7,6 +7,7 @@
#pragma once
#include <pango/pango.h>
+#include <vector>
#include "ui/gfx/render_text.h"
@@ -21,7 +22,6 @@
// Overridden from RenderText:
virtual base::i18n::TextDirection GetTextDirection() OVERRIDE;
virtual int GetStringWidth() OVERRIDE;
- virtual void Draw(Canvas* canvas) OVERRIDE;
virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
virtual Rect GetCursorBounds(const SelectionModel& position,
bool insert_mode) OVERRIDE;
@@ -34,8 +34,14 @@
BreakType break_type) OVERRIDE;
virtual SelectionModel LeftEndSelectionModel() OVERRIDE;
virtual SelectionModel RightEndSelectionModel() OVERRIDE;
+ virtual void GetSubstringBounds(size_t from,
+ size_t to,
+ std::vector<Rect>* bounds) OVERRIDE;
+ virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE;
virtual bool IsCursorablePosition(size_t position) OVERRIDE;
virtual void UpdateLayout() OVERRIDE;
+ virtual void EnsureLayout() OVERRIDE;
+ virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
private:
virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) OVERRIDE;
@@ -69,10 +75,6 @@
SelectionModel LeftSelectionModelByWord(const SelectionModel& current);
SelectionModel RightSelectionModelByWord(const SelectionModel& current);
- // If |layout_| is NULL, create and setup |layout_|, retain and ref
- // |current_line_|. Return |layout_|.
- PangoLayout* EnsureLayout();
-
// Unref |layout_| and |pango_line_|. Set them to NULL.
void ResetLayout();
@@ -96,6 +98,15 @@
size_t Utf16IndexToUtf8Index(size_t index) const;
size_t Utf8IndexToUtf16Index(size_t index) const;
+ // Calculate the visual bounds containing the logical substring within |from|
+ // to |to| into |bounds|.
+ void CalculateSubstringBounds(size_t from,
+ size_t to,
+ std::vector<Rect>* bounds);
+
+ // Save the visual bounds of logical selection into |bounds|.
+ void GetSelectionBounds(std::vector<Rect>* bounds);
+
// Pango Layout.
PangoLayout* layout_;
// A single line layout resulting from laying out via |layout_|.
@@ -106,6 +117,9 @@
// Number of attributes in |log_attrs_|.
int num_log_attrs_;
+ // Vector of the visual bounds containing the logical substring of selection.
+ std::vector<Rect> selection_visual_bounds_;
+
// The text in the |layout_|.
const char* layout_text_;
// The text length.
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698