Commit Graph

158 Commits

Author SHA1 Message Date
Jean-Philippe Andre 681573c555 Evas: Fix compilation warning (-Wshadow) 2015-02-13 14:00:23 +09:00
Carsten Haitzler 7c5f92d702 evas - render - have lock point to allow for async obj walk + update add
this adds a lock for when walking all the objects to generate render
commands for an async render. this allows even the object tree walk
plus update area caluclation to be moved off into async if every oject
that can change canvas state actually does so correctly. this change
adds all those lock block calls to synchronise with an async object
tree walk.
2015-02-12 11:06:40 +09:00
Jae Yong Hwang e561570507 evas:fix markup text length issue
Summary:
There was no conversion to the double quotation mark in the evas_textblock_text_utf8_to_markup function.
The price of the text coming out to API and text coming out to Textblock was different as a result.
As a result, Two text lengths came out differently.
So, I added the exceptional treatment part in the evas_textblock_text_utf8_to_markup function.

@fix

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1853
2015-01-08 19:38:49 +09:00
Tom Hacohen c970e787d6 Evas textblock: Remove redundant magic member.
We don't use magic since moving to Eo.
2014-12-15 14:58:32 +00:00
Tom Hacohen 95f89f6e2e Evas textblock: Fix possibly null dereference.
Thanks to kimcinoo for reporting.

@fix
2014-12-01 11:55:08 +00:00
Thiep Ha c30303d7e8 edje entry: improve selection performance
Summary:
The selection performance is slow if we select large chunk of text.
This is caused by many rectangles created and deleted.
This patch provides a way to improve it by combine selection rectangles
of line in middle into one rectangles (i.e, if we have N lines,
the selection rectangle for lines 2 to N-1 will be combined into one.)

@feature

Reviewers: raster, cedric, tasn

Subscribers: herdsman, woohyun, cedric

Differential Revision: https://phab.enlightenment.org/D1508
2014-11-26 11:29:09 +00:00
Thiep Ha e9a40835f2 textblock: correct text position for RTL text with margins
Summary:
If a RTL textblock has right margin, text is wrongly placed
(right margin is moved to left).
This patch fixes this issue.
Test cases are also added to test text position with margins.

@fix

Reviewers: tasn, herdsman

Subscribers: woohyun, cedric

Differential Revision: https://phab.enlightenment.org/D1691
2014-11-26 10:18:49 +02:00
kabeer khan c3ee589b8f evas_object_textblock: Resolved FIXME replaced int with size_t
Summary:
Since Evas_Textblock_Cursor has pos  of type size_t so changed
pos argument in _find_layout_item_line_match from int to size_t
Also Evas_Object_Textblock_Item has text_pos of size_t so defined
variable p of type size_t

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>

Reviewers: tasn

Subscribers: devilhorns, cedric

Differential Revision: https://phab.enlightenment.org/D1692
2014-11-25 09:55:36 +00:00
Thiep Ha dee98ea248 evas textblock: return text direction for under cursor in cursor geometry get
Summary:
Currently, in cursor geometry get function, the text direction is not
returned if cursor is under cursor.
This patch fixs it by returning text direction for under cursor.

@fix

Reviewers: tasn

Subscribers: herdsman, cedric

Differential Revision: https://phab.enlightenment.org/D1505
2014-10-02 08:36:35 +01:00
Daniel Hirt fae337469e Evas Textblock: Fix native width of BiDi text
Summary:
This fixes an issue that causes BiDi text to get wrapped even when
resizing the textblock to its native size.
The way we find the last visual item in the native line is wrong. The
'visual_pos' describes the visual position in the formatted layout, in
which wrapping may occur. So, this is really bad to use it for native
width calculations as well.
Also, there's no need to actually reorder the line - we just need the
last visual item.
This adds and uses a function very similar to _layout_line_reorder, in
which we retrieve the last visual item in the native line. This
function does not do any actual reordering, as the native layout is
disposed of after calculation is done.

Also, added GET_ITEM_LEN macro for convenience.

Fixes T1532

@fix

Test Plan: Added to evas textblock test suite in this patch

Reviewers: tasn

Subscribers: id213sin, JackDanielZ, cedric

Maniphest Tasks: T1532

Differential Revision: https://phab.enlightenment.org/D1353
2014-10-01 16:45:58 +01:00
Daniel Hirt a4d716d1c0 Evas Textblock: Fix bad empty line add on wrapping
Summary:
In some cases of char or word wrapping, an empty line might be
accidentally added at the end of the paragraph. That line contains
no items. Of course, this line should not exist.
One outcome of this is that it causes wrong height values of the
paragraph, when the finalizing code uses the
_layout_last_line_max_descent_adjust_calc, which in turn
looks at that empty line to calculate the descent values.

@fix

Test Plan: Char-wrap and word-wrap tests to test suite included in this revision.

Reviewers: tasn

Subscribers: JackDanielZ, cedric

Projects: #efl

Differential Revision: https://phab.enlightenment.org/D1444
2014-09-26 13:20:14 +01:00
Tom Hacohen a7560dbc61 Eo: Change eo_add/del/unref behaviour.
Before this change eo_add() used to create an object with 1 ref, and if
the object had a parent, a second ref.
Now, eo_add() always returns an object with 1 ref, and eo_add_ref()
    preserves the old behaviour (for bindings).

eo_unref now un-parents if refcount is 0, and eo_del() is an alias for
eo_unref (will change to be a way to ensure an object is dead and goes
        to zombie-land even if still refed).
2014-09-25 17:38:45 +01:00
Srivardhan Hebbar 65ad94bac4 Documentation: Adding documentation for evas_object_textblock structures.
Summary:
This is a fix to one of the FIXME in the code, evas_object_textblock.c

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: herdsman, tasn

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1383
2014-09-08 12:18:54 +01:00
Youngbok Shin 15281561e5 evas textblock: fixed ellipsis character cut off issue with complex markup text.
Summary:
Evas Textblock ellipsis is handled in a item.
When the ellipsis item is added in the text, some characters are cut off
considering width of ellipsis character.
But, it is handled in only one text item.
If there are many short text item, the ellipsis item can be cut off visually.
And there was a bug in the patch when text is displayed in two lines or more.
The bug is also fixed.

Fixes Phab ticket T1213

@fix

Test Plan: This commit includes test case.

Reviewers: woohyun, seoz, sohyun, tasn, raster

Subscribers: cedric, herdsman

Differential Revision: https://phab.enlightenment.org/D1360
2014-09-02 11:47:36 +01:00
Carsten Haitzler 27ae94596f evas textblock - fix inconsistent ascent/descent return ptr checks
ascent/descent are always non-null in usage of
_layout_item_ascent_descent_adjust() so don't check for them.

fix CID 1099704
2014-08-27 17:37:01 +09:00
Carsten Haitzler 2a580c1665 evas textblock - remove unused pointer
fixes CID 1039479
2014-08-25 13:17:02 +09:00
Tom Hacohen 1fcbd88e6d Evas textblock: Remove unused function. 2014-08-20 17:08:28 +01:00
Tom Hacohen 841191d907 Evas textblock: Fix BiDi text cut-off at the edges.
This patch fixes an issue causing text to be cut off in some cases.
The problem was that we were calculating line width and alignment before
we did any bidi calculations, which in turn caused us to use the wrong
text items for those calculations.

Many thanks to Daniel Hirt for investigating this deeply, finding all
the nitty-gritty and generally pointing me to where the problem is.
Daniel also provided the test case.
His patch (D1291) was close, but not enough.

Fixes T1496

@Fix
2014-08-20 15:10:23 +01:00
Carsten Haitzler 9a91261a4e Revert "evas textblock: fixed ellipsis character cut off issue with complex markup text."
This reverts commit d408408283.

this breaks mult-line "long" filenames in efm. 2nd line is just ...
for almost all of them (ones that are actually in need of 3 or more
lines). break break! REVERT!
2014-08-20 12:03:14 +09:00
Youngbok Shin d408408283 evas textblock: fixed ellipsis character cut off issue with complex markup text.
Summary:
Evas Textblock ellipsis is handled in a item.
When the ellipsis item is added in the text, some characters are cut off
considering width of ellipsis character.
But, it is handled in only one text item.
If there are many short text item, the ellipsis item can be cut off visually.

Fixes Phab ticket T1213

@fix

Test Plan: This commit includes test case.

Reviewers: woohyun, seoz, sohyun, tasn

Subscribers: herdsman, cedric

Differential Revision: https://phab.enlightenment.org/D1311
2014-08-19 15:20:35 +01:00
Carsten Haitzler 4b431d3638 evas font - fix null access of font format possibility
this fixes NULL access in CID 1099705, 1099703, 1099704
2014-08-14 18:14:08 +09:00
Carsten Haitzler d539152156 address non nul terminated string due to strncpy
this addresses CID 1230994. as such  eina_unicode_unicode_to_utf8()
always returns a nul terminated string. so it's guaranteed. but yes -
if string is 7 bytes or longer it will not put a nul byte on the
destination. as such for a single unicode char this can never happen
as in utf8 it's 6 bytes. but since eina_unicode_unicode_to_utf8()
safely returns a nul terminated string at all times - we can just use
strcpy safely. no need for strncpy. also handle null return from
eina_unicode_unicode_to_utf8()
2014-08-13 09:03:02 +09:00
Tom Hacohen 90c0eb15a4 Evas textblock: strcpy->strncpy (although the buffer is always big enough).
Many tools will complain about the use of strcpy, and it's not that hard to use
strncpy anyway.

CID1039581.
2014-08-12 10:11:41 +01:00
Tom Hacohen 1d6960867d Evas textblock: remove checks for impossible null derefs.
This improves code clarity based on input from coverity.

CID1190401
CID1190402
2014-08-12 09:52:18 +01:00
Youngbok Shin 7a87f322f4 textblock: Update visual_pos before calling _size_native_calc_line_finalize.
Summary:
In items loop of _size_native_calc_line_finalize,
last_it should be replaced with new item according to position.
But, visual_pos is not prepared and it is always zero in the function.
So, we need to update visual_pos.
And when textblock only has LTR text,
we can replace last_it according to item list sequence.
@fix

Test Plan:
It includes test cases using the following test case.
 1. "i<b>。</b>"
 2. "。<b>i</b>"

Reviewers: seoz, woohyun, sohyun, tasn

Subscribers: raster, herdsman, cedric

Differential Revision: https://phab.enlightenment.org/D859
2014-08-06 10:40:02 +01:00
Youngbok Shin 1984961ba6 evas/textblock: fix to keep original format when a markup tag is matched to a style tag.
Summary:
We can define a style tag as opener, closer and own closer.
If there is a markup tag that is matched to style tag,
it is reprocessed to format node inside of textblock.
But, when the format node will be converted to markup text,
'/' character can be appended to text at closer and own closer style tag.
Even if original markup tag does not has '/' character,
it will be appended according to format node information.

It makes some issue when compare input text with output text.
@fix

Test Plan: This commit includes test case.

Reviewers: woohyun, raster, sohyun, tasn

Subscribers: herdsman, cedric

Differential Revision: https://phab.enlightenment.org/D1037
2014-08-05 10:26:05 +01:00
Thiep Ha 104f04eda1 Evas textblock: Correct word start/end moving at new line or line begins with spaces
Summary:
Word start/end works incorrectly when it goes to new line or line begins with spaces.
Ex: In elementary_test/Entry, place cursor at the end of line, press ctrl + right arrow keys: cursor moves to begin of next line. In this case, cursor should move to end of 1st word in next line.
Ex2: In elementary_test/Entry, add some spaces to begin of 2nd line ("   uses markup"), place cursor at the first word ("uses"), press ctrl + left arrow keys twice, cursor moves to begin of 2nd line. In this case, cursor should move to begin of last word in 1st line.

This patch provides a fix by considerring next/previous text node to move cursor to correct place.

@fix

Reviewers: woohyun, raster, tasn

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1140
2014-08-04 11:01:51 +01:00
Thiep Ha 808202e6af Evas textblock: Fix memory leak
Summary:
In evas_textblock_cursor_word_end function, the breaks' memory is allocated but not freed when cursor position is equal to text length.
Fix: Remove memory allocating.

@fix

Reviewers: raster, tasn

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1225
2014-07-25 16:06:37 +01:00
Tom Hacohen 7f3a44894b Evas canvas eolian: Fix namespace and class name for the evas canvas. 2014-06-30 17:47:06 +01:00
Daniel Hirt 2b40860f78 Evas/Textblock: Introduce PS deletion bug test and fix
Summary:
This test should make the test suite fail. It sets "a<ps>b" and
"a<ps/>b" markups, and deletes the PS format. Essentially, these two
different markups should have the same result by this deletion. Instead,
only the <ps/> format gets deleted properly.
A follow-up commit is added with this as a fix.

Evas/Textblock: fix deletion of PS bug

Fixes an issue with deletion of "<ps>". Format deletion was only
performed for formats that are own-closers. This sets the paragraph
separator to be an own-closer format.

@fix

Reviewers: tasn

Reviewed By: tasn

CC: JackDanielZ, id213sin

Differential Revision: https://phab.enlightenment.org/D1046
2014-06-17 11:11:33 +01:00
Youngbok Shin f7cf96d4d9 evas/textblock: check item's type before returning result.
Summary:
When format item is cut off by ellipsis, result of "_find_layout_item_line_match"
can be TEXT type item. And it keeps ellipsis item's information.
@fix

Test Plan: D974

Reviewers: woohyun, tasn

CC: cedric, herdsman

Differential Revision: https://phab.enlightenment.org/D975
2014-06-10 15:08:09 +01:00
Tom Hacohen 0fc3279db9 Efl: Update code to use the new class names generated by eolian. 2014-06-03 11:28:01 +01:00
Daniel Hirt 177135ff0d Evas/Textblock: add support for ellipsis values
Summary:
This enables textblock to support more values other than 1.0.
For 0 <= ellipsis < 1.0, it splits the text such that it fits the
textblock's width. The ellipsis is relatively position according to the
ellipsis value, and characters are removed also relatively.
For example, a value of 0.5 will position the ellipsis right in the
center of the textblock's width, while removing characters equally right
and left from the center.

Basic approach to this feature was to do some work before the layout
process. We calculate the expected total width of the items, and by how
much we exceed from the textblock's width. Afterwards is it just some
careful work to set the boundaries of the width we want to cut, and
deciding which characters we need to removed to fulfill this requirement.
The rest is splitting the text and visually-removing the part we
need to cut.
This is all handled before any logical lines are created, so the
_layout_par function remains almost intact. A designated _ellip_prev_it
field in the Paragraph struct instructs after which item we place the
ellipsis item, if at all.

Note that we keep the fast path for ellipsis 1.0, as heavier work needs
to be done for the other values.

Added tests to evas_suite for a range of ellipsis values.

Also, multiline is unsupported at the moment.
@feature

Test Plan: Anything that uses Evas Textblock (single-line, please)

Reviewers: tasn, id213sin, raster

CC: cedric, JackDanielZ, raster

Differential Revision: https://phab.enlightenment.org/D905
2014-05-29 15:52:01 +01:00
ChunEon Park b61b1c9412 evas/textblock - apply efl coding style. 2014-05-28 14:19:46 +09:00
ChunEon Park fbb4d092cb evas/textblock - removed unnecessary null check.
It should be definitely valid.
It's meaningless checking the value there.
2014-05-28 14:14:35 +09:00
ChunEon Park e973390f64 evas/textblock - null check format.
logically it's insane that it doesn't check the null there but it checks right next line.
2014-05-28 14:09:34 +09:00
Tom Hacohen cf4ad9328a Evas textblock: Fix wrong advance calculation when bidi is disabled.
The last_it was not updated correctly with bidi disabled.

Thanks to Daniel Hirt for spotting this.

@fix
2014-05-27 14:20:18 +01:00
ChunEon Park a5b89f17b3 evas - removed stdlib.h math.h header include in each source files.
It's included in the evas_common_private.h.
2014-05-07 16:33:23 +09:00
ChunEon Park c399017cef evas - removed unncessary header include
it's already done in evas_common_private.h. no need it in each file.
2014-04-29 15:44:29 +09:00
Yossi Kantor 1563181922 Eolian: Legacy integration of Evas Rectangle, Polygon, Line, Textgrid and Textblock 2014-04-11 09:26:15 +03:00
Tom Hacohen 35525a53e0 Adjust eo_do calls to work with the eo2 api. 2014-04-10 04:20:21 +01:00
Tom Hacohen 8e5234cf75 Evas textblock: Minor code cleanup.
Moved a global variable into a local scope, as it's no longer needed globally.
2014-04-02 10:06:57 +01:00
Tom Hacohen 2e7565b7c3 Evas textblock: Fixed compilation with FriBiDi disabled.
This issue was introduced in d175b8aa69
during the previous merge window.

Thanks a lot to vtorri for reporting.
2014-03-31 11:41:51 +01:00
Daniel Hirt 5778896735 Evas Textblock: increase ref of format before work
We need to increase ref count for the format prior to calling of
functions that handle the layout.
This resolves valgrind error of accessing already freed memory.
Please note that a scenerio to trigger this exists in test suite, and
for some reason is not being detected by jenkins.
@fix
2014-03-26 12:32:25 +00:00
Cedric BAIL fe2948be08 evas: let's be to safe than sorry.
Fix CID 1193214.
2014-03-20 16:50:48 +09:00
Daniel Zaoui 6fd341a449 Eolian: Fix ctor/dtor generation 2014-03-19 07:04:28 +02:00
Tom Hacohen 2eaf9049b9 Evas textblock: Don't include right margin/padding twice when aligning lines.
This should fix enventor issues.

@fix
2014-03-14 12:54:09 +00:00
Tom Hacohen d175b8aa69 Evas textblock: Fix clipping issues with some texts with width > advance.
This happens with many texts. The issue occurs when the width of the
last char is larger than it's advance. Before this patch, we didn't the
width into account when calculating width, thus causing clipping issues
in some cases.
2014-03-10 14:58:18 +00:00
Daniel Zaoui ee7541e202 Eolian: Integration of Evas Text Block 2014-03-10 13:28:03 +02:00
Tom Hacohen 46361148b2 Evas textblock: Implemented mid-contextualization formatting.
There are many situations (e.g all the time with Arabic text) in which
characters change their appearance depending on the context they lie
within. Before this patch, we didn't support changing font appearance
mid-context. So for example one couldn't do "a<color=#f00>b" without
messing up 'a' and 'b's change to their contextual forms.

Although Arabic is a very good example, this also applies to Latin text
in many cases, and should fix some wrong spacing that might have
appeared when changing styles.

@feature
2014-02-28 10:47:56 +00:00