Summary: | Use the complete block as the context for Dictionary lookups | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Thomas Deniau <deniau> | ||||||
Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, enrica, graouts, jiapu.mail, rniwa, thorton, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Thomas Deniau
2013-04-26 06:35:03 PDT
Created attachment 199826 [details]
Patch
When computing the context we give when looking up a word in the Dictionary, use startOfBlock/endOfBlock instead of startOfParagraph/endOfParagraph so that the context doesn't stop at line breaks. Comment on attachment 199826 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=199826&action=review > Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:510 > + // A "paragraph" is not enough as it may stop at a <br> and Lookup sometimes needs several lines of context. If paragraph isn’t good enough, then block is probably not good enough either. You realize that we can have each paragraph being isolated by a div, right? Comment on attachment 199826 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=199826&action=review >> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:510 >> + // A "paragraph" is not enough as it may stop at a <br> and Lookup sometimes needs several lines of context. > > If paragraph isn’t good enough, then block is probably not good enough either. > You realize that we can have each paragraph being isolated by a div, right? I do. This is of course best-effort and there's no solution that can work with all the web pages out there. My take is that a good Web author will put any related information (that Lookup cares about) in the same block. If that doesn't work, Lookup will do its best given the partial context. The user can select text manually if that's not enough... Comment on attachment 199826 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=199826&action=review >>> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:510 >>> + // A "paragraph" is not enough as it may stop at a <br> and Lookup sometimes needs several lines of context. >> >> If paragraph isn’t good enough, then block is probably not good enough either. >> You realize that we can have each paragraph being isolated by a div, right? > > I do. This is of course best-effort and there's no solution that can work with all the web pages out there. My take is that a good Web author will put any related information (that Lookup cares about) in the same block. If that doesn't work, Lookup will do its best given the partial context. The user can select text manually if that's not enough... Why don’t we get 3 paragraphs around the word instead? Created attachment 202717 [details]
Patch
Comment on attachment 202717 [details] Patch Clearing flags on attachment: 202717 Committed r150653: <http://trac.webkit.org/changeset/150653> All reviewed patches have been landed. Closing bug. This caused https://bugs.webkit.org/show_bug.cgi?id=117020. |