Caret is not rendered in empty inline contenteditable elements
https://bugs.webkit.org/show_bug.cgi?id=85793
Patch by Shezan Baig <shezbaig.wk@gmail.com> on 2012-06-08
Reviewed by Ryosuke Niwa.
Source/WebCore:
Override localCaretRect in RenderInline. The implementation was almost
identical to localCaretRect in RenderBlock for empty block elements, so
I refactored RenderBlock::localCaretRect and moved the logic to a new
method 'localCaretRectForEmptyElement' in RenderBoxModelObject. The
implementation of 'localCaretRect' in RenderBlock and RenderInline both
use this helper method in RenderBoxModelObject.
Tests: editing/selection/caret-in-empty-inline-1.html
editing/selection/caret-in-empty-inline-2.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::localCaretRect):
Modified to use RenderBoxModelObject::localCaretRectForEmptyElement.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::localCaretRectForEmptyElement):
(WebCore):
* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):
Add localCaretRectForEmptyElement helper method.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::localCaretRect):
(WebCore):
* rendering/RenderInline.h:
(RenderInline):
Override localCaretRect using localCaretRectForEmptyElement.
LayoutTests:
Add test cases for caret in empty inline.
* editing/selection/caret-in-empty-inline-1-expected.txt: Added.
* editing/selection/caret-in-empty-inline-1.html: Added.
* editing/selection/caret-in-empty-inline-2-expected.txt: Added.
* editing/selection/caret-in-empty-inline-2.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
11 files changed