RESOLVED FIXED 86649
isStartOfDocument and isEndOfDocument are poorly named
https://bugs.webkit.org/show_bug.cgi?id=86649
Summary isStartOfDocument and isEndOfDocument are poorly named
Ryosuke Niwa
Reported 2012-05-16 10:16:14 PDT
bool isStartOfDocument(const VisiblePosition &p) { return p.isNotNull() && p.previous().isNull(); } bool isEndOfDocument(const VisiblePosition &p) { return p.isNotNull() && p.next().isNull(); } These functions are extremely poorly named. They don't check whether we're at the end of a document at all. They check whether we're at an editing boundary or not.
Attachments
Renames isEndOfDocument and adds fixed versions functions (8.59 KB, patch)
2012-05-18 17:47 PDT, Ryosuke Niwa
no flags
Removed erroneous change in FrameSelection (7.92 KB, patch)
2012-05-18 18:02 PDT, Ryosuke Niwa
no flags
Fixed builds (7.49 KB, patch)
2012-05-18 20:59 PDT, Ryosuke Niwa
no flags
Put back the missing changes (7.93 KB, patch)
2012-05-21 09:39 PDT, Ryosuke Niwa
leviw: review+
Ryosuke Niwa
Comment 1 2012-05-18 17:15:16 PDT
I'm fixing isStartOfDocument and isEndOfDocument to cross editing boundary and adding isEndOfEditableOrNonEditableContent which does what isEndOfDocument used to do. After this change, selectFrameElementInParentIfFullySelected is the only client of isStartOfDocument and isEndOfDocument. The problem is that this function was added in http://trac.webkit.org/changeset/8942 without any tests without any tests. As far as I know, this function had been broken for ages (it only checked if the selection started and ended at the beginning and the end of the current editable region). So I'm very inclined to just delete it altogether. If anything, we should probably support control selection on iframes per https://bugs.webkit.org/show_bug.cgi?id=12250. Darin, what is your opinion on this?
Ryosuke Niwa
Comment 2 2012-05-18 17:47:51 PDT
Created attachment 142833 [details] Renames isEndOfDocument and adds fixed versions functions
Ryosuke Niwa
Comment 3 2012-05-18 18:02:33 PDT
Created attachment 142836 [details] Removed erroneous change in FrameSelection
Early Warning System Bot
Comment 4 2012-05-18 18:10:29 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection Attachment 142836 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/12726614
WebKit Review Bot
Comment 5 2012-05-18 18:13:20 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection Attachment 142836 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12731052
Gyuyoung Kim
Comment 6 2012-05-18 19:27:02 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection Attachment 142836 [details] did not pass efl-ews (efl): Output: http://queues.webkit.org/results/12732062
Ryosuke Niwa
Comment 7 2012-05-18 19:42:54 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection View in context: https://bugs.webkit.org/attachment.cgi?id=142836&action=review > Source/WebCore/editing/visible_units.cpp:-1379 > -bool isStartOfDocument(const VisiblePosition &p) > -{ > - return p.isNotNull() && p.previous().isNull(); > -} > - > -bool isEndOfDocument(const VisiblePosition &p) > -{ > - return p.isNotNull() && p.next().isNull(); > -} > - How odd. I shouldn't be removing these functions. Will fix.
Early Warning System Bot
Comment 8 2012-05-18 19:45:34 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection Attachment 142836 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/12730070
Build Bot
Comment 9 2012-05-18 20:13:07 PDT
Comment on attachment 142836 [details] Removed erroneous change in FrameSelection Attachment 142836 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/12729275
Ryosuke Niwa
Comment 10 2012-05-18 20:59:59 PDT
Created attachment 142847 [details] Fixed builds
Ryosuke Niwa
Comment 11 2012-05-18 21:02:12 PDT
For now, I kept selectFrameElementInParentIfFullySelected intact (in fact I'm probably fixing a bug in it).
Mikhail Naganov
Comment 12 2012-05-21 02:04:02 PDT
Comment on attachment 142847 [details] Fixed builds View in context: https://bugs.webkit.org/attachment.cgi?id=142847&action=review > Source/WebCore/ChangeLog:10 > + Also added new versions of isStartOfDocument and isEndOfDocument that correctly cross editing boundaries Is this true? I don't see the new versions.
Ryosuke Niwa
Comment 13 2012-05-21 07:37:43 PDT
(In reply to comment #12) > (From update of attachment 142847 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=142847&action=review > > > Source/WebCore/ChangeLog:10 > > + Also added new versions of isStartOfDocument and isEndOfDocument that correctly cross editing boundaries > > Is this true? I don't see the new versions. Ugh... my change in isStartOfDocument and isEndOfDocument have been lost.
Ryosuke Niwa
Comment 14 2012-05-21 09:39:07 PDT
Created attachment 143050 [details] Put back the missing changes
Levi Weintraub
Comment 15 2012-05-21 10:58:52 PDT
Comment on attachment 143050 [details] Put back the missing changes View in context: https://bugs.webkit.org/attachment.cgi?id=143050&action=review > Source/WebCore/ChangeLog:8 > + isEndOfDocument to isEndOfEditableOrNonEditableContent because that's what this function checks. I believe you're missing the word "Changed" at the beginning :) > Source/WebCore/ChangeLog:11 > + Also added new versions of isStartOfDocument and isEndOfDocument that correctly cross editing boundaries > + to be used in selectFrameElementInParentIfFullySelected. Since you didn't create a isStartOfEditableOrNonEditableContent (man that's long) was isStartOfDocument just never used? Is isEndOfDocument still used after this patch?
Ryosuke Niwa
Comment 16 2012-05-21 11:02:20 PDT
Comment on attachment 143050 [details] Put back the missing changes View in context: https://bugs.webkit.org/attachment.cgi?id=143050&action=review >> Source/WebCore/ChangeLog:11 >> + to be used in selectFrameElementInParentIfFullySelected. > > Since you didn't create a isStartOfEditableOrNonEditableContent (man that's long) was isStartOfDocument just never used? Is isEndOfDocument still used after this patch? isEndOfDocument and isStartOfDocument are still used in selectFrameElementInParentIfFullySelected. See my comment #1.
Emil A Eklund
Comment 17 2012-05-21 11:11:22 PDT
Comment on attachment 143050 [details] Put back the missing changes View in context: https://bugs.webkit.org/attachment.cgi?id=143050&action=review > Source/WebCore/editing/visible_units.cpp:1400 > +bool isEndOfEditableOrNonEditableContent(const VisiblePosition &p) This is still a pretty poor name. How about isAtEditableBoundary or even isAtEndOfEditableBoundary?
Ryosuke Niwa
Comment 18 2012-05-21 11:21:54 PDT
(In reply to comment #17) > (From update of attachment 143050 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=143050&action=review > > > Source/WebCore/editing/visible_units.cpp:1400 > > +bool isEndOfEditableOrNonEditableContent(const VisiblePosition &p) > > This is still a pretty poor name. How about isAtEditableBoundary or even isAtEndOfEditableBoundary? isAtEditableBoundary is inaccurate. isAtEndOfEditableBoundary doesn't make sense because an editing boundary is a point in DOM and a point/position doesn't have a start/end.
Emil A Eklund
Comment 19 2012-05-21 11:49:31 PDT
> isAtEditableBoundary is inaccurate. isAtEndOfEditableBoundary doesn't make sense because an editing boundary is a point in DOM and a point/position doesn't have a start/end. Then what is isEndOfEditableOrNonEditableContent trying to communicate if it isn't a boundary? I'm confused.
Levi Weintraub
Comment 20 2012-05-21 11:49:50 PDT
Comment on attachment 143050 [details] Put back the missing changes View in context: https://bugs.webkit.org/attachment.cgi?id=143050&action=review >> Source/WebCore/ChangeLog:8 >> + isEndOfDocument to isEndOfEditableOrNonEditableContent because that's what this function checks. > > I believe you're missing the word "Changed" at the beginning :) Make this a sentence. >>> Source/WebCore/editing/visible_units.cpp:1400 >>> +bool isEndOfEditableOrNonEditableContent(const VisiblePosition &p) >> >> This is still a pretty poor name. How about isAtEditableBoundary or even isAtEndOfEditableBoundary? > > isAtEditableBoundary is inaccurate. isAtEndOfEditableBoundary doesn't make sense because an editing boundary is a point in DOM and a point/position doesn't have a start/end. I'm not in love with this name, but it's at least accurate in what it portrays :)
Ryosuke Niwa
Comment 21 2012-05-21 13:51:36 PDT
Note You need to log in before you can comment on or make changes to this bug.