Remove inline member functions of FrameSelection that access m_selection
https://bugs.webkit.org/show_bug.cgi?id=127986

Reviewed by Enrica Casucci.

Source/WebCore: 

Removed numerous inline member functions of FrameSelection that depend on m_selection.

This is needed to ensure all accesses to m_selection happen through FrameSelection::selection(),
which in turn, allows us to update its call sites to use either validated selection that editing
and rendering code uses or invalidated selection that's exposed to JavaScript.

* WebCore.exp.in:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _convertToNSRange:]):
(-[WebAccessibilityObjectWrapper _convertToDOMRange:]):
* bindings/objc/DOMUIKitExtensions.mm:
(-[DOMRange move:inDirection:]):
(-[DOMRange extend:inDirection:]):
* dom/Element.cpp:
(WebCore::Element::updateFocusAppearance):
* editing/Editor.cpp:
(WebCore::Editor::canEdit):
(WebCore::Editor::canEditRichly):
(WebCore::Editor::canDHTMLCut):
(WebCore::Editor::canDHTMLCopy):
(WebCore::Editor::canCopy):
(WebCore::Editor::canDelete):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::tryDHTMLCopy):
(WebCore::Editor::tryDHTMLCut):
(WebCore::Editor::applyStyle):
(WebCore::Editor::applyParagraphStyle):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::paste):
(WebCore::Editor::setComposition):
(WebCore::Editor::guessesForMisspelledOrUngrammatical):
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::isSpellCheckingEnabledInFocusedNode):
(WebCore::Editor::markAndReplaceFor):
(WebCore::Editor::getCompositionSelection):
(WebCore::Editor::selectionStartHasMarkerFor):
* editing/EditorCommand.cpp:
(WebCore::expandSelectionToGranularity):
(WebCore::enabledInRichlyEditableText):
(WebCore::enabledRangeInEditableText):
(WebCore::enabledRangeInRichlyEditableText):
* editing/FrameSelection.cpp:
(WebCore::CaretBase::updateCaretRect):
(WebCore::FrameSelection::recomputeCaretRect):
(WebCore::FrameSelection::selectAll):
(WebCore::FrameSelection::updateAppearance):
(WebCore::FrameSelection::updateSelectionCachesIfSelectionIsInsideTextFormControl):
(WebCore::FrameSelection::setFocusedElementIfNeeded):
(WebCore::FrameSelection::currentForm):
(WebCore::FrameSelection::revealSelection):
(WebCore::FrameSelection::setSelectionFromNone):
* editing/FrameSelection.h:
(WebCore::FrameSelection::isCaretOrRange):
* editing/RemoveFormatCommand.cpp:
(WebCore::RemoveFormatCommand::doApply):
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::isInPasswordField):
* editing/VisibleSelection.h:
* editing/mac/EditorMac.mm:
(WebCore::Editor::canCopyExcludingStandaloneImages):
(WebCore::Editor::readSelectionFromPasteboard):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::defaultEventHandler):
(WebCore::HTMLAnchorElement::setActive):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::computeSelectionStart):
(WebCore::HTMLTextFormControlElement::computeSelectionEnd):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
* page/DragController.cpp:
(WebCore::DragController::dragIsMove):
(WebCore::setSelectionToDragCaret):
(WebCore::DragController::concludeEditDrag):
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::nodeIsNotBeingEdited):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::handleDrag):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::clearSelectionIfNeeded):
* page/ios/FrameIOS.mm:
(WebCore::Frame::caretRect):
(WebCore::Frame::rectForScrollToVisible):
(WebCore::Frame::styleAtSelectionStart):
(WebCore::Frame::setRangedSelectionBaseToCurrentSelectionStart):
(WebCore::Frame::setRangedSelectionBaseToCurrentSelectionEnd):
(WebCore::Frame::setRangedSelectionInitialExtentToCurrentSelectionStart):
(WebCore::Frame::setRangedSelectionInitialExtentToCurrentSelectionEnd):
(WebCore::Frame::interpretationsForCurrentRoot):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintCaret):

Source/WebKit/efl: 

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::selectedRange):
* ewk/ewk_frame.cpp:
(ewk_frame_text_selection_type_get):

Source/WebKit/gtk: 

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::selectedRange):
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::collapseSelection):

Source/WebKit/ios: 

* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame extendSelection:]):
(-[WebFrame ensureRangedSelectionContainsInitialStartPoint:initialEndPoint:]):
(-[WebFrame aggressivelyExpandSelectionToWordContainingCaretSelection]):
(-[WebFrame expandSelectionToSentence]):
(-[WebFrame setBaseWritingDirection:]):
(-[WebFrame smartExtendRangedSelection:]):

Source/WebKit/mac: 

* WebView/WebFrame.mm:
(-[WebFrame hasEditableSelection]):
(-[WebFrame selectionAffinity]):
(-[WebFrame getDictationResultRanges:andMetadatas:]):
(-[WebFrame hasRichlyEditableSelection]):
(-[WebFrame focusedNodeHasContent]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView readSelectionFromPasteboard:]):
(-[WebHTMLView _hasSelection]):
(-[WebHTMLView _hasSelectionOrInsertionPoint]):
(-[WebHTMLView _hasInsertionPoint]):
(-[WebHTMLView _isEditable]):
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
(-[WebHTMLView maintainsInactiveSelection]):
(isTextInput):
(isInPasswordField):
* WebView/WebView.mm:
(-[WebView selectionAffinity]):

Source/WebKit2: 

* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::collapseSelection):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):
(WebKit::WebPage::confirmComposition):
(WebKit::WebPage::setComposition):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::updateSelectionWithTouches):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::getAttributedSubstringFromRange):

Tools: 

* TestWebKitAPI/Configurations/Base.xcconfig:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163232 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Debug build fix after r163232. Call hasEditableStyle() instead of isContentEditable() which
can trigger a layout synchronously inside paintCaret. This matches the code before r163232.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintCaret):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163233 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: Index cursors use wrong deserialization for the retrieved value
https://bugs.webkit.org/show_bug.cgi?id=128035

Reviewed by Dan Bernstein.

Source/WebCore:

For the cursor operations, add an IDBKey value result in the callbacks.
If an already deserialized IDBKey value exists it will be preferred over the serialized buffer.

Change some of the onSuccess() callback formats:
* Modules/indexeddb/IDBCallbacks.h:
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess): Selectively choose between the IDBKey or the SharedBuffer value
  when choosed what to convert to the ScriptValue.
* Modules/indexeddb/IDBRequest.h:

Let the IDBCursorBackend hold both a value buffer and a value key:
* Modules/indexeddb/IDBCursorBackend.cpp:
(WebCore::IDBCursorBackend::updateCursorData):
(WebCore::IDBCursorBackend::clear):
* Modules/indexeddb/IDBCursorBackend.h:
(WebCore::IDBCursorBackend::valueBuffer):
(WebCore::IDBCursorBackend::valueKey):

* Modules/indexeddb/IDBCursorBackendOperations.cpp:
(WebCore::CursorAdvanceOperation::perform):
(WebCore::CursorIterationOperation::perform):

* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
(WebCore::OpenCursorOperation::perform):

* Modules/indexeddb/IDBServerConnection.h:
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp:
(WebCore::IDBServerConnectionLevelDB::openCursor):
(WebCore::IDBServerConnectionLevelDB::cursorAdvance):
(WebCore::IDBServerConnectionLevelDB::cursorIterate):
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h:

Add IDBKey/IDBKeyData debug logging utilities:
* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::loggingString):
* Modules/indexeddb/IDBKey.h:
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString):
* Modules/indexeddb/IDBKeyData.h:

* WebCore.exp.in:

Source/WebKit2:

Most of this is updating everything related to the cursor operation callbacks
to support returning an IDBKey value in addition to a SharedBuffer value.

* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::openCursor):
(WebKit::DatabaseProcessIDBConnection::cursorAdvance):
(WebKit::DatabaseProcessIDBConnection::cursorIterate):

* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::openCursor):
(WebKit::UniqueIDBDatabase::cursorAdvance):
(WebKit::UniqueIDBDatabase::cursorIterate):
(WebKit::UniqueIDBDatabase::openCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didOpenCursorInBackingStore):
(WebKit::UniqueIDBDatabase::advanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didAdvanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::iterateCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didIterateCursorInBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:

* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::openCursor):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::advanceCursor):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::iterateCursor):
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:

* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::SQLiteIDBCursor::advance):
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h:
(WebKit::SQLiteIDBCursor::currentValueBuffer):
(WebKit::SQLiteIDBCursor::currentValueKey):

* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::didOpenCursor):
(WebKit::WebIDBServerConnection::didAdvanceCursor):
(WebKit::WebIDBServerConnection::didIterateCursor):
(WebKit::WebIDBServerConnection::openCursor):
(WebKit::WebIDBServerConnection::cursorAdvance):
(WebKit::WebIDBServerConnection::cursorIterate):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Release build fix after r163234. Don't always export the symbol that doesn't exist under NDEBUG.

* WebCore.exp.in:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163235 268f45cc-cd09-0410-ab3c-d52691b4dbfc