Reproduction: <pre contenteditable=true style="width:100%; height:40%; border:solid 1 black; margin-left:4px; padding-left:4px; overflow-y:scroll;"></pre> http://crbug.com/40480
Created attachment 112983 [details] fixes the bug
Created attachment 112984 [details] Fixed typo in comment
Comment on attachment 112984 [details] Fixed typo in comment View in context: https://bugs.webkit.org/attachment.cgi?id=112984&action=review > Source/WebCore/editing/htmlediting.cpp:1182 > + return node->hasTagName(listingTag) > + || node->hasTagName(olTag) > + || node->hasTagName(preTag) > + || node->hasTagName(tableTag) > + || node->hasTagName(ulTag) > + || node->hasTagName(xmpTag) > + || node->hasTagName(h1Tag) > + || node->hasTagName(h2Tag) > + || node->hasTagName(h3Tag) > + || node->hasTagName(h4Tag) > + || node->hasTagName(h5Tag); Normally these would all be indented one tab stop (four spaces). Not sure if the compiler will notice the common subexpression and remove the 11 unneeded checks of the “is element” bit. If not, the function could be written with an early exit and cast to make sure it gets that right.
Comment on attachment 112984 [details] Fixed typo in comment View in context: https://bugs.webkit.org/attachment.cgi?id=112984&action=review Thanks for the review! >> Source/WebCore/editing/htmlediting.cpp:1182 >> + || node->hasTagName(h5Tag); > > Normally these would all be indented one tab stop (four spaces). > > Not sure if the compiler will notice the common subexpression and remove the 11 unneeded checks of the “is element” bit. If not, the function could be written with an early exit and cast to make sure it gets that right. We should just rewrite this using hashmap at some point. Also it's missing h6 :( Will fix the style before landing it.
(In reply to comment #4) > We should just rewrite this using hashmap at some point. Also it's missing h6 :( Will fix the style before landing it. This is such a small set of values that a linear or binary search might be faster than a hash map.
Committed r98899: <http://trac.webkit.org/changeset/98899>