[Webkit-unassigned] [Bug 25415] [GTK][ATK] Please implement support for get_text_at_offset

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 28 10:40:38 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25415


gns at gnome.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30614|review?                     |review+
               Flag|                            |




------- Comment #21 from gns at gnome.org  2009-05-28 10:40 PDT -------
(From update of attachment 30614)
> +typedef int (*advanceFunc) (int);
> +
> +static int increaseInt(int i) {
> +    return i + 1;
> +}
> +
> +static int decreaseInt(int i) {
> +    return i - 1;
> +}
[...]
> +static bool findCharacterAttribute(isCharacterAttribute predicateFunction, PangoLogAttr* attributes, Direction direction, int startOffset, int attrsLength, int* resultOffset)
> +{
> +    advanceFunc advanceFunc = direction == DirectionForward ? increaseInt : decreaseInt;
> +
> +    *resultOffset = -1;
> +
> +    for (int i = startOffset; i >= 0 && i < attrsLength; i = advanceFunc(i)) {

The patch looks good to me, except for this nitpick. I think using the
advanceFunc strategy here is a bit overblown. You should be able to use a
simple int variable here.

int advanceBy = direction == DirectionForward ? 1 : -1;

for (int i = startOffset; i >= 0 && i < attrsLength; i = i + advanceBy) {

If there's a reason that escaped my eye, please not in a comment =).


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list