RESOLVED FIXED65723
A few purely stylistic modifications to visible_units.cpp
https://bugs.webkit.org/show_bug.cgi?id=65723
Summary A few purely stylistic modifications to visible_units.cpp
Van Lam
Reported 2011-08-04 15:09:53 PDT
See title
Attachments
Proposed fix (5.77 KB, patch)
2011-08-04 15:17 PDT, Van Lam
no flags
Revised fix (5.77 KB, patch)
2011-08-04 15:24 PDT, Van Lam
rniwa: review+
rniwa: commit-queue-
Revised fix (5.78 KB, patch)
2011-08-04 15:30 PDT, Van Lam
no flags
Van Lam
Comment 1 2011-08-04 15:17:01 PDT
Created attachment 102988 [details] Proposed fix Renamed greatestValueUnder to greatestOffsetUnder, positionIsInsideBox to positionIsInBoxButNotOnBoundary (to avoid confusion with positionIsInBox, which is just a getInlineBoxAndOffset check). Removed use of invalidOffset as an error value in greatestOffsetUnder and smallestOffsetAbove since semantically it should only be used to check if it makes sense to compare offsets in a single box.
Ryosuke Niwa
Comment 2 2011-08-04 15:18:13 PDT
Comment on attachment 102988 [details] Proposed fix View in context: https://bugs.webkit.org/attachment.cgi?id=102988&action=review > Source/WebCore/editing/visible_units.cpp:1644 > + if (index != -1) Probably better to check index < 0. > Source/WebCore/editing/visible_units.cpp:1681 > + if (index != -1) Ditto.
Van Lam
Comment 3 2011-08-04 15:24:49 PDT
Created attachment 102991 [details] Revised fix Changed comparison index != -1 to index >= 0.
Ryosuke Niwa
Comment 4 2011-08-04 15:27:30 PDT
Comment on attachment 102991 [details] Revised fix View in context: https://bugs.webkit.org/attachment.cgi?id=102991&action=review > Source/WebCore/editing/visible_units.cpp:1643 > + : smallestOffsetAbove(offset, blockDirection == RTL, orderedWordBoundaries); Oops, cq- because you forgot to indent here.
Van Lam
Comment 5 2011-08-04 15:30:49 PDT
Created attachment 102992 [details] Revised fix Indented. Nice catch :)
WebKit Review Bot
Comment 6 2011-08-04 16:56:37 PDT
Comment on attachment 102992 [details] Revised fix Clearing flags on attachment: 102992 Committed r92431: <http://trac.webkit.org/changeset/92431>
WebKit Review Bot
Comment 7 2011-08-04 16:56:41 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 8 2011-08-05 10:56:27 PDT
Comment on attachment 102992 [details] Revised fix View in context: https://bugs.webkit.org/attachment.cgi?id=102992&action=review > Source/WebCore/editing/visible_units.cpp:1450 > - return invalidOffset; > + return -1; Replacing a name constant with a magic value of -1 does not seem like a style improvement to me.
Ryosuke Niwa
Comment 9 2011-08-05 11:01:38 PDT
Comment on attachment 102992 [details] Revised fix View in context: https://bugs.webkit.org/attachment.cgi?id=102992&action=review >> Source/WebCore/editing/visible_units.cpp:1450 >> + return -1; > > Replacing a name constant with a magic value of -1 does not seem like a style improvement to me. invalidOffset was supposed to be used only for offsets in inline boxes. So this was misused here. We can introduce new const like NotFound instead.
Note You need to log in before you can comment on or make changes to this bug.