Frame::rectForSelection shouldn't instantiate FrameSelection
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Feb 2014 01:53:03 +0000 (01:53 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Feb 2014 01:53:03 +0000 (01:53 +0000)
commitaa673103a2b0e69036b56e7c46ea5cb6170f3bb7
treec0b6d30dd7bab35320ecc9f7cf917fd746a22d80
parent0efba8cc690c42c36fc30bab0727f7f81508a1e0
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
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/FrameSelection.h
Source/WebCore/editing/VisiblePosition.cpp
Source/WebCore/editing/htmlediting.cpp
Source/WebCore/editing/htmlediting.h
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/EditorClient.h
Source/WebCore/page/Frame.h
Source/WebCore/page/ios/FrameIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm