Frame::rectForSelection shouldn't instantiate FrameSelection
https://bugs.webkit.org/show_bug.cgi?id=128587
Reviewed by Enrica Casucci.
Source/WebCore:
Made VisiblePosition::absoluteCaretBounds more interoperable with the one in FrameSelection and made
iOS's Frame::rectForScrollToVisible use that function instead.
The above change allows us to remove:
- suppressCloseTyping(), restoreCloseTyping(), and m_closeTypingSuppressions in FrameSelection
- suppressSelectionNotifications() and restoreSelectionNotifications() in EditorClient
See inline comments below for more details.
* Source/WebCore/WebCore.exp.in:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::FrameSelection):
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
(WebCore::CaretBase::updateCaretRect):
(WebCore::FrameSelection::caretRendererWithoutUpdatingLayout):
(WebCore::DragCaretController::caretRenderer):
(WebCore::repaintCaretForLocalRect):
(WebCore::FrameSelection::recomputeCaretRect): Merged FrameSelection::localCaretRect(). Modified
the code to update caretNode when and only when caret rect is updated. Also added an assertion to
ensure absoluteCaretBounds() on FrameSelection and VisiblePosition yield the same result.
(WebCore::CaretBase::paintCaret):
* editing/FrameSelection.h:
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::absoluteCaretBounds): Fixed the bug where the old code wasn't respecting
the convention to use containing block as the renderer to paint caret.
* editing/htmlediting.cpp:
(WebCore::caretRendersInsideNode): Moved from FrameSelection.cpp.
(WebCore::rendererForCaretPainting): Ditto and renamed from caretRenderer.
(WebCore::localCaretRectInRendererForCaretPainting): Extracted from FrameSelection::updateCaretRect.
(WebCore::absoluteBoundsForLocalCaretRect): Ditto from CaretBase::absoluteBoundsForLocalRect.
* editing/htmlediting.h:
* loader/EmptyClients.h:
* page/EditorClient.h:
* page/Frame.h:
* page/ios/FrameIOS.mm:
(WebCore::Frame::rectForScrollToVisible): Reimplemented in its simplest form using VisiblePosition's
absoluteCaretBounds().
Source/WebKit/mac:
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::WebEditorClient):
(WebEditorClient::respondToChangedSelection):
Source/WebKit2:
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163920
268f45cc-cd09-0410-ab3c-
d52691b4dbfc