Bug 51219

Summary: queryCommandValue("FormatBlock") does not respect editing boundaries
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Enhancement CC: commit-queue, darin, enrica, eric, jparent, justin.garcia, ojan
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
fixes the bug none

Ryosuke Niwa
Reported 2010-12-16 16:15:51 PST
document.queryCommandValue("FormatBlock") does not respect the editing boundary. It returns the name of block even if the block was an ancestor of the editable root or the editable root itself. Firefox doesn't this do.
Attachments
fixes the bug (4.97 KB, patch)
2010-12-16 16:56 PST, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2010-12-16 16:56:28 PST
Created attachment 76828 [details] fixes the bug
Ryosuke Niwa
Comment 2 2010-12-16 16:58:55 PST
Comment on attachment 76828 [details] fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=76828&action=review > WebCore/editing/FormatBlockCommand.cpp:111 > if (!commonAncestor) > return 0; > > + Element* rootEditableElement = range->startContainer()->rootEditableElement(); > + if (!rootEditableElement || commonAncestor->contains(rootEditableElement)) > + return 0; > + I could combine these two if statements in practice but I was concerned that there could be a case where startContainer() is null. While we DO check this condition in valueFormatBlock, I didn't want to make the precondition of this function tighter.
WebKit Commit Bot
Comment 3 2010-12-23 18:33:55 PST
Comment on attachment 76828 [details] fixes the bug Clearing flags on attachment: 76828 Committed r74603: <http://trac.webkit.org/changeset/74603>
WebKit Commit Bot
Comment 4 2010-12-23 18:34:01 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.