⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 161638 in webkit


Ignore:
Timestamp:
Jan 10, 2014, 9:06:52 AM (13 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Upstream WebCore and Tools miscellaneous changes
https://bugs.webkit.org/show_bug.cgi?id=126698

Reviewed by David Kilzer.

Source/WebCore:

  • Configurations/Base.xcconfig:
  • Configurations/WebCore.xcconfig:
  • Configurations/WebCoreTestSupport.xcconfig:
  • Configurations/iOS.xcconfig: Added.
  • DerivedSources.make:
  • English.lproj/Localizable.strings:
  • Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp: Copied from Source/WebCore/editing/TextAffinity.h.

(WebCore::stringForPlaybackTargetAvailability):
(WebCore::WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent):

  • Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h: Added.

(WebCore::WebKitPlaybackTargetAvailabilityEventInit::WebKitPlaybackTargetAvailabilityEventInit):
(WebCore::WebKitPlaybackTargetAvailabilityEvent::~WebKitPlaybackTargetAvailabilityEvent):
(WebCore::WebKitPlaybackTargetAvailabilityEvent::create):
(WebCore::WebKitPlaybackTargetAvailabilityEvent::availability):

  • Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl: Copied from Source/WebCore/editing/DeleteButton.h.
  • Modules/geolocation/Geolocation.cpp:

(WebCore::Geolocation::Geolocation):
(WebCore::Geolocation::canSuspend):
(WebCore::Geolocation::suspend):
(WebCore::Geolocation::resume):
(WebCore::Geolocation::resumeTimerFired):
(WebCore::Geolocation::resetAllGeolocationPermission):
(WebCore::Geolocation::stop):
(WebCore::Geolocation::setIsAllowed):
(WebCore::Geolocation::positionChanged):
(WebCore::Geolocation::setError):

  • Modules/geolocation/Geolocation.h:
  • Modules/geolocation/NavigatorGeolocation.cpp:

(WebCore::NavigatorGeolocation::resetAllGeolocationPermission):

  • Modules/geolocation/NavigatorGeolocation.h:
  • Modules/speech/SpeechSynthesis.cpp:

(WebCore::SpeechSynthesis::SpeechSynthesis):
(WebCore::SpeechSynthesis::speak):

  • Modules/speech/SpeechSynthesis.h:

(WebCore::SpeechSynthesis::userGestureRequiredForSpeechStart):
(WebCore::SpeechSynthesis::removeBehaviorRestriction):

  • Modules/webaudio/AudioContext.cpp:
  • Modules/webaudio/AudioContext.h:
  • Modules/webaudio/AudioScheduledSourceNode.cpp:
  • Modules/webdatabase/Database.cpp:
  • Modules/webdatabase/DatabaseBackendBase.cpp:

(WebCore::DatabaseBackendBase::performOpenAndVerify):
(WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded):

  • Modules/webdatabase/DatabaseContext.cpp:

(WebCore::DatabaseContext::DatabaseContext):
(WebCore::DatabaseContext::databaseThread):
(WebCore::DatabaseContext::setPaused):

  • Modules/webdatabase/DatabaseContext.h:
  • Modules/webdatabase/DatabaseManagerClient.h:
  • Modules/webdatabase/DatabaseTask.cpp:

(WebCore::DatabaseTask::performTask):
(WebCore::Database::DatabaseTransactionTask::shouldPerformWhilePaused):

  • Modules/webdatabase/DatabaseTask.h:
  • Modules/webdatabase/DatabaseThread.cpp:

(WebCore::DatabaseThread::DatabaseThread):
(WebCore::DatabaseThread::requestTermination):
(WebCore::DatabaseUnpauseTask::create):
(WebCore::DatabaseUnpauseTask::shouldPerformWhilePaused):
(WebCore::DatabaseUnpauseTask::DatabaseUnpauseTask):
(WebCore::DatabaseUnpauseTask::doPerformTask):
(WebCore::DatabaseUnpauseTask::debugTaskName):
(WebCore::DatabaseThread::setPaused):
(WebCore::DatabaseThread::handlePausedQueue):
(WebCore::DatabaseThread::databaseThread):

  • Modules/webdatabase/DatabaseThread.h:
  • Modules/webdatabase/DatabaseTracker.cpp:

(WebCore::DatabaseTracker::setQuota):
(WebCore::DatabaseTracker::deleteOrigin):
(WebCore::DatabaseTracker::deleteDatabase):
(WebCore::DatabaseTracker::deleteDatabaseFile):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
(WebCore::isZeroByteFile):
(WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
(WebCore::DatabaseTracker::openDatabaseMutex):
(WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
(WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
(WebCore::DatabaseTracker::setDatabasesPaused):

  • Modules/webdatabase/DatabaseTracker.h:
  • Modules/webdatabase/SQLTransactionBackend.cpp:

(WebCore::SQLTransactionBackend::shouldPerformWhilePaused):

  • Modules/webdatabase/SQLTransactionBackend.h:
  • Resources/DictationPhraseWithAlternativesDot.png: Added.
  • Resources/DictationPhraseWithAlternativesDot@2x.png: Added.
  • Resources/SpellingDot.png: Added.
  • Resources/SpellingDot@2x.png: Added.
  • Resources/decrementArrow.tiff: Added.
  • Resources/hScrollControl_left.png: Added.
  • Resources/hScrollControl_middle.png: Added.
  • Resources/hScrollControl_right.png: Added.
  • Resources/incrementArrow.tiff: Added.
  • Resources/markedLeft.png: Added.
  • Resources/markedMiddle.png: Added.
  • Resources/markedRight.png: Added.
  • Resources/vScrollControl_bottom.png: Added.
  • Resources/vScrollControl_middle.png: Added.
  • Resources/vScrollControl_top.png: Added.
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/GCController.cpp:

(WebCore::GCController::garbageCollectNow):
(WebCore::GCController::releaseExecutableMemory):

  • bindings/js/GCController.h:
  • bindings/js/JSCallbackData.h:

(WebCore::JSCallbackData::~JSCallbackData):

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::supportsProfiling):
(WebCore::JSDOMWindowBase::shouldInterruptScriptBeforeTimeout):
(WebCore::JSDOMWindowBase::commonVM):
(WebCore::JSDOMWindowBase::commonVMExists):
(WebCore::JSDOMWindowBase::commonVMInternal):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::touch):
(WebCore::JSDOMWindow::touchList):

  • bindings/js/JSDeviceOrientationEventCustom.cpp:

(WebCore::JSDeviceOrientationEvent::webkitCompassHeading):
(WebCore::JSDeviceOrientationEvent::webkitCompassAccuracy):
(WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):

  • bindings/js/JSMainThreadExecState.h:
  • bindings/js/JSTouchCustom.cpp:
  • bindings/js/JSTouchListCustom.cpp:
  • bindings/js/PageScriptDebugServer.cpp:

(WebCore::PageScriptDebugServer::didContinue):

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::initializeThreading):

  • bindings/js/ScriptDebugServer.cpp:

(WebCore::ScriptDebugServer::handlePause):

  • bindings/js/ios/TouchConstructors.cpp: Added.
  • bindings/objc/DOM.mm:

(WebCore::wkQuadFromFloatQuad):
(WebCore::kit):
(WebCore::min4):
(WebCore::max4):
(WebCore::emptyQuad):
(-[WKQuadObject initWithQuad:]):
(-[WKQuadObject quad]):
(-[WKQuadObject boundingBox]):
(-[DOMNode boundingBox]):
(-[DOMNode absoluteQuad]):
(-[DOMNode absoluteQuadAndInsideFixedPosition:]):
(-[DOMNode boundingBoxUsingTransforms]):
(-[DOMNode lineBoxQuads]):
(-[DOMNode _linkElement]):
(-[DOMNode hrefURL]):
(-[DOMNode hrefTarget]):
(-[DOMNode hrefFrame]):
(-[DOMNode hrefLabel]):
(-[DOMNode hrefTitle]):
(-[DOMNode boundingFrame]):
(-[DOMNode innerFrameQuad]):
(-[DOMNode computedFontSize]):
(-[DOMNode nextFocusNode]):
(-[DOMNode previousFocusNode]):
(-[DOMRange boundingBox]):
(-[DOMRange renderedImageForcingBlackText:renderedImageForcingBlackText:]):
(-[DOMElement _font]):
(-[DOMHTMLLinkElement _mediaQueryMatchesForOrientation:]):
(-[DOMHTMLLinkElement _mediaQueryMatches]):

  • bindings/objc/DOMEvents.h:
  • bindings/objc/DOMEvents.mm:

(kitClass):

  • bindings/objc/DOMExtensions.h:
  • bindings/objc/DOMHTML.mm:

(-[DOMHTMLElement scrollYOffset]):
(-[DOMHTMLElement setScrollXOffset:scrollYOffset:]):
(-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):
(-[DOMHTMLElement absolutePosition::::]):
(-[DOMHTMLInputElement _autocapitalizeType]):
(-[DOMHTMLTextAreaElement _autocapitalizeType]):
(-[DOMHTMLInputElement setValueWithChangeEvent:]):
(-[DOMHTMLInputElement setValueAsNumberWithChangeEvent:]):

  • bindings/objc/DOMInternal.h:
  • bindings/objc/DOMInternal.mm:

(wrapperCacheLock):
(getDOMWrapper):
(addDOMWrapper):
(removeDOMWrapper):

  • bindings/objc/DOMPrivate.h:
  • bindings/objc/DOMUIKitExtensions.h: Added.
  • bindings/objc/DOMUIKitExtensions.mm: Added.
  • bindings/objc/PublicDOMInterfaces.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeaderContentHeader):
(GenerateImplementationContentHeader):
(GenerateHeader):
(GenerateImplementation):
(GenerateCallbackImplementation):

  • bindings/scripts/CodeGeneratorObjC.pm:

(ReadPublicInterfaces):
(GetClassName):
(IsCoreFoundationType):
(GetObjCType):
(AddIncludesForType):
(GenerateHeader):
(GenerateImplementation):
(WriteData):

  • bindings/scripts/IDLAttributes.txt:
  • bindings/scripts/preprocessor.pm:

(applyPreprocessor):

  • bridge/objc/objc_class.mm:

(JSC::Bindings::ObjcClass::fieldNamed):

  • bridge/objc/objc_instance.mm:
  • config.h:
  • dom/Document.cpp:

(WebCore::Document::addAutoSizingNode):

  • dom/Document.h:
  • dom/Document.idl:
  • dom/ios/TouchEvents.cpp: Added.
  • editing/ApplyStyleCommand.cpp:

(WebCore::ApplyStyleCommand::applyBlockStyle):

  • editing/CompositeEditCommand.cpp:

(WebCore::EditCommandComposition::unapply):
(WebCore::CompositeEditCommand::apply):
(WebCore::CompositeEditCommand::inputText):
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
(WebCore::CompositeEditCommand::moveParagraphs):

  • editing/CompositeEditCommand.h:
  • editing/DeleteButton.h:
  • editing/DeleteButtonController.cpp:

(WebCore::DeleteButtonController::enable):
(WebCore::DeleteButtonController::disable):

  • editing/DeleteSelectionCommand.cpp:

(WebCore::DeleteSelectionCommand::doApply):

  • editing/DeleteSelectionCommand.h:
  • editing/EditAction.h:
  • editing/EditCommand.h:

(WebCore::EditCommand::isInsertTextCommand):

  • editing/EditingStyle.cpp:
  • editing/Editor.cpp:

(WebCore::ClearTextCommand::ClearTextCommand):
(WebCore::ClearTextCommand::editingAction):
(WebCore::ClearTextCommand::CreateAndApply):
(WebCore::Editor::handleTextEvent):
(WebCore::Editor::clearText):
(WebCore::Editor::insertDictationPhrases):
(WebCore::Editor::setDictationPhrasesAsChildOfElement):
(WebCore::Editor::confirmMarkedText):
(WebCore::Editor::setTextAsChildOfElement):
(WebCore::Editor::notifyComponentsOnChangedSelection):
(WebCore::Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping):
(WebCore::Editor::copy):
(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::setComposition):
(WebCore::Editor::showSpellingGuessPanel):
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::markMisspellingsOrBadGrammar):
(WebCore::Editor::changeBackToReplacedString):
(WebCore::Editor::updateMarkersForWordsAffectedByEditing):
(WebCore::Editor::setIgnoreCompositionSelectionChange):
(WebCore::Editor::changeSelectionAfterCommand):
(WebCore::Editor::shouldChangeSelection):
(WebCore::Editor::respondToChangedSelection):
(WebCore::Editor::resolveTextCheckingTypeMask):

  • editing/Editor.h:
  • editing/EditorCommand.cpp:

(WebCore::executeClearText):
(WebCore::enabledCopy):
(WebCore::enabledCut):
(WebCore::enabledClearText):
(WebCore::createCommandMap):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::FrameSelection):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::modifyExtendingRight):
(WebCore::FrameSelection::modifyExtendingForward):
(WebCore::FrameSelection::modifyMovingRight):
(WebCore::FrameSelection::modifyMovingForward):
(WebCore::FrameSelection::modifyExtendingLeft):
(WebCore::FrameSelection::modifyExtendingBackward):
(WebCore::FrameSelection::modifyMovingLeft):
(WebCore::FrameSelection::modifyMovingBackward):
(WebCore::FrameSelection::setSelectedRange):
(WebCore::FrameSelection::focusedOrActiveStateChanged):
(WebCore::FrameSelection::updateAppearance):
(WebCore::FrameSelection::shouldDeleteSelection):
(WebCore::FrameSelection::revealSelection):
(WebCore::FrameSelection::setSelectionFromNone):
(WebCore::FrameSelection::shouldChangeSelection):
(WebCore::FrameSelection::expandSelectionToElementContainingCaretSelection):
(WebCore::FrameSelection::elementRangeContainingCaretSelection):
(WebCore::FrameSelection::expandSelectionToWordContainingCaretSelection):
(WebCore::FrameSelection::wordRangeContainingCaretSelection):
(WebCore::FrameSelection::expandSelectionToStartOfWordContainingCaretSelection):
(WebCore::FrameSelection::characterInRelationToCaretSelection):
(WebCore::FrameSelection::characterBeforeCaretSelection):
(WebCore::FrameSelection::characterAfterCaretSelection):
(WebCore::FrameSelection::wordOffsetInRange):
(WebCore::FrameSelection::spaceFollowsWordInRange):
(WebCore::FrameSelection::selectionAtDocumentStart):
(WebCore::FrameSelection::selectionAtSentenceStart):
(WebCore::FrameSelection::selectionAtWordStart):
(WebCore::FrameSelection::rangeByMovingCurrentSelection):
(WebCore::FrameSelection::rangeByExtendingCurrentSelection):
(WebCore::FrameSelection::selectRangeOnElement):
(WebCore::FrameSelection::wordSelectionContainingCaretSelection):
(WebCore::FrameSelection::actualSelectionAtSentenceStart):
(WebCore::FrameSelection::rangeByAlteringCurrentSelection):
(WebCore::FrameSelection::clearCurrentSelection):
(WebCore::FrameSelection::setCaretBlinks):
(WebCore::FrameSelection::setCaretColor):

  • editing/FrameSelection.h:

(WebCore::FrameSelection::suppressCloseTyping):
(WebCore::FrameSelection::restoreCloseTyping):
(WebCore::FrameSelection::setUpdateAppearanceEnabled):
(WebCore::FrameSelection::suppressScrolling):
(WebCore::FrameSelection::restoreScrolling):

  • editing/InsertIntoTextNodeCommand.cpp:

(WebCore::InsertIntoTextNodeCommand::doReapply):

  • editing/InsertIntoTextNodeCommand.h:
  • editing/InsertTextCommand.h:
  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::doApply):

  • editing/TextAffinity.h:
  • editing/TextCheckingHelper.cpp:
  • editing/TextGranularity.h:
  • editing/TextIterator.cpp:

(WebCore::isRendererReplacedElement):

  • editing/TypingCommand.cpp:

(WebCore::TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping):
(WebCore::TypingCommand::markMisspellingsAfterTyping):
(WebCore::TypingCommand::deleteKeyPressed):
(WebCore::TypingCommand::forwardDeleteKeyPressed):
(WebCore::FriendlyEditCommand::setEndingSelection):
(WebCore::TypingCommand::setEndingSelectionOnLastInsertCommand):

  • editing/TypingCommand.h:
  • editing/VisiblePosition.h:

(WebCore::operator<):
(WebCore::operator>):
(WebCore::operator<=):
(WebCore::operator>=):

  • editing/VisibleSelection.cpp:

(WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
(WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries):

  • editing/VisibleUnits.cpp:

(WebCore::previousBoundary):
(WebCore::nextBoundary):
(WebCore::startOfDocument):
(WebCore::endOfDocument):
(WebCore::directionIsDownstream):
(WebCore::atBoundaryOfGranularity):
(WebCore::withinTextUnitOfGranularity):
(WebCore::nextCharacterBoundaryInDirection):
(WebCore::nextWordBoundaryInDirection):
(WebCore::nextSentenceBoundaryInDirection):
(WebCore::nextLineBoundaryInDirection):
(WebCore::nextParagraphBoundaryInDirection):
(WebCore::nextDocumentBoundaryInDirection):
(WebCore::positionOfNextBoundaryOfGranularity):
(WebCore::enclosingTextUnitOfGranularity):
(WebCore::distanceBetweenPositions):
(WebCore::wordRangeFromPosition):
(WebCore::closestWordBoundaryForPosition):

  • editing/VisibleUnits.h:
  • editing/ios/DictationCommandIOS.cpp: Added.
  • editing/ios/DictationCommandIOS.h: Added.

(WebCore::DictationCommandIOS::create):
(WebCore::DictationCommandIOS::editingAction):

  • editing/mac/FrameSelectionMac.mm:

(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):

  • fileapi/AsyncFileStream.cpp:
  • generate-export-file: Added.
  • inspector/InspectorCounters.h:
  • inspector/InspectorFrontendHost.h:
  • make-export-file-generator:
  • plugins/PluginPackage.h:
  • plugins/PluginViewBase.h:

(WebCore::PluginViewBase::willProvidePluginLayer):
(WebCore::PluginViewBase::attachPluginLayer):
(WebCore::PluginViewBase::detachPluginLayer):

  • style/StyleResolveForDocument.cpp:

(WebCore::Style::resolveForDocument):

  • style/StyleResolveTree.cpp:

(WebCore::Style::elementImplicitVisibility):

  • testing/Internals.cpp:

(WebCore::Internals::getCurrentCursorInfo):
(WebCore::Internals::isSelectPopupVisible):

  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::workerThread):

Source/WebKit:

  • WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

  • MigrateHeaders.make:

Tools:

  • Scripts/check-for-inappropriate-objc-class-names:
  • Scripts/check-for-webkit-framework-include-consistency:
Location:
trunk
Files:
27 added
107 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r161637 r161638  
     12014-01-10  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Upstream WebCore and Tools miscellaneous changes
     4        https://bugs.webkit.org/show_bug.cgi?id=126698
     5
     6        Reviewed by David Kilzer.
     7
     8        * Configurations/Base.xcconfig:
     9        * Configurations/WebCore.xcconfig:
     10        * Configurations/WebCoreTestSupport.xcconfig:
     11        * Configurations/iOS.xcconfig: Added.
     12        * DerivedSources.make:
     13        * English.lproj/Localizable.strings:
     14        * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp: Copied from Source/WebCore/editing/TextAffinity.h.
     15        (WebCore::stringForPlaybackTargetAvailability):
     16        (WebCore::WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent):
     17        * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h: Added.
     18        (WebCore::WebKitPlaybackTargetAvailabilityEventInit::WebKitPlaybackTargetAvailabilityEventInit):
     19        (WebCore::WebKitPlaybackTargetAvailabilityEvent::~WebKitPlaybackTargetAvailabilityEvent):
     20        (WebCore::WebKitPlaybackTargetAvailabilityEvent::create):
     21        (WebCore::WebKitPlaybackTargetAvailabilityEvent::availability):
     22        * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl: Copied from Source/WebCore/editing/DeleteButton.h.
     23        * Modules/geolocation/Geolocation.cpp:
     24        (WebCore::Geolocation::Geolocation):
     25        (WebCore::Geolocation::canSuspend):
     26        (WebCore::Geolocation::suspend):
     27        (WebCore::Geolocation::resume):
     28        (WebCore::Geolocation::resumeTimerFired):
     29        (WebCore::Geolocation::resetAllGeolocationPermission):
     30        (WebCore::Geolocation::stop):
     31        (WebCore::Geolocation::setIsAllowed):
     32        (WebCore::Geolocation::positionChanged):
     33        (WebCore::Geolocation::setError):
     34        * Modules/geolocation/Geolocation.h:
     35        * Modules/geolocation/NavigatorGeolocation.cpp:
     36        (WebCore::NavigatorGeolocation::resetAllGeolocationPermission):
     37        * Modules/geolocation/NavigatorGeolocation.h:
     38        * Modules/speech/SpeechSynthesis.cpp:
     39        (WebCore::SpeechSynthesis::SpeechSynthesis):
     40        (WebCore::SpeechSynthesis::speak):
     41        * Modules/speech/SpeechSynthesis.h:
     42        (WebCore::SpeechSynthesis::userGestureRequiredForSpeechStart):
     43        (WebCore::SpeechSynthesis::removeBehaviorRestriction):
     44        * Modules/webaudio/AudioContext.cpp:
     45        * Modules/webaudio/AudioContext.h:
     46        * Modules/webaudio/AudioScheduledSourceNode.cpp:
     47        * Modules/webdatabase/Database.cpp:
     48        * Modules/webdatabase/DatabaseBackendBase.cpp:
     49        (WebCore::DatabaseBackendBase::performOpenAndVerify):
     50        (WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded):
     51        * Modules/webdatabase/DatabaseContext.cpp:
     52        (WebCore::DatabaseContext::DatabaseContext):
     53        (WebCore::DatabaseContext::databaseThread):
     54        (WebCore::DatabaseContext::setPaused):
     55        * Modules/webdatabase/DatabaseContext.h:
     56        * Modules/webdatabase/DatabaseManagerClient.h:
     57        * Modules/webdatabase/DatabaseTask.cpp:
     58        (WebCore::DatabaseTask::performTask):
     59        (WebCore::Database::DatabaseTransactionTask::shouldPerformWhilePaused):
     60        * Modules/webdatabase/DatabaseTask.h:
     61        * Modules/webdatabase/DatabaseThread.cpp:
     62        (WebCore::DatabaseThread::DatabaseThread):
     63        (WebCore::DatabaseThread::requestTermination):
     64        (WebCore::DatabaseUnpauseTask::create):
     65        (WebCore::DatabaseUnpauseTask::shouldPerformWhilePaused):
     66        (WebCore::DatabaseUnpauseTask::DatabaseUnpauseTask):
     67        (WebCore::DatabaseUnpauseTask::doPerformTask):
     68        (WebCore::DatabaseUnpauseTask::debugTaskName):
     69        (WebCore::DatabaseThread::setPaused):
     70        (WebCore::DatabaseThread::handlePausedQueue):
     71        (WebCore::DatabaseThread::databaseThread):
     72        * Modules/webdatabase/DatabaseThread.h:
     73        * Modules/webdatabase/DatabaseTracker.cpp:
     74        (WebCore::DatabaseTracker::setQuota):
     75        (WebCore::DatabaseTracker::deleteOrigin):
     76        (WebCore::DatabaseTracker::deleteDatabase):
     77        (WebCore::DatabaseTracker::deleteDatabaseFile):
     78        (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
     79        (WebCore::isZeroByteFile):
     80        (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
     81        (WebCore::DatabaseTracker::openDatabaseMutex):
     82        (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
     83        (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
     84        (WebCore::DatabaseTracker::setDatabasesPaused):
     85        * Modules/webdatabase/DatabaseTracker.h:
     86        * Modules/webdatabase/SQLTransactionBackend.cpp:
     87        (WebCore::SQLTransactionBackend::shouldPerformWhilePaused):
     88        * Modules/webdatabase/SQLTransactionBackend.h:
     89        * Resources/DictationPhraseWithAlternativesDot.png: Added.
     90        * Resources/DictationPhraseWithAlternativesDot@2x.png: Added.
     91        * Resources/SpellingDot.png: Added.
     92        * Resources/SpellingDot@2x.png: Added.
     93        * Resources/decrementArrow.tiff: Added.
     94        * Resources/hScrollControl_left.png: Added.
     95        * Resources/hScrollControl_middle.png: Added.
     96        * Resources/hScrollControl_right.png: Added.
     97        * Resources/incrementArrow.tiff: Added.
     98        * Resources/markedLeft.png: Added.
     99        * Resources/markedMiddle.png: Added.
     100        * Resources/markedRight.png: Added.
     101        * Resources/vScrollControl_bottom.png: Added.
     102        * Resources/vScrollControl_middle.png: Added.
     103        * Resources/vScrollControl_top.png: Added.
     104        * WebCore.xcodeproj/project.pbxproj:
     105        * bindings/js/GCController.cpp:
     106        (WebCore::GCController::garbageCollectNow):
     107        (WebCore::GCController::releaseExecutableMemory):
     108        * bindings/js/GCController.h:
     109        * bindings/js/JSCallbackData.h:
     110        (WebCore::JSCallbackData::~JSCallbackData):
     111        * bindings/js/JSDOMWindowBase.cpp:
     112        (WebCore::JSDOMWindowBase::supportsProfiling):
     113        (WebCore::JSDOMWindowBase::shouldInterruptScriptBeforeTimeout):
     114        (WebCore::JSDOMWindowBase::commonVM):
     115        (WebCore::JSDOMWindowBase::commonVMExists):
     116        (WebCore::JSDOMWindowBase::commonVMInternal):
     117        * bindings/js/JSDOMWindowCustom.cpp:
     118        (WebCore::JSDOMWindow::touch):
     119        (WebCore::JSDOMWindow::touchList):
     120        * bindings/js/JSDeviceOrientationEventCustom.cpp:
     121        (WebCore::JSDeviceOrientationEvent::webkitCompassHeading):
     122        (WebCore::JSDeviceOrientationEvent::webkitCompassAccuracy):
     123        (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
     124        * bindings/js/JSMainThreadExecState.h:
     125        * bindings/js/JSTouchCustom.cpp:
     126        * bindings/js/JSTouchListCustom.cpp:
     127        * bindings/js/PageScriptDebugServer.cpp:
     128        (WebCore::PageScriptDebugServer::didContinue):
     129        * bindings/js/ScriptController.cpp:
     130        (WebCore::ScriptController::initializeThreading):
     131        * bindings/js/ScriptDebugServer.cpp:
     132        (WebCore::ScriptDebugServer::handlePause):
     133        * bindings/js/ios/TouchConstructors.cpp: Added.
     134        * bindings/objc/DOM.mm:
     135        (WebCore::wkQuadFromFloatQuad):
     136        (WebCore::kit):
     137        (WebCore::min4):
     138        (WebCore::max4):
     139        (WebCore::emptyQuad):
     140        (-[WKQuadObject initWithQuad:]):
     141        (-[WKQuadObject quad]):
     142        (-[WKQuadObject boundingBox]):
     143        (-[DOMNode boundingBox]):
     144        (-[DOMNode absoluteQuad]):
     145        (-[DOMNode absoluteQuadAndInsideFixedPosition:]):
     146        (-[DOMNode boundingBoxUsingTransforms]):
     147        (-[DOMNode lineBoxQuads]):
     148        (-[DOMNode _linkElement]):
     149        (-[DOMNode hrefURL]):
     150        (-[DOMNode hrefTarget]):
     151        (-[DOMNode hrefFrame]):
     152        (-[DOMNode hrefLabel]):
     153        (-[DOMNode hrefTitle]):
     154        (-[DOMNode boundingFrame]):
     155        (-[DOMNode innerFrameQuad]):
     156        (-[DOMNode computedFontSize]):
     157        (-[DOMNode nextFocusNode]):
     158        (-[DOMNode previousFocusNode]):
     159        (-[DOMRange boundingBox]):
     160        (-[DOMRange renderedImageForcingBlackText:renderedImageForcingBlackText:]):
     161        (-[DOMElement _font]):
     162        (-[DOMHTMLLinkElement _mediaQueryMatchesForOrientation:]):
     163        (-[DOMHTMLLinkElement _mediaQueryMatches]):
     164        * bindings/objc/DOMEvents.h:
     165        * bindings/objc/DOMEvents.mm:
     166        (kitClass):
     167        * bindings/objc/DOMExtensions.h:
     168        * bindings/objc/DOMHTML.mm:
     169        (-[DOMHTMLElement scrollYOffset]):
     170        (-[DOMHTMLElement setScrollXOffset:scrollYOffset:]):
     171        (-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):
     172        (-[DOMHTMLElement absolutePosition::::]):
     173        (-[DOMHTMLInputElement _autocapitalizeType]):
     174        (-[DOMHTMLTextAreaElement _autocapitalizeType]):
     175        (-[DOMHTMLInputElement setValueWithChangeEvent:]):
     176        (-[DOMHTMLInputElement setValueAsNumberWithChangeEvent:]):
     177        * bindings/objc/DOMInternal.h:
     178        * bindings/objc/DOMInternal.mm:
     179        (wrapperCacheLock):
     180        (getDOMWrapper):
     181        (addDOMWrapper):
     182        (removeDOMWrapper):
     183        * bindings/objc/DOMPrivate.h:
     184        * bindings/objc/DOMUIKitExtensions.h: Added.
     185        * bindings/objc/DOMUIKitExtensions.mm: Added.
     186        * bindings/objc/PublicDOMInterfaces.h:
     187        * bindings/scripts/CodeGeneratorJS.pm:
     188        (GenerateHeaderContentHeader):
     189        (GenerateImplementationContentHeader):
     190        (GenerateHeader):
     191        (GenerateImplementation):
     192        (GenerateCallbackImplementation):
     193        * bindings/scripts/CodeGeneratorObjC.pm:
     194        (ReadPublicInterfaces):
     195        (GetClassName):
     196        (IsCoreFoundationType):
     197        (GetObjCType):
     198        (AddIncludesForType):
     199        (GenerateHeader):
     200        (GenerateImplementation):
     201        (WriteData):
     202        * bindings/scripts/IDLAttributes.txt:
     203        * bindings/scripts/preprocessor.pm:
     204        (applyPreprocessor):
     205        * bridge/objc/objc_class.mm:
     206        (JSC::Bindings::ObjcClass::fieldNamed):
     207        * bridge/objc/objc_instance.mm:
     208        * config.h:
     209        * dom/Document.cpp:
     210        (WebCore::Document::addAutoSizingNode):
     211        * dom/Document.h:
     212        * dom/Document.idl:
     213        * dom/ios/TouchEvents.cpp: Added.
     214        * editing/ApplyStyleCommand.cpp:
     215        (WebCore::ApplyStyleCommand::applyBlockStyle):
     216        * editing/CompositeEditCommand.cpp:
     217        (WebCore::EditCommandComposition::unapply):
     218        (WebCore::CompositeEditCommand::apply):
     219        (WebCore::CompositeEditCommand::inputText):
     220        (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
     221        (WebCore::CompositeEditCommand::moveParagraphs):
     222        * editing/CompositeEditCommand.h:
     223        * editing/DeleteButton.h:
     224        * editing/DeleteButtonController.cpp:
     225        (WebCore::DeleteButtonController::enable):
     226        (WebCore::DeleteButtonController::disable):
     227        * editing/DeleteSelectionCommand.cpp:
     228        (WebCore::DeleteSelectionCommand::doApply):
     229        * editing/DeleteSelectionCommand.h:
     230        * editing/EditAction.h:
     231        * editing/EditCommand.h:
     232        (WebCore::EditCommand::isInsertTextCommand):
     233        * editing/EditingStyle.cpp:
     234        * editing/Editor.cpp:
     235        (WebCore::ClearTextCommand::ClearTextCommand):
     236        (WebCore::ClearTextCommand::editingAction):
     237        (WebCore::ClearTextCommand::CreateAndApply):
     238        (WebCore::Editor::handleTextEvent):
     239        (WebCore::Editor::clearText):
     240        (WebCore::Editor::insertDictationPhrases):
     241        (WebCore::Editor::setDictationPhrasesAsChildOfElement):
     242        (WebCore::Editor::confirmMarkedText):
     243        (WebCore::Editor::setTextAsChildOfElement):
     244        (WebCore::Editor::notifyComponentsOnChangedSelection):
     245        (WebCore::Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping):
     246        (WebCore::Editor::copy):
     247        (WebCore::Editor::setBaseWritingDirection):
     248        (WebCore::Editor::setComposition):
     249        (WebCore::Editor::showSpellingGuessPanel):
     250        (WebCore::Editor::markMisspellingsAfterTypingToWord):
     251        (WebCore::Editor::markMisspellingsOrBadGrammar):
     252        (WebCore::Editor::changeBackToReplacedString):
     253        (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
     254        (WebCore::Editor::setIgnoreCompositionSelectionChange):
     255        (WebCore::Editor::changeSelectionAfterCommand):
     256        (WebCore::Editor::shouldChangeSelection):
     257        (WebCore::Editor::respondToChangedSelection):
     258        (WebCore::Editor::resolveTextCheckingTypeMask):
     259        * editing/Editor.h:
     260        * editing/EditorCommand.cpp:
     261        (WebCore::executeClearText):
     262        (WebCore::enabledCopy):
     263        (WebCore::enabledCut):
     264        (WebCore::enabledClearText):
     265        (WebCore::createCommandMap):
     266        * editing/FrameSelection.cpp:
     267        (WebCore::FrameSelection::FrameSelection):
     268        (WebCore::FrameSelection::setSelection):
     269        (WebCore::FrameSelection::modifyExtendingRight):
     270        (WebCore::FrameSelection::modifyExtendingForward):
     271        (WebCore::FrameSelection::modifyMovingRight):
     272        (WebCore::FrameSelection::modifyMovingForward):
     273        (WebCore::FrameSelection::modifyExtendingLeft):
     274        (WebCore::FrameSelection::modifyExtendingBackward):
     275        (WebCore::FrameSelection::modifyMovingLeft):
     276        (WebCore::FrameSelection::modifyMovingBackward):
     277        (WebCore::FrameSelection::setSelectedRange):
     278        (WebCore::FrameSelection::focusedOrActiveStateChanged):
     279        (WebCore::FrameSelection::updateAppearance):
     280        (WebCore::FrameSelection::shouldDeleteSelection):
     281        (WebCore::FrameSelection::revealSelection):
     282        (WebCore::FrameSelection::setSelectionFromNone):
     283        (WebCore::FrameSelection::shouldChangeSelection):
     284        (WebCore::FrameSelection::expandSelectionToElementContainingCaretSelection):
     285        (WebCore::FrameSelection::elementRangeContainingCaretSelection):
     286        (WebCore::FrameSelection::expandSelectionToWordContainingCaretSelection):
     287        (WebCore::FrameSelection::wordRangeContainingCaretSelection):
     288        (WebCore::FrameSelection::expandSelectionToStartOfWordContainingCaretSelection):
     289        (WebCore::FrameSelection::characterInRelationToCaretSelection):
     290        (WebCore::FrameSelection::characterBeforeCaretSelection):
     291        (WebCore::FrameSelection::characterAfterCaretSelection):
     292        (WebCore::FrameSelection::wordOffsetInRange):
     293        (WebCore::FrameSelection::spaceFollowsWordInRange):
     294        (WebCore::FrameSelection::selectionAtDocumentStart):
     295        (WebCore::FrameSelection::selectionAtSentenceStart):
     296        (WebCore::FrameSelection::selectionAtWordStart):
     297        (WebCore::FrameSelection::rangeByMovingCurrentSelection):
     298        (WebCore::FrameSelection::rangeByExtendingCurrentSelection):
     299        (WebCore::FrameSelection::selectRangeOnElement):
     300        (WebCore::FrameSelection::wordSelectionContainingCaretSelection):
     301        (WebCore::FrameSelection::actualSelectionAtSentenceStart):
     302        (WebCore::FrameSelection::rangeByAlteringCurrentSelection):
     303        (WebCore::FrameSelection::clearCurrentSelection):
     304        (WebCore::FrameSelection::setCaretBlinks):
     305        (WebCore::FrameSelection::setCaretColor):
     306        * editing/FrameSelection.h:
     307        (WebCore::FrameSelection::suppressCloseTyping):
     308        (WebCore::FrameSelection::restoreCloseTyping):
     309        (WebCore::FrameSelection::setUpdateAppearanceEnabled):
     310        (WebCore::FrameSelection::suppressScrolling):
     311        (WebCore::FrameSelection::restoreScrolling):
     312        * editing/InsertIntoTextNodeCommand.cpp:
     313        (WebCore::InsertIntoTextNodeCommand::doReapply):
     314        * editing/InsertIntoTextNodeCommand.h:
     315        * editing/InsertTextCommand.h:
     316        * editing/ReplaceSelectionCommand.cpp:
     317        (WebCore::ReplaceSelectionCommand::doApply):
     318        * editing/TextAffinity.h:
     319        * editing/TextCheckingHelper.cpp:
     320        * editing/TextGranularity.h:
     321        * editing/TextIterator.cpp:
     322        (WebCore::isRendererReplacedElement):
     323        * editing/TypingCommand.cpp:
     324        (WebCore::TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping):
     325        (WebCore::TypingCommand::markMisspellingsAfterTyping):
     326        (WebCore::TypingCommand::deleteKeyPressed):
     327        (WebCore::TypingCommand::forwardDeleteKeyPressed):
     328        (WebCore::FriendlyEditCommand::setEndingSelection):
     329        (WebCore::TypingCommand::setEndingSelectionOnLastInsertCommand):
     330        * editing/TypingCommand.h:
     331        * editing/VisiblePosition.h:
     332        (WebCore::operator<):
     333        (WebCore::operator>):
     334        (WebCore::operator<=):
     335        (WebCore::operator>=):
     336        * editing/VisibleSelection.cpp:
     337        (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
     338        (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries):
     339        * editing/VisibleUnits.cpp:
     340        (WebCore::previousBoundary):
     341        (WebCore::nextBoundary):
     342        (WebCore::startOfDocument):
     343        (WebCore::endOfDocument):
     344        (WebCore::directionIsDownstream):
     345        (WebCore::atBoundaryOfGranularity):
     346        (WebCore::withinTextUnitOfGranularity):
     347        (WebCore::nextCharacterBoundaryInDirection):
     348        (WebCore::nextWordBoundaryInDirection):
     349        (WebCore::nextSentenceBoundaryInDirection):
     350        (WebCore::nextLineBoundaryInDirection):
     351        (WebCore::nextParagraphBoundaryInDirection):
     352        (WebCore::nextDocumentBoundaryInDirection):
     353        (WebCore::positionOfNextBoundaryOfGranularity):
     354        (WebCore::enclosingTextUnitOfGranularity):
     355        (WebCore::distanceBetweenPositions):
     356        (WebCore::wordRangeFromPosition):
     357        (WebCore::closestWordBoundaryForPosition):
     358        * editing/VisibleUnits.h:
     359        * editing/ios/DictationCommandIOS.cpp: Added.
     360        * editing/ios/DictationCommandIOS.h: Added.
     361        (WebCore::DictationCommandIOS::create):
     362        (WebCore::DictationCommandIOS::editingAction):
     363        * editing/mac/FrameSelectionMac.mm:
     364        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
     365        * fileapi/AsyncFileStream.cpp:
     366        * generate-export-file: Added.
     367        * inspector/InspectorCounters.h:
     368        * inspector/InspectorFrontendHost.h:
     369        * make-export-file-generator:
     370        * plugins/PluginPackage.h:
     371        * plugins/PluginViewBase.h:
     372        (WebCore::PluginViewBase::willProvidePluginLayer):
     373        (WebCore::PluginViewBase::attachPluginLayer):
     374        (WebCore::PluginViewBase::detachPluginLayer):
     375        * style/StyleResolveForDocument.cpp:
     376        (WebCore::Style::resolveForDocument):
     377        * style/StyleResolveTree.cpp:
     378        (WebCore::Style::elementImplicitVisibility):
     379        * testing/Internals.cpp:
     380        (WebCore::Internals::getCurrentCursorInfo):
     381        (WebCore::Internals::isSelectPopupVisible):
     382        * workers/WorkerThread.cpp:
     383        (WebCore::WorkerThread::workerThread):
     384
    13852014-01-10  Daniel Bates  <dabates@apple.com>
    2386
  • trunk/Source/WebCore/Configurations/Base.xcconfig

    r159669 r161638  
    2121// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2222// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23
     24#include "iOS.xcconfig"
    2325
    2426CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
     
    5759GCC_WARN_64_TO_32_BIT_CONVERSION_armv7 = YES;
    5860GCC_WARN_64_TO_32_BIT_CONVERSION_armv7s = YES;
     61GCC_WARN_64_TO_32_BIT_CONVERSION_arm64 = NO;
    5962GCC_WARN_64_TO_32_BIT_CONVERSION_i386 = YES;
    6063GCC_WARN_64_TO_32_BIT_CONVERSION_x86_64 = NO;
     
    8386
    8487GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
    85 GCC_OPTIMIZATION_LEVEL_normal = 2;
     88GCC_OPTIMIZATION_LEVEL_normal = $(GCC_OPTIMIZATION_LEVEL_normal_$(PLATFORM_NAME));
     89GCC_OPTIMIZATION_LEVEL_normal_iphoneos = 3;
     90GCC_OPTIMIZATION_LEVEL_normal_iphonesimulator = 3;
     91GCC_OPTIMIZATION_LEVEL_normal_macosx = 2;
    8692GCC_OPTIMIZATION_LEVEL_debug = 0;
    8793
     
    94100DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT));
    95101
    96 SECTORDER_FLAGS = -Wl,-order_file,WebCore.order;
     102SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(PLATFORM_NAME));
     103SECTORDER_FLAGS_iphoneos = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebCore.order;
     104SECTORDER_FLAGS_macosx = -Wl,-order_file,WebCore.order;
    97105
    98106WEBCORE_SQLITE3_HEADER_SEARCH_PATHS = $(NEXT_ROOT)/usr/local/include/WebCoreSQLite3;
  • trunk/Source/WebCore/Configurations/WebCore.xcconfig

    r161610 r161638  
    3434EXPORTED_SYMBOLS_FILE_i386_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.i386.exp;
    3535EXPORTED_SYMBOLS_FILE_i386_macosx = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp;
    36 EXPORTED_SYMBOLS_FILE_ppc = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp;
    37 EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
     36EXPORTED_SYMBOLS_FILE_x86_64 = $(EXPORTED_SYMBOLS_FILE_x86_64_$(PLATFORM_NAME));
     37EXPORTED_SYMBOLS_FILE_x86_64_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.x86_64.exp;
     38EXPORTED_SYMBOLS_FILE_x86_64_macosx = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
    3839GCC_PREFIX_HEADER = WebCorePrefix.h;
    3940GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS);
     
    5253STAGED_FRAMEWORKS_SEARCH_PATH_YES = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
    5354
    54 HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "${BUILT_PRODUCTS_DIR}/usr/local/include" $(HEADER_SEARCH_PATHS);
     55WEBKITADDITIONS_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions $(SDKROOT)/usr/local/include/WebKitAdditions;
     56
     57HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "$(BUILT_PRODUCTS_DIR)/usr/local/include" $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) $(HEADER_SEARCH_PATHS);
    5558INFOPLIST_FILE = Info.plist;
    5659INSTALL_PATH = $(INSTALL_PATH_$(PLATFORM_NAME));
     
    6972OTHER_LDFLAGS_BASE = -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport;
    7073OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
    71 OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework QuartzCore;
    72 OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
     74OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_iphonesimulator) -framework IOSurface;
     75OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_BASE) -framework Accelerate -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework OpenGLES -framework QuartzCore -lMobileGestalt;
    7376OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -umbrella WebKit -allowable_client WebKit2 -framework IOSurface;
    7477
     
    103106JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering);
    104107JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Debug = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering);
    105 JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production = $(SDKROOT)$(PRODUCTION_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders;
     108JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production = $(JAVASCRIPTCORE_PRIVATE_HEADERS_Production_$(PLATFORM_NAME));
     109JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production_iphoneos = $(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaScriptCore.framework/Headers;
     110JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production_iphonesimulator = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production_iphoneos);
     111JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production_macosx = $(SDKROOT)$(PRODUCTION_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders;
    106112JAVASCRIPTCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/JavaScriptCore.framework/PrivateHeaders;
    107113
    108114EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME));
    109 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png Cursor.cpp CursorMac.mm EventHandlerMac.mm HTMLConverter.mm KillRingMac.mm PlatformEventFactoryMac.mm SSLKeyGeneratorMac.cpp SearchPopupMenuMac.mm ScrollingCoordinatorMac.mm ScrollingStateScrollingNodeMac.mm ScrollingTreeScrollingNodeMac.mm SharedTimerMac.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm;
     115EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ClipboardMac.mm ColorMac.mm Cursor.cpp CursorMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KeyEventMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollingCoordinatorMac.mm ScrollingStateScrollingNodeMac.mm ScrollingTreeScrollingNodeMac.mm ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreURLResponse.mm WebCoreView.m WebFontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WheelEventMac.mm WidgetMac.mm mac/LayerPool.mm DisplayRefreshMonitorMac.mm;
    110116EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos);
    111117EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm KillRingNone.cpp WAKAppKitStubs.h WAKClipView.h WAKResponder.h WAKScrollView.h WAKView.h WAKViewPrivate.h WAKWindow.h WKContentObservation.h WKGraphics.h WKTypes.h WKUtilities.h WKView.h WKViewPrivate.h WebCoreThread.h WebCoreThreadMessage.h WebCoreThreadRun.h WebCoreThreadSystemInterface.h;
  • trunk/Source/WebCore/Configurations/WebCoreTestSupport.xcconfig

    r157667 r161638  
    2727PRIVATE_HEADERS_FOLDER_PATH_Debug = WebCoreTestSupport;
    2828PRIVATE_HEADERS_FOLDER_PATH_Release = $(PRIVATE_HEADERS_FOLDER_PATH_Debug);
    29 PRIVATE_HEADERS_FOLDER_PATH_Production = /usr/local/include/WebCoreTestSupport;
     29PRIVATE_HEADERS_FOLDER_PATH_Production = $(PRIVATE_HEADERS_FOLDER_PATH_Production_$(PLATFORM_NAME));
     30PRIVATE_HEADERS_FOLDER_PATH_Production_iphoneos = /usr/local/include/WebCoreTestSupport;
     31PRIVATE_HEADERS_FOLDER_PATH_Production_iphonesimulator = $(INDIGO_INSTALL_PATH_PREFIX)$(PRIVATE_HEADERS_FOLDER_PATH_Production_iphoneos);
     32PRIVATE_HEADERS_FOLDER_PATH_Production_macosx = /usr/local/include/WebCoreTestSupport;
    3033
    31 INSTALL_PATH = $(INSTALL_PATH_$(CONFIGURATION));
    32 INSTALL_PATH_Production = /usr/local/lib;
     34INSTALL_PATH = $(INSTALL_PATH_$(CONFIGURATION)_$(PLATFORM_NAME));
     35INSTALL_PATH_Production_iphoneos = /usr/local/lib;
     36INSTALL_PATH_Production_iphonesimulator = $(INDIGO_INSTALL_PATH_PREFIX)$(INSTALL_PATH_Production_iphoneos);
     37INSTALL_PATH_Production_macosx = /usr/local/lib;
    3338
    3439SKIP_INSTALL = $(SKIP_INSTALL_$(FORCE_TOOL_INSTALL));
  • trunk/Source/WebCore/DerivedSources.make

    r161563 r161638  
    2929VPATH = \
    3030    $(WebCore) \
     31    $(WebCore)/Modules/airplay \
    3132    $(WebCore)/Modules/encryptedmedia \
    3233    $(WebCore)/Modules/geolocation \
     
    6869
    6970BINDING_IDLS = \
     71    $(WebCore)/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl \
    7072    $(WebCore)/Modules/encryptedmedia/MediaKeyMessageEvent.idl \
    7173    $(WebCore)/Modules/encryptedmedia/MediaKeyNeededEvent.idl \
     
    305307    $(WebCore)/dom/Text.idl \
    306308    $(WebCore)/dom/TextEvent.idl \
    307     $(WebCore)/dom/Touch.idl \
    308     $(WebCore)/dom/TouchEvent.idl \
    309     $(WebCore)/dom/TouchList.idl \
    310309    $(WebCore)/dom/TransitionEvent.idl \
    311310    $(WebCore)/dom/TreeWalker.idl \
     
    720719endif
    721720
     721ifeq ($(shell $(CC) -isysroot $(SDKROOT) -std=gnu++11 -x c++ -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
     722    WTF_PLATFORM_IOS = 1
     723else
     724    WTF_PLATFORM_IOS = 0
     725endif
     726
    722727ifeq ($(shell $(CC) -std=gnu++11 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ENABLE_ORIENTATION_EVENTS | cut -d' ' -f3), 1)
    723728    ENABLE_ORIENTATION_EVENTS = 1
     
    726731ifeq ($(PLATFORM_FEATURE_DEFINES),)
    727732PLATFORM_FEATURE_DEFINES = Configurations/FeatureDefines.xcconfig
     733endif
     734
     735ifeq ($(WTF_PLATFORM_IOS), 1)
     736
     737ADDITIONAL_BINDING_IDLS = \
     738    GestureEvent.idl \
     739    Touch.idl \
     740    TouchEvent.idl \
     741    TouchList.idl
     742
     743BINDING_IDLS += $(ADDITIONAL_BINDING_IDLS)
     744
     745all : $(ADDITIONAL_BINDING_IDLS:%.idl=JS%.h)
     746
     747vpath %.idl $(BUILT_PRODUCTS_DIR)/usr/local/include $(SDKROOT)/usr/local/include
     748
     749$(ADDITIONAL_BINDING_IDLS) : % : WebKitAdditions/%
     750    cp $< .
     751
     752else
     753
     754BINDING_IDLS += \
     755    $(WebCore)/dom/Touch.idl \
     756    $(WebCore)/dom/TouchEvent.idl \
     757    $(WebCore)/dom/TouchList.idl
     758
    728759endif
    729760
     
    11571188ifneq ($(ACTION),installhdrs)
    11581189
     1190ifeq ($(WTF_PLATFORM_IOS),1)
     1191
     1192ifeq ($(findstring armv6,$(ARCHS)), armv6)
     1193    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.armv6.exp
     1194endif
     1195ifeq ($(findstring armv7f,$(ARCHS)), armv7f)
     1196    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.armv7f.exp
     1197endif
     1198ifeq ($(findstring armv7s,$(ARCHS)), armv7s)
     1199    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.armv7s.exp
     1200endif
     1201ifeq ($(findstring armv7,$(ARCHS)), armv7)
     1202    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.armv7.exp
     1203endif
     1204ifeq ($(findstring arm64,$(ARCHS)), arm64)
     1205    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.arm64.exp
     1206endif
     1207ifeq ($(findstring i386,$(ARCHS)), i386)
     1208    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.i386.exp
     1209endif
     1210ifeq ($(findstring x86_64,$(ARCHS)), x86_64)
     1211    WEBCORE_EXPORT_FILES := $(WEBCORE_EXPORT_FILES) WebCore.LP64.x86_64.exp
     1212endif
     1213
     1214all : $(WEBCORE_EXPORT_FILES)
     1215
     1216WebCore.%.exp : generate-export-file WebCore.exp.in
     1217    $^ $@
     1218
     1219# Switch NSRect, NSSize and NSPoint with their CG counterparts for the 64-bit exports file.
     1220WebCore.LP64.%.exp : WebCore.%.exp
     1221    cat $^ | sed -e s/7_NSRect/6CGRect/ -e s/7_NSSize/6CGSize/ -e s/8_NSPoint/7CGPoint/ > $@
     1222
     1223else
     1224
    11591225all : WebCore.exp WebCore.LP64.exp
    11601226
    11611227WebCore.exp : $(BUILT_PRODUCTS_DIR)/WebCoreExportFileGenerator
    1162         $^ > $@
     1228    $^ | grep -v '^# ' | sed -e 's/^#//' > $@
    11631229
    11641230# Switch NSRect, NSSize and NSPoint with their CG counterparts for the 64-bit exports file.
    11651231WebCore.LP64.exp : WebCore.exp
    11661232        cat $^ | sed -e s/7_NSRect/6CGRect/ -e s/7_NSSize/6CGSize/ -e s/8_NSPoint/7CGPoint/ > $@
     1233
     1234endif # WTF_PLATFORM_IOS
    11671235
    11681236endif # installhdrs
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r161004 r161638  
    113113"Choose Files" = "Choose Files";
    114114
     115/* PLATFORM(IOS) title for file button used in HTML forms for media files */
     116"Choose Media (Single)" = "Choose Photo";
     117
     118/* PLATFORM(IOS) title for file button used in HTML5 forms for multiple media files */
     119"Choose Media (Multiple)" = "Choose Photos";
     120
    115121/* menu item in Recent Searches menu that empties menu's contents */
    116122"Clear Recent Searches" = "Clear Recent Searches";
     
    158164"Default" = "Default";
    159165
     166/* PLATFORM(IOS) Undo action name */
     167"Delete (Undo action name)" = "Delete";
     168
     169/* PLATFORM(IOS) Undo action name */
     170"Dictation (Undo action name)" = "Dictation";
     171
    160172/* text to display in <details> tag when it has no <summary> child */
    161173"Details" = "Details";
     
    782794"no files selected" = "no files selected";
    783795
     796/* PLATFORM(IOS) text to display in file button used in HTML forms for media files when no media file is selected */
     797"no media selected (single)" = "no photo selected";
     798
     799/* PLATFORM(IOS) text to display in file button used in HTML forms for media files when no media files are selected and the button allows multiple files to be selected */
     800"no media selected (multiple)" = "no photos selected";
     801
    784802/* HTTP result code string */
    785803"no longer exists" = "no longer exists";
  • trunk/Source/WebCore/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp

    r161637 r161638  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 #ifndef TextAffinity_h
    27 #define TextAffinity_h
     26#include "config.h"
     27#include "WebKitPlaybackTargetAvailabilityEvent.h"
    2828
    29 #ifdef __OBJC__
    30 #include <AppKit/NSTextView.h>
    31 #endif
     29#if ENABLE(IOS_AIRPLAY)
    3230
    3331namespace WebCore {
    3432
    35 // These match the AppKit values for these concepts.
    36 // From NSTextView.h:
    37 // NSSelectionAffinityUpstream = 0
    38 // NSSelectionAffinityDownstream = 1
    39 enum EAffinity { UPSTREAM = 0, DOWNSTREAM = 1 };
     33static const AtomicString& stringForPlaybackTargetAvailability(bool available)
     34{
     35    DEFINE_STATIC_LOCAL(AtomicString, availableString, ("available", AtomicString::ConstructFromLiteral));
     36    DEFINE_STATIC_LOCAL(AtomicString, notAvailableString, ("not-available", AtomicString::ConstructFromLiteral));
     37
     38    return available ? availableString : notAvailableString;
     39}
     40
     41WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent()
     42{
     43}
     44
     45WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent(const AtomicString& eventType, bool available)
     46    : Event(eventType, false, false)
     47    , m_availability(stringForPlaybackTargetAvailability(available))
     48{
     49}
     50
     51WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent(const AtomicString& eventType, const WebKitPlaybackTargetAvailabilityEventInit& initializer)
     52    : Event(eventType, initializer)
     53    , m_availability(initializer.availability)
     54{
     55}
    4056
    4157} // namespace WebCore
    4258
    43 #ifdef __OBJC__
    44 
    45 inline NSSelectionAffinity kit(WebCore::EAffinity affinity)
    46 {
    47     return static_cast<NSSelectionAffinity>(affinity);
    48 }
    49 
    50 inline WebCore::EAffinity core(NSSelectionAffinity affinity)
    51 {
    52     return static_cast<WebCore::EAffinity>(affinity);
    53 }
    54 
    55 #endif
    56 
    57 #endif // TextAffinity_h
     59#endif // ENABLE(IOS_AIRPLAY)
  • trunk/Source/WebCore/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl

    r161637 r161638  
    11/*
    2  * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     13 * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
    1414 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1515 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2323 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24 *
    2425 */
    2526
    26 #ifndef DeleteButton_h
    27 #define DeleteButton_h
    28 
    29 #include "HTMLImageElement.h"
    30 
    31 namespace WebCore {
    32 
    33 class DeleteButton : public HTMLImageElement {
    34 public:
    35     static PassRefPtr<DeleteButton> create(Document&);
    36 
    37     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
    38 
    39 private:
    40     explicit DeleteButton(Document&);
    41 
    42     virtual void defaultEventHandler(Event*);
     27[
     28    Conditional=IOS_AIRPLAY,
     29    ConstructorTemplate=Event
     30] interface WebKitPlaybackTargetAvailabilityEvent : Event {
     31    [InitializedByEventConstructor] readonly attribute DOMString availability;
    4332};
    4433
    45 } // namespace
    46 
    47 #endif
  • trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp

    r154967 r161638  
    236236    : ActiveDOMObject(context)
    237237    , m_allowGeolocation(Unknown)
     238#if PLATFORM(IOS)
     239    , m_isSuspended(false)
     240    , m_hasChangedPosition(false)
     241    , m_resumeTimer(this, &Geolocation::resumeTimerFired)
     242#endif
    238243{
    239244}
     
    258263    return document() ? document()->page() : 0;
    259264}
     265
     266#if PLATFORM(IOS)
     267bool Geolocation::canSuspend() const
     268{
     269    return !hasListeners();
     270}
     271
     272void Geolocation::suspend(ReasonForSuspension reason)
     273{
     274    // Allow pages that no longer have listeners to enter the page cache.
     275    // Have them stop updating and reset geolocation permissions when the page is resumed.
     276    if (reason == ActiveDOMObject::DocumentWillBecomeInactive) {
     277        ASSERT(!hasListeners());
     278        stop();
     279        m_resetOnResume = true;
     280    }
     281
     282    // Suspend GeoNotifier timeout timers.
     283    if (hasListeners())
     284        stopTimers();
     285
     286    m_isSuspended = true;
     287    m_resumeTimer.stop();
     288    ActiveDOMObject::suspend(reason);
     289}
     290
     291void Geolocation::resume()
     292{
     293    ASSERT(WebThreadIsLockedOrDisabled());
     294    ActiveDOMObject::resume();
     295
     296    if (!m_resumeTimer.isActive())
     297        m_resumeTimer.startOneShot(0);
     298}
     299
     300void Geolocation::resumeTimerFired(Timer<Geolocation>*)
     301{
     302    m_isSuspended = false;
     303
     304    if (m_resetOnResume) {
     305        resetAllGeolocationPermission();
     306        m_resetOnResume = false;
     307    }
     308
     309    // Resume GeoNotifier timeout timers.
     310    if (hasListeners()) {
     311        GeoNotifierSet::const_iterator end = m_oneShots.end();
     312        for (GeoNotifierSet::const_iterator it = m_oneShots.begin(); it != end; ++it)
     313            (*it)->startTimerIfNeeded();
     314        GeoNotifierVector watcherCopy;
     315        m_watchers.getNotifiersVector(watcherCopy);
     316        for (size_t i = 0; i < watcherCopy.size(); ++i)
     317            watcherCopy[i]->startTimerIfNeeded();
     318    }
     319
     320    if ((isAllowed() || isDenied()) && !m_pendingForPermissionNotifiers.isEmpty()) {
     321        // The pending permission was granted while the object was suspended.
     322        setIsAllowed(isAllowed());
     323        ASSERT(!m_hasChangedPosition);
     324        ASSERT(!m_errorWaitingForResume);
     325        return;
     326    }
     327
     328    if (isDenied() && hasListeners()) {
     329        // The permission was revoked while the object was suspended.
     330        setIsAllowed(false);
     331        return;
     332    }
     333
     334    if (m_hasChangedPosition) {
     335        positionChanged();
     336        m_hasChangedPosition = false;
     337    }
     338
     339    if (m_errorWaitingForResume) {
     340        handleError(m_errorWaitingForResume.get());
     341        m_errorWaitingForResume = nullptr;
     342    }
     343}
     344
     345void Geolocation::resetAllGeolocationPermission()
     346{
     347    if (m_isSuspended) {
     348        m_resetOnResume = true;
     349        return;
     350    }
     351
     352    if (m_allowGeolocation == InProgress) {
     353        Page* page = this->page();
     354        if (page)
     355            GeolocationController::from(page)->cancelPermissionRequest(this);
     356
     357        // This return is not technically correct as GeolocationController::cancelPermissionRequest() should have cleared the active request.
     358        // Neither iOS nor OS X supports cancelPermissionRequest() (https://bugs.webkit.org/show_bug.cgi?id=89524), so we workaround that and let ongoing requests complete. :(
     359        return;
     360    }
     361
     362    // 1) Reset our own state.
     363    stopUpdating();
     364    m_allowGeolocation = Unknown;
     365    m_hasChangedPosition = false;
     366    m_errorWaitingForResume = nullptr;
     367
     368    // 2) Request new permission for the active notifiers.
     369    stopTimers();
     370
     371    // Go over the one shot and re-request permission.
     372    GeoNotifierSet::iterator end = m_oneShots.end();
     373    for (GeoNotifierSet::iterator it = m_oneShots.begin(); it != end; ++it)
     374        startRequest((*it).get());
     375    // Go over the watchers and re-request permission.
     376    GeoNotifierVector watcherCopy;
     377    m_watchers.getNotifiersVector(watcherCopy);
     378    for (size_t i = 0; i < watcherCopy.size(); ++i)
     379        startRequest(watcherCopy[i].get());
     380}
     381#endif // PLATFORM(IOS)
    260382
    261383void Geolocation::stop()
     
    268390    cancelAllRequests();
    269391    stopUpdating();
     392#if PLATFORM(IOS)
     393    m_hasChangedPosition = false;
     394    m_errorWaitingForResume = nullptr;
     395#endif // PLATFORM(IOS)
    270396    m_pendingForPermissionNotifiers.clear();
    271397}
     
    430556    m_allowGeolocation = allowed ? Yes : No;
    431557   
     558#if PLATFORM(IOS)
     559    if (m_isSuspended)
     560        return;
     561#endif
     562
    432563    // Permission request was made during the startRequest process
    433564    if (!m_pendingForPermissionNotifiers.isEmpty()) {
     
    442573        handleError(error.get());
    443574        m_requestsAwaitingCachedPosition.clear();
     575#if PLATFORM(IOS)
     576        m_hasChangedPosition = false;
     577        m_errorWaitingForResume = nullptr;
     578#endif
     579
    444580        return;
    445581    }
     
    621757    stopTimers();
    622758
     759#if PLATFORM(IOS)
     760    if (m_isSuspended) {
     761        m_hasChangedPosition = true;
     762        return;
     763    }
     764#endif
     765
    623766    makeSuccessCallbacks();
    624767}
     
    626769void Geolocation::setError(GeolocationError* error)
    627770{
     771#if PLATFORM(IOS)
     772    if (m_isSuspended) {
     773        m_errorWaitingForResume = createPositionError(error);
     774        return;
     775    }
     776#endif
    628777    RefPtr<PositionError> positionError = createPositionError(error);
    629778    handleError(positionError.get());
  • trunk/Source/WebCore/Modules/geolocation/Geolocation.h

    r157653 r161638  
    5555    ~Geolocation();
    5656
     57#if PLATFORM(IOS)
     58    virtual bool canSuspend() const OVERRIDE;
     59    virtual void suspend(ReasonForSuspension) OVERRIDE;
     60    virtual void resume() OVERRIDE;
     61    void resetAllGeolocationPermission();
     62#endif // PLATFORM(IOS)
    5763    Document* document() const;
    5864    Frame* frame() const;
     
    175181        No
    176182    } m_allowGeolocation;
     183#if PLATFORM(IOS)
     184    bool m_isSuspended;
     185    bool m_resetOnResume;
     186    bool m_hasChangedPosition;
     187    RefPtr<PositionError> m_errorWaitingForResume;
     188
     189    void resumeTimerFired(Timer<Geolocation>*);
     190    Timer<Geolocation> m_resumeTimer;
     191#endif // PLATFORM(IOS)
    177192
    178193    GeoNotifierSet m_requestsAwaitingCachedPosition;
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp

    r140509 r161638  
    5858}
    5959
     60#if PLATFORM(IOS)
     61void NavigatorGeolocation::resetAllGeolocationPermission()
     62{
     63    if (m_geolocation)
     64        m_geolocation->resetAllGeolocationPermission();
     65}
     66#endif // PLATFORM(IOS)
     67
    6068Geolocation* NavigatorGeolocation::geolocation(Navigator* navigator)
    6169{
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h

    r140509 r161638  
    4040    Geolocation* geolocation() const;
    4141
     42#if PLATFORM(IOS)
     43    void resetAllGeolocationPermission();
     44#endif // PLATFORM(IOS)
     45
    4246private:
    4347    NavigatorGeolocation(Frame*);
  • trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp

    r157653 r161638  
    3131#include "PlatformSpeechSynthesisVoice.h"
    3232#include "PlatformSpeechSynthesizer.h"
     33#include "ScriptController.h"
    3334#include "SpeechSynthesisEvent.h"
    3435#include "SpeechSynthesisUtterance.h"
     
    4546    : m_currentSpeechUtterance(0)
    4647    , m_isPaused(false)
     48#if PLATFORM(IOS)
     49    , m_restrictions(RequireUserGestureForSpeechStartRestriction)
     50#endif
    4751{
    4852}
     
    113117    if (!utterance)
    114118        return;
     119 
     120    // Like Audio, we should require that the user interact to start a speech synthesis session.
     121#if PLATFORM(IOS)
     122    if (ScriptController::processingUserGesture())
     123        removeBehaviorRestriction(RequireUserGestureForSpeechStartRestriction);
     124    else if (userGestureRequiredForSpeechStart())
     125        return;
     126#endif
    115127   
    116128    m_utteranceQueue.append(utterance);
  • trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h

    r157653 r161638  
    7777    void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned long charIndex, const String& name);
    7878   
     79#if PLATFORM(IOS)
     80    // Restrictions to change default behaviors.
     81    enum BehaviorRestrictionFlags {
     82        NoRestrictions = 0,
     83        RequireUserGestureForSpeechStartRestriction = 1 << 0,
     84    };
     85    typedef unsigned BehaviorRestrictions;
     86   
     87    bool userGestureRequiredForSpeechStart() const { return m_restrictions & RequireUserGestureForSpeechStartRestriction; }
     88    void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictions &= ~restriction; }
     89#endif
     90   
    7991    OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer;
    8092    Vector<RefPtr<SpeechSynthesisVoice>> m_voiceList;
     
    8294    Deque<RefPtr<SpeechSynthesisUtterance>> m_utteranceQueue;
    8395    bool m_isPaused;
     96#if PLATFORM(IOS)
     97    BehaviorRestrictions m_restrictions;
     98#endif
    8499};
    85100   
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp

    r159931 r161638  
    8181#endif
    8282
     83#if PLATFORM(IOS)
     84#include "ScriptController.h"
     85#include "Settings.h"
     86#endif
     87
    8388#include <runtime/ArrayBuffer.h>
    8489#include <wtf/Atomics.h>
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.h

    r158365 r161638  
    9797
    9898    Document* document() const; // ASSERTs if document no longer exists.
    99     bool hasDocument();
    10099
    101100    AudioDestinationNode* destination() { return m_destinationNode.get(); }
  • trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp

    r157971 r161638  
    3636#include <wtf/MathExtras.h>
    3737
     38#if PLATFORM(IOS)
     39#include "ScriptController.h"
     40#endif
     41
    3842namespace WebCore {
    3943
  • trunk/Source/WebCore/Modules/webdatabase/Database.cpp

    r157075 r161638  
    6161#include <wtf/text/CString.h>
    6262
     63#if PLATFORM(IOS)
     64#include "SQLiteDatabaseTracker.h"
     65#endif
     66
    6367namespace WebCore {
    6468
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp

    r157337 r161638  
    5353#include <wtf/text/StringHash.h>
    5454
     55#if PLATFORM(IOS)
     56#include "SQLiteDatabaseTracker.h"
     57#endif
     58
    5559// Registering "opened" databases with the DatabaseTracker
    5660// =======================================================
     
    315319    const int maxSqliteBusyWaitTime = 30000;
    316320
     321#if PLATFORM(IOS)
     322    {
     323        // Make sure we wait till the background removal of the empty database files finished before trying to open any database.
     324        MutexLocker locker(DatabaseTracker::openDatabaseMutex());
     325    }
     326    SQLiteTransactionInProgressAutoCounter transactionCounter;
     327#endif
     328
    317329    if (!m_sqliteDatabase.open(m_filename, true)) {
    318330        errorMessage = formatErrorMessage("unable to open database", m_sqliteDatabase.lastError(), m_sqliteDatabase.lastErrorMsg());
     
    565577void DatabaseBackendBase::incrementalVacuumIfNeeded()
    566578{
     579#if PLATFORM(IOS)
     580    SQLiteTransactionInProgressAutoCounter transactionCounter;
     581#endif
    567582    int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize();
    568583    int64_t totalSize = m_sqliteDatabase.totalSize();
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp

    r154272 r161638  
    103103    , m_isRegistered(true) // will register on construction below.
    104104    , m_hasRequestedTermination(false)
     105#if PLATFORM(IOS)
     106    , m_paused(false)
     107#endif //PLATFORM(IOS)
    105108{
    106109    // ActiveDOMObject expects this to be called to set internal flags.
     
    162165{
    163166    if (!m_databaseThread && !m_hasOpenDatabases) {
     167#if PLATFORM(IOS)
     168        MutexLocker lock(m_databaseThreadMutex);
     169#endif //PLATFORM(IOS)
    164170        // It's OK to ask for the m_databaseThread after we've requested
    165171        // termination because we're still using it to execute the closing
     
    173179        if (!m_databaseThread->start())
    174180            m_databaseThread = 0;
     181#if PLATFORM(IOS)
     182        if (m_databaseThread)
     183            m_databaseThread->setPaused(m_paused);
     184#endif //PLATFORM(IOS)
    175185    }
    176186
    177187    return m_databaseThread.get();
    178188}
     189
     190#if PLATFORM(IOS)
     191void DatabaseContext::setPaused(bool paused)
     192{
     193    MutexLocker lock(m_databaseThreadMutex);
     194
     195    m_paused = paused;
     196    if (m_databaseThread)
     197        m_databaseThread->setPaused(m_paused);
     198}
     199#endif // PLATFORM(IOS)
    179200
    180201bool DatabaseContext::stopDatabases(DatabaseTaskSynchronizer* cleanupSync)
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h

    r141928 r161638  
    3636#include <wtf/ThreadSafeRefCounted.h>
    3737
     38#if PLATFORM(IOS)
     39#include <wtf/Threading.h>
     40#endif // PLATFORM(IOS)
     41
    3842namespace WebCore {
    3943
     
    5458    PassRefPtr<DatabaseBackendContext> backend();
    5559    DatabaseThread* databaseThread();
     60#if PLATFORM(IOS)
     61    void setPaused(bool);
     62#endif // PLATFORM(IOS)
    5663
    5764    void setHasOpenDatabases() { m_hasOpenDatabases = true; }
     
    7683    friend class DatabaseBackendContext;
    7784    friend class DatabaseManager;
     85
     86#if PLATFORM(IOS)
     87    Mutex m_databaseThreadMutex;
     88    bool m_paused;
     89#endif // PLATFORM(IOS)
    7890};
    7991
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h

    r137520 r161638  
    3939    virtual void dispatchDidModifyOrigin(SecurityOrigin*) = 0;
    4040    virtual void dispatchDidModifyDatabase(SecurityOrigin*, const String& databaseName) = 0;
     41
     42#if PLATFORM(IOS)
     43    virtual void dispatchDidAddNewOrigin(SecurityOrigin*) = 0;
     44    virtual void dispatchDidDeleteDatabase() = 0;
     45    virtual void dispatchDidDeleteDatabaseOrigin() = 0;
     46#endif
    4147};
    4248
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp

    r143551 r161638  
    8686    LOG(StorageAPI, "Performing %s %p\n", debugTaskName(), this);
    8787
     88#if !PLATFORM(IOS)
    8889    m_database->resetAuthorizer();
     90#else
     91    if (m_database)
     92        m_database->resetAuthorizer();
     93#endif
     94
    8995    doPerformTask();
    9096
     
    169175}
    170176
     177#if PLATFORM(IOS)
     178bool Database::DatabaseTransactionTask::shouldPerformWhilePaused() const
     179{
     180    return m_transaction->shouldPerformWhilePaused();
     181}
     182#endif
     183
    171184void DatabaseBackend::DatabaseTransactionTask::doPerformTask()
    172185{
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h

    r156972 r161638  
    7676    virtual ~DatabaseTask();
    7777
     78#if PLATFORM(IOS)
     79    virtual bool shouldPerformWhilePaused() const = 0;
     80#endif
     81
    7882    void performTask();
    7983
     
    105109        return std::unique_ptr<DatabaseOpenTask>(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success));
    106110    }
     111   
     112#if PLATFORM(IOS)
     113    virtual bool shouldPerformWhilePaused() const OVERRIDE { return true; }
     114#endif
    107115
    108116private:
     
    127135    }
    128136
     137#if PLATFORM(IOS)
     138    virtual bool shouldPerformWhilePaused() const OVERRIDE { return true; }
     139#endif
     140
    129141private:
    130142    DatabaseCloseTask(DatabaseBackend*, DatabaseTaskSynchronizer*);
     
    146158    }
    147159
     160#if PLATFORM(IOS)
     161    virtual bool shouldPerformWhilePaused() const OVERRIDE;
     162#endif
     163
    148164    SQLTransactionBackend* transaction() const { return m_transaction.get(); }
    149165
     
    167183    }
    168184
     185#if PLATFORM(IOS)
     186    virtual bool shouldPerformWhilePaused() const OVERRIDE { return true; }
     187#endif
     188
    169189private:
    170190    DatabaseTableNamesTask(DatabaseBackend*, DatabaseTaskSynchronizer*, Vector<String>& names);
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp

    r156972 r161638  
    4343DatabaseThread::DatabaseThread()
    4444    : m_threadID(0)
     45#if PLATFORM(IOS)
     46    , m_paused(false)
     47#endif
    4548    , m_transactionClient(adoptPtr(new SQLTransactionClient()))
    4649    , m_transactionCoordinator(adoptPtr(new SQLTransactionCoordinator()))
     
    7881    m_cleanupSync = cleanupSync;
    7982    LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this);
     83#if PLATFORM(IOS)
     84    m_pausedQueue.kill();
     85#endif
    8086    m_queue.kill();
    8187}
     
    99105}
    100106
     107#if PLATFORM(IOS)
     108class DatabaseUnpauseTask : public DatabaseTask {
     109public:
     110    static std::unique_ptr<DatabaseUnpauseTask> create(DatabaseThread* thread)
     111    {
     112        return std::unique_ptr<DatabaseUnpauseTask>(new DatabaseUnpauseTask(thread));
     113    }
     114   
     115    virtual bool shouldPerformWhilePaused() const
     116    {
     117        // Since we're not locking the DatabaseThread::m_paused in the main database thread loop, it's possible that
     118        // a DatabaseUnpauseTask might be added to the m_pausedQueue and performed from within ::handlePausedQueue.
     119        // To protect against this, we allow it to be performed even if the database is paused.
     120        // If the thread is paused when it is being performed, the tasks from the paused queue will simply be
     121        // requeued instead of performed.
     122        return true;
     123    }
     124
     125private:
     126    DatabaseUnpauseTask(DatabaseThread* thread)
     127        : DatabaseTask(0, 0)
     128        , m_thread(thread)
     129    {}
     130
     131    virtual void doPerformTask()
     132    {
     133        m_thread->handlePausedQueue();
     134    }
     135#if !LOG_DISABLED
     136    virtual const char* debugTaskName() const { return "DatabaseUnpauseTask"; }
     137#endif
     138
     139    DatabaseThread* m_thread;
     140};
     141
     142
     143void DatabaseThread::setPaused(bool paused)
     144{
     145    if (m_paused == paused)
     146        return;
     147
     148    MutexLocker pausedLocker(m_pausedMutex);
     149    m_paused = paused;
     150    if (!m_paused)
     151        scheduleTask(DatabaseUnpauseTask::create(this));
     152}
     153
     154void DatabaseThread::handlePausedQueue()
     155{
     156    Vector<std::unique_ptr<DatabaseTask> > pausedTasks;
     157    while (auto task = m_pausedQueue.tryGetMessage())
     158        pausedTasks.append(std::move(task));
     159
     160    for (unsigned i = 0; i < pausedTasks.size(); ++i) {
     161        AutodrainedPool pool;
     162
     163        std::unique_ptr<DatabaseTask> task(pausedTasks[i].release());
     164        {
     165            MutexLocker pausedLocker(m_pausedMutex);
     166            if (m_paused) {
     167                m_pausedQueue.append(std::move(task));
     168                continue;
     169            }
     170        }
     171           
     172        if (terminationRequested())
     173            break;
     174   
     175        task->performTask();
     176    }
     177}
     178#endif //PLATFORM(IOS)
     179
     180
    101181void DatabaseThread::databaseThread()
    102182{
     
    110190        AutodrainedPool pool;
    111191
     192#if PLATFORM(IOS)
     193        if (!m_paused || task->shouldPerformWhilePaused())
     194            task->performTask();
     195        else
     196            m_pausedQueue.append(std::move(task));
     197#else
    112198        task->performTask();
     199#endif
    113200    }
    114201
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h

    r157653 r161638  
    7070    SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCoordinator.get(); }
    7171
     72#if PLATFORM(IOS)
     73    void setPaused(bool);
     74    void handlePausedQueue();
     75#endif
     76
    7277private:
    7378    DatabaseThread();
     
    8186
    8287    MessageQueue<DatabaseTask> m_queue;
     88#if PLATFORM(IOS)
     89    MessageQueue<DatabaseTask> m_pausedQueue;
     90    Mutex m_pausedMutex;
     91    volatile bool m_paused;
     92#endif
    8393
    8494    // This set keeps track of the open databases that have been used on this thread.
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp

    r161309 r161638  
    3434#include "Chrome.h"
    3535#include "ChromeClient.h"
     36#include "Database.h"
    3637#include "DatabaseBackendBase.h"
    3738#include "DatabaseBackendContext.h"
     
    5152#include <wtf/text/CString.h>
    5253
     54#if PLATFORM(IOS)
     55#include "WebCoreThread.h"
     56#endif
     57
    5358namespace WebCore {
    5459
     
    742747    if (!m_database.isOpen())
    743748        return;
     749   
     750#if PLATFORM(IOS)
     751    bool insertedNewOrigin = false;
     752#endif
    744753
    745754    bool originEntryExists = hasEntryForOriginNoLock(origin);
     
    754763            if (statement.step() != SQLResultDone)
    755764                LOG_ERROR("Unable to establish origin %s in the tracker", origin->databaseIdentifier().ascii().data());
     765#if PLATFORM(IOS)
     766            else
     767                insertedNewOrigin = true;
     768#endif
    756769        }
    757770    } else {
     
    770783
    771784    if (m_client)
     785#if PLATFORM(IOS)
     786    {
     787        if (insertedNewOrigin)
     788            m_client->dispatchDidAddNewOrigin(origin);
     789#endif
    772790        m_client->dispatchDidModifyOrigin(origin);
     791#if PLATFORM(IOS)
     792    }
     793#endif
    773794}
    774795
     
    898919        if (m_client) {
    899920            m_client->dispatchDidModifyOrigin(origin);
     921#if PLATFORM(IOS)
     922            m_client->dispatchDidDeleteDatabaseOrigin();
     923#endif
    900924            for (unsigned i = 0; i < databaseNames.size(); ++i)
    901925                m_client->dispatchDidModifyDatabase(origin, databaseNames[i]);
     
    10631087        m_client->dispatchDidModifyOrigin(origin);
    10641088        m_client->dispatchDidModifyDatabase(origin, name);
     1089#if PLATFORM(IOS)
     1090        m_client->dispatchDidDeleteDatabase();
     1091#endif
    10651092    }
    10661093    doneDeletingDatabase(origin, name);
     
    11111138        deletedDatabases[i]->markAsDeletedAndClose();
    11121139
     1140#if !PLATFORM(IOS)
    11131141    return SQLiteFileSystem::deleteDatabaseFile(fullPath);
    1114 }
     1142#else
     1143    // On the phone, other background processes may still be accessing this database.  Deleting the database directly
     1144    // would nuke the POSIX file locks, potentially causing Safari/WebApp to corrupt the new db if it's running in the background.
     1145    // We'll instead truncate the database file to 0 bytes.  If another process is operating on this same database file after
     1146    // the truncation, it should get an error since the database file is no longer valid.  When Safari is launched
     1147    // next time, it'll go through the database files and clean up any zero-bytes ones.
     1148    SQLiteDatabase database;
     1149    if (database.open(fullPath))
     1150        return SQLiteFileSystem::truncateDatabaseFile(database.sqlite3Handle());
     1151    return false;
     1152#endif
     1153}
     1154   
     1155#if PLATFORM(IOS)
     1156void DatabaseTracker::removeDeletedOpenedDatabases()
     1157{
     1158    // This is called when another app has deleted a database.  Go through all opened databases in this
     1159    // tracker and close any that's no longer being tracked in the database.
     1160   
     1161    {
     1162        // Acquire the lock before calling openTrackerDatabase.
     1163        MutexLocker lockDatabase(m_databaseGuard);
     1164        openTrackerDatabase(DontCreateIfDoesNotExist);
     1165    }
     1166
     1167    if (!m_database.isOpen())
     1168        return;
     1169   
     1170    // Keep track of which opened databases have been deleted.
     1171    Vector<RefPtr<Database> > deletedDatabases;
     1172    typedef HashMap<RefPtr<SecurityOrigin>, Vector<String> > DeletedDatabaseMap;
     1173    DeletedDatabaseMap deletedDatabaseMap;
     1174   
     1175    // Make sure not to hold the m_openDatabaseMapGuard mutex when calling
     1176    // Database::markAsDeletedAndClose(), since that can cause a deadlock
     1177    // during the synchronous DatabaseThread call it triggers.
     1178    {
     1179        MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
     1180        if (m_openDatabaseMap) {
     1181            DatabaseOriginMap::const_iterator originMapEnd = m_openDatabaseMap->end();
     1182            for (DatabaseOriginMap::const_iterator originMapIt = m_openDatabaseMap->begin(); originMapIt != originMapEnd; ++originMapIt) {
     1183                RefPtr<SecurityOrigin> origin = originMapIt->key;
     1184                DatabaseNameMap* databaseNameMap = originMapIt->value;
     1185                Vector<String> deletedDatabaseNamesForThisOrigin;
     1186
     1187                // Loop through all opened databases in this origin.  Get the current database file path of each database and see if
     1188                // it still matches the path stored in the opened database object.
     1189                DatabaseNameMap::const_iterator dbNameMapEnd = databaseNameMap->end();
     1190                for (DatabaseNameMap::const_iterator dbNameMapIt = databaseNameMap->begin(); dbNameMapIt != dbNameMapEnd; ++dbNameMapIt) {
     1191                    String databaseName = dbNameMapIt->key;
     1192                    String databaseFileName;
     1193                    SQLiteStatement statement(m_database, "SELECT path FROM Databases WHERE origin=? AND name=?;");
     1194                    if (statement.prepare() == SQLResultOk) {
     1195                        statement.bindText(1, origin->databaseIdentifier());
     1196                        statement.bindText(2, databaseName);
     1197                        if (statement.step() == SQLResultRow)
     1198                            databaseFileName = statement.getColumnText(0);
     1199                        statement.finalize();
     1200                    }
     1201                   
     1202                    bool foundDeletedDatabase = false;
     1203                    DatabaseSet* databaseSet = dbNameMapIt->value;
     1204                    DatabaseSet::const_iterator dbEnd = databaseSet->end();
     1205                    for (DatabaseSet::const_iterator dbIt = databaseSet->begin(); dbIt != dbEnd; ++dbIt) {
     1206                        Database* db = static_cast<Database*>(*dbIt);
     1207                       
     1208                        // We are done if this database has already been marked as deleted.
     1209                        if (db->deleted())
     1210                            continue;
     1211                       
     1212                        // If this database has been deleted or if its database file no longer matches the current version, this database is no longer valid and it should be marked as deleted.
     1213                        if (databaseFileName.isNull() || databaseFileName != pathGetFileName(db->fileName())) {
     1214                            deletedDatabases.append(db);
     1215                            foundDeletedDatabase = true;
     1216                        }
     1217                    }
     1218                   
     1219                    // If the database no longer exists, we should remember to remove it from the OriginQuotaManager later.
     1220                    if (foundDeletedDatabase && databaseFileName.isNull())
     1221                        deletedDatabaseNamesForThisOrigin.append(databaseName);
     1222                }
     1223               
     1224                if (!deletedDatabaseNamesForThisOrigin.isEmpty())
     1225                    deletedDatabaseMap.set(origin, deletedDatabaseNamesForThisOrigin);
     1226            }
     1227        }
     1228    }
     1229   
     1230    for (unsigned i = 0; i < deletedDatabases.size(); ++i)
     1231        deletedDatabases[i]->markAsDeletedAndClose();
     1232   
     1233    DeletedDatabaseMap::const_iterator end = deletedDatabaseMap.end();
     1234    for (DeletedDatabaseMap::const_iterator it = deletedDatabaseMap.begin(); it != end; ++it) {
     1235        SecurityOrigin* origin = it->key.get();
     1236        if (m_client)
     1237            m_client->dispatchDidModifyOrigin(origin);
     1238       
     1239        const Vector<String>& databaseNames = it->value;
     1240        for (unsigned i = 0; i < databaseNames.size(); ++i) {
     1241            if (m_client)
     1242                m_client->dispatchDidModifyDatabase(origin, databaseNames[i]);
     1243        }       
     1244    }
     1245}
     1246   
     1247static bool isZeroByteFile(const String& path)
     1248{
     1249    long long size = 0;
     1250    return getFileSize(path, size) && !size;
     1251}
     1252   
     1253bool DatabaseTracker::deleteDatabaseFileIfEmpty(const String& path)
     1254{
     1255    if (!isZeroByteFile(path))
     1256        return false;
     1257   
     1258    SQLiteDatabase database;
     1259    if (!database.open(path))
     1260        return false;
     1261   
     1262    // Specify that we want the exclusive locking mode, so after the next read,
     1263    // we'll be holding the lock to this database file.
     1264    SQLiteStatement lockStatement(database, "PRAGMA locking_mode=EXCLUSIVE;");
     1265    if (lockStatement.prepare() != SQLResultOk)
     1266        return false;
     1267    int result = lockStatement.step();
     1268    if (result != SQLResultRow && result != SQLResultDone)
     1269        return false;
     1270    lockStatement.finalize();
     1271
     1272    // Every sqlite database has a sqlite_master table that contains the schema for the database.
     1273    // http://www.sqlite.org/faq.html#q7
     1274    SQLiteStatement readStatement(database, "SELECT * FROM sqlite_master LIMIT 1;");   
     1275    if (readStatement.prepare() != SQLResultOk)
     1276        return false;
     1277    // We shouldn't expect any result.
     1278    if (readStatement.step() != SQLResultDone)
     1279        return false;
     1280    readStatement.finalize();
     1281   
     1282    // At this point, we hold the exclusive lock to this file.  Double-check again to make sure
     1283    // it's still zero bytes.
     1284    if (!isZeroByteFile(path))
     1285        return false;
     1286   
     1287    return SQLiteFileSystem::deleteDatabaseFile(path);
     1288}
     1289
     1290Mutex& DatabaseTracker::openDatabaseMutex()
     1291{
     1292    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
     1293    return mutex;
     1294}
     1295
     1296void DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled()
     1297{
     1298    // Lock the database from opening any database until we are done with scanning the file system for
     1299    // zero byte database files to remove.
     1300    openDatabaseMutex().lock();
     1301}
     1302
     1303void DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish()
     1304{
     1305    openDatabaseMutex().unlock();
     1306}
     1307
     1308void DatabaseTracker::setDatabasesPaused(bool paused)
     1309{
     1310    MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
     1311    if (!m_openDatabaseMap)
     1312        return;
     1313
     1314    // This walking is - sadly - the only reliable way to get at each open database thread.
     1315    // This will be cleaner once <rdar://problem/5680441> or some other DB thread consolidation takes place.
     1316    DatabaseOriginMap::iterator i = m_openDatabaseMap.get()->begin();
     1317    DatabaseOriginMap::iterator end = m_openDatabaseMap.get()->end();
     1318   
     1319    for (; i != end; ++i) {
     1320        DatabaseNameMap* databaseNameMap = i->value;
     1321        DatabaseNameMap::iterator j = databaseNameMap->begin();
     1322        DatabaseNameMap::iterator dbNameMapEnd = databaseNameMap->end();
     1323        for (; j != dbNameMapEnd; ++j) {
     1324            DatabaseSet* databaseSet = j->value;
     1325            DatabaseSet::iterator k = databaseSet->begin();
     1326            DatabaseSet::iterator dbSetEnd = databaseSet->end();
     1327            for (; k != dbSetEnd; ++k) {
     1328                DatabaseContext* context = (*k)->databaseContext();
     1329                context->setPaused(paused);
     1330            }
     1331        }
     1332    }
     1333}
     1334
     1335#endif
    11151336
    11161337void DatabaseTracker::setClient(DatabaseManagerClient* client)
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h

    r157653 r161638  
    101101    bool deleteDatabase(SecurityOrigin*, const String& name);
    102102
     103#if PLATFORM(IOS)
     104    void removeDeletedOpenedDatabases();
     105    static bool deleteDatabaseFileIfEmpty(const String&);
     106
     107    // MobileSafari will grab this mutex on the main thread before dispatching the task to
     108    // clean up zero byte database files.  Any operations to open new database will have to
     109    // wait for that task to finish by waiting on this mutex.
     110    static Mutex& openDatabaseMutex();
     111   
     112    static void emptyDatabaseFilesRemovalTaskWillBeScheduled();
     113    static void emptyDatabaseFilesRemovalTaskDidFinish();
     114   
     115    void setDatabasesPaused(bool);
     116#endif
     117   
    103118    void setClient(DatabaseManagerClient*);
    104119
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp

    r157653 r161638  
    519519}
    520520
     521#if PLATFORM(IOS)
     522bool SQLTransactionBackend::shouldPerformWhilePaused() const
     523{
     524    // SQLTransactions should only run-while-paused if they have progressed passed the first transaction step.
     525    return m_nextState != SQLTransactionState::AcquireLock;
     526}
     527#endif
     528
    521529void SQLTransactionBackend::executeSQL(PassOwnPtr<AbstractSQLStatement> statement,
    522530    const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions)
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h

    r157653 r161638  
    6868    void lockAcquired();
    6969    void performNextStep();
     70
     71#if PLATFORM(IOS)
     72    bool shouldPerformWhilePaused() const;
     73#endif
    7074
    7175    DatabaseBackend* database() { return m_database.get(); }
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r161628 r161638  
    6464                01D3CF8614BD0A3000FE9970 /* WebGLSharedObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01D3CF8014BD0A3000FE9970 /* WebGLSharedObject.cpp */; };
    6565                01D3CF8714BD0A3000FE9970 /* WebGLSharedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 01D3CF8114BD0A3000FE9970 /* WebGLSharedObject.h */; };
     66                01E6C2E41194B2820050821C /* SpellingDot@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01E6C2E31194B2820050821C /* SpellingDot@2x.png */; };
    6667                0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */; };
    6768                0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */; };
     
    35683569                A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
    35693570                A1C7FAA2133A5D3500D6732D /* JSXPathResultCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */; };
     3571                A1DE712D18612AC100734192 /* TouchEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1DE712B18612AC100734192 /* TouchEvents.cpp */; };
     3572                A1DE71321861322200734192 /* TouchConstructors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1DE71301861322200734192 /* TouchConstructors.cpp */; };
    35703573                A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */; };
    35713574                A1E1154613015C4E0054AC8C /* PointLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E1154513015C4E0054AC8C /* PointLightSource.cpp */; };
     
    36403643                A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
    36413644                A5C566AB127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C566AA127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3645                A5DEBDA316FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */; };
     3646                A5DEBDA416FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */; };
    36423647                A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */; };
    36433648                A5F9EF701266750D00FCCF52 /* DiskImageCacheIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5F9EF6E1266750D00FCCF52 /* DiskImageCacheIOS.mm */; };
     
    53295334                BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0D51715D2A200658D98 /* VideoTrackList.cpp */; };
    53305335                BE88E0E21715D2A200658D98 /* VideoTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0D61715D2A200658D98 /* VideoTrackList.h */; };
     5336                BE8C753110681324001E93F5 /* SpellingDot.png in Resources */ = {isa = PBXBuildFile; fileRef = BE8C753010681324001E93F5 /* SpellingDot.png */; };
    53315337                BE8EF042171C8FF9009B48C3 /* JSAudioTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */; };
    53325338                BE8EF043171C8FF9009B48C3 /* JSAudioTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */; };
     
    55815587                D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */; };
    55825588                D01A27AE10C9BFD800026A42 /* SpaceSplitString.h in Headers */ = {isa = PBXBuildFile; fileRef = D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */; settings = {ATTRIBUTES = (Private, ); }; };
     5589                D02B64B214089E56006EFA21 /* DictationPhraseWithAlternativesDot.png in Resources */ = {isa = PBXBuildFile; fileRef = D02B64B014089E56006EFA21 /* DictationPhraseWithAlternativesDot.png */; };
     5590                D02B64B314089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D02B64B114089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png */; };
    55835591                D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */; };
    55845592                D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */; };
     
    55935601                D0B0556909C6700100307E43 /* CreateLinkCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */; };
    55945602                D0BC54491443AC4A00E105DA /* CachedStyleSheetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     5603                D0BD4F5C1408850F006839B6 /* DictationCommandIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */; };
     5604                D0BD4F5D1408850F006839B6 /* DictationCommandIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */; };
    55955605                D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */; };
    55965606                D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = D0CE58F7125E4CC200F3F199 /* ResourceLoadScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    64576467                FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */; };
    64586468                FEBC5F3216BD0CC300659BD3 /* DatabaseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6469                FED13D2A0CEA91DF00D89466 /* DOMUIKitExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = FED13D260CEA91DF00D89466 /* DOMUIKitExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6470                FED13D2B0CEA91DF00D89466 /* DOMUIKitExtensions.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D270CEA91DF00D89466 /* DOMUIKitExtensions.mm */; };
    64596471                FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D390CEA934600D89466 /* EditorIOS.mm */; };
    64606472                FED13D3D0CEA936A00D89466 /* FrameIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3B0CEA936A00D89466 /* FrameIOS.mm */; };
     
    67396751                01D3CF8014BD0A3000FE9970 /* WebGLSharedObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLSharedObject.cpp; path = canvas/WebGLSharedObject.cpp; sourceTree = "<group>"; };
    67406752                01D3CF8114BD0A3000FE9970 /* WebGLSharedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLSharedObject.h; path = canvas/WebGLSharedObject.h; sourceTree = "<group>"; };
     6753                01E6C2E31194B2820050821C /* SpellingDot@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SpellingDot@2x.png"; sourceTree = "<group>"; };
    67416754                0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSSVGDocumentValue.cpp; sourceTree = "<group>"; };
    67426755                0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSSVGDocumentValue.h; sourceTree = "<group>"; };
     
    1052110534                A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
    1052210535                A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResultCustom.cpp; sourceTree = "<group>"; };
     10536                A1DE712B18612AC100734192 /* TouchEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchEvents.cpp; sourceTree = "<group>"; };
     10537                A1DE71301861322200734192 /* TouchConstructors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchConstructors.cpp; sourceTree = "<group>"; };
    1052310538                A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DistantLightSource.cpp; path = filters/DistantLightSource.cpp; sourceTree = "<group>"; };
    1052410539                A1E1154513015C4E0054AC8C /* PointLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PointLightSource.cpp; path = filters/PointLightSource.cpp; sourceTree = "<group>"; };
     
    1060210617                A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCocoa.h; path = cocoa/KeyEventCocoa.h; sourceTree = "<group>"; };
    1060310618                A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventCocoa.mm; path = cocoa/KeyEventCocoa.mm; sourceTree = "<group>"; };
     10619                A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitPlaybackTargetAvailabilityEvent.cpp; sourceTree = "<group>"; };
     10620                A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitPlaybackTargetAvailabilityEvent.h; sourceTree = "<group>"; };
     10621                A5DEBDA116FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitPlaybackTargetAvailabilityEvent.idl; sourceTree = "<group>"; };
    1060410622                A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Autocapitalize.cpp; sourceTree = "<group>"; };
    1060510623                A5F9EF6E1266750D00FCCF52 /* DiskImageCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DiskImageCacheIOS.mm; sourceTree = "<group>"; };
     
    1253512553                BE88E0D61715D2A200658D98 /* VideoTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackList.h; sourceTree = "<group>"; };
    1253612554                BE88E0D71715D2A200658D98 /* VideoTrackList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VideoTrackList.idl; sourceTree = "<group>"; };
     12555                BE8C753010681324001E93F5 /* SpellingDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SpellingDot.png; sourceTree = "<group>"; };
    1253712556                BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioTrack.cpp; sourceTree = "<group>"; };
    1253812557                BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAudioTrack.h; sourceTree = "<group>"; };
     
    1284712866                D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceSplitString.cpp; sourceTree = "<group>"; };
    1284812867                D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; };
     12868                D02B64B014089E56006EFA21 /* DictationPhraseWithAlternativesDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DictationPhraseWithAlternativesDot.png; sourceTree = "<group>"; };
     12869                D02B64B114089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "DictationPhraseWithAlternativesDot@2x.png"; sourceTree = "<group>"; };
    1284912870                D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; };
    1285012871                D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormatBlockCommand.h; sourceTree = "<group>"; };
     
    1285912880                D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CreateLinkCommand.cpp; sourceTree = "<group>"; };
    1286012881                D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedStyleSheetClient.h; sourceTree = "<group>"; };
     12882                D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationCommandIOS.cpp; sourceTree = "<group>"; };
     12883                D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictationCommandIOS.h; sourceTree = "<group>"; };
    1286112884                D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadScheduler.cpp; sourceTree = "<group>"; };
    1286212885                D0CE58F7125E4CC200F3F199 /* ResourceLoadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadScheduler.h; sourceTree = "<group>"; };
     
    1381813841                FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseBase.cpp; sourceTree = "<group>"; };
    1381913842                FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseBase.h; sourceTree = "<group>"; };
     13843                FED13D260CEA91DF00D89466 /* DOMUIKitExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMUIKitExtensions.h; sourceTree = "<group>"; };
     13844                FED13D270CEA91DF00D89466 /* DOMUIKitExtensions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMUIKitExtensions.mm; sourceTree = "<group>"; };
    1382013845                FED13D390CEA934600D89466 /* EditorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorIOS.mm; sourceTree = "<group>"; };
    1382113846                FED13D3B0CEA936A00D89466 /* FrameIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FrameIOS.mm; sourceTree = "<group>"; };
     
    1382613851                FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionBackend.cpp; sourceTree = "<group>"; };
    1382713852                FEE1811216C319E800084849 /* SQLTransactionBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionBackend.h; sourceTree = "<group>"; };
     13853                FEE7D6610D99AD16005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
    1382813854                FF945EC9161F7F3600971BC8 /* PseudoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PseudoElement.cpp; sourceTree = "<group>"; };
    1382913855                FF945ECA161F7F3600971BC8 /* PseudoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PseudoElement.h; sourceTree = "<group>"; };
     
    1441314439                        children = (
    1441414440                                CD0DBB3E142274E600280263 /* audio */,
     14441                                65998A650E5F5FD3004E097A /* images */,
    1441514442                                46F9D5DA0B0D60170028EE36 /* aliasCursor.png */,
    1441614443                                46D4F2460AF97E810035385A /* cellCursor.png */,
     
    1491914946                                1CDD45E40BA9C84600F90147 /* DebugRelease.xcconfig */,
    1492014947                                449098B10F8F82520076A327 /* FeatureDefines.xcconfig */,
     14948                                FEE7D6610D99AD16005351F6 /* iOS.xcconfig */,
    1492114949                                1C904DF90BA9D2C80081E9D0 /* Version.xcconfig */,
    1492214950                                1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */,
     
    1528015308                        isa = PBXGroup;
    1528115309                        children = (
     15310                                D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */,
     15311                                D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */,
    1528215312                                FED13D390CEA934600D89466 /* EditorIOS.mm */,
    1528315313                        );
     
    1599916029                        );
    1600016030                        path = mac;
     16031                        sourceTree = "<group>";
     16032                };
     16033                65998A650E5F5FD3004E097A /* images */ = {
     16034                        isa = PBXGroup;
     16035                        children = (
     16036                                D02B64B014089E56006EFA21 /* DictationPhraseWithAlternativesDot.png */,
     16037                                D02B64B114089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png */,
     16038                                BE8C753010681324001E93F5 /* SpellingDot.png */,
     16039                                01E6C2E31194B2820050821C /* SpellingDot@2x.png */,
     16040                        );
     16041                        name = images;
    1600116042                        sourceTree = "<group>";
    1600216043                };
     
    1742417465                        isa = PBXGroup;
    1742517466                        children = (
     17467                                CE26169D187E6554007955F3 /* airplay */,
    1742617468                                072AE1DE183C0513000A5988 /* plugins */,
    1742717469                                CDA98DBD16014E0800FEA3B1 /* encryptedmedia */,
     
    2019920241                                BC1A37A7097C715F0019F3D8 /* DOMStylesheets.h */,
    2020020242                                BC1A37A8097C715F0019F3D8 /* DOMTraversal.h */,
     20243                                FED13D260CEA91DF00D89466 /* DOMUIKitExtensions.h */,
     20244                                FED13D270CEA91DF00D89466 /* DOMUIKitExtensions.mm */,
    2020120245                                BC1A37A9097C715F0019F3D8 /* DOMUtility.mm */,
    2020220246                                BC1A37AA097C715F0019F3D8 /* DOMViews.h */,
     
    2061320657                        isa = PBXGroup;
    2061420658                        children = (
     20659                                CE261694187E6469007955F3 /* ios */,
    2061520660                                BC6C49F10D7DBA0500FFA558 /* JSImageConstructor.cpp */,
    2061620661                                BC6C49F20D7DBA0500FFA558 /* JSImageConstructor.h */,
     
    2092120966                        );
    2092220967                        path = mediasource;
     20968                        sourceTree = "<group>";
     20969                };
     20970                CE261694187E6469007955F3 /* ios */ = {
     20971                        isa = PBXGroup;
     20972                        children = (
     20973                                A1DE71301861322200734192 /* TouchConstructors.cpp */,
     20974                        );
     20975                        path = ios;
     20976                        sourceTree = "<group>";
     20977                };
     20978                CE26169D187E6554007955F3 /* airplay */ = {
     20979                        isa = PBXGroup;
     20980                        children = (
     20981                                A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */,
     20982                                A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */,
     20983                                A5DEBDA116FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.idl */,
     20984                        );
     20985                        path = airplay;
     20986                        sourceTree = "<group>";
     20987                };
     20988                CE2616A4187E65C1007955F3 /* ios */ = {
     20989                        isa = PBXGroup;
     20990                        children = (
     20991                                A1DE712B18612AC100734192 /* TouchEvents.cpp */,
     20992                        );
     20993                        path = ios;
    2092320994                        sourceTree = "<group>";
    2092420995                };
     
    2179221863                        isa = PBXGroup;
    2179321864                        children = (
     21865                                CE2616A4187E65C1007955F3 /* ios */,
    2179421866                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
    2179521867                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
     
    2335623428                                0705851317FA7107005F2BCB /* JSMediaStreamCapabilities.h in Headers */,
    2335723429                                BC53DA601143141A000D817E /* DOMObjectHashTableMap.h in Headers */,
     23430                                FED13D2A0CEA91DF00D89466 /* DOMUIKitExtensions.h in Headers */,
    2335823431                                85C7F5D00AAFB8D9004014DD /* DOMOverflowEvent.h in Headers */,
    2335923432                                85989DCF0ACC8BBD00A0BC51 /* DOMOverflowEventInternal.h in Headers */,
     
    2502925102                                514BC843161CF05C004D52F4 /* ResourceBuffer.h in Headers */,
    2503025103                                7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
     25104                                D0BD4F5D1408850F006839B6 /* DictationCommandIOS.h in Headers */,
    2503125105                                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
    2503225106                                514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
     
    2569625770                                F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */,
    2569725771                                15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */,
     25772                                A5DEBDA416FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h in Headers */,
    2569825773                                FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */,
    2569925774                                BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */,
     
    2606026135                        buildActionMask = 2147483647;
    2606126136                        files = (
     26137                                D02B64B214089E56006EFA21 /* DictationPhraseWithAlternativesDot.png in Resources */,
    2606226138                                46F9D5DD0B0D60170028EE36 /* aliasCursor.png in Resources */,
     26139                                D02B64B314089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png in Resources */,
    2606326140                                46D4F2490AF97E810035385A /* cellCursor.png in Resources */,
    2606426141                                93153BDE141959F400FCF5BE /* deleteButton.png in Resources */,
     26142                                BE8C753110681324001E93F5 /* SpellingDot.png in Resources */,
    2606526143                                93153BCD1417FBBF00FCF5BE /* deleteButton@2x.png in Resources */,
    2606626144                                93153BE014195A2800FCF5BE /* deleteButtonPressed.png in Resources */,
     
    2606926147                                85136C9A0AED665900F90A3D /* eastWestResizeCursor.png in Resources */,
    2607026148                                85136C9B0AED665900F90A3D /* helpCursor.png in Resources */,
     26149                                01E6C2E41194B2820050821C /* SpellingDot@2x.png in Resources */,
    2607126150                                7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */,
    2607226151                                93153BE414195B2A00FCF5BE /* inputSpeech.png in Resources */,
     
    2649326572                                BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */,
    2649426573                                4A6E9FC313C17D1D0046A7F8 /* CSSFontFeatureValue.cpp in Sources */,
     26574                                A5DEBDA316FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp in Sources */,
    2649526575                                BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
    2649626576                                A80E6CF10A1989CA007FB8C5 /* CSSFontValue.cpp in Sources */,
     
    2719427274                                F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */,
    2719527275                                51D719E6181106E00016DC51 /* IDBOpenDBRequest.cpp in Sources */,
     27276                                FED13D2B0CEA91DF00D89466 /* DOMUIKitExtensions.mm in Sources */,
    2719627277                                089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */,
    2719727278                                B275357B0B053814002CE64F /* ImageMac.mm in Sources */,
     
    2737527456                                65DF31F509D1CC60000BE325 /* JSDocumentType.cpp in Sources */,
    2737627457                                1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */,
     27458                                A1DE712D18612AC100734192 /* TouchEvents.cpp in Sources */,
    2737727459                                93B70D6309EB0C7C009D8468 /* JSDOMBinding.cpp in Sources */,
    2737827460                                BC60D7C00D29A46300B9918F /* JSDOMCoreException.cpp in Sources */,
     
    2753827620                                D6489D25166FFCF1007C031B /* JSHTMLTemplateElement.cpp in Sources */,
    2753927621                                D6F7960D166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp in Sources */,
     27622                                A1DE71321861322200734192 /* TouchConstructors.cpp in Sources */,
    2754027623                                A80E7E9E0A1A83E3007FB8C5 /* JSHTMLTextAreaElement.cpp in Sources */,
    2754127624                                A80E7B130A19D606007FB8C5 /* JSHTMLTitleElement.cpp in Sources */,
     
    2906129144                                4476531B133170990006B789 /* SSLKeyGeneratorIOS.cpp in Sources */,
    2906229145                                1AB7FC7A0A8B92EC00D9D37B /* XPathPath.cpp in Sources */,
     29146                                D0BD4F5C1408850F006839B6 /* DictationCommandIOS.cpp in Sources */,
    2906329147                                1AB7FC7C0A8B92EC00D9D37B /* XPathPredicate.cpp in Sources */,
    2906429148                                1AB7FC7E0A8B92EC00D9D37B /* XPathResult.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/GCController.cpp

    r156804 r161638  
    8282{
    8383    JSLockHolder lock(JSDOMWindow::commonVM());
     84#if PLATFORM(IOS)
     85    // If JavaScript was never run in this process, there's no need to call GC which will
     86    // end up creating a VM unnecessarily.
     87    if (!JSDOMWindow::commonVMExists())
     88        return;
     89#endif
    8490    if (!JSDOMWindow::commonVM()->heap.isBusy())
    8591        JSDOMWindow::commonVM()->heap.collectAllGarbage();
     
    98104}
    99105
     106#if PLATFORM(IOS)
     107void GCController::releaseExecutableMemory()
     108{
     109    JSLockHolder lock(JSDOMWindow::commonVM());
     110
     111    if (!JSDOMWindow::commonVMExists())
     112        return;
     113
     114    // We shouldn't have any javascript running on our stack when this function is called. The
     115    // following line asserts that.
     116    ASSERT(!JSDOMWindow::commonVM()->dynamicGlobalObject);
     117
     118    // But be safe in release builds just in case...
     119    if (JSDOMWindow::commonVM()->dynamicGlobalObject)
     120        return;
     121
     122    JSDOMWindow::commonVM()->releaseExecutableMemory();
     123}
     124#endif
     125
    100126void GCController::setJavaScriptGarbageCollectorTimerEnabled(bool enable)
    101127{
  • trunk/Source/WebCore/bindings/js/GCController.h

    r156804 r161638  
    4545
    4646        void garbageCollectOnAlternateThreadForDebugging(bool waitUntilDone); // Used for stress testing.
     47#if PLATFORM(IOS)
     48        void releaseExecutableMemory();
     49#endif
    4750        void setJavaScriptGarbageCollectorTimerEnabled(bool);
    4851        void discardAllCompiledCode();
  • trunk/Source/WebCore/bindings/js/JSCallbackData.h

    r157075 r161638  
    5959    ~JSCallbackData()
    6060    {
     61#if !PLATFORM(IOS)
    6162        ASSERT(m_thread == currentThread());
     63#endif
    6264    }
    6365
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r161241 r161638  
    4141#include <wtf/MainThread.h>
    4242
     43#if PLATFORM(IOS)
     44#include "ChromeClient.h"
     45#include "WebSafeGCActivityCallbackIOS.h"
     46#include "WebSafeIncrementalSweeperIOS.h"
     47#endif
     48
    4349using namespace JSC;
    4450
     
    111117        return false;
    112118
     119#if ENABLE(INSPECTOR)
    113120    return page->inspectorController()->profilerEnabled();
     121#else
     122    return false;
     123#endif // ENABLE(INSPECTOR)
    114124#endif
    115125}
     
    167177
    168178#if PLATFORM(IOS)
    169     if (page->chrome().client()->isStopping())
     179    if (page->chrome().client().isStopping())
    170180        return true;
    171181#endif
     
    203213    ASSERT(isMainThread());
    204214
     215#if !PLATFORM(IOS)
    205216    static VM* vm = 0;
     217#else
     218    VM*& vm = commonVMInternal();
     219#endif
    206220    if (!vm) {
    207221        ScriptController::initializeThreading();
    208222        vm = VM::createLeaked(LargeHeap).leakRef();
     223#if PLATFORM(IOS)
     224        PassOwnPtr<WebSafeGCActivityCallback> activityCallback = WebSafeGCActivityCallback::create(&vm->heap);
     225        vm->heap.setActivityCallback(activityCallback);
     226        PassOwnPtr<WebSafeIncrementalSweeper> incrementalSweeper = WebSafeIncrementalSweeper::create(&vm->heap);
     227        vm->heap.setIncrementalSweeper(incrementalSweeper);
     228        vm->makeUsableFromMultipleThreads();
     229        vm->heap.machineThreads().addCurrentThread();
     230#else
    209231        vm->exclusiveThread = currentThread();
     232#endif // !PLATFORM(IOS)
    210233        initNormalWorldClientData(vm);
    211234    }
     
    213236    return vm;
    214237}
     238
     239#if PLATFORM(IOS)
     240bool JSDOMWindowBase::commonVMExists()
     241{
     242    return commonVMInternal();
     243}
     244
     245VM*& JSDOMWindowBase::commonVMInternal()
     246{
     247    ASSERT(isMainThread());
     248    static VM* commonVM;
     249    return commonVM;
     250}
     251#endif
    215252
    216253// JSDOMGlobalObject* is ignored, accessing a window in any context will
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r161220 r161638  
    4040#if ENABLE(SHARED_WORKERS)
    4141#include "JSSharedWorker.h"
     42#endif
     43
     44#if ENABLE(IOS_TOUCH_EVENTS)
     45#include "JSTouchConstructor.h"
     46#include "JSTouchListConstructor.h"
    4247#endif
    4348
     
    453458}
    454459
     460#if ENABLE(IOS_TOUCH_EVENTS)
     461JSValue JSDOMWindow::touch(ExecState* exec) const
     462{
     463    return getDOMConstructor<JSTouchConstructor>(exec->vm(), this);
     464}
     465
     466JSValue JSDOMWindow::touchList(ExecState* exec) const
     467{
     468    return getDOMConstructor<JSTouchListConstructor>(exec->vm(), this);
     469}
     470#endif
     471
    455472// Custom functions
    456473
  • trunk/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp

    r157274 r161638  
    6161}
    6262
     63#if PLATFORM(IOS)
     64JSValue JSDeviceOrientationEvent::webkitCompassHeading(ExecState*) const
     65{
     66    DeviceOrientationEvent& imp = impl();
     67    if (!imp.orientation()->canProvideCompassHeading())
     68        return jsNull();
     69    return jsNumber(imp.orientation()->compassHeading());
     70}
     71
     72JSValue JSDeviceOrientationEvent::webkitCompassAccuracy(ExecState*) const
     73{
     74    DeviceOrientationEvent& imp = impl();
     75    if (!imp.orientation()->canProvideCompassAccuracy())
     76        return jsNull();
     77    return jsNumber(imp.orientation()->compassAccuracy());
     78}
     79#endif
     80
     81#if !PLATFORM(IOS)
    6382JSValue JSDeviceOrientationEvent::absolute(ExecState*) const
    6483{
     
    6887    return jsBoolean(imp.orientation()->absolute());
    6988}
     89#endif
    7090
    7191JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec)
     
    82102    bool gammaProvided = !exec->argument(5).isUndefinedOrNull();
    83103    double gamma = exec->argument(5).toNumber(exec);
     104#if PLATFORM(IOS)
     105    bool compassHeadingProvided = !exec->argument(6).isUndefinedOrNull();
     106    double compassHeading = exec->argument(6).toNumber(exec);
     107    bool compassAccuracyProvided = !exec->argument(7).isUndefinedOrNull();
     108    double compassAccuracy = exec->argument(7).toNumber(exec);
     109    RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, compassHeadingProvided, compassHeading, compassAccuracyProvided, compassAccuracy);
     110#else
    84111    bool absoluteProvided = !exec->argument(6).isUndefinedOrNull();
    85112    bool absolute = exec->argument(6).toBoolean(exec);
    86113    RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute);
     114#endif
    87115    impl().initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get());
    88116    return jsUndefined();
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h

    r161563 r161638  
    3030#include <runtime/Completion.h>
    3131#include <wtf/MainThread.h>
     32
     33#if PLATFORM(IOS)
     34#include "WebCoreThread.h"
     35#endif
    3236
    3337namespace WebCore {
  • trunk/Source/WebCore/bindings/js/JSTouchCustom.cpp

    r95901 r161638  
    2626#include "config.h"
    2727
     28#if !PLATFORM(IOS)
    2829#if ENABLE(TOUCH_EVENTS)
    2930
     
    4748
    4849#endif // ENABLE(TOUCH_EVENTS)
     50#endif // !PLATFORM(IOS)
  • trunk/Source/WebCore/bindings/js/JSTouchListCustom.cpp

    r95901 r161638  
    2626#include "config.h"
    2727
     28#if !PLATFORM(IOS)
    2829#if ENABLE(TOUCH_EVENTS)
    2930
     
    4748
    4849#endif // ENABLE(TOUCH_EVENTS)
     50#endif // !PLATFORM(IOS)
  • trunk/Source/WebCore/bindings/js/PageScriptDebugServer.cpp

    r159605 r161638  
    149149    // Page can be null if we are continuing because the Page closed.
    150150    Page* page = toPage(globalObject);
     151#if PLATFORM(IOS)
     152    // FIXME: Can this happen in open source too, or is this iOS (multi-threaded) only?
     153    if (!page)
     154        return;
     155#endif
    151156    ASSERT(!page || page == m_pausedPage);
    152157
  • trunk/Source/WebCore/bindings/js/ScriptController.cpp

    r160457 r161638  
    6262void ScriptController::initializeThreading()
    6363{
     64#if !PLATFORM(IOS)
    6465    JSC::initializeThreading();
    6566    WTF::initializeMainThread();
     67#endif
    6668}
    6769
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r160682 r161638  
    3535
    3636#include "ContentSearchUtils.h"
     37#include "EventLoop.h"
    3738#include "Frame.h"
    3839#include "JSDOMWindowCustom.h"
     
    5051#include <wtf/text/WTFString.h>
    5152
     53#if PLATFORM(IOS)
     54#include "JSDOMWindowBase.h"
     55#include "WebCoreThreadInternal.h"
     56#endif
     57
    5258using namespace JSC;
    5359
     
    296302    TimerBase::fireTimersInNestedEventLoop();
    297303
     304#if PLATFORM(IOS)
     305    // On iOS, running an EventLoop causes us to run a nested WebRunLoop.
     306    // Since the WebThread is autoreleased at the end of run loop iterations
     307    // we need to gracefully handle releasing and reacquiring the lock.
     308    ASSERT(WebThreadIsLockedOrDisabled());
     309    {
     310        if (WebThreadIsEnabled())
     311            JSC::JSLock::DropAllLocks dropAllLocks(WebCore::JSDOMWindowBase::commonVM(), JSC::JSLock::DropAllLocks::AlwaysDropLocks);
     312        WebRunLoopEnableNested();
     313#endif
     314
    298315    m_runningNestedMessageLoop = true;
    299316    m_doneProcessingDebuggerEvents = false;
     
    301318    m_runningNestedMessageLoop = false;
    302319
     320#if PLATFORM(IOS)
     321        WebRunLoopDisableNested();
     322    }
     323    ASSERT(WebThreadIsLockedOrDisabled());
     324#endif
    303325    didContinue(vmEntryGlobalObject);
    304326    dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject);
  • trunk/Source/WebCore/bindings/objc/DOM.mm

    r160152 r161638  
    5353#import <JavaScriptCore/APICast.h>
    5454#import <wtf/HashMap.h>
     55
     56#if PLATFORM(IOS)
     57#import "FocusController.h"
     58#import "HTMLLinkElement.h"
     59#import "KeyboardEvent.h"
     60#import "URL.h"
     61#import "MediaList.h"
     62#import "MediaQueryEvaluator.h"
     63#import "NodeRenderStyle.h"
     64#import "Page.h"
     65#import "RenderView.h"
     66#import "Touch.h"
     67#import "WAKAppKitStubs.h"
     68#import "WAKWindow.h"
     69#import "WebCoreThreadMessage.h"
     70#endif
    5571
    5672using namespace JSC;
     
    177193}
    178194
     195#if PLATFORM(IOS)
     196static WKQuad wkQuadFromFloatQuad(const FloatQuad& inQuad)
     197{
     198    WKQuad  theQuad;
     199    theQuad.p1 = inQuad.p1();
     200    theQuad.p2 = inQuad.p2();
     201    theQuad.p3 = inQuad.p3();
     202    theQuad.p4 = inQuad.p4();
     203   
     204    return theQuad;
     205}
     206
     207static NSArray *kit(const Vector<FloatQuad>& quads)
     208{
     209    size_t size = quads.size();
     210    NSMutableArray *array = [NSMutableArray arrayWithCapacity:size];
     211    for (size_t i = 0; i < size; ++i) {
     212        WKQuadObject* quadObject = [[WKQuadObject alloc] initWithQuad:wkQuadFromFloatQuad(quads[i])];
     213        [array addObject:quadObject];
     214        [quadObject release];
     215    }
     216    return array;
     217}
     218
     219static inline float min4(float a, float b, float c, float d)
     220{
     221    return std::min(std::min(a, b), std::min(c, d));
     222}
     223
     224static inline float max4(float a, float b, float c, float d)
     225{
     226    return std::max(std::max(a, b), std::max(c, d));
     227}
     228
     229static inline WKQuad emptyQuad()
     230{
     231    WKQuad zeroQuad = { CGPointZero, CGPointZero, CGPointZero, CGPointZero };
     232    return zeroQuad;
     233}
     234#endif
     235
    179236} // namespace WebCore
     237
     238#if PLATFORM(IOS)
     239@implementation WKQuadObject
     240
     241- (id)initWithQuad:(WKQuad)quad
     242{
     243    if ((self = [super init]))
     244    {
     245        _quad = quad;
     246    }
     247    return self;
     248}
     249
     250- (WKQuad)quad
     251{
     252    return _quad;
     253}
     254
     255- (CGRect)boundingBox
     256{
     257    float left      = WebCore::min4(_quad.p1.x, _quad.p2.x, _quad.p3.x, _quad.p4.x);
     258    float top       = WebCore::min4(_quad.p1.y, _quad.p2.y, _quad.p3.y, _quad.p4.y);
     259   
     260    float right     = WebCore::max4(_quad.p1.x, _quad.p2.x, _quad.p3.x, _quad.p4.x);
     261    float bottom    = WebCore::max4(_quad.p1.y, _quad.p2.y, _quad.p3.y, _quad.p4.y);
     262   
     263    return CGRectMake(left, top, right - left, bottom - top);
     264}
     265
     266@end
     267#endif
    180268
    181269@implementation DOMNode (WebCoreInternal)
     
    264352@implementation DOMNode (DOMNodeExtensions)
    265353
     354#if PLATFORM(IOS)
     355- (CGRect)boundingBox
     356#else
    266357- (NSRect)boundingBox
     358#endif
    267359{
    268360    // FIXME: Could we move this function to WebCore::Node and autogenerate?
     
    270362    WebCore::RenderObject* renderer = core(self)->renderer();
    271363    if (!renderer)
     364#if PLATFORM(IOS)
     365        return CGRectZero;
     366#else
    272367        return NSZeroRect;
     368#endif
    273369    return renderer->absoluteBoundingBoxRect();
    274370}
     
    279375}
    280376
     377#if PLATFORM(IOS)
     378// quad in page coordinates, taking transforms into account. c.f. - (NSRect)boundingBox;
     379- (WKQuad)absoluteQuad
     380{
     381    return [self absoluteQuadAndInsideFixedPosition:0];
     382}
     383
     384- (WKQuad)absoluteQuadAndInsideFixedPosition:(BOOL *)insideFixed
     385{
     386    core(self)->document().updateLayoutIgnorePendingStylesheets();
     387    WebCore::RenderObject *renderer = core(self)->renderer();
     388    if (renderer) {
     389        Vector<FloatQuad> quads;
     390        bool wasFixed = false;
     391        renderer->absoluteQuads(quads, &wasFixed);
     392        if (insideFixed)
     393            *insideFixed = wasFixed;
     394
     395        if (quads.size() == 0)
     396            return WebCore::emptyQuad();
     397       
     398        if (quads.size() == 1)
     399            return wkQuadFromFloatQuad(quads[0]);
     400
     401        FloatRect boundingRect = quads[0].boundingBox();
     402        for (size_t i = 1; i < quads.size(); ++i)
     403            boundingRect.unite(quads[i].boundingBox());
     404
     405        return wkQuadFromFloatQuad(boundingRect);
     406    }
     407
     408    return WebCore::emptyQuad();
     409}
     410
     411// this method is like - (CGRect)boundingBox, but it accounts for for transforms
     412- (CGRect)boundingBoxUsingTransforms
     413{
     414    core(self)->document().updateLayoutIgnorePendingStylesheets();
     415    WebCore::RenderObject* renderer = core(self)->renderer();
     416    if (!renderer)
     417        return CGRectZero;
     418    return renderer->absoluteBoundingBoxRect(true);
     419}
     420
     421// returns array of WKQuadObject
     422- (NSArray *)lineBoxQuads
     423{
     424    core(self)->document().updateLayoutIgnorePendingStylesheets();
     425    WebCore::RenderObject *renderer = core(self)->renderer();
     426    if (renderer) {
     427        Vector<WebCore::FloatQuad> quads;
     428        renderer->absoluteQuads(quads);
     429        return kit(quads);
     430    }
     431    return nil;
     432}
     433
     434- (Element *)_linkElement
     435{
     436    WebCore::Node* node = core(self);
     437   
     438    while (node) {
     439        if (node->isLink())
     440            return static_cast<WebCore::Element*>(node);
     441        node = node->parentNode();
     442    }
     443   
     444    return 0;
     445}
     446
     447- (NSURL *)hrefURL
     448{
     449    Element *link= [self _linkElement];
     450    if (link)
     451        return link->document().completeURL(stripLeadingAndTrailingHTMLSpaces(link->getAttribute(HTMLNames::hrefAttr)));
     452   
     453    return nil;
     454}
     455
     456- (NSString *)hrefTarget
     457{
     458    Element *target = [self _linkElement];
     459   
     460    if(target) return target->getAttribute(HTMLNames::targetAttr);
     461   
     462    return nil;
     463}
     464
     465- (CGRect)hrefFrame
     466{
     467    RenderObject *renderer = [self _linkElement]->renderer();
     468   
     469    if(renderer) return renderer->absoluteBoundingBoxRect();
     470   
     471    return NSZeroRect;
     472}
     473
     474- (NSString *)hrefLabel
     475{
     476    Element *link= [self _linkElement];
     477   
     478    if (!link) return nil;
     479   
     480    return link->textContent();
     481}
     482
     483- (NSString *)hrefTitle
     484{
     485    Element *link= [self _linkElement];
     486   
     487    if (!link) return nil;
     488   
     489    return link->document().displayStringModifiedByEncoding(static_cast<HTMLElement *>(link)->title());
     490}
     491
     492- (CGRect)boundingFrame
     493{
     494    return [self boundingBox];
     495}
     496
     497- (WKQuad)innerFrameQuad       // takes transforms into account
     498{
     499    core(self)->document().updateLayoutIgnorePendingStylesheets();
     500    RenderObject* renderer = core(self)->renderer();
     501    if (!renderer)
     502        return emptyQuad();
     503
     504    RenderStyle& style = renderer->style();
     505    IntRect boundingBox = renderer->absoluteBoundingBoxRect(true /* use transforms*/);
     506
     507    boundingBox.move(style.borderLeftWidth(), style.borderTopWidth());
     508    boundingBox.setWidth(boundingBox.width() - style.borderLeftWidth() - style.borderRightWidth());
     509    boundingBox.setHeight(boundingBox.height() - style.borderBottomWidth() - style.borderTopWidth());
     510
     511    // FIXME: This function advertises returning a quad, but it actually returns a bounding box (so there is no rotation, for instance).
     512    return wkQuadFromFloatQuad(FloatQuad(boundingBox));
     513}
     514
     515- (float)computedFontSize
     516{
     517    WebCore::Node *node = core(self);
     518    RenderStyle *style = node->renderStyle();
     519    if (!style)
     520        return 0.0f;
     521    return style->fontDescription().computedSize();
     522}
     523
     524- (DOMNode *)nextFocusNode
     525{
     526    Page *page = core(self)->document().page();
     527    if (!page)
     528        return nil;
     529
     530    RefPtr<KeyboardEvent> key = KeyboardEvent::create();
     531    return kit(page->focusController().nextFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&core(self)->document()), core(self), key.get()));
     532}
     533
     534- (DOMNode *)previousFocusNode
     535{
     536    Page *page = core(self)->document().page();
     537    if (!page)
     538        return nil;
     539
     540    RefPtr<KeyboardEvent> key = KeyboardEvent::create();
     541    return kit(page->focusController().previousFocusableElement(FocusNavigationScope::focusNavigationScopeOf(&core(self)->document()), core(self), key.get()));
     542}
     543
     544#endif // PLATFORM(IOS)
     545
    281546@end
    282547
    283548@implementation DOMNode (DOMNodeExtensionsPendingPublic)
    284549
     550#if !PLATFORM(IOS)
    285551- (NSImage *)renderedImage
    286552{
     
    292558    return [createDragImageForNode(*frame, *node).leakRef() autorelease];
    293559}
     560#endif
    294561
    295562- (NSArray *)textRects
     
    322589@implementation DOMRange (DOMRangeExtensions)
    323590
     591#if PLATFORM(IOS)
     592- (CGRect)boundingBox
     593#else
    324594- (NSRect)boundingBox
     595#endif
    325596{
    326597    // FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range.
     
    329600}
    330601
     602#if !PLATFORM(IOS)
    331603- (NSImage *)renderedImageForcingBlackText:(BOOL)forceBlackText
     604#else
     605- (CGImageRef)renderedImageForcingBlackText:(BOOL)forceBlackText
     606#endif
    332607{
    333608    WebCore::Range* range = core(self);
     
    361636@implementation DOMElement (DOMElementAppKitExtensions)
    362637
     638#if !PLATFORM(IOS)
    363639- (NSImage*)image
    364640{
     
    372648    return cachedImage->imageForRenderer(toRenderImage(renderer))->getNSImage();
    373649}
     650#endif
    374651
    375652@end
     
    377654@implementation DOMElement (WebPrivate)
    378655
     656#if !PLATFORM(IOS)
    379657- (NSFont *)_font
    380658{
     
    385663    return renderer->style().font().primaryFont()->getNSFont();
    386664}
    387 
     665#else
     666- (CTFontRef)_font
     667{
     668    RenderObject* renderer = core(self)->renderer();
     669    if (!renderer)
     670        return nil;
     671    return renderer->style().font().primaryFont()->getCTFont();
     672}
     673#endif
     674
     675#if !PLATFORM(IOS)
    388676- (NSData *)_imageTIFFRepresentation
    389677{
     
    397685    return (NSData *)cachedImage->imageForRenderer(renderer)->getTIFFRepresentation();
    398686}
     687#endif
    399688
    400689- (NSURL *)_getURLAttribute:(NSString *)name
     
    416705@end
    417706
     707#if PLATFORM(IOS)
     708@implementation DOMHTMLLinkElement (WebPrivate)
     709- (BOOL)_mediaQueryMatchesForOrientation:(int)orientation
     710{
     711    Document& document = static_cast<HTMLLinkElement*>(core(self))->document();
     712    FrameView* frameView = document.frame() ? document.frame()->view() : 0;
     713    if (!frameView)
     714        return false;
     715    int layoutWidth = frameView->layoutWidth();
     716    int layoutHeight = frameView->layoutHeight();
     717    IntSize savedFixedLayoutSize = frameView->fixedLayoutSize();
     718    bool savedUseFixedLayout = frameView->useFixedLayout();
     719    if ((orientation == WebMediaQueryOrientationPortrait && layoutWidth > layoutHeight) ||
     720        (orientation == WebMediaQueryOrientationLandscape && layoutWidth < layoutHeight)) {
     721        // temporarily swap the orientation for the evaluation
     722        frameView->setFixedLayoutSize(IntSize(layoutHeight, layoutWidth));
     723        frameView->setUseFixedLayout(true);
     724    }
     725       
     726    bool result = [self _mediaQueryMatches];
     727
     728    frameView->setFixedLayoutSize(savedFixedLayoutSize);
     729    frameView->setUseFixedLayout(savedUseFixedLayout);
     730
     731    return result;
     732}
     733
     734- (BOOL)_mediaQueryMatches
     735{
     736    HTMLLinkElement* link = static_cast<HTMLLinkElement*>(core(self));
     737    String media = link->getAttribute(HTMLNames::mediaAttr);
     738    if (media.isEmpty())
     739        return true;
     740    Document& document = link->document();
     741
     742    RefPtr<MediaQuerySet> mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(media);
     743    MediaQueryEvaluator screenEval("screen", document.frame(), document.renderView() ? &document.renderView()->style() : 0);
     744
     745    return screenEval.eval(mediaQuerySet.get());
     746}
     747@end
     748#endif
     749
    418750//------------------------------------------------------------------------------------------
    419751// DOMRange
     
    443775@implementation DOMRGBColor (WebPrivate)
    444776
     777#if !PLATFORM(IOS)
    445778// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with
    446779// calls to the public method - (NSColor *)color.
     
    449782    return [self color];
    450783}
     784#endif
    451785
    452786@end
  • trunk/Source/WebCore/bindings/objc/DOMEvents.h

    r138992 r161638  
    4141#import <WebCore/DOMUIEvent.h>
    4242#import <WebCore/DOMWheelEvent.h>
     43
     44#if defined(ENABLE_IOS_TOUCH_EVENTS) && ENABLE_IOS_TOUCH_EVENTS
     45#import <WebCore/DOMTouchEvent.h>
     46#endif
     47
     48#if defined(ENABLE_IOS_GESTURE_EVENTS) && ENABLE_IOS_GESTURE_EVENTS
     49#import <WebCore/DOMGestureEvent.h>
     50#endif
  • trunk/Source/WebCore/bindings/objc/DOMEvents.mm

    r156241 r161638  
    4141#import "EventNames.h"
    4242
     43#if ENABLE(TOUCH_EVENTS)
     44#import "DOMTouchEvent.h"
     45#endif
     46
     47#if ENABLE(IOS_GESTURE_EVENTS)
     48#import "DOMGestureEvent.h"
     49#endif
     50
    4351using WebCore::eventNames;
    4452
     
    5563            return [DOMTextEvent class];
    5664        if (desiredInterface == WebCore::WheelEventInterfaceType)
    57             return [DOMWheelEvent class];
     65            return [DOMWheelEvent class];       
     66#if PLATFORM(IOS) && ENABLE(TOUCH_EVENTS)
     67        if (desiredInterface == WebCore::TouchEventInterfaceType)
     68            return [DOMTouchEvent class];
     69#endif
     70#if ENABLE(IOS_GESTURE_EVENTS)
     71        if (desiredInterface == WebCore::GestureEventInterfaceType)
     72            return [DOMGestureEvent class];
     73#endif
    5874        return [DOMUIEvent class];
    5975    }
  • trunk/Source/WebCore/bindings/objc/DOMExtensions.h

    r161406 r161638  
    4444#import <WebCore/DOMRange.h>
    4545
     46#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     47#import <CoreGraphics/CoreGraphics.h>
     48#endif
     49
    4650@class NSArray;
    4751@class NSImage;
    4852@class NSURL;
    4953
     54
     55#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     56@interface DOMHTMLElement (DOMHTMLElementExtensions)
     57- (int)scrollXOffset;
     58- (int)scrollYOffset;
     59- (void)setScrollXOffset:(int)x scrollYOffset:(int)y;
     60- (void)setScrollXOffset:(int)x scrollYOffset:(int)y adjustForIOSCaret:(BOOL)adjustForIOSCaret;
     61- (void)absolutePosition:(int *)x :(int *)y :(int *)w :(int *)h;
     62@end
     63#endif
     64
     65#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     66typedef struct _WKQuad {
     67    CGPoint p1;
     68    CGPoint p2;
     69    CGPoint p3;
     70    CGPoint p4;
     71} WKQuad;
     72
     73@interface WKQuadObject : NSObject
     74{
     75    WKQuad  _quad;
     76}
     77
     78- (id)initWithQuad:(WKQuad)quad;
     79- (WKQuad)quad;
     80- (CGRect)boundingBox;
     81@end
     82#endif
     83
    5084@interface DOMNode (DOMNodeExtensions)
     85#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     86- (CGRect)boundingBox;
     87#else
    5188- (NSRect)boundingBox WEBKIT_AVAILABLE_MAC(10_5);
     89#endif
    5290- (NSArray *)lineBoxRects WEBKIT_AVAILABLE_MAC(10_5);
     91
     92#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     93- (CGRect)boundingBoxUsingTransforms; // takes transforms into account
     94
     95- (WKQuad)absoluteQuad;
     96- (WKQuad)absoluteQuadAndInsideFixedPosition:(BOOL *)insideFixed;
     97- (NSArray *)lineBoxQuads;      // returns array of WKQuadObject
     98
     99- (NSURL *)hrefURL;
     100- (CGRect)hrefFrame;
     101- (NSString *)hrefTarget;
     102- (NSString *)hrefLabel;
     103- (NSString *)hrefTitle;
     104- (CGRect)boundingFrame;
     105- (WKQuad)innerFrameQuad;       // takes transforms into account
     106- (float)computedFontSize;
     107- (DOMNode *)nextFocusNode;
     108- (DOMNode *)previousFocusNode;
     109#endif
    53110@end
    54111
    55112@interface DOMElement (DOMElementAppKitExtensions)
     113#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    56114- (NSImage *)image WEBKIT_AVAILABLE_MAC(10_5);
     115#endif
    57116@end
    58117
     
    61120- (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text WEBKIT_AVAILABLE_MAC(10_5);
    62121@end
     122
     123#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     124@interface DOMHTMLAreaElement (DOMHTMLAreaElementExtensions)
     125- (CGRect)boundingFrameForOwner:(DOMNode *)anOwner;
     126@end
     127
     128@interface DOMHTMLSelectElement (DOMHTMLSelectElementExtensions)
     129- (DOMNode *)listItemAtIndex:(int)anIndex;
     130@end
     131#endif
  • trunk/Source/WebCore/bindings/objc/DOMHTML.mm

    r157058 r161638  
    5050#import "markup.h"
    5151
     52#if PLATFORM(IOS)
     53#import "Autocapitalize.h"
     54#import "DOMHTMLElementInternal.h"
     55#import "HTMLTextFormControlElement.h"
     56#import "JSMainThreadExecState.h"
     57#import "RenderLayer.h"
     58#import "WAKWindow.h"
     59#import "WebCoreThreadMessage.h"
     60#endif
     61
     62#if PLATFORM(IOS)
     63
     64using namespace WebCore;
     65
     66@implementation DOMHTMLElement (DOMHTMLElementExtensions)
     67
     68- (int)scrollXOffset
     69{
     70    RenderObject *renderer = core(self)->renderer();
     71    if (!renderer)
     72        return 0;
     73
     74    if (!renderer->isRenderBlockFlow())
     75        renderer = renderer->containingBlock();
     76
     77    if (!renderer->isBox() || !renderer->hasOverflowClip())
     78        return 0;
     79
     80    RenderBox *renderBox = toRenderBox(renderer);
     81    return renderBox->layer()->scrollXOffset();
     82}
     83
     84- (int)scrollYOffset
     85{
     86    RenderObject *renderer = core(self)->renderer();
     87    if (!renderer)
     88        return 0;
     89
     90    if (!renderer->isRenderBlockFlow())
     91        renderer = renderer->containingBlock();
     92    if (!renderer->isBox() || !renderer->hasOverflowClip())
     93        return 0;
     94
     95    RenderBox *renderBox = toRenderBox(renderer);
     96    return renderBox->layer()->scrollYOffset();
     97}
     98
     99- (void)setScrollXOffset:(int)x scrollYOffset:(int)y
     100{
     101    [self setScrollXOffset:x scrollYOffset:y adjustForIOSCaret:NO];
     102}
     103
     104- (void)setScrollXOffset:(int)x scrollYOffset:(int)y adjustForIOSCaret:(BOOL)adjustForIOSCaret
     105{
     106    RenderObject *renderer = core(self)->renderer();
     107    if (!renderer)
     108        return;
     109
     110    if (!renderer->isRenderBlockFlow())
     111        renderer = renderer->containingBlock();
     112    if (!renderer->hasOverflowClip() || !renderer->isBox())
     113        return;
     114
     115    RenderBox *renderBox = toRenderBox(renderer);
     116    RenderLayer *layer = renderBox->layer();
     117    if (adjustForIOSCaret)
     118        layer->setAdjustForIOSCaretWhenScrolling(true);
     119    layer->scrollToOffset(IntSize(x, y));
     120    if (adjustForIOSCaret)
     121        layer->setAdjustForIOSCaretWhenScrolling(false);
     122}
     123
     124- (void)absolutePosition:(int *)x :(int *)y :(int *)w :(int *)h {
     125    RenderBox *renderer = core(self)->renderBox();
     126    if (renderer) {
     127        if (w)
     128            *w = renderer->width();
     129        if (h)
     130            *h = renderer->width();
     131        if (x && y) {
     132            FloatPoint floatPoint(*x, *y);
     133            renderer->localToAbsolute(floatPoint);
     134            IntPoint point = roundedIntPoint(floatPoint);
     135            *x = point.x();
     136            *y = point.y();
     137        }
     138    }
     139}
     140
     141@end
     142
     143#endif // PLATFORM(IOS)
     144
    52145//------------------------------------------------------------------------------------------
    53146// DOMHTMLDocument
     
    91184}
    92185
     186#if !PLATFORM(IOS)
    93187- (NSRect)_rectOnScreen
    94188{
     
    106200    return result;
    107201}
     202#endif
    108203
    109204- (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index
     
    182277@end
    183278
     279#if PLATFORM(IOS)
     280@implementation DOMHTMLInputElement (AutocapitalizeAdditions)
     281
     282- (WebAutocapitalizeType)_autocapitalizeType
     283{
     284    WebCore::HTMLInputElement* inputElement = core(self);
     285    return static_cast<WebAutocapitalizeType>(inputElement->autocapitalizeType());
     286}
     287
     288@end
     289
     290@implementation DOMHTMLTextAreaElement (AutocapitalizeAdditions)
     291
     292- (WebAutocapitalizeType)_autocapitalizeType
     293{
     294    WebCore::HTMLTextAreaElement* textareaElement = core(self);
     295    return static_cast<WebAutocapitalizeType>(textareaElement->autocapitalizeType());
     296}
     297
     298@end
     299
     300@implementation DOMHTMLInputElement (WebInputChangeEventAdditions)
     301
     302- (void)setValueWithChangeEvent:(NSString *)newValue
     303{
     304    WebCore::JSMainThreadNullState state;
     305    core(self)->setValue(newValue, DispatchInputAndChangeEvent);
     306}
     307
     308- (void)setValueAsNumberWithChangeEvent:(double)newValueAsNumber
     309{
     310    WebCore::JSMainThreadNullState state;
     311    WebCore::ExceptionCode ec = 0;
     312    core(self)->setValueAsNumber(newValueAsNumber, ec, DispatchInputAndChangeEvent);
     313}
     314
     315@end
     316#endif
     317
    184318Class kitClass(WebCore::HTMLCollection* collection)
    185319{
  • trunk/Source/WebCore/bindings/objc/DOMInternal.h

    r97771 r161638  
    4646    class NodeFilter;
    4747    class XPathNSResolver;
     48#if ENABLE(TOUCH_EVENTS)
     49    class Touch;
     50#endif
    4851}
    4952
  • trunk/Source/WebCore/bindings/objc/DOMInternal.mm

    r154877 r161638  
    3434#import "runtime_root.h"
    3535
     36#if PLATFORM(IOS)
     37#define NEEDS_WRAPPER_CACHE_LOCK 1
     38#endif
     39
    3640//------------------------------------------------------------------------------------------
    3741// Wrapping WebCore implementation objects
    3842
    3943static NSMapTable* DOMWrapperCache;
     44   
     45#ifdef NEEDS_WRAPPER_CACHE_LOCK
     46static Mutex& wrapperCacheLock()
     47{
     48    DEFINE_STATIC_LOCAL(Mutex, wrapperCacheMutex, ());
     49    return wrapperCacheMutex;
     50}
     51#endif
    4052
    4153#if COMPILER(CLANG)
     
    5870NSObject* getDOMWrapper(DOMObjectInternal* impl)
    5971{
     72#ifdef NEEDS_WRAPPER_CACHE_LOCK
     73    MutexLocker locker(wrapperCacheLock());
     74#endif
    6075    if (!DOMWrapperCache)
    6176        return nil;
     
    6580void addDOMWrapper(NSObject* wrapper, DOMObjectInternal* impl)
    6681{
     82#ifdef NEEDS_WRAPPER_CACHE_LOCK
     83    MutexLocker locker(wrapperCacheLock());
     84#endif
    6785    if (!DOMWrapperCache)
    6886        DOMWrapperCache = createWrapperCache();
     
    7290void removeDOMWrapper(DOMObjectInternal* impl)
    7391{
     92#ifdef NEEDS_WRAPPER_CACHE_LOCK
     93    MutexLocker locker(wrapperCacheLock());
     94#endif
    7495    if (!DOMWrapperCache)
    7596        return;
  • trunk/Source/WebCore/bindings/objc/DOMPrivate.h

    r138851 r161638  
    2727#import <WebCore/DOM.h>
    2828
     29#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     30#import <WebCore/WebAutocapitalize.h>
     31#import <CoreText/CoreText.h>
     32#endif
     33
    2934@interface DOMNode (DOMNodeExtensionsPendingPublic)
     35#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    3036- (NSImage *)renderedImage;
     37#endif
    3138- (NSArray *)textRects;
    3239@end
     
    3946// calls to the public method - (NSColor *)color.
    4047@interface DOMRGBColor (WebPrivate)
     48#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    4149- (NSColor *)_color;
     50#endif
    4251@end
    4352
     
    4958
    5059@interface DOMRange (DOMRangeExtensions)
     60#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     61- (CGRect)boundingBox;
     62#else
    5163- (NSRect)boundingBox;
     64#endif
     65#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    5266- (NSImage *)renderedImageForcingBlackText:(BOOL)forceBlackText;
     67#else
     68- (CGImageRef)renderedImageForcingBlackText:(BOOL)forceBlackText;
     69#endif
    5370- (NSArray *)lineBoxRects; // Deprecated. Use textRects instead.
    5471- (NSArray *)textRects;
     
    5673
    5774@interface DOMElement (WebPrivate)
     75#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    5876- (NSFont *)_font;
    5977- (NSData *)_imageTIFFRepresentation;
     78#else
     79- (CTFontRef)_font;
     80#endif
    6081- (NSURL *)_getURLAttribute:(NSString *)name;
    6182- (BOOL)isFocused;
     
    82103- (BOOL)_isAutofilled;
    83104- (BOOL)_isTextField;
     105#if !defined(TARGET_OS_EMBEDDED) || !TARGET_OS_EMBEDDED
    84106- (NSRect)_rectOnScreen; // bounding box of the text field, in screen coordinates
     107#endif
    85108- (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index;
    86109- (NSRange)_selectedRange;
     
    106129- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection;
    107130@end
     131
     132#if defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
     133enum { WebMediaQueryOrientationCurrent, WebMediaQueryOrientationPortrait, WebMediaQueryOrientationLandscape };
     134@interface DOMHTMLLinkElement (WebPrivate)
     135- (BOOL)_mediaQueryMatchesForOrientation:(int)orientation;
     136- (BOOL)_mediaQueryMatches;
     137@end
     138
     139// These changes are useful to get the AutocapitalizeType on particular form controls.
     140@interface DOMHTMLInputElement (AutocapitalizeAdditions)
     141- (WebAutocapitalizeType)_autocapitalizeType;
     142@end
     143
     144@interface DOMHTMLTextAreaElement (AutocapitalizeAdditions)
     145- (WebAutocapitalizeType)_autocapitalizeType;
     146@end
     147
     148// These are used by Date and Time input types because the generated ObjC methods default to not dispatching events.
     149@interface DOMHTMLInputElement (WebInputChangeEventAdditions)
     150- (void)setValueWithChangeEvent:(NSString *)newValue;
     151- (void)setValueAsNumberWithChangeEvent:(double)newValueAsNumber;
     152@end
     153#endif // defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
  • trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h

    r161415 r161638  
    2626// All public DOM class interfaces, properties and methods need to be in this file.
    2727// Anything not in the file will be generated into the appropriate private header file.
     28
     29#include <wtf/Platform.h>
    2830
    2931#ifndef OBJC_CODE_GENERATION
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r161220 r161638  
    5050my $currentCachedAttribute = 0;
    5151
     52my $beginAppleCopyrightForHeaderFiles = <<END;
     53// ------- Begin Apple Copyright -------
     54/*
     55 * Copyright (C) 2008, Apple Inc. All rights reserved.
     56 *
     57 * Permission is granted by Apple to use this file to the extent
     58 * necessary to relink with LGPL WebKit files.
     59 *
     60 * No license or rights are granted by Apple expressly or by
     61 * implication, estoppel, or otherwise, to Apple patents and
     62 * trademarks. For the sake of clarity, no license or rights are
     63 * granted by Apple expressly or by implication, estoppel, or otherwise,
     64 * under any Apple patents, copyrights and trademarks to underlying
     65 * implementations of any application programming interfaces (APIs)
     66 * or to any functionality that is invoked by calling any API.
     67 */
     68
     69END
     70my $beginAppleCopyrightForSourceFiles = <<END;
     71// ------- Begin Apple Copyright -------
     72/*
     73 * Copyright (C) 2008, Apple Inc. All rights reserved.
     74 *
     75 * No license or rights are granted by Apple expressly or by implication,
     76 * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
     77 * secrets or other rights.
     78 */
     79
     80END
     81my $endAppleCopyright   = <<END;
     82// ------- End Apple Copyright   -------
     83
     84END
     85
    5286# Default .h template
    5387my $headerTemplate = << "EOF";
     
    449483    my $className = "JS" . $interface->name;
    450484
    451     my @headerContentHeader = split("\r", $headerTemplate);
     485    my @headerContentHeader;
     486    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     487        @headerContentHeader = split("\r", $beginAppleCopyrightForHeaderFiles);
     488    } else {
     489        @headerContentHeader = split("\r", $headerTemplate);
     490    }
    452491
    453492    # - Add header protection
     
    465504    my $className = "JS" . $interface->name;
    466505
    467     my @implContentHeader = split("\r", $headerTemplate);
     506    my @implContentHeader;
     507    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     508        @implContentHeader = split("\r", $beginAppleCopyrightForSourceFiles);
     509    } else {
     510        @implContentHeader = split("\r", $headerTemplate);
     511    }
    468512
    469513    push(@implContentHeader, "\n#include \"config.h\"\n");
     
    868912
    869913    if ($numCustomFunctions > 0) {
     914        my $inAppleCopyright = 0;
    870915        push(@headerContent, "\n    // Custom functions\n");
    871916        foreach my $function (@{$interface->functions}) {
     917            # PLATFORM_IOS
     918            my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
     919            if ($needsAppleCopyright) {
     920                if (!$inAppleCopyright) {
     921                    push(@headerContent, $beginAppleCopyrightForHeaderFiles);
     922                    $inAppleCopyright = 1;
     923                }
     924            } elsif ($inAppleCopyright) {
     925                push(@headerContent, $endAppleCopyright);
     926                $inAppleCopyright = 0;
     927            }
     928            # end PLATFORM_IOS
    872929            next unless HasCustomMethod($function->signature->extendedAttributes);
    873930            next if $function->{overloads} && $function->{overloadIndex} != 1;
     
    878935            push(@headerContent, "#endif\n") if $conditionalString;
    879936        }
     937        push(@headerContent, $endAppleCopyright) if $inAppleCopyright;
    880938    }
    881939
     
    10441102
    10451103    if ($numFunctions > 0) {
     1104        my $inAppleCopyright = 0;
    10461105        push(@headerContent,"// Functions\n\n");
    10471106        foreach my $function (@{$interface->functions}) {
    10481107            next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
     1108            my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
     1109            if ($needsAppleCopyright) {
     1110                if (!$inAppleCopyright) {
     1111                    push(@headerContent, $beginAppleCopyrightForHeaderFiles);
     1112                    $inAppleCopyright = 1;
     1113                }
     1114            } elsif ($inAppleCopyright) {
     1115                push(@headerContent, $endAppleCopyright);
     1116                $inAppleCopyright = 0;
     1117            }
     1118
    10491119            my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
    10501120            push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
     
    10531123            push(@headerContent, "#endif\n") if $conditionalString;
    10541124        }
     1125
     1126        push(@headerContent, $endAppleCopyright) if $inAppleCopyright;
    10551127    }
    10561128
     
    10951167    push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString;
    10961168    push(@headerContent, "#endif\n");
     1169
     1170    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1171        push(@headerContent, split("\r", $endAppleCopyright));
     1172    }
    10971173}
    10981174
     
    23832459    # Functions
    23842460    if ($numFunctions > 0) {
     2461        my $inAppleCopyright = 0;
    23852462        foreach my $function (@{$interface->functions}) {
     2463            my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
     2464            if ($needsAppleCopyright) {
     2465                if (!$inAppleCopyright) {
     2466                    push(@implContent, $beginAppleCopyrightForSourceFiles);
     2467                    $inAppleCopyright = 1;
     2468                }
     2469            } elsif ($inAppleCopyright) {
     2470                push(@implContent, $endAppleCopyright);
     2471                $inAppleCopyright = 0;
     2472            }
     2473
    23862474            my $isCustom = HasCustomMethod($function->signature->extendedAttributes);
    23872475            my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1;
     
    24982586
    24992587        }
     2588
     2589        push(@implContent, $endAppleCopyright) if $inAppleCopyright;
     2590
    25002591    }
    25012592
     
    32303321    my $conditionalString = $codeGenerator->GenerateConditionalString($interface);
    32313322    push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
     3323
     3324    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     3325        push(@implContent, split("\r", $endAppleCopyright));
     3326    }
    32323327}
    32333328
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r161406 r161638  
    4949my @internalHeaderContent = ();
    5050
     51my @implConditionalIncludes = ();
    5152my @implContentHeader = ();
    5253my @implContent = ();
    5354my %implIncludes = ();
    5455my @depsContent = ();
     56
     57my $beginAppleCopyrightForHeaderFiles = <<END;
     58// ------- Begin Apple Copyright -------
     59/*
     60 * Copyright (C) 2008, Apple Inc. All rights reserved.
     61 *
     62 * Permission is granted by Apple to use this file to the extent
     63 * necessary to relink with LGPL WebKit files.
     64 *
     65 * No license or rights are granted by Apple expressly or by
     66 * implication, estoppel, or otherwise, to Apple patents and
     67 * trademarks. For the sake of clarity, no license or rights are
     68 * granted by Apple expressly or by implication, estoppel, or otherwise,
     69 * under any Apple patents, copyrights and trademarks to underlying
     70 * implementations of any application programming interfaces (APIs)
     71 * or to any functionality that is invoked by calling any API.
     72 */
     73
     74END
     75my $beginAppleCopyrightForSourceFiles = <<END;
     76// ------- Begin Apple Copyright -------
     77/*
     78 * Copyright (C) 2008, Apple Inc. All rights reserved.
     79 *
     80 * No license or rights are granted by Apple expressly or by implication,
     81 * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
     82 * secrets or other rights.
     83 */
     84
     85END
     86my $endAppleCopyright   = <<END;
     87// ------- End Apple Copyright   -------
     88
     89END
    5590
    5691# Hashes
     
    77112
    78113# Constants
     114my $buildingForIPhone = ($ENV{PLATFORM_NAME} eq "iphoneos" or $ENV{PLATFORM_NAME} eq "iphonesimulator");
    79115my $nullableInit = "bool isNull = false;";
    80116my $exceptionInit = "WebCore::ExceptionCode ec = 0;";
     
    215251    %publicInterfaces = ();
    216252
     253    my @args = qw(-E -P -x objective-c);
     254    # Set include path to find <wtf/Platform.h>.  We search BUILT_PRODUCTS_DIR
     255    # first for local developer builds, then the installation path for B&I
     256    # builds.
     257    push(@args, "-I" . $ENV{BUILT_PRODUCTS_DIR} . "/usr/local/include") if $ENV{BUILT_PRODUCTS_DIR};
     258    push(@args, "-I" . $ENV{BUILT_PRODUCTS_DIR} . $ENV{SDKROOT} . "/usr/local/include") if $ENV{BUILT_PRODUCTS_DIR};
     259
     260    # Xcode 3.1 is required for SDKROOT to be set.
     261    if ($ENV{SDKROOT} && $ENV{SYSTEM_LIBRARY_DIR}) {
     262        push(@args, "-I" . $ENV{BUILT_PRODUCTS_DIR} . $ENV{SDKROOT} . "/usr/local/include") if $ENV{BUILT_PRODUCTS_DIR};
     263        push(@args, "-I" . $ENV{SDKROOT} . "/usr/local/include");
     264    }
    217265    my $fileName = "WebCore/bindings/objc/PublicDOMInterfaces.h";
    218266    my $gccLocation = "";
     
    226274        $gccLocation = "/usr/bin/gcc";
    227275    }
    228     open FILE, "-|", $gccLocation, "-E", "-P", "-x", "objective-c",
     276
     277    if ($ENV{SDKROOT}) {
     278        # PLATFORM(IOS)
     279        push(@args, "-isysroot", $ENV{SDKROOT});
     280    }
     281
     282    open FILE, "-|", $gccLocation, @args,
    229283        (map { "-D$_" } split(/ +/, $defines)), "-DOBJC_CODE_GENERATION", $fileName or die "Could not open $fileName";
    230284    my @documentContent = <FILE>;
     
    354408    # special cases
    355409    return "NSString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
     410    return "CGColorRef" if $name eq "Color" and $buildingForIPhone;
    356411    return "NS$name" if IsNativeObjCType($name);
    357412    return "BOOL" if $name eq "boolean";
     
    484539}
    485540
     541sub IsCoreFoundationType
     542{
     543    my $type = shift;
     544
     545    return 1 if $type =~ /^(CF|CG)[A-Za-z]+Ref$/;
     546    return 0;
     547}
     548
    486549sub SkipFunction
    487550{
     
    519582}
    520583
    521 
    522584sub GetObjCType
    523585{
     
    528590    return $name if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp";
    529591    return "unsigned short" if $type eq "CompareHow";
     592    return $name if IsCoreFoundationType($name);
    530593    return "$name *";
    531594}
     
    613676    if (IsNativeObjCType($type)) {
    614677        if ($type eq "Color") {
    615             $implIncludes{"ColorMac.h"} = 1;
     678            if ($buildingForIPhone) {
     679                $implIncludes{"ColorSpace.h"} = 1;
     680            } else {
     681                $implIncludes{"ColorMac.h"} = 1;
     682            }
    616683        }
    617684        return;
     
    753820
    754821    # - Add default header template
    755     @headerContentHeader = split("\r", $headerLicenseTemplate);
     822    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     823        @headerContentHeader = split("\r", $beginAppleCopyrightForHeaderFiles);
     824    } else {
     825        @headerContentHeader = split("\r", $headerLicenseTemplate);
     826    }
    756827    push(@headerContentHeader, "\n");
    757828
     
    849920            my $publicInterfaceKey = $property . ";";
    850921
     922            # FIXME: This only works for the getter, but not the setter.  Need to refactor this code.
     923            if ($buildingForTigerOrEarlier && !$buildingForIPhone || IsCoreFoundationType($attributeType)) {
     924                $publicInterfaceKey = "- (" . $attributeType . ")" . $attributeName . ";";
     925            }
     926
    851927            my $availabilityMacro = "";
    852928            if (defined $publicInterfaces{$publicInterfaceKey} and length $publicInterfaces{$publicInterfaceKey}) {
     
    876952            }
    877953
    878             $property .= $declarationSuffix;
    879             push(@headerAttributes, $property) if $public;
    880             push(@privateHeaderAttributes, $property) unless $public;
     954            if (!IsCoreFoundationType($attributeType)) {
     955                $property .= $declarationSuffix;
     956                push(@headerAttributes, $property) if $public;
     957                push(@privateHeaderAttributes, $property) unless $public;
     958            } else {
     959                my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
     960                if ($attributeConditionalString) {
     961                    push(@headerAttributes, "#if ${attributeConditionalString}\n") if $public;
     962                    push(@privateHeaderAttributes, "#if ${attributeConditionalString}\n") unless $public;
     963                }
     964 
     965                # - GETTER
     966                my $getter = "- (" . $attributeType . ")" . $attributeName . $declarationSuffix;
     967                push(@headerAttributes, $getter) if $public;
     968                push(@privateHeaderAttributes, $getter) unless $public;
     969 
     970                # - SETTER
     971                if (!$attribute->isReadOnly) {
     972                    my $setter = "- (void)$setterName(" . $attributeType . ")new" . ucfirst($attributeName) . $declarationSuffix;
     973                    push(@headerAttributes, $setter) if $public;
     974                    push(@privateHeaderAttributes, $setter) unless $public;
     975                }
     976 
     977                if ($attributeConditionalString) {
     978                    push(@headerAttributes, "#endif\n") if $public;
     979                    push(@privateHeaderAttributes, "#endif\n") unless $public;
     980                }
     981            }
    881982        }
    882983
     
    890991    # - Add functions.
    891992    if ($numFunctions > 0) {
     993        my %inAppleCopyright = (public => 0, private => 0);
    892994        foreach my $function (@{$interface->functions}) {
    893995            next if SkipFunction($function);
     
    897999            my $returnType = GetObjCType($function->signature->type);
    8981000            my $needsDeprecatedVersion = (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"ObjCLegacyUnnamedParameters"});
     1001            my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
    8991002            my $numberOfParameters = @{$function->parameters};
    9001003            my %typesToForwardDeclare = ($function->signature->type => 1);
     
    9511054            }
    9521055
     1056            if ($needsAppleCopyright) {
     1057                if (!$inAppleCopyright{$public ? "public" : "private"}) {
     1058                    push(@headerFunctions, $beginAppleCopyrightForHeaderFiles) if $public;
     1059                    push(@privateHeaderFunctions, $beginAppleCopyrightForHeaderFiles) unless $public;
     1060                    $inAppleCopyright{$public ? "public" : "private"} = 1;
     1061                }
     1062            } elsif ($inAppleCopyright{$public ? "public" : "private"}) {
     1063                push(@headerFunctions, $endAppleCopyright) if $public;
     1064                push(@privateHeaderFunctions, $endAppleCopyright) unless $public;
     1065                $inAppleCopyright{$public ? "public" : "private"} = 0;
     1066            }
     1067
    9531068            my $functionConditionalString = $codeGenerator->GenerateConditionalString($function->signature);
    9541069            if ($functionConditionalString) {
     
    9921107        }
    9931108
     1109        push(@headerFunctions, $endAppleCopyright) if $inAppleCopyright{"public"};
     1110        push(@privateHeaderFunctions, $endAppleCopyright) if $inAppleCopyright{"private"};
     1111
    9941112        if (@headerFunctions > 0) {
    9951113            push(@headerContent, "\n") if @headerAttributes > 0;
     
    10121130    }
    10131131
     1132    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1133        push(@headerContent, split("\r", $endAppleCopyright));
     1134    }
     1135
    10141136    my %alwaysGenerateForNoSVGBuild = map { $_ => 1 } qw(DOMHTMLEmbedElement DOMHTMLObjectElement);
    10151137
    10161138    if (@privateHeaderAttributes > 0 or @privateHeaderFunctions > 0 or exists $alwaysGenerateForNoSVGBuild{$className}) {
    10171139        # - Private category @interface
    1018         @privateHeaderContentHeader = split("\r", $headerLicenseTemplate);
     1140        if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1141            @privateHeaderContentHeader = split("\r", $beginAppleCopyrightForHeaderFiles);
     1142        } else {
     1143            @privateHeaderContentHeader = split("\r", $headerLicenseTemplate);
     1144        }
    10191145        push(@privateHeaderContentHeader, "\n");
    10201146
     
    10281154        push(@privateHeaderContent, @privateHeaderFunctions) if @privateHeaderFunctions > 0;
    10291155        push(@privateHeaderContent, "\@end\n");
     1156
     1157        if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1158            push(@privateHeaderContent, split("\r", $endAppleCopyright));
     1159        }
    10301160    }
    10311161
     
    10401170
    10411171        # Generate interface definitions.
    1042         @internalHeaderContent = split("\r", $implementationLicenseTemplate);
     1172        if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1173            @internalHeaderContent = split("\r", $beginAppleCopyrightForHeaderFiles);
     1174        } else {
     1175            @internalHeaderContent = split("\r", $implementationLicenseTemplate);
     1176        }
    10431177
    10441178        push(@internalHeaderContent, "\n#import <WebCore/$className.h>\n\n");
     
    11091243
    11101244    # - Add default header template.
    1111     @implContentHeader = split("\r", $implementationLicenseTemplate);
     1245    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1246        @implContentHeader = split("\r", $beginAppleCopyrightForSourceFiles);
     1247    } else {
     1248        @implContentHeader = split("\r", $implementationLicenseTemplate);
     1249    }
    11121250
    11131251    # - INCLUDES -
     
    13361474                $getterContentTail .= ")";
    13371475            } elsif ($idlType eq "Color") {
    1338                 $getterContentHead = "WebCore::nsColor($getterContentHead";
    1339                 $getterContentTail .= ")";
     1476                if ($buildingForIPhone) {
     1477                    $getterContentHead = "WebCore::cachedCGColor($getterContentHead";
     1478                    $getterContentTail .= ", WebCore::ColorSpaceDeviceRGB)";
     1479                } else {
     1480                    $getterContentHead = "WebCore::nsColor($getterContentHead";
     1481                    $getterContentTail .= ")";
     1482                }
    13401483            } elsif ($attribute->signature->type eq "SerializedScriptValue") {
    13411484                $getterContentHead = "$getterContentHead";
     
    15081651    # - Functions
    15091652    if ($numFunctions > 0) {
     1653        my $inAppleCopyright = 0;
    15101654        foreach my $function (@{$interface->functions}) {
    15111655            next if SkipFunction($function);
     
    15151659            my $functionName = $function->signature->name;
    15161660            my $returnType = GetObjCType($function->signature->type);
     1661            my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
    15171662            my $hasParameters = @{$function->parameters};
    15181663            my $raisesExceptions = $function->signature->extendedAttributes->{"RaisesException"};
     
    17251870            }
    17261871
     1872            if ($needsAppleCopyright) {
     1873                if (!$inAppleCopyright) {
     1874                    push(@implContent, $beginAppleCopyrightForSourceFiles);
     1875                    $inAppleCopyright = 1;
     1876                }
     1877            } elsif ($inAppleCopyright) {
     1878                push(@implContent, $endAppleCopyright);
     1879                $inAppleCopyright = 0;
     1880            }
     1881
    17271882            my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
    17281883            push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
     
    17511906            %needsCustom = ();
    17521907        }
     1908        push(@implContent, $endAppleCopyright) if $inAppleCopyright;
    17531909    }
    17541910
    17551911    # END implementation
    17561912    push(@implContent, "\@end\n");
     1913
     1914    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1915        push(@implContent, split("\r", $endAppleCopyright));
     1916    }
    17571917
    17581918    # Generate internal interfaces
     
    17931953    push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
    17941954
     1955    if ($interface->extendedAttributes->{"AppleCopyright"}) {
     1956        push(@implContent, split("\r", $endAppleCopyright));
     1957    }
     1958
    17951959    # - Generate dependencies.
    17961960    if ($writeDependencies && @ancestorInterfaceNames) {
     
    18041968{
    18051969    my $object = shift;
    1806     my $dataNode = shift;
     1970    my $interface = shift;
    18071971    my $outputDir = shift;
    18081972
    18091973    # Open files for writing...
    1810     my $name = $dataNode->name;
     1974    my $name = $interface->name;
    18111975    my $prefix = FileNamePrefix;
    18121976    my $headerFileName = "$outputDir/$prefix$name.h";
     
    18181982    # Write public header.
    18191983    my $contents = join "", @headerContentHeader;
    1820     map { $contents .= "\@class $_;\n" } sort keys(%headerForwardDeclarations);
     1984    map { $contents .= (IsCoreFoundationType($_) ? "typedef struct " . substr($_, 0, -3) . "* $_;\n" : "\@class $_;\n") } sort keys(%headerForwardDeclarations);
    18211985    map { $contents .= "\@protocol $_;\n" } sort keys(%headerForwardDeclarationsForProtocols);
    18221986
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r160775 r161638  
    108108TypedArray=*
    109109URL
     110
     111# PLATFORM(IOS)
     112AppleCopyright
  • trunk/Source/WebCore/bindings/scripts/preprocessor.pm

    r151619 r161638  
    5858    }
    5959
     60    push(@args, "-I" . $ENV{BUILT_PRODUCTS_DIR} . "/usr/local/include") if $ENV{BUILT_PRODUCTS_DIR};
     61    push(@args, "-isysroot", $ENV{SDKROOT}) if $ENV{SDKROOT};
     62
    6063    # Remove double quotations from $defines and extract macros.
    6164    # For example, if $defines is ' "A=1" "B=1" C=1 ""    D  ',
  • trunk/Source/WebCore/bridge/objc/objc_class.mm

    r149255 r161638  
    162162    RetainPtr<CFStringRef> fieldName = adoptCF(CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII));
    163163    id targetObject = (static_cast<ObjcInstance*>(instance))->getObject();
     164#if PLATFORM(IOS)
     165    id attributes = [targetObject respondsToSelector:@selector(attributeKeys)] ? [targetObject performSelector:@selector(attributeKeys)] : nil;
     166#else
    164167    id attributes = [targetObject attributeKeys];
     168#endif
    165169    if (attributes) {
    166170        // Class overrides attributeKeys, use that array of key names.
  • trunk/Source/WebCore/bridge/objc/objc_instance.mm

    r159605 r161638  
    3838#import <wtf/Assertions.h>
    3939
     40#if PLATFORM(IOS)
     41#import <Foundation/NSMapTable.h>
     42#endif // PLATFORM(IOS)
     43
    4044#ifdef NDEBUG
    4145#define OBJC_LOG(formatAndArgs...) ((void)0)
  • trunk/Source/WebCore/config.h

    r156302 r161638  
    101101#endif
    102102
    103 #if PLATFORM(MAC)
     103#if PLATFORM(MAC) && !PLATFORM(IOS)
    104104// New theme
    105105#define WTF_USE_NEW_THEME 1
     
    126126#endif
    127127
     128#if PLATFORM(IOS)
     129#define WEBCORE_NAVIGATOR_PLATFORM wkGetPlatformNameForNavigator();
     130#define WEBCORE_NAVIGATOR_VENDOR wkGetVendorNameForNavigator();
     131#endif
     132
    128133// FIXME: Move this to JavaScriptCore/wtf/Platform.h, which is where we define WTF_USE_AVFOUNDATION on the Mac.
    129134// https://bugs.webkit.org/show_bug.cgi?id=67334
  • trunk/Source/WebCore/dom/Document.cpp

    r161464 r161638  
    47904790void Document::addAutoSizingNode(Node* node, float candidateSize)
    47914791{
    4792     TextAutoSizingKey key(node->renderer()->style(), &document());
     4792    TextAutoSizingKey key(&node->renderer()->style(), &document());
    47934793    TextAutoSizingMap::AddResult result = m_textAutoSizedNodes.add(key, nullptr);
    47944794    if (result.isNewEntry)
  • trunk/Source/WebCore/dom/Document.h

    r161259 r161638  
    166166#if ENABLE(TOUCH_EVENTS)
    167167#if PLATFORM(IOS)
    168 #include "DocumentIOSForward.h"
    169 #endif
     168#include <WebKitAdditions/DocumentIOSForward.h>
     169#endif // PLATFORM(IOS)
    170170class Touch;
    171171class TouchList;
     
    11151115#if ENABLE(TOUCH_EVENTS)
    11161116#if PLATFORM(IOS)
    1117 #include "DocumentIOS.h"
     1117#include <WebKitAdditions/DocumentIOS.h>
    11181118#else
    11191119    PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const;
  • trunk/Source/WebCore/dom/Document.idl

    r160775 r161638  
    324324    // and/or modifying the bindings scripts to support generating more complicated conditional code.
    325325#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
    326 #include "DocumentIOS.idl"
     326#include <WebKitAdditions/DocumentIOS.idl>
    327327#else
    328328    [ReturnNewObject, RaisesException] Touch createTouch([Default=Undefined] optional DOMWindow window,
  • trunk/Source/WebCore/editing/ApplyStyleCommand.cpp

    r161196 r161638  
    256256        return;
    257257
     258#if !PLATFORM(IOS)
    258259    // Save and restore the selection endpoints using their indices in the document, since
     260#else
     261    // Save and restore the selection endpoints using their indices in the editable root, since
     262#endif
    259263    // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoints.
    260264    // Calculate start and end indices from the start of the tree that they're in.
     265#if !PLATFORM(IOS)
    261266    Node* scope = highestAncestor(visibleStart.deepEquivalent().deprecatedNode());
     267#else
     268    Node* scope = highestEditableRoot(visibleStart.deepEquivalent());
     269#endif
    262270    RefPtr<Range> startRange = Range::create(document(), firstPositionInNode(scope), visibleStart.deepEquivalent().parentAnchoredEquivalent());
    263271    RefPtr<Range> endRange = Range::create(document(), firstPositionInNode(scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent());
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r160966 r161638  
    7373#endif
    7474
     75#if PLATFORM(IOS)
     76#include "BreakBlockquoteCommand.h"
     77#endif
     78
    7579namespace WebCore {
    7680
     
    103107    // if one is necessary (like for the creation of VisiblePositions).
    104108    m_document->updateLayoutIgnorePendingStylesheets();
     109#if PLATFORM(IOS)
     110    // FIXME: Where should iPhone code deal with the composition?
     111    // Since editing commands don't save/restore the composition, undoing without fixing
     112    // up the composition will leave a stale, invalid composition, as in <rdar://problem/6831637>.
     113    // Desktop handles this in -[WebHTMLView _updateSelectionForInputManager], but the phone
     114    // goes another route.
     115    frame->editor().cancelComposition();
     116#endif
    105117
    106118    {
     
    191203        case EditActionCut:
    192204        case EditActionUnspecified:
     205#if PLATFORM(IOS)
     206        case EditActionDelete:
     207        case EditActionDictation:
     208#endif
    193209            break;
    194210        default:
     
    487503}
    488504
     505#if PLATFORM(IOS)
     506void CompositeEditCommand::inputText(const String& text, bool selectInsertedText)
     507{
     508    unsigned offset = 0;
     509    unsigned length = text.length();
     510   
     511    RefPtr<ContainerNode> scope;
     512    unsigned startIndex = indexForVisiblePosition(endingSelection().visibleStart(), scope);
     513   
     514    size_t newline;
     515    do {
     516        newline = text.find('\n', offset);
     517        if (newline != offset) {
     518            int substringLength = newline == notFound ? length - offset : newline - offset;
     519            RefPtr<InsertTextCommand> command = InsertTextCommand::create(document(), text.substring(offset, substringLength), false);
     520            applyCommandToComposite(command);
     521        }
     522        if (newline != notFound) {
     523            VisiblePosition caret(endingSelection().visibleStart());
     524            if (enclosingNodeOfType(caret.deepEquivalent(), &isMailBlockquote)) {
     525                // FIXME: Breaking a blockquote when the caret is just after a space will collapse the
     526                // space. Modify startIndex or length to compensate for this so that the ending selection
     527                // will be positioned correctly.
     528                // <rdar://problem/9914462> breaking a Mail blockquote just after a space collapses the space
     529                if (caret.previous().characterAfter() == ' ') {
     530                    if (!offset && !startIndex)
     531                        startIndex--;
     532                    else if (!length)
     533                        length--;
     534                }
     535                applyCommandToComposite(BreakBlockquoteCommand::create(document()));
     536            } else
     537                insertLineBreak();
     538        }
     539           
     540        offset = newline + 1;
     541    } while (newline != notFound && offset != length);
     542   
     543    if (selectInsertedText)
     544        setEndingSelection(VisibleSelection(visiblePositionForIndex(startIndex, scope.get()), visiblePositionForIndex(startIndex + length, scope.get())));
     545}
     546#endif
     547
    489548void CompositeEditCommand::insertTextIntoNode(PassRefPtr<Text> node, unsigned offset, const String& text)
    490549{
     
    536595    RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length());
    537596    for (size_t i = 0; i < markers.size(); ++i)
     597#if PLATFORM(IOS)
     598        markerController.addMarker(newRange.get(), markers[i].type(), markers[i].description(), markers[i].alternatives(), markers[i].metadata());
     599#else
    538600        markerController.addMarker(newRange.get(), markers[i].type(), markers[i].description());
     601#endif // PLATFORM(IOS)
    539602}
    540603
     
    12021265    // too, <div><b><br></b></div> for example.  Save it so that we can preserve it later.
    12031266    RefPtr<EditingStyle> styleInEmptyParagraph;
     1267#if !PLATFORM(IOS)
    12041268    if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) {
     1269#else
     1270    if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle && isRichlyEditablePosition(destination.deepEquivalent())) {
     1271#endif
    12051272        styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deepEquivalent());
    12061273        styleInEmptyParagraph->mergeTypingStyle(document());
  • trunk/Source/WebCore/editing/CompositeEditCommand.h

    r157653 r161638  
    105105    void deleteSelection(const VisibleSelection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true, bool sanitizeMarkup = true);
    106106    virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned offset, unsigned count);
     107#if PLATFORM(IOS)
     108    void inputText(const String&, bool selectInsertedText = false);
     109#endif
    107110    bool isRemovableBlock(const Node*);
    108111    void insertNodeAfter(PassRefPtr<Node>, PassRefPtr<Node> refChild);
  • trunk/Source/WebCore/editing/DeleteButton.h

    r155786 r161638  
    3535    static PassRefPtr<DeleteButton> create(Document&);
    3636
     37#if !PLATFORM(IOS)
    3738    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
     39#endif // !PLATFORM(IOS)
    3840
    3941private:
  • trunk/Source/WebCore/editing/DeleteButtonController.cpp

    r160966 r161638  
    332332void DeleteButtonController::enable()
    333333{
     334#if !PLATFORM(IOS)
    334335    ASSERT(m_disableStack > 0);
    335336    if (m_disableStack > 0)
     
    342343        show(enclosingDeletableElement(m_frame.selection().selection()));
    343344    }
     345#endif
    344346}
    345347
    346348void DeleteButtonController::disable()
    347349{
     350#if !PLATFORM(IOS)
    348351    if (enabled())
    349352        hide();
    350353    m_disableStack++;
     354#endif
    351355}
    352356
  • trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp

    r160966 r161638  
    862862    }
    863863
     864#if PLATFORM(IOS)
     865    // This checking is due to iphone shows the last entered character momentarily, removing and adding back the
     866    // space when deleting password cause space been showed insecurely.
     867    bool isSecure = NO;
     868    Node* node = m_endingPosition.deprecatedNode();
     869    if (node && node->isTextNode()) {
     870        Text* textNode = static_cast<Text*>(node);   
     871        if (textNode->length() > 0) {
     872            RenderObject* renderer = textNode->renderer();
     873            isSecure = renderer->style().textSecurity() != TSNONE;
     874        }
     875    }
     876       
     877    if (!isSecure)
     878        rebalanceWhitespaceAt(m_endingPosition);
     879#else
    864880    rebalanceWhitespaceAt(m_endingPosition);
     881#endif
    865882
    866883    calculateTypingStyleAfterDelete();
  • trunk/Source/WebCore/editing/DeleteSelectionCommand.h

    r154938 r161638  
    4444    }
    4545
     46protected:
     47    DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool santizeMarkup);
     48
    4649private:
    47     DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool santizeMarkup);
    4850    DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup);
    4951
  • trunk/Source/WebCore/editing/EditAction.h

    r141799 r161638  
    5858        EditActionBold,
    5959        EditActionItalics,
     60#if PLATFORM(IOS)
     61        EditActionDelete,
     62        EditActionDictation,
     63#endif
    6064        EditActionPaste,
    6165        EditActionPasteFont,
  • trunk/Source/WebCore/editing/EditCommand.h

    r157081 r161638  
    5252    const VisibleSelection& endingSelection() const { return m_endingSelection; }
    5353
     54#if PLATFORM(IOS)
     55    virtual bool isInsertTextCommand() const { return false; }
     56#endif
     57   
    5458    virtual bool isSimpleEditCommand() const { return false; }
    5559    virtual bool isCompositeEditCommand() const { return false; }
  • trunk/Source/WebCore/editing/EditingStyle.cpp

    r160966 r161638  
    7272    CSSPropertyWidows,
    7373    CSSPropertyWordSpacing,
     74#if PLATFORM(IOS)
     75    CSSPropertyWebkitTapHighlightColor,
     76    CSSPropertyWebkitCompositionFillColor,
     77#endif
    7478    CSSPropertyWebkitTextDecorationsInEffect,
    7579    CSSPropertyWebkitTextFillColor,
  • trunk/Source/WebCore/editing/Editor.cpp

    r160966 r161638  
    9696#endif
    9797
     98#if PLATFORM(IOS)
     99#include "DictationCommandIOS.h"
     100#include <wtf/text/StringBuilder.h>
     101#include <wtf/text/WTFString.h>
     102#endif
     103
    98104namespace WebCore {
     105
     106#if PLATFORM(IOS)
     107class ClearTextCommand : public DeleteSelectionCommand {
     108public:
     109    ClearTextCommand(Document& document);
     110    static void CreateAndApply(const RefPtr<Frame> frame);
     111   
     112private:
     113    virtual EditAction editingAction() const;
     114};
     115
     116ClearTextCommand::ClearTextCommand(Document& document)
     117    : DeleteSelectionCommand(document, false, true, false, false, true)
     118{
     119}
     120
     121EditAction ClearTextCommand::editingAction() const
     122{
     123    return EditActionDelete;
     124}
     125
     126void ClearTextCommand::CreateAndApply(const RefPtr<Frame> frame)
     127{
     128    if (frame->selection().isNone())
     129        return;
     130
     131    // Don't leave around stale composition state.
     132    frame->editor().clear();
     133   
     134    const VisibleSelection oldSelection = frame->selection().selection();
     135    frame->selection().selectAll();
     136    RefPtr<ClearTextCommand> clearCommand = adoptRef(new ClearTextCommand(*frame->document()));
     137    clearCommand->setStartingSelection(oldSelection);
     138    applyCommand(clearCommand.release());
     139}
     140#endif
    99141
    100142using namespace HTMLNames;
     
    219261    if (event->isPaste()) {
    220262        if (event->pastingFragment())
     263#if PLATFORM(IOS)
     264        {
     265            if (client()->performsTwoStepPaste(event->pastingFragment()))
     266                return true;
     267#endif
    221268            replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle());
     269#if PLATFORM(IOS)
     270        }
     271#endif
    222272        else
    223273            replaceSelectionWithText(event->data(), false, event->shouldSmartReplace());
     
    392442}
    393443
     444#if PLATFORM(IOS)
     445void Editor::clearText()
     446{
     447    ClearTextCommand::CreateAndApply(&m_frame);
     448}
     449
     450void Editor::insertDictationPhrases(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata)
     451{
     452    if (m_frame.selection().isNone())
     453        return;
     454       
     455    if (dictationPhrases->isEmpty())
     456        return;
     457       
     458    applyCommand(DictationCommandIOS::create(document(), dictationPhrases, metadata));
     459}
     460
     461void Editor::setDictationPhrasesAsChildOfElement(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata, Element* element)
     462{
     463    // Clear the composition.
     464    clear();
     465   
     466    // Clear the Undo stack, since the operations that follow are not Undoable, and will corrupt the stack.  Some day
     467    // we could make them Undoable, and let callers clear the Undo stack explicitly if they wish.
     468    clearUndoRedoOperations();
     469   
     470    m_frame.selection().clear();
     471   
     472    element->removeChildren();
     473   
     474    if (dictationPhrases->isEmpty()) {
     475        client()->respondToChangedContents();
     476        return;
     477    }
     478   
     479    ExceptionCode ec;   
     480    RefPtr<Range> context = document().createRange();
     481    context->selectNodeContents(element, ec);
     482   
     483    StringBuilder dictationPhrasesBuilder;
     484    size_t dictationPhraseCount = dictationPhrases->size();
     485    for (size_t i = 0; i < dictationPhraseCount; i++) {
     486        const String& firstInterpretation = dictationPhrases->at(i)[0];
     487        dictationPhrasesBuilder.append(firstInterpretation);
     488    }
     489    String serializedDictationPhrases = dictationPhrasesBuilder.toString();
     490   
     491    element->appendChild(createFragmentFromText(*context.get(), serializedDictationPhrases), ec);
     492   
     493    // We need a layout in order to add markers below.
     494    document().updateLayout();
     495   
     496    if (!element->firstChild()->isTextNode()) {
     497        // Shouldn't happen.
     498        ASSERT(element->firstChild()->isTextNode());
     499        return;
     500    }
     501       
     502    Text* textNode = static_cast<Text*>(element->firstChild());
     503    int previousDictationPhraseStart = 0;
     504    for (size_t i = 0; i < dictationPhraseCount; i++) {
     505        const Vector<String>& interpretations = dictationPhrases->at(i);
     506        int dictationPhraseLength = interpretations[0].length();
     507        int dictationPhraseEnd = previousDictationPhraseStart + dictationPhraseLength;
     508        if (interpretations.size() > 1) {
     509            RefPtr<Range> dictationPhraseRange = Range::create(document(), textNode, previousDictationPhraseStart, textNode, dictationPhraseEnd);
     510            document().markers().addDictationPhraseWithAlternativesMarker(dictationPhraseRange.get(), interpretations);
     511        }
     512        previousDictationPhraseStart = dictationPhraseEnd;
     513    }
     514   
     515    RefPtr<Range> resultRange = Range::create(document(), textNode, 0, textNode, textNode->length());
     516    document().markers().addDictationResultMarker(resultRange.get(), metadata);
     517   
     518    client()->respondToChangedContents();
     519}
     520#endif
     521
    394522void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
    395523{
     
    508636}
    509637
     638#if PLATFORM(IOS)
     639void Editor::confirmMarkedText()
     640{
     641    // FIXME: This is a hacky workaround for the keyboard calling this method too late -
     642    // after the selection and focus have already changed.  See <rdar://problem/5975559>
     643    Element* focused = document().focusedElement();
     644    Node* composition = compositionNode();
     645   
     646    if (composition && focused && focused != composition && !composition->isDescendantOrShadowDescendantOf(focused)) {
     647        cancelComposition();
     648        document().setFocusedElement(focused);
     649    } else
     650        confirmComposition();
     651}
     652
     653void Editor::setTextAsChildOfElement(const String& text, Element* elem)
     654{
     655    // Clear the composition
     656    clear();
     657   
     658    // Clear the Undo stack, since the operations that follow are not Undoable, and will corrupt the stack.  Some day
     659    // we could make them Undoable, and let callers clear the Undo stack explicitly if they wish.
     660    clearUndoRedoOperations();
     661   
     662    // If the element is empty already and we're not adding text, we can early return and avoid clearing/setting
     663    // a selection at [0, 0] and the expense involved in creation VisiblePositions.
     664    if (!elem->firstChild() && text.isEmpty())
     665        return;
     666   
     667    // As a side effect this function sets a caret selection after the inserted content.  Much of what
     668    // follows is more expensive if there is a selection, so clear it since it's going to change anyway.
     669    m_frame.selection().clear();
     670   
     671    // clear out all current children of element
     672    elem->removeChildren();
     673
     674    if (text.length()) {
     675        // insert new text
     676        // remove element from tree while doing it
     677        // FIXME: The element we're inserting into is often the body element.  It seems strange to be removing it
     678        // (even if it is only temporary).  ReplaceSelectionCommand doesn't bother doing this when it inserts
     679        // content, why should we here?
     680        ExceptionCode ec;
     681        RefPtr<Node> parent = elem->parentNode();
     682        RefPtr<Node> siblingAfter = elem->nextSibling();
     683        if (parent)
     684            elem->remove(ec);   
     685           
     686        RefPtr<Range> context = document().createRange();
     687        context->selectNodeContents(elem, ec);
     688        RefPtr<DocumentFragment> fragment = createFragmentFromText(*context.get(), text);
     689        elem->appendChild(fragment, ec);
     690   
     691        // restore element to document
     692        if (parent) {
     693            if (siblingAfter)
     694                parent->insertBefore(elem, siblingAfter.get(), ec);
     695            else
     696                parent->appendChild(elem, ec);
     697        }
     698    }
     699
     700    // set the selection to the end
     701    VisibleSelection selection;
     702
     703    Position pos = createLegacyEditingPosition(elem, elem->childNodeCount());
     704
     705    VisiblePosition visiblePos(pos, VP_DEFAULT_AFFINITY);
     706    if (visiblePos.isNull())
     707        return;
     708
     709    selection.setBase(visiblePos);
     710    selection.setExtent(visiblePos);
     711     
     712    m_frame.selection().setSelection(selection);
     713   
     714    client()->respondToChangedContents();
     715}
     716#endif
     717
    510718bool Editor::shouldDeleteRange(Range* range) const
    511719{
     
    547755void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options)
    548756{
     757#if PLATFORM(IOS)
     758    // FIXME: Merge this to open source https://bugs.webkit.org/show_bug.cgi?id=38830
     759    if (m_ignoreCompositionSelectionChange)
     760        return;
     761#endif
     762
    549763    if (client())
    550764        client()->respondToChangedSelection(&m_frame);
     
    705919    m_lastEditCommand.clear();
    706920}
     921#if PLATFORM(IOS)
     922// If the selection is adjusted from UIKit without closing the typing, the typing command may
     923// have a stale selection.
     924void Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping()
     925{
     926    TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping(&m_frame, m_frame.selection().selection());
     927}
     928#endif
    707929
    708930// Returns whether caller should continue with "the default processing", which is the same as
     
    10891311    } else {
    10901312        if (HTMLImageElement* imageElement = imageElementFromImageDocument(document())) {
    1091 #if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL) || PLATFORM(NIX)
     1313#if PLATFORM(MAC) || PLATFORM(EFL) || PLATFORM(NIX)
    10921314            writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *imageElement, document().url(), document().title());
    10931315#else
     
    10951317#endif
    10961318        } else {
    1097 #if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL) || PLATFORM(NIX)
     1319#if PLATFORM(MAC) || PLATFORM(EFL) || PLATFORM(NIX)
    10981320            writeSelectionToPasteboard(*Pasteboard::createForCopyAndPaste());
    10991321#else
     
    11701392}
    11711393
     1394#if !PLATFORM(IOS)
    11721395void Editor::copyURL(const URL& url, const String& title)
    11731396{
     
    12041427#endif
    12051428}
     1429#endif
    12061430
    12071431bool Editor::isContinuousSpellCheckingEnabled() const
     
    14141638void Editor::setBaseWritingDirection(WritingDirection direction)
    14151639{
     1640#if PLATFORM(IOS)
     1641    if (inSameParagraph(m_frame.selection().selection().visibleStart(), m_frame.selection().selection().visibleEnd()) &&
     1642        baseWritingDirectionForSelectionStart() == direction)
     1643        return;
     1644#endif
     1645       
    14161646    Element* focusedElement = document().focusedElement();
    14171647    if (focusedElement && isHTMLTextFormControlElement(*focusedElement)) {
     
    15611791        return;
    15621792    }
     1793
     1794#if PLATFORM(IOS)
     1795    client()->startDelayingAndCoalescingContentChangeNotifications();
     1796#endif
    15631797
    15641798    Element* target = document().focusedElement();
     
    16371871
    16381872    setIgnoreCompositionSelectionChange(false);
     1873
     1874#if PLATFORM(IOS)       
     1875    client()->stopDelayingAndCoalescingContentChangeNotifications();
     1876#endif
    16391877}
    16401878
     
    16691907}
    16701908
     1909#if !PLATFORM(IOS)
    16711910void Editor::advanceToNextMisspelling(bool startBeforeSelection)
    16721911{
     
    18412080    }
    18422081}
     2082#endif // !PLATFORM(IOS)
    18432083
    18442084String Editor::misspelledWordAtCaretOrRange(Node* clickedNode) const
     
    19552195        return;
    19562196    }
    1957    
     2197
     2198#if !PLATFORM(IOS)
    19582199    advanceToNextMisspelling(true);
     2200#endif
    19592201    client()->showSpellingUI(true);
    19602202}
     
    19832225void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement)
    19842226{
     2227#if PLATFORM(IOS)
     2228    UNUSED_PARAM(selectionAfterTyping);
     2229    UNUSED_PARAM(doReplacement);
     2230    TextCheckingTypeMask textCheckingOptions = 0;
     2231    if (isContinuousSpellCheckingEnabled())
     2232        textCheckingOptions |= TextCheckingTypeSpelling;
     2233    if (!(textCheckingOptions & TextCheckingTypeSpelling))
     2234        return;
     2235
     2236    VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
     2237    markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), adjacentWords.toNormalizedRange().get());
     2238#else
    19852239#if !USE(AUTOMATIC_TEXT_REPLACEMENT)
    19862240    UNUSED_PARAM(doReplacement);
     
    20572311    // Check grammar of entire sentence
    20582312    markBadGrammar(VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart)));
     2313#endif
    20592314}
    20602315   
    20612316void Editor::markMisspellingsOrBadGrammar(const VisibleSelection& selection, bool checkSpelling, RefPtr<Range>& firstMisspellingRange)
    20622317{
     2318#if !PLATFORM(IOS)
    20632319    // This function is called with a selection already expanded to word boundaries.
    20642320    // Might be nice to assert that here.
     
    20962352#endif
    20972353    }   
     2354#else
     2355        UNUSED_PARAM(selection);
     2356        UNUSED_PARAM(checkSpelling);
     2357        UNUSED_PARAM(firstMisspellingRange);
     2358#endif // !PLATFORM(IOS)
    20982359}
    20992360
     
    23732634void Editor::changeBackToReplacedString(const String& replacedString)
    23742635{
     2636#if !PLATFORM(IOS)
    23752637    ASSERT(unifiedTextCheckerEnabled());
    23762638
     
    23882650    changedRange->startContainer()->document().markers().addMarker(changedRange.get(), DocumentMarker::Replacement, String());
    23892651    m_alternativeTextController->markReversed(changedRange.get());
     2652#else
     2653    ASSERT_NOT_REACHED();
     2654    UNUSED_PARAM(replacedString);
     2655#endif // !PLATFORM(IOS)
    23902656}
    23912657
     
    24882754        m_alternativeTextController->removeDictationAlternativesForMarker(markers[i]);
    24892755
     2756#if PLATFORM(IOS)
     2757    document().markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives | DocumentMarker::DictationPhraseWithAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);
     2758#else
    24902759    document().markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);
     2760#endif
    24912761    document().markers().clearDescriptionOnMarkersIntersectingRange(wordRange.get(), DocumentMarker::Replacement);
    24922762}
     
    25282798
    25292799    m_ignoreCompositionSelectionChange = ignore;
     2800#if PLATFORM(IOS)
     2801    // FIXME: Merge this to open source https://bugs.webkit.org/show_bug.cgi?id=38830
     2802    if (!ignore)
     2803        notifyComponentsOnChangedSelection(m_frame.selection().selection(), 0);
     2804#endif
    25302805    if (!ignore)
    25312806        revealSelectionAfterEditingOperation(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
     
    26572932    // does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and
    26582933    // starts a new kill ring sequence, but we want to do these things (matches AppKit).
     2934#if PLATFORM(IOS)
     2935    // FIXME: Merge this to open source https://bugs.webkit.org/show_bug.cgi?id=38830
     2936    if (m_ignoreCompositionSelectionChange)
     2937        return;
     2938#endif
    26592939    if (selectionDidNotChangeDOMPosition && client())
    26602940        client()->respondToChangedSelection(&m_frame);
     
    27283008bool Editor::shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity affinity, bool stillSelecting) const
    27293009{
     3010#if PLATFORM(IOS)
     3011    if (m_frame.selectionChangeCallbacksDisabled())
     3012        return true;
     3013#endif
    27303014    return client() && client()->shouldChangeSelectedRange(oldSelection.toNormalizedRange().get(), newSelection.toNormalizedRange().get(), affinity, stillSelecting);
    27313015}
     
    30223306        if (m_frame.selection().selection().isContentEditable() || caretBrowsing) {
    30233307            VisiblePosition newStart(m_frame.selection().selection().visibleStart());
     3308#if !PLATFORM(IOS)
    30243309            newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
     3310#else
     3311            // If this bug gets fixed, this PLATFORM(IOS) code could be removed:
     3312            // <rdar://problem/7259611> Word boundary code on iPhone gives different results than desktop
     3313            EWordSide startWordSide = LeftWordIfOnBoundary;
     3314            UChar32 c = newStart.characterBefore();
     3315            // FIXME: VisiblePosition::characterAfter() and characterBefore() do not emit newlines the same
     3316            // way as TextIterator, so we do an isStartOfParagraph check here.
     3317            if (isSpaceOrNewline(c) || c == 0xA0 || isStartOfParagraph(newStart)) {
     3318                startWordSide = RightWordIfOnBoundary;
     3319            }
     3320            newAdjacentWords = VisibleSelection(startOfWord(newStart, startWordSide), endOfWord(newStart, RightWordIfOnBoundary));
     3321#endif // !PLATFORM(IOS)
    30253322            if (isContinuousGrammarCheckingEnabled)
    30263323                newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart));
     
    31043401    bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
    31053402    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
     3403#if !PLATFORM(IOS)
    31063404    bool shouldShowCorrectionPanel = textCheckingOptions & TextCheckingTypeShowCorrectionPanel;
    31073405    bool shouldCheckForCorrection = shouldShowCorrectionPanel || (textCheckingOptions & TextCheckingTypeCorrection);
     3406#endif
    31083407
    31093408    TextCheckingTypeMask checkingTypes = 0;
     
    31123411    if (shouldMarkGrammar)
    31133412        checkingTypes |= TextCheckingTypeGrammar;
     3413#if !PLATFORM(IOS)
    31143414    if (shouldCheckForCorrection)
    31153415        checkingTypes |= TextCheckingTypeCorrection;
     
    31323432    }
    31333433#endif
     3434#endif // !PLATFORM(IOS)
    31343435
    31353436    return checkingTypes;
  • trunk/Source/WebCore/editing/Editor.h

    r160045 r161638  
    127127    void performDelete();
    128128
     129#if !PLATFORM(IOS)
    129130    void copyURL(const URL&, const String& title);
    130131    void copyURL(const URL&, const String& title, Pasteboard&);
    131132    void copyImage(const HitTestResult&);
     133#endif
    132134
    133135    String readPlainTextFromPasteboard(Pasteboard&);
     
    162164
    163165    void clearLastEditCommand();
     166#if PLATFORM(IOS)
     167    void ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
     168#endif
    164169
    165170    bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction);
    166171    void deleteSelectionWithSmartDelete(bool smartDelete);
     172#if PLATFORM(IOS)
     173    void clearText();
     174    void removeUnchangeableStyles();
     175#endif
     176   
    167177    bool dispatchCPPEvent(const AtomicString&, ClipboardAccessPolicy);
    168178   
     
    236246
    237247    void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange);
     248#if PLATFORM(IOS)
     249    NO_RETURN_DUE_TO_ASSERT
     250#endif
    238251    void changeBackToReplacedString(const String& replacedString);
    239252
     253#if !PLATFORM(IOS)
    240254    void advanceToNextMisspelling(bool startBeforeSelection = false);
     255#endif // !PLATFORM(IOS)
    241256    void showSpellingGuessPanel();
    242257    bool spellingPanelIsShowing();
     
    304319
    305320    PassRefPtr<Range> selectedRange();
     321
     322#if PLATFORM(IOS)
     323    void confirmMarkedText();
     324    void setTextAsChildOfElement(const String&, Element*);
     325    void setTextAlignmentForChangedBaseWritingDirection(WritingDirection);
     326    void insertDictationPhrases(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata);
     327    void setDictationPhrasesAsChildOfElement(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata, Element* element);
     328#endif
    306329   
    307330    void addToKillRing(Range*, bool prepend);
     
    401424    const SimpleFontData* fontForSelection(bool&) const;
    402425    NSDictionary* fontAttributesForSelectionStart() const;
     426    String stringSelectionForPasteboard();
     427    String stringSelectionForPasteboardWithImageAltText();
     428    PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText);
     429#if !PLATFORM(IOS)
    403430    bool canCopyExcludingStandaloneImages();
    404431    void takeFindStringFromSelection();
    405432    void readSelectionFromPasteboard(const String& pasteboardName);
    406     String stringSelectionForPasteboard();
    407     String stringSelectionForPasteboardWithImageAltText();
    408433    PassRefPtr<SharedBuffer> dataSelectionForPasteboard(const String& pasteboardName);
    409     PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText);
     434#endif // !PLATFORM(IOS)
    410435#endif
    411436
  • trunk/Source/WebCore/editing/EditorCommand.cpp

    r160966 r161638  
    303303}
    304304
     305#if PLATFORM(IOS)
     306static bool executeClearText(Frame& frame, Event*, EditorCommandSource, const String&)
     307{
     308    frame.editor().clearText();
     309    return true;
     310}
     311#endif
     312
    305313static bool executeDefaultParagraphSeparator(Frame& frame, Event*, EditorCommandSource, const String& value)
    306314{
     
    10941102}
    10951103
    1096 #if PLATFORM(MAC)
     1104#if PLATFORM(MAC) && !PLATFORM(IOS)
    10971105static bool executeTakeFindStringFromSelection(Frame& frame, Event*, EditorCommandSource, const String&)
    10981106{
     
    12381246static bool enabledCopy(Frame& frame, Event*, EditorCommandSource)
    12391247{
     1248#if !PLATFORM(IOS)
    12401249    return frame.editor().canDHTMLCopy() || frame.editor().canCopy();
     1250#else
     1251    return frame.editor().canCopy();
     1252#endif
    12411253}
    12421254
    12431255static bool enabledCut(Frame& frame, Event*, EditorCommandSource)
    12441256{
     1257#if !PLATFORM(IOS)
    12451258    return frame.editor().canDHTMLCut() || frame.editor().canCut();
    1246 }
     1259#else
     1260    return frame.editor().canCut();
     1261#endif
     1262}
     1263
     1264#if PLATFORM(IOS)
     1265static bool enabledClearText(Frame& frame, Event*, EditorCommandSource)
     1266{
     1267    UNUSED_PARAM(frame);
     1268    return false;
     1269}
     1270#endif
    12471271
    12481272static bool enabledInEditableText(Frame& frame, Event* event, EditorCommandSource)
     
    12971321}
    12981322
    1299 #if PLATFORM(MAC)
     1323#if PLATFORM(MAC) && !PLATFORM(IOS)
    13001324static bool enabledTakeFindStringFromSelection(Frame& frame, Event*, EditorCommandSource)
    13011325{
     
    16041628#endif
    16051629
    1606 #if PLATFORM(MAC)
     1630#if PLATFORM(MAC) && !PLATFORM(IOS)
    16071631        { "TakeFindStringFromSelection", { executeTakeFindStringFromSelection, supportedFromMenuOrKeyBinding, enabledTakeFindStringFromSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1632#endif
     1633#if PLATFORM(IOS)
     1634        { "ClearText", { executeClearText, supported, enabledClearText, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
     1635#endif
     1636
     1637#if PLATFORM(GTK) || PLATFORM(QT)
     1638        { "PasteGlobalSelection", { executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
    16081639#endif
    16091640    };
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r161026 r161638  
    6666#include <wtf/text/CString.h>
    6767
     68#if PLATFORM(IOS)
     69#include "Chrome.h"
     70#include "ChromeClient.h"
     71#include "Color.h"
     72#include "RenderLayer.h"
     73#include "RenderObject.h"
     74#include "RenderStyle.h"
     75#endif
     76
    6877#define EDIT_DEBUG 0
    6978
     
    108117    , m_focused(frame && frame->page() && frame->page()->focusController().focusedFrame() == frame)
    109118    , m_shouldShowBlockCursor(false)
     119#if PLATFORM(IOS)
     120    , m_updateAppearanceEnabled(false)
     121    , m_caretBlinks(true)
     122    , m_closeTypingSuppressions(0)
     123    , m_scrollingSuppressCount(0)
     124#endif
    110125{
    111126    if (shouldAlwaysUseDirectionalSelection(m_frame))
     
    269284    m_granularity = granularity;
    270285
     286#if PLATFORM(IOS)
     287    if (closeTyping && m_closeTypingSuppressions == 0)
     288#else
    271289    if (closeTyping)
     290#endif
    272291        TypingCommand::closeTyping(m_frame);
    273292
     
    621640        pos = modifyExtendingForward(granularity);
    622641        break;
     642#if PLATFORM(IOS)
     643    case DocumentGranularity:
     644        ASSERT_NOT_REACHED();
     645        break;
     646#endif
    623647    }
    624648#if ENABLE(USERSELECT_ALL)
     
    647671        pos = nextParagraphPosition(pos, lineDirectionPointForBlockDirectionNavigation(EXTENT));
    648672        break;
     673#if PLATFORM(IOS)
     674    case DocumentGranularity:
     675        ASSERT_NOT_REACHED();
     676        break;
     677#endif
    649678    case SentenceBoundary:
    650679        pos = endOfSentence(endForPlatform());
     
    704733        pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock());
    705734        break;
     735#if PLATFORM(IOS)
     736    case DocumentGranularity:
     737        ASSERT_NOT_REACHED();
     738        break;
     739#endif
    706740    }
    707741    return pos;
     
    736770        pos = nextParagraphPosition(endForPlatform(), lineDirectionPointForBlockDirectionNavigation(START));
    737771        break;
     772#if PLATFORM(IOS)
     773    case DocumentGranularity:
     774        ASSERT_NOT_REACHED();
     775        break;
     776#endif
    738777    case SentenceBoundary:
    739778        pos = endOfSentence(endForPlatform());
     
    792831        pos = modifyExtendingBackward(granularity);
    793832        break;
     833#if PLATFORM(IOS)
     834    case DocumentGranularity:
     835        ASSERT_NOT_REACHED();
     836        break;
     837#endif
    794838    }
    795839#if ENABLE(USERSELECT_ALL)
     
    839883            pos = startOfDocument(pos);
    840884        break;
     885#if PLATFORM(IOS)
     886    case DocumentGranularity:
     887        ASSERT_NOT_REACHED();
     888        break;
     889#endif
    841890    }
    842891#if ENABLE(USERSELECT_ALL)
     
    878927        pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock());
    879928        break;
     929#if PLATFORM(IOS)
     930    case DocumentGranularity:
     931        ASSERT_NOT_REACHED();
     932        break;
     933#endif
    880934    }
    881935    return pos;
     
    920974            pos = startOfDocument(pos);
    921975        break;
     976#if PLATFORM(IOS)
     977    case DocumentGranularity:
     978        ASSERT_NOT_REACHED();
     979        break;
     980#endif
    922981    }
    923982    return pos;
     
    16691728    VisiblePosition visibleStart(range->startPosition(), collapsed ? affinity : DOWNSTREAM);
    16701729    VisiblePosition visibleEnd(range->endPosition(), SEL_DEFAULT_AFFINITY);
     1730#if PLATFORM(IOS)
     1731    if (range->startContainer() && visibleStart.isNull())
     1732        return false;
     1733    if (range->endContainer() && visibleEnd.isNull())
     1734        return false;
     1735#endif
    16711736    setSelection(VisibleSelection(visibleStart, visibleEnd), ClearTypingStyle | (closeTyping ? CloseTyping : 0));
    16721737    return true;
     
    16861751    document->updateStyleIfNeeded();
    16871752
     1753#if USE(UIKIT_EDITING)
     1754    // Caret blinking (blinks | does not blink)
     1755    if (activeAndFocused)
     1756        setSelectionFromNone();
     1757    setCaretVisible(activeAndFocused);
     1758#else
    16881759    // Because RenderObject::selectionBackgroundColor() and
    16891760    // RenderObject::selectionForegroundColor() check if the frame is active,
     
    17091780                renderer->theme().stateChanged(renderer, FocusState);
    17101781    }
     1782#endif
    17111783}
    17121784
     
    17391811void FrameSelection::updateAppearance()
    17401812{
     1813#if PLATFORM(IOS)
     1814    if (!m_updateAppearanceEnabled)
     1815        return;
     1816#endif
     1817
    17411818    // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case
    17421819    // the FrameSelection will paint a blinking caret as usual).
     
    19131990bool FrameSelection::shouldDeleteSelection(const VisibleSelection& selection) const
    19141991{
     1992#if PLATFORM(IOS)
     1993    if (m_frame->selectionChangeCallbacksDisabled())
     1994        return true;
     1995#endif
    19151996    return m_frame->editor().client()->shouldDeleteRange(selection.toNormalizedRange().get());
    19161997}
     
    20112092    ASSERT(start.deprecatedNode());
    20122093    if (start.deprecatedNode() && start.deprecatedNode()->renderer()) {
     2094#if PLATFORM(IOS)
     2095        if (RenderLayer* layer = start.deprecatedNode()->renderer()->enclosingLayer()) {
     2096            if (!m_scrollingSuppressCount) {
     2097                layer->setAdjustForIOSCaretWhenScrolling(true);
     2098                layer->scrollRectToVisible(rect, alignment, alignment);
     2099                layer->setAdjustForIOSCaretWhenScrolling(false);
     2100                updateAppearance();
     2101                if (m_frame->page())
     2102                    m_frame->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(m_frame);
     2103            }
     2104        }
     2105#else
    20132106        // FIXME: This code only handles scrolling the startContainer's layer, but
    20142107        // the selection rect could intersect more than just that.
     
    20162109        if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, alignment, alignment))
    20172110            updateAppearance();
     2111#endif
    20182112    }
    20192113}
     
    20252119
    20262120    Document* document = m_frame->document();
     2121#if !PLATFORM(IOS)
    20272122    bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
    20282123    if (!isNone() || !(document->hasEditableStyle() || caretBrowsing))
    20292124        return;
     2125#else
     2126    if (!document || !(isNone() || isStartOfDocument(VisiblePosition(selection().start(), selection().affinity()))) || !document->rendererIsEditable())
     2127        return;
     2128#endif
    20302129
    20312130    Node* node = document->documentElement();
     
    20382137bool FrameSelection::shouldChangeSelection(const VisibleSelection& newSelection) const
    20392138{
     2139#if PLATFORM(IOS)
     2140    if (m_frame->selectionChangeCallbacksDisabled())
     2141        return true;
     2142#endif
    20402143    return m_frame->editor().shouldChangeSelection(selection(), newSelection, newSelection.affinity(), false);
    20412144}
     
    20732176#endif
    20742177
     2178#if PLATFORM(IOS)
     2179void FrameSelection::expandSelectionToElementContainingCaretSelection()
     2180{
     2181    RefPtr<Range> range = elementRangeContainingCaretSelection();
     2182    if (!range)
     2183        return;
     2184    VisibleSelection selection(range.get(), DOWNSTREAM);
     2185    setSelection(selection);
     2186}
     2187
     2188PassRefPtr<Range> FrameSelection::elementRangeContainingCaretSelection() const
     2189{
     2190    if (m_selection.isNone())
     2191        return nullptr;
     2192
     2193    VisibleSelection selection = m_selection;
     2194    if (selection.isNone())
     2195        return nullptr;
     2196
     2197    VisiblePosition visiblePos(selection.start(), VP_DEFAULT_AFFINITY);
     2198    if (visiblePos.isNull())
     2199        return nullptr;
     2200
     2201    Node* node = visiblePos.deepEquivalent().deprecatedNode();
     2202    Element* element = deprecatedEnclosingBlockFlowElement(node);
     2203    if (!element)
     2204        return nullptr;
     2205
     2206    Position startPos = createLegacyEditingPosition(element, 0);
     2207    Position endPos = createLegacyEditingPosition(element, element->childNodeCount());
     2208   
     2209    VisiblePosition startVisiblePos(startPos, VP_DEFAULT_AFFINITY);
     2210    VisiblePosition endVisiblePos(endPos, VP_DEFAULT_AFFINITY);
     2211    if (startVisiblePos.isNull() || endVisiblePos.isNull())
     2212        return nullptr;
     2213
     2214    selection.setBase(startVisiblePos);
     2215    selection.setExtent(endVisiblePos);
     2216
     2217    return selection.toNormalizedRange();
     2218}
     2219
     2220void FrameSelection::expandSelectionToWordContainingCaretSelection()
     2221{
     2222    VisibleSelection selection(wordSelectionContainingCaretSelection(m_selection));       
     2223    if (selection.isCaretOrRange())
     2224        setSelection(selection);
     2225}
     2226
     2227PassRefPtr<Range> FrameSelection::wordRangeContainingCaretSelection()
     2228{
     2229    return wordSelectionContainingCaretSelection(m_selection).toNormalizedRange();
     2230}
     2231
     2232void FrameSelection::expandSelectionToStartOfWordContainingCaretSelection()
     2233{
     2234    if (m_selection.isNone() || isStartOfDocument(m_selection.start()))
     2235        return;
     2236
     2237    VisiblePosition s1(m_selection.start());
     2238    VisiblePosition e1(m_selection.end());
     2239
     2240    VisibleSelection expanded(wordSelectionContainingCaretSelection(m_selection));
     2241    VisiblePosition s2(expanded.start());
     2242
     2243    // Don't allow the start to become greater after the expansion.
     2244    if (s2.isNull() || s2 > s1)
     2245        s2 = s1;
     2246
     2247    moveTo(s2, e1);
     2248}
     2249
     2250UChar FrameSelection::characterInRelationToCaretSelection(int amount) const
     2251{
     2252    if (m_selection.isNone())
     2253        return 0;
     2254
     2255    VisibleSelection selection = m_selection;
     2256    ASSERT(selection.isCaretOrRange());
     2257
     2258    VisiblePosition visiblePosition(selection.start(), VP_DEFAULT_AFFINITY);
     2259
     2260    if (amount < 0) {
     2261        int count = abs(amount);
     2262        for (int i = 0; i < count; i++)
     2263            visiblePosition = visiblePosition.previous();   
     2264        return visiblePosition.characterBefore();
     2265    }
     2266    for (int i = 0; i < amount; i++)
     2267        visiblePosition = visiblePosition.next();   
     2268    return visiblePosition.characterAfter();
     2269}
     2270
     2271UChar FrameSelection::characterBeforeCaretSelection() const
     2272{
     2273    if (m_selection.isNone())
     2274        return 0;
     2275
     2276    VisibleSelection selection = m_selection;
     2277    ASSERT(selection.isCaretOrRange());
     2278
     2279    VisiblePosition visiblePosition(selection.start(), VP_DEFAULT_AFFINITY);
     2280    return visiblePosition.characterBefore();
     2281}
     2282
     2283UChar FrameSelection::characterAfterCaretSelection() const
     2284{
     2285    if (m_selection.isNone())
     2286        return 0;
     2287
     2288    VisibleSelection selection = m_selection;
     2289    ASSERT(selection.isCaretOrRange());
     2290
     2291    VisiblePosition visiblePosition(selection.end(), VP_DEFAULT_AFFINITY);
     2292    return visiblePosition.characterAfter();
     2293}
     2294
     2295int FrameSelection::wordOffsetInRange(const Range *range) const
     2296{
     2297    if (!range)
     2298        return -1;
     2299
     2300    VisibleSelection selection = m_selection;
     2301    if (!selection.isCaret())
     2302        return -1;
     2303
     2304    // FIXME: This will only work in cases where the selection remains in
     2305    // the same node after it is expanded. Improve to handle more complicated
     2306    // cases.
     2307    ExceptionCode ec = 0;
     2308    int result = selection.start().deprecatedEditingOffset() - range->startOffset(ec);
     2309    ASSERT(!ec);
     2310    if (result < 0)
     2311        result = 0;
     2312    return result;
     2313}
     2314
     2315bool FrameSelection::spaceFollowsWordInRange(const Range *range) const
     2316{
     2317    if (!range)
     2318        return false;
     2319    ExceptionCode ec = 0;
     2320    Node* node = range->endContainer(ec);
     2321    ASSERT(!ec);
     2322    int endOffset = range->endOffset(ec);
     2323    ASSERT(!ec);
     2324    VisiblePosition pos(createLegacyEditingPosition(node, endOffset), VP_DEFAULT_AFFINITY);
     2325    return isSpaceOrNewline(pos.characterAfter());
     2326}
     2327
     2328bool FrameSelection::selectionAtDocumentStart() const
     2329{
     2330    VisibleSelection selection = m_selection;
     2331    if (selection.isNone())
     2332        return false;
     2333
     2334    Position startPos(selection.start());
     2335    VisiblePosition pos(createLegacyEditingPosition(startPos.deprecatedNode(), startPos.deprecatedEditingOffset()), VP_DEFAULT_AFFINITY);
     2336    if (pos.isNull())
     2337        return false;
     2338
     2339    return isStartOfDocument(pos);
     2340}
     2341
     2342bool FrameSelection::selectionAtSentenceStart() const
     2343{
     2344    VisibleSelection selection = m_selection;
     2345    if (selection.isNone())
     2346        return false;
     2347
     2348    return actualSelectionAtSentenceStart(selection);
     2349}
     2350
     2351bool FrameSelection::selectionAtWordStart() const
     2352{
     2353    VisibleSelection selection = m_selection;
     2354    if (selection.isNone())
     2355        return false;
     2356
     2357    Position startPos(selection.start());
     2358    VisiblePosition pos(createLegacyEditingPosition(startPos.deprecatedNode(), startPos.deprecatedEditingOffset()), VP_DEFAULT_AFFINITY);
     2359    if (pos.isNull())
     2360        return false;
     2361
     2362    if (isStartOfParagraph(pos))
     2363        return true;
     2364       
     2365    bool result = true;
     2366    unsigned previousCount = 0;
     2367    for (pos = pos.previous(); !pos.isNull(); pos = pos.previous()) {
     2368        previousCount++;
     2369        if (isStartOfParagraph(pos)) {
     2370            if (previousCount == 1)
     2371                result = false;
     2372            break;
     2373        }
     2374        UChar c(pos.characterAfter());
     2375        if (c) {
     2376            result = isSpaceOrNewline(c) || c == 0xA0 || (u_ispunct(c) && c != ',' && c != '-' && c != '\'');
     2377            break;
     2378        }
     2379    }
     2380
     2381    return result;
     2382}
     2383
     2384PassRefPtr<Range> FrameSelection::rangeByMovingCurrentSelection(int amount) const
     2385{
     2386    return rangeByAlteringCurrentSelection(AlterationMove, amount);
     2387}
     2388
     2389PassRefPtr<Range> FrameSelection::rangeByExtendingCurrentSelection(int amount) const
     2390{
     2391    return rangeByAlteringCurrentSelection(AlterationExtend, amount);
     2392}
     2393
     2394void FrameSelection::selectRangeOnElement(unsigned location, unsigned length, Node* node)
     2395{
     2396    RefPtr<Range> resultRange = m_frame->document()->createRange();
     2397    ExceptionCode ec = 0;
     2398    resultRange->setStart(node, location, ec);
     2399    ASSERT(!ec);
     2400    resultRange->setEnd(node, location + length, ec);
     2401    ASSERT(!ec);
     2402    VisibleSelection selection = VisibleSelection(resultRange.get(), SEL_DEFAULT_AFFINITY);
     2403    setSelection(selection, true);
     2404}
     2405
     2406VisibleSelection FrameSelection::wordSelectionContainingCaretSelection(const VisibleSelection& selection)
     2407{
     2408    if (selection.isNone())
     2409        return VisibleSelection();
     2410
     2411    ASSERT(selection.isCaretOrRange());
     2412    FrameSelection frameSelection;
     2413    frameSelection.setSelection(selection);
     2414
     2415    Position startPosBeforeExpansion(selection.start());
     2416    Position endPosBeforeExpansion(selection.end());
     2417    VisiblePosition startVisiblePosBeforeExpansion(startPosBeforeExpansion, VP_DEFAULT_AFFINITY);
     2418    VisiblePosition endVisiblePosBeforeExpansion(endPosBeforeExpansion, VP_DEFAULT_AFFINITY);
     2419    if (endVisiblePosBeforeExpansion.isNull())
     2420        return VisibleSelection();
     2421
     2422    if (isEndOfParagraph(endVisiblePosBeforeExpansion)) {
     2423        UChar c(endVisiblePosBeforeExpansion.characterBefore());
     2424        if (isSpaceOrNewline(c) || c == 0xA0) {
     2425            // End of paragraph with space.
     2426            return VisibleSelection();
     2427        }
     2428    }
     2429
     2430    // If at end of paragraph, move backwards one character.
     2431    // This has the effect of selecting the word on the line (which is
     2432    // what we want, rather than selecting past the end of the line).
     2433    if (isEndOfParagraph(endVisiblePosBeforeExpansion) && !isStartOfParagraph(endVisiblePosBeforeExpansion))
     2434        frameSelection.modify(FrameSelection::AlterationMove, DirectionBackward, CharacterGranularity);
     2435
     2436    VisibleSelection newSelection = frameSelection.selection();
     2437    newSelection.expandUsingGranularity(WordGranularity);
     2438    frameSelection.setSelection(newSelection, frameSelection.granularity());
     2439
     2440    Position startPos(frameSelection.selection().start());
     2441    Position endPos(frameSelection.selection().end());
     2442
     2443    // Expansion cannot be allowed to change selection so that it is no longer
     2444    // touches (or contains) the original, unexpanded selection.
     2445    // Enforce this on the way into these additional calculations to give them
     2446    // the best chance to yield a suitable answer.
     2447    if (startPos > startPosBeforeExpansion)
     2448        startPos = startPosBeforeExpansion;
     2449    if (endPos < endPosBeforeExpansion)
     2450        endPos = endPosBeforeExpansion;
     2451
     2452    VisiblePosition startVisiblePos(startPos, VP_DEFAULT_AFFINITY);
     2453    VisiblePosition endVisiblePos(endPos, VP_DEFAULT_AFFINITY);
     2454
     2455    if (startVisiblePos.isNull() || endVisiblePos.isNull()) {
     2456        // Start or end is nil
     2457        return VisibleSelection();
     2458    }
     2459
     2460    if (isEndOfLine(endVisiblePosBeforeExpansion)) {
     2461        VisiblePosition previous(endVisiblePos.previous());
     2462        if (previous == endVisiblePos) {
     2463            // Empty document
     2464            return VisibleSelection();
     2465        }
     2466        UChar c(previous.characterAfter());
     2467        if (isSpaceOrNewline(c) || c == 0xA0) {
     2468            // Space at end of line
     2469            return VisibleSelection();
     2470        }
     2471    }
     2472
     2473    // Expansion has selected past end of line.
     2474    // Try repositioning backwards.
     2475    if (isEndOfLine(startVisiblePos) && isStartOfLine(endVisiblePos)) {
     2476        VisiblePosition previous(startVisiblePos.previous());
     2477        if (isEndOfLine(previous)) {
     2478            // On empty line
     2479            return VisibleSelection();
     2480        }
     2481        UChar c(previous.characterAfter());
     2482        if (isSpaceOrNewline(c) || c == 0xA0) {
     2483            // Space at end of line
     2484            return VisibleSelection();
     2485        }
     2486        frameSelection.moveTo(startVisiblePos);
     2487        frameSelection.modify(FrameSelection::AlterationExtend, DirectionBackward, WordGranularity);
     2488        startPos = frameSelection.selection().start();
     2489        endPos = frameSelection.selection().end();
     2490        startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY);
     2491        endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY);
     2492        if (startVisiblePos.isNull() || endVisiblePos.isNull()) {
     2493            // Start or end is nil
     2494            return VisibleSelection();
     2495        }
     2496    }
     2497
     2498    // Now loop backwards until we find a non-space.
     2499    while (endVisiblePos != startVisiblePos) {
     2500        VisiblePosition previous(endVisiblePos.previous());
     2501        UChar c(previous.characterAfter());
     2502        if (!isSpaceOrNewline(c) && c != 0xA0)
     2503            break;
     2504        endVisiblePos = previous;
     2505    }
     2506
     2507    // Expansion cannot be allowed to change selection so that it is no longer
     2508    // touches (or contains) the original, unexpanded selection.
     2509    // Enforce this on the way out of the function to preserve the invariant.
     2510    if (startVisiblePos > startVisiblePosBeforeExpansion)
     2511        startVisiblePos = startVisiblePosBeforeExpansion;
     2512    if (endVisiblePos < endVisiblePosBeforeExpansion)
     2513        endVisiblePos = endVisiblePosBeforeExpansion;
     2514
     2515    return VisibleSelection(startVisiblePos, endVisiblePos);   
     2516}
     2517
     2518bool FrameSelection::actualSelectionAtSentenceStart(const VisibleSelection& sel) const
     2519{
     2520    Position startPos(sel.start());
     2521    VisiblePosition pos(createLegacyEditingPosition(startPos.deprecatedNode(), startPos.deprecatedEditingOffset()), VP_DEFAULT_AFFINITY);
     2522    if (pos.isNull())
     2523        return false;
     2524
     2525    if (isStartOfParagraph(pos))
     2526        return true;
     2527 
     2528    bool result = true;
     2529    bool sawSpace = false;
     2530    unsigned previousCount = 0;
     2531    for (pos = pos.previous(); !pos.isNull(); pos = pos.previous()) {
     2532        previousCount++;
     2533        if (isStartOfParagraph(pos)) {
     2534            if (previousCount == 1 || (previousCount == 2 && sawSpace))
     2535                result = false;
     2536            break;
     2537        }
     2538        UChar c(pos.characterAfter());
     2539        if (c) {
     2540            if (isSpaceOrNewline(c) || c == 0xA0) {
     2541                sawSpace = true;
     2542            }
     2543            else {
     2544                result = (c == '.' || c == '!' || c == '?');
     2545                break;
     2546            }
     2547        }
     2548    }
     2549   
     2550    return result;
     2551}
     2552
     2553PassRefPtr<Range> FrameSelection::rangeByAlteringCurrentSelection(EAlteration alteration, int amount) const
     2554{
     2555    if (m_selection.isNone())
     2556        return nullptr;
     2557
     2558    if (!amount)
     2559        return toNormalizedRange();
     2560
     2561    FrameSelection frameSelection;
     2562    frameSelection.setSelection(m_selection);
     2563    SelectionDirection direction = amount > 0 ? DirectionForward : DirectionBackward;
     2564    for (int i = 0; i < abs(amount); i++)
     2565        frameSelection.modify(alteration, direction, CharacterGranularity);
     2566    return frameSelection.toNormalizedRange();
     2567}
     2568
     2569void FrameSelection::clearCurrentSelection()
     2570{
     2571    setSelection(VisibleSelection());
     2572}
     2573
     2574void FrameSelection::setCaretBlinks(bool caretBlinks)
     2575{
     2576    if (m_caretBlinks == caretBlinks)
     2577        return;
     2578#if ENABLE(TEXT_CARET)
     2579    m_frame->document()->updateLayoutIgnorePendingStylesheets();
     2580    if (m_caretPaint) {
     2581        m_caretPaint = false;
     2582        invalidateCaretRect();
     2583    }
     2584#endif
     2585    if (caretBlinks)
     2586        setFocusedElementIfNeeded();
     2587    m_caretBlinks = caretBlinks;
     2588    updateAppearance();
     2589}
     2590
     2591void FrameSelection::setCaretColor(const Color& caretColor)
     2592{
     2593    if (m_caretColor != caretColor) {
     2594        m_caretColor = caretColor;
     2595        if (caretIsVisible() && m_caretBlinks && isCaret())
     2596            invalidateCaretRect();
     2597    }
     2598}
     2599#endif // PLATFORM(IOS)
     2600
    20752601}
    20762602
  • trunk/Source/WebCore/editing/FrameSelection.h

    r160966 r161638  
    3636#include <wtf/Noncopyable.h>
    3737
     38#if PLATFORM(IOS)
     39#include "Color.h"
     40#endif
     41
    3842namespace WebCore {
    3943
     
    229233#endif
    230234
     235#if PLATFORM(IOS)
     236public:
     237    void expandSelectionToElementContainingCaretSelection();
     238    PassRefPtr<Range> elementRangeContainingCaretSelection() const;
     239    void expandSelectionToWordContainingCaretSelection();
     240    PassRefPtr<Range> wordRangeContainingCaretSelection();
     241    void expandSelectionToStartOfWordContainingCaretSelection();
     242    UChar characterInRelationToCaretSelection(int amount) const;
     243    UChar characterBeforeCaretSelection() const;
     244    UChar characterAfterCaretSelection() const;
     245    int wordOffsetInRange(const Range*) const;
     246    bool spaceFollowsWordInRange(const Range*) const;
     247    bool selectionAtDocumentStart() const;
     248    bool selectionAtSentenceStart() const;
     249    bool selectionAtWordStart() const;
     250    PassRefPtr<Range> rangeByMovingCurrentSelection(int amount) const;
     251    PassRefPtr<Range> rangeByExtendingCurrentSelection(int amount) const;
     252    void selectRangeOnElement(unsigned location, unsigned length, Node*);
     253    void suppressCloseTyping() { ++m_closeTypingSuppressions; }
     254    void restoreCloseTyping() { --m_closeTypingSuppressions; }
     255    void clearCurrentSelection();
     256    void setCaretBlinks(bool caretBlinks = true);
     257    void setCaretColor(const Color&);
     258    static VisibleSelection wordSelectionContainingCaretSelection(const VisibleSelection&);
     259    void setUpdateAppearanceEnabled(bool enabled) { m_updateAppearanceEnabled = enabled; }
     260    void suppressScrolling() { ++m_scrollingSuppressCount; }
     261    void restoreScrolling()
     262    {
     263        ASSERT(m_scrollingSuppressCount);
     264        --m_scrollingSuppressCount;
     265    }
     266private:
     267    bool actualSelectionAtSentenceStart(const VisibleSelection&) const;
     268    PassRefPtr<Range> rangeByAlteringCurrentSelection(EAlteration, int amount) const;
     269public:
     270#endif
     271
    231272    bool shouldChangeSelection(const VisibleSelection&) const;
    232273    bool shouldDeleteSelection(const VisibleSelection&) const;
     
    310351    bool m_focused : 1;
    311352    bool m_shouldShowBlockCursor : 1;
     353
     354#if PLATFORM(IOS)
     355    bool m_updateAppearanceEnabled : 1;
     356    bool m_caretBlinks : 1;
     357    Color m_caretColor;
     358    int m_closeTypingSuppressions;
     359    int m_scrollingSuppressCount;
     360#endif
    312361};
    313362
  • trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp

    r160966 r161638  
    3333#include "Settings.h"
    3434#include "Text.h"
     35#if PLATFORM(IOS)
     36#include "RenderText.h"
     37#endif
    3538
    3639namespace WebCore {
     
    6972}
    7073
     74#if PLATFORM(IOS)
     75void InsertIntoTextNodeCommand::doReapply()
     76{
     77    ExceptionCode ec;
     78    m_node->insertData(m_offset, m_text, ec);
     79}
     80#endif
     81   
    7182void InsertIntoTextNodeCommand::doUnapply()
    7283{
  • trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h

    r102527 r161638  
    4545    virtual void doApply() OVERRIDE;
    4646    virtual void doUnapply() OVERRIDE;
     47#if PLATFORM(IOS)
     48    virtual void doReapply() OVERRIDE;
     49#endif
    4750   
    4851#ifndef NDEBUG
  • trunk/Source/WebCore/editing/InsertTextCommand.h

    r154938 r161638  
    6969    virtual void doApply();
    7070
     71#if PLATFORM(IOS)
     72    virtual bool isInsertTextCommand() const OVERRIDE { return true; }
     73#endif
     74
    7175    Position positionInsideTextNode(const Position&);
    7276    Position insertTab(const Position&);
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r161196 r161638  
    900900        return;
    901901
     902#if PLATFORM(IOS)
     903    // In plain text only regions, we create style-less fragments, so the inserted content will automatically
     904    // match the style of the surrounding area and so we can avoid unnecessary work below for m_matchStyle.
     905    if (!selection.isContentRichlyEditable())
     906        m_matchStyle = false;
     907#endif
     908
    902909    ReplacementFragment fragment(document(), m_documentFragment.get(), selection);
    903910    if (performTrivialReplace(fragment))
  • trunk/Source/WebCore/editing/TextAffinity.h

    r55633 r161638  
    2828
    2929#ifdef __OBJC__
     30#if !PLATFORM(IOS)
    3031#include <AppKit/NSTextView.h>
     32#else
     33#include "WAKAppKitStubs.h"
     34#endif // !PLATFORM(IOS)
    3135#endif
    3236
  • trunk/Source/WebCore/editing/TextCheckingHelper.cpp

    r161518 r161638  
    234234}
    235235
     236#if !PLATFORM(IOS)
    236237String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, bool markAll, RefPtr<Range>& firstMisspellingRange)
    237238{
     
    414415    return firstFoundItem;
    415416}
     417#endif // !PLATFORM(IOS)
    416418
    417419#if USE(GRAMMAR_CHECKING)
     
    613615
    614616
     617#if !PLATFORM(IOS)
    615618void TextCheckingHelper::markAllMisspellings(RefPtr<Range>& firstMisspellingRange)
    616619{
     
    631634}
    632635#endif
     636#endif // !PLATFORM(IOS)
    633637
    634638bool TextCheckingHelper::unifiedTextCheckerEnabled() const
  • trunk/Source/WebCore/editing/TextGranularity.h

    r102252 r161638  
    3737    LineGranularity,
    3838    ParagraphGranularity,
     39#if PLATFORM(IOS)
     40    DocumentGranularity,
     41#endif
    3942    SentenceBoundary,
    4043    LineBoundary,
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r158743 r161638  
    251251        return false;
    252252   
     253#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     254    if (renderer->isImage() || renderer->isMedia())
     255        return true;
     256    if (renderer->isWidget()) {
     257        if (renderer->node() && renderer->node()->isElementNode()) {
     258            Element* element = toElement(renderer->node());
     259            if (element->hasTagName(videoTag) || !element->hasTagName(audioTag))
     260                return false; // See <rdar://problem/6893793>.
     261        }
     262        return true;
     263    }
     264#else
    253265    if (renderer->isImage() || renderer->isWidget() || renderer->isMedia())
    254266        return true;
     267#endif
    255268   
    256269    if (renderer->node() && renderer->node()->isElementNode()) {
  • trunk/Source/WebCore/editing/TypingCommand.cpp

    r158350 r161638  
    237237}
    238238
     239#if PLATFORM(IOS)
     240void TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping(Frame* frame, const VisibleSelection& newSelection)
     241{
     242    if (RefPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(frame)) {
     243        lastTypingCommand->setEndingSelection(newSelection);
     244        lastTypingCommand->setEndingSelectionOnLastInsertCommand(newSelection);
     245    }
     246}
     247#endif
     248
    239249void TypingCommand::doApply()
    240250{
     
    282292    Frame& frame = this->frame();
    283293
    284 #if PLATFORM(MAC)
     294#if PLATFORM(MAC) && !PLATFORM(IOS)
    285295    if (!frame.editor().isContinuousSpellCheckingEnabled()
    286296        && !frame.editor().isAutomaticQuoteSubstitutionEnabled()
     
    300310    VisiblePosition previous = start.previous();
    301311    if (previous.isNotNull()) {
     312#if !PLATFORM(IOS)
    302313        VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
    303314        VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
     
    310321        } else if (commandType == TypingCommand::InsertText)
    311322            frame.editor().startAlternativeTextUITimer();
     323#else
     324        UNUSED_PARAM(commandType);
     325        // If this bug gets fixed, this PLATFORM(IOS) code could be removed:
     326        // <rdar://problem/7259611> Word boundary code on iPhone gives different results than desktop
     327        EWordSide startWordSide = LeftWordIfOnBoundary;
     328        UChar32 c = previous.characterAfter();
     329        // FIXME: VisiblePosition::characterAfter() and characterBefore() do not emit newlines the same
     330        // way as TextIterator, so we do an isEndOfParagraph check here.
     331        if (isSpaceOrNewline(c) || c == 0xA0 || isEndOfParagraph(previous)) {
     332            startWordSide = RightWordIfOnBoundary;
     333        }
     334        VisiblePosition p1 = startOfWord(previous, startWordSide);
     335        VisiblePosition p2 = startOfWord(start, startWordSide);
     336        if (p1 != p2)
     337            frame.editor().markMisspellingsAfterTypingToWord(p1, endingSelection(), false);
     338#endif // !PLATFORM(IOS)
    312339    }
    313340}
     
    488515   
    489516    ASSERT(!selectionToDelete.isNone());
    490     if (selectionToDelete.isNone())
    491         return;
     517    if (selectionToDelete.isNone()) {
     518#if PLATFORM(IOS)
     519        // Workaround for this bug:
     520        // <rdar://problem/4653755> UIKit text widgets should use WebKit editing API to manipulate text
     521        setEndingSelection(frame.selection().selection());
     522        closeTyping(&frame);
     523#endif
     524        return;
     525    }
    492526   
    493527    if (selectionToDelete.isCaret() || !frame.selection().shouldDeleteSelection(selectionToDelete))
     
    579613   
    580614    ASSERT(!selectionToDelete.isNone());
    581     if (selectionToDelete.isNone())
    582         return;
     615    if (selectionToDelete.isNone()) {
     616#if PLATFORM(IOS)
     617        // Workaround for this bug:
     618        // <rdar://problem/4653755> UIKit text widgets should use WebKit editing API to manipulate text
     619        setEndingSelection(frame.selection().selection());
     620        closeTyping(&frame);
     621#endif
     622        return;
     623    }
    583624   
    584625    if (selectionToDelete.isCaret() || !frame.selection().shouldDeleteSelection(selectionToDelete))
     
    600641}
    601642
     643#if PLATFORM(IOS)
     644class FriendlyEditCommand : public EditCommand {
     645public:
     646    void setEndingSelection(const VisibleSelection& selection)
     647    {
     648        EditCommand::setEndingSelection(selection);
     649    }
     650};
     651
     652void TypingCommand::setEndingSelectionOnLastInsertCommand(const VisibleSelection& selection)
     653{
     654    if (!m_commands.isEmpty()) {
     655        EditCommand* lastCommand = m_commands.last().get();
     656        if (lastCommand->isInsertTextCommand())
     657            static_cast<FriendlyEditCommand*>(lastCommand)->setEndingSelection(selection);
     658    }
     659}
     660#endif
     661
    602662void TypingCommand::updatePreservesTypingStyle(ETypingCommand commandType)
    603663{
  • trunk/Source/WebCore/editing/TypingCommand.h

    r156941 r161638  
    6767    static void insertParagraphSeparatorInQuotedContent(Document&);
    6868    static void closeTyping(Frame*);
     69#if PLATFORM(IOS)
     70    static void ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping(Frame*, const VisibleSelection&);
     71#endif
    6972
    7073    void insertText(const String &text, bool selectInsertedText);
     
    7780    void deleteSelection(bool smartDelete);
    7881    void setCompositionType(TextCompositionType type) { m_compositionType = type; }
     82
     83#if PLATFORM(IOS)
     84    void setEndingSelectionOnLastInsertCommand(const VisibleSelection& selection);
     85#endif
    7986
    8087private:
  • trunk/Source/WebCore/editing/VisiblePosition.h

    r127300 r161638  
    128128    return !(a == b);
    129129}
     130   
     131#if PLATFORM(IOS)
     132inline bool operator<(const VisiblePosition& a, const VisiblePosition& b)
     133{
     134    return a.deepEquivalent() < b.deepEquivalent();
     135}
     136
     137inline bool operator>(const VisiblePosition& a, const VisiblePosition& b)
     138{
     139    return a.deepEquivalent() > b.deepEquivalent();
     140}
     141
     142inline bool operator<=(const VisiblePosition& a, const VisiblePosition& b)
     143{
     144    return a.deepEquivalent() <= b.deepEquivalent();
     145}
     146
     147inline bool operator>=(const VisiblePosition& a, const VisiblePosition& b)
     148{
     149    return a.deepEquivalent() >= b.deepEquivalent();
     150}   
     151#endif
    130152
    131153PassRefPtr<Range> makeRange(const VisiblePosition&, const VisiblePosition&);
  • trunk/Source/WebCore/editing/VisibleSelection.cpp

    r160966 r161638  
    322322               
    323323            m_end = end.deepEquivalent();
     324#if PLATFORM(IOS)
     325            // End must not be before start.
     326            if (m_start.deprecatedNode() == m_end.deprecatedNode() && m_start.deprecatedEditingOffset() > m_end.deprecatedEditingOffset()) {
     327                Position swap(m_start);
     328                m_start = m_end;   
     329                m_end = swap;   
     330            }
     331#endif
    324332            break;
    325333        }
     
    385393            m_end = endOfSentence(VisiblePosition(m_end, m_affinity)).deepEquivalent();
    386394            break;
     395#if PLATFORM(IOS)
     396        case DocumentGranularity:
     397            ASSERT_NOT_REACHED();
     398            break;
     399#endif
    387400    }
    388401   
     
    519532    if (m_base.isNull() || m_start.isNull() || m_end.isNull())
    520533        return;
     534
     535#if PLATFORM(IOS)
     536    // Early return in the caret case (the state hasn't actually been set yet, so we can't use isCaret()) to avoid the
     537    // expense of computing highestEditableRoot.
     538    if (m_base == m_start && m_base == m_end)
     539        return;
     540#endif
    521541
    522542    Node* baseRoot = highestEditableRoot(m_base);
  • trunk/Source/WebCore/editing/VisibleUnits.cpp

    r160966 r161638  
    498498            // Treat bullets used in the text security mode as regular characters when looking for boundaries
    499499            String iteratorString(it.characters(), it.length());
     500#if PLATFORM(IOS)
     501            iteratorString = iteratorString.impl()->fill('x');
     502#else
    500503            iteratorString.fill('x');
     504#endif
    501505            string.insert(0, iteratorString.characters(), iteratorString.length());
    502506        }
     
    572576            // Treat bullets used in the text security mode as regular characters when looking for boundaries
    573577            String iteratorString(it.characters(), it.length());
     578#if PLATFORM(IOS)
     579            iteratorString = iteratorString.impl()->fill('x');
     580#else
    574581            iteratorString.fill('x');
     582#endif
    575583            string.append(iteratorString.characters(), iteratorString.length());
    576584        }
     
    13331341        return VisiblePosition();
    13341342   
     1343#if PLATFORM(IOS)
     1344    // The canonicalization of the position at (documentElement, 0) can turn the visible
     1345    // position to null, even when there's a valid candidate to be had, because the root HTML element
     1346    // is not content editable.  So we construct directly from the valid candidate.
     1347    // FIXME: Merge this to Open Source. https://bugs.webkit.org/show_bug.cgi?id=56437
     1348    Position firstCandidate = nextCandidate(createLegacyEditingPosition(node->document().documentElement(), 0));
     1349    if (firstCandidate.isNull())
     1350        return VisiblePosition();
     1351    return VisiblePosition(firstCandidate);
     1352#else
    13351353    return VisiblePosition(firstPositionInNode(node->document().documentElement()), DOWNSTREAM);
     1354#endif
    13361355}
    13371356
     
    13461365        return VisiblePosition();
    13471366   
     1367#if PLATFORM(IOS)
     1368    // (As above, in startOfDocument.)  The canonicalization can reject valid visible positions
     1369    // when descending from the root element, so we construct the visible position directly from a
     1370    // valid candidate.
     1371    // FIXME: Merge this to Open Source. https://bugs.webkit.org/show_bug.cgi?id=56437
     1372#endif
    13481373    Element* doc = node->document().documentElement();
     1374#if PLATFORM(IOS)
     1375    Position lastPosition = createLegacyEditingPosition(node->document().documentElement(), doc->childNodeCount());
     1376    Position lastCandidate = previousCandidate(lastPosition);
     1377    if (lastCandidate.isNull())
     1378        return VisiblePosition();
     1379    return VisiblePosition(lastCandidate);
     1380#endif
    13491381    return VisiblePosition(lastPositionInNode(doc), DOWNSTREAM);
    13501382}
     
    14141446}
    14151447
    1416 }
     1448#if PLATFORM(IOS)
     1449static bool directionIsDownstream(SelectionDirection direction)
     1450{
     1451    if (direction == DirectionBackward)
     1452        return false;
     1453    else if (direction == DirectionForward)
     1454        return true;
     1455
     1456    // FIXME: this code doesn't take into account the original direction of the element.
     1457    // I'm not fixing this now because I'm afraid there is some code in UIKit relying on
     1458    // this wrong behavior.
     1459    return direction == DirectionRight;
     1460}
     1461
     1462bool atBoundaryOfGranularity(const VisiblePosition& vp, TextGranularity granularity, SelectionDirection direction)
     1463{
     1464    if (granularity == CharacterGranularity)
     1465        return true;
     1466
     1467    VisiblePosition boundary;
     1468
     1469    bool useDownstream = directionIsDownstream(direction);
     1470
     1471    switch (granularity) {
     1472    case WordGranularity:
     1473        // visible_units claims erroneously that the start and the end
     1474        // of a paragraph are the end and start of a word, respectively.
     1475        if ((useDownstream && isStartOfParagraph(vp)) || (!useDownstream && isEndOfParagraph(vp)))
     1476            return false;
     1477
     1478        // Note that "Left" and "Right" in this context apparently mean "upstream/previous" and "downstream/next".
     1479        boundary = useDownstream ? endOfWord(vp, LeftWordIfOnBoundary) : startOfWord(vp, RightWordIfOnBoundary);
     1480        break;
     1481
     1482    case SentenceGranularity:
     1483        boundary = useDownstream ? endOfSentence(vp) : startOfSentence(vp);
     1484        break;
     1485
     1486    case LineGranularity:
     1487        // Affinity has to be set to get right boundary of the line.
     1488        boundary = vp;
     1489        boundary.setAffinity(useDownstream ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
     1490        boundary = useDownstream ? endOfLine(boundary) : startOfLine(boundary);
     1491        break;
     1492
     1493    case ParagraphGranularity:
     1494        boundary = useDownstream ? endOfParagraph(vp) : startOfParagraph(vp);
     1495        break;
     1496
     1497    case DocumentGranularity:
     1498        boundary = useDownstream ? endOfDocument(vp) : startOfDocument(vp);
     1499        break;
     1500
     1501    default:
     1502        ASSERT_NOT_REACHED();
     1503        break;
     1504    }
     1505
     1506    return vp == boundary;
     1507}
     1508
     1509bool withinTextUnitOfGranularity(const VisiblePosition& vp, TextGranularity granularity, SelectionDirection direction)
     1510{
     1511    if (granularity == CharacterGranularity || granularity == DocumentGranularity)
     1512        return true;
     1513
     1514    bool useDownstream = directionIsDownstream(direction);
     1515
     1516    VisiblePosition prevBoundary;
     1517    VisiblePosition nextBoundary;
     1518   
     1519    switch (granularity) {
     1520    case WordGranularity:
     1521        // Note that "Left" and "Right" in this context apparently mean "upstream/previous" and "downstream/next".
     1522        prevBoundary = startOfWord(vp, (useDownstream ? RightWordIfOnBoundary : LeftWordIfOnBoundary));
     1523        nextBoundary = endOfWord(vp, (useDownstream ? RightWordIfOnBoundary : LeftWordIfOnBoundary));
     1524   
     1525        // Workaround for <rdar://problem/7259611> Word boundary code on iPhone gives different results than desktop
     1526        if (endOfWord(prevBoundary, RightWordIfOnBoundary) != nextBoundary)
     1527            return false;
     1528
     1529        break;
     1530
     1531    case SentenceGranularity:
     1532        prevBoundary = startOfSentence(vp);
     1533        nextBoundary = endOfSentence(vp);
     1534        break;
     1535
     1536    case LineGranularity:
     1537        prevBoundary = startOfLine(vp);
     1538        nextBoundary = endOfLine(vp);
     1539
     1540        if (prevBoundary == nextBoundary) {
     1541            nextBoundary = nextLinePosition(nextBoundary, 0);
     1542            nextBoundary.setAffinity(UPSTREAM);
     1543            if (!inSameLine(prevBoundary, nextBoundary))
     1544                nextBoundary = vp.next();
     1545        }
     1546        break;
     1547
     1548    case ParagraphGranularity:
     1549        prevBoundary = startOfParagraph(vp);
     1550        nextBoundary = endOfParagraph(vp);
     1551        break;
     1552
     1553    default:
     1554        ASSERT_NOT_REACHED();
     1555        break;
     1556    }
     1557
     1558    if (prevBoundary == nextBoundary)
     1559        return false;
     1560
     1561    if (vp == prevBoundary)
     1562        return useDownstream;
     1563
     1564    if (vp == nextBoundary)
     1565        return !useDownstream;
     1566
     1567    return (prevBoundary < vp && vp < nextBoundary);
     1568}
     1569
     1570static VisiblePosition nextCharacterBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1571{
     1572    return directionIsDownstream(direction) ? vp.next() : vp.previous();
     1573}
     1574
     1575static VisiblePosition nextWordBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1576{
     1577    bool useDownstream = directionIsDownstream(direction);
     1578    bool withinUnitOfGranularity = withinTextUnitOfGranularity(vp, WordGranularity, direction);
     1579    VisiblePosition result;
     1580   
     1581    if (useDownstream) {
     1582        if (withinUnitOfGranularity)
     1583            result = endOfWord(vp, RightWordIfOnBoundary);
     1584        else {
     1585            VisiblePosition start = startOfWord(vp, RightWordIfOnBoundary);
     1586            if (start > vp && start != endOfWord(start))
     1587                result = start;
     1588            else {
     1589                // Do same thing as backwards traveling below.
     1590                start = vp;
     1591                while (true) {
     1592                    result = startOfWord(nextWordPosition(start), RightWordIfOnBoundary);
     1593
     1594                    if (result == start)
     1595                        break;
     1596
     1597                    // We failed to find a word boundary.
     1598                    if (result.isNull() || result < start)
     1599                        return VisiblePosition();
     1600
     1601                    // We consider successs also the case where start is before element and result is after.
     1602                    // This covers moving past images like words.
     1603                    if (result != endOfWord(result)
     1604                        || (result.deepEquivalent().anchorNode() == start.deepEquivalent().anchorNode()
     1605                            && result.deepEquivalent().anchorType() == Position::PositionIsAfterAnchor
     1606                            && start.deepEquivalent().anchorType() == Position::PositionIsBeforeAnchor))
     1607                        break;
     1608
     1609                    start = result;
     1610                }
     1611            }
     1612        }
     1613    } else {
     1614        if (withinUnitOfGranularity)
     1615            result = startOfWord(vp, LeftWordIfOnBoundary);
     1616        else {
     1617            // This is complicated because:
     1618            //   When given "Blah blah.|", endOfWord is "Blah blah|.", and previousWordPosition is "Blah| blah."
     1619            //   When given "Blah blah. |", endOfWord is "Blah blah.| ", and previousWordPosition is "Blah |blah. ".
     1620            VisiblePosition end = endOfWord(vp, LeftWordIfOnBoundary);
     1621            if (end < vp && end != startOfWord(end))
     1622                result = end;
     1623            else {
     1624                end = vp;
     1625                while (true) {
     1626                    result = endOfWord(previousWordPosition(end), RightWordIfOnBoundary);
     1627
     1628                    if (result == end)
     1629                        break;
     1630
     1631                    if (result.isNull() || result > end)
     1632                        return VisiblePosition();
     1633
     1634                    if (result != startOfWord(result))
     1635                        break;
     1636
     1637                    end = result;
     1638                }
     1639            }
     1640        }
     1641    }
     1642   
     1643    if (result == vp)
     1644        return VisiblePosition();
     1645   
     1646    return result;
     1647}
     1648
     1649static VisiblePosition nextSentenceBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1650{
     1651    bool useDownstream = directionIsDownstream(direction);
     1652    bool withinUnitOfGranularity = withinTextUnitOfGranularity(vp, SentenceGranularity, direction);
     1653    VisiblePosition result;
     1654
     1655    if (withinUnitOfGranularity)
     1656        result = useDownstream ? endOfSentence(vp) : startOfSentence(vp);
     1657    else {
     1658        result = useDownstream ? nextSentencePosition(vp) : previousSentencePosition(vp);
     1659        if (result.isNull() || result == vp)
     1660            return VisiblePosition();
     1661
     1662        result = useDownstream ? startOfSentence(vp) : endOfSentence(vp);
     1663    }
     1664
     1665    if (result == vp)
     1666        return VisiblePosition();
     1667
     1668    ASSERT(useDownstream ? (result > vp) : (result < vp));
     1669
     1670    return result;
     1671}
     1672
     1673static VisiblePosition nextLineBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1674{
     1675    bool useDownstream = directionIsDownstream(direction);
     1676    VisiblePosition result = vp;
     1677
     1678    if (useDownstream) {
     1679        result.setAffinity(DOWNSTREAM);
     1680        result = isEndOfLine(result) ? startOfLine(nextLinePosition(result, result.lineDirectionPointForBlockDirectionNavigation())) : endOfLine(result);
     1681    } else {
     1682        result.setAffinity(VP_UPSTREAM_IF_POSSIBLE);
     1683        result = isStartOfLine(result) ? endOfLine(previousLinePosition(result, result.lineDirectionPointForBlockDirectionNavigation())) : startOfLine(result);
     1684    }
     1685
     1686    return result;
     1687}
     1688
     1689static VisiblePosition nextParagraphBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1690{
     1691    bool useDownstream = directionIsDownstream(direction);
     1692    bool withinUnitOfGranularity = withinTextUnitOfGranularity(vp, ParagraphGranularity, direction);
     1693    VisiblePosition result;
     1694
     1695    if (!withinUnitOfGranularity)
     1696        result =  useDownstream ? startOfParagraph(nextParagraphPosition(vp, vp.lineDirectionPointForBlockDirectionNavigation())) : endOfParagraph(previousParagraphPosition(vp, vp.lineDirectionPointForBlockDirectionNavigation()));
     1697    else
     1698        result = useDownstream ? endOfParagraph(vp) : startOfParagraph(vp);
     1699
     1700    return result;
     1701}
     1702
     1703static VisiblePosition nextDocumentBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
     1704{
     1705    return directionIsDownstream(direction) ? endOfDocument(vp) : startOfDocument(vp);
     1706}
     1707
     1708VisiblePosition positionOfNextBoundaryOfGranularity(const VisiblePosition& vp, TextGranularity granularity, SelectionDirection direction)
     1709{
     1710    switch (granularity) {
     1711    case CharacterGranularity:
     1712        return nextCharacterBoundaryInDirection(vp, direction);
     1713    case WordGranularity:
     1714        return nextWordBoundaryInDirection(vp, direction);
     1715    case SentenceGranularity:
     1716        return nextSentenceBoundaryInDirection(vp, direction);
     1717    case LineGranularity:
     1718        return nextLineBoundaryInDirection(vp, direction);
     1719    case ParagraphGranularity:
     1720        return nextParagraphBoundaryInDirection(vp, direction);
     1721    case DocumentGranularity:
     1722        return nextDocumentBoundaryInDirection(vp, direction);
     1723    default:
     1724        ASSERT_NOT_REACHED();
     1725        return VisiblePosition();
     1726    }
     1727}
     1728
     1729PassRefPtr<Range> enclosingTextUnitOfGranularity(const VisiblePosition& vp, TextGranularity granularity, SelectionDirection direction)
     1730{
     1731    // This is particularly inefficient.  We could easily obtain the answer with the boundaries computed below.
     1732    if (!withinTextUnitOfGranularity(vp, granularity, direction))
     1733        return 0;
     1734
     1735    VisiblePosition prevBoundary;
     1736    VisiblePosition nextBoundary;
     1737    bool useDownstream = directionIsDownstream(direction);
     1738
     1739    switch (granularity) {
     1740        case CharacterGranularity:
     1741            prevBoundary = vp;
     1742            nextBoundary = prevBoundary.next();
     1743            break;
     1744
     1745        case WordGranularity:
     1746            // NB: "Left" and "Right" in this context apparently mean "upstream/previous" and "downstream/next".
     1747            if (useDownstream) {
     1748                prevBoundary = startOfWord(vp, RightWordIfOnBoundary);
     1749                nextBoundary = endOfWord(vp, RightWordIfOnBoundary);
     1750            } else {
     1751                prevBoundary = startOfWord(vp, LeftWordIfOnBoundary);
     1752                nextBoundary = endOfWord(vp, LeftWordIfOnBoundary);
     1753            }
     1754            break;
     1755
     1756        case SentenceGranularity:
     1757            prevBoundary = startOfSentence(vp);
     1758            nextBoundary = endOfSentence(vp);
     1759            break;
     1760
     1761        case LineGranularity:
     1762            prevBoundary = startOfLine(vp);
     1763            nextBoundary = endOfLine(vp);
     1764
     1765            if (prevBoundary == nextBoundary) {
     1766                nextBoundary = nextLinePosition(nextBoundary, 0);
     1767                nextBoundary.setAffinity(UPSTREAM);
     1768                if (!inSameLine(prevBoundary, nextBoundary))
     1769                    nextBoundary = vp.next();
     1770            }
     1771            break;
     1772
     1773        case ParagraphGranularity:
     1774            prevBoundary = startOfParagraph(vp);
     1775            nextBoundary = endOfParagraph(vp);
     1776            break;
     1777
     1778        case DocumentGranularity:
     1779            prevBoundary = startOfDocument(vp);
     1780            nextBoundary = endOfDocument(vp);
     1781            break;
     1782
     1783        default:
     1784            ASSERT_NOT_REACHED();
     1785            return 0;
     1786    }
     1787
     1788    if (prevBoundary.isNull() || nextBoundary.isNull())
     1789        return 0;
     1790
     1791    if (vp < prevBoundary || vp > nextBoundary)
     1792        return 0;
     1793
     1794    RefPtr<Range> range = Range::create(prevBoundary.deepEquivalent().deprecatedNode()->document(), prevBoundary, nextBoundary);
     1795
     1796    return range;
     1797}
     1798
     1799int distanceBetweenPositions(const VisiblePosition& vp, const VisiblePosition& other)
     1800{
     1801    if (vp.isNull() || other.isNull())
     1802        return 0;
     1803
     1804    bool thisIsStart = (vp < other);
     1805
     1806    // Start must come first in the Range constructor.
     1807    RefPtr<Range> range = Range::create(vp.deepEquivalent().deprecatedNode()->document(),
     1808                                        (thisIsStart ? vp : other),
     1809                                        (thisIsStart ? other : vp));
     1810    int distance = TextIterator::rangeLength(range.get());
     1811
     1812    return (thisIsStart ? -distance : distance);
     1813}
     1814
     1815PassRefPtr<Range> wordRangeFromPosition(const VisiblePosition& position)
     1816{
     1817    ASSERT(position.isNotNull());
     1818
     1819    RefPtr<Range> range = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionBackward);
     1820
     1821    if (!range) {
     1822        // We could be at the start of a word, try forward.
     1823        range = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionForward);
     1824    }
     1825    if (range)
     1826        return range;
     1827
     1828    VisiblePosition currentPosition = position;
     1829    do {
     1830        currentPosition = positionOfNextBoundaryOfGranularity(currentPosition, WordGranularity, DirectionBackward);
     1831    } while (currentPosition.isNotNull() && !atBoundaryOfGranularity(currentPosition, WordGranularity, DirectionBackward));
     1832
     1833    // If the position is an empty paragraph and at the end of the document
     1834    // the word iterator could not pass the paragraph boundary, therefore iterating to
     1835    // the previous line is required.
     1836    if (currentPosition.isNull() && isEndOfDocument(position)) {
     1837        VisiblePosition previousLinePosition = positionOfNextBoundaryOfGranularity(position, LineGranularity, DirectionBackward);
     1838        if (previousLinePosition.isNotNull()) {
     1839            currentPosition = positionOfNextBoundaryOfGranularity(previousLinePosition, WordGranularity, DirectionBackward);
     1840            if (currentPosition.isNull())
     1841                currentPosition = previousLinePosition;
     1842        }
     1843    }
     1844
     1845    if (currentPosition.isNull())
     1846        currentPosition = positionOfNextBoundaryOfGranularity(position, WordGranularity, DirectionForward);
     1847
     1848    if (currentPosition.isNotNull()) {
     1849        range = Range::create(position.deepEquivalent().deprecatedNode()->document(), currentPosition, position);
     1850        ASSERT(range);
     1851    }
     1852    return range;
     1853}
     1854
     1855VisiblePosition closestWordBoundaryForPosition(const VisiblePosition& position)
     1856{
     1857    VisiblePosition result;
     1858
     1859    // move the the position at the end of the word
     1860    if (atBoundaryOfGranularity(position, LineGranularity, DirectionForward)) {
     1861        // Don't cross line boundaries.
     1862        result = position;
     1863    } else if (withinTextUnitOfGranularity(position, WordGranularity, DirectionForward)) {
     1864        // The position lies within a word.
     1865        RefPtr<Range> wordRange = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionForward);
     1866
     1867        result = wordRange->startPosition();
     1868        if (distanceBetweenPositions(position, result) > 1)
     1869            result = wordRange->endPosition();
     1870    } else if (atBoundaryOfGranularity(position, WordGranularity, DirectionBackward)) {
     1871        // The position is at the end of a word.
     1872        result = position;
     1873    } else {
     1874        // The position is not within a word.
     1875        // Go to the next boundary.
     1876        result = positionOfNextBoundaryOfGranularity(position, WordGranularity, DirectionForward);
     1877
     1878        // If there is no such boundary we go to the end of the element.
     1879        if (result.isNull())
     1880            result = endOfEditableContent(position);
     1881    }
     1882    return result;
     1883}
     1884
     1885#endif
     1886
     1887}
  • trunk/Source/WebCore/editing/VisibleUnits.h

    r151947 r161638  
    2929#include "EditingBoundary.h"
    3030#include "TextDirection.h"
     31#include "VisibleSelection.h"
    3132
    3233namespace WebCore {
     
    9697bool isEndOfEditableOrNonEditableContent(const VisiblePosition&);
    9798
     99#if PLATFORM(IOS)
     100bool atBoundaryOfGranularity(const VisiblePosition&, TextGranularity, SelectionDirection);
     101bool withinTextUnitOfGranularity(const VisiblePosition&, TextGranularity, SelectionDirection);
     102VisiblePosition positionOfNextBoundaryOfGranularity(const VisiblePosition&, TextGranularity, SelectionDirection);
     103PassRefPtr<Range> enclosingTextUnitOfGranularity(const VisiblePosition&, TextGranularity, SelectionDirection);
     104int distanceBetweenPositions(const VisiblePosition&, const VisiblePosition&);
     105PassRefPtr<Range> wordRangeFromPosition(const VisiblePosition& position);
     106VisiblePosition closestWordBoundaryForPosition(const VisiblePosition& position);
     107#endif
    98108} // namespace WebCore
    99109
  • trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm

    r156339 r161638  
    3333namespace WebCore {
    3434
     35#if !PLATFORM(IOS)
    3536static CGRect accessibilityConvertScreenRect(CGRect bounds)
    3637{
     
    4445    return bounds;
    4546}
     47#endif // !PLATFORM(IOS)
    4648   
    4749   
     
    5557    }
    5658
     59#if !PLATFORM(IOS)
    5760    // if zoom feature is enabled, insertion point changes should update the zoom
    5861    if (!UAZoomEnabled() || !m_selection.isCaret())
     
    7780
    7881    UAZoomChangeFocus(&cgViewRect, &cgCaretRect, kUAZoomFocusTypeInsertionPoint);
     82#endif // !PLATFORM(IOS)
    7983}
    8084
  • trunk/Source/WebCore/fileapi/AsyncFileStream.cpp

    r156550 r161638  
    4545#include <wtf/text/WTFString.h>
    4646
     47#if PLATFORM(IOS)
     48#include "WebCoreThread.h"
     49#endif
     50
    4751namespace WebCore {
    4852
  • trunk/Source/WebCore/inspector/InspectorCounters.h

    r155251 r161638  
    3636#if !ASSERT_DISABLED
    3737#include <wtf/MainThread.h>
     38#if PLATFORM(IOS)
     39#include "WebCoreThread.h"
     40#endif
    3841#endif
    3942
  • trunk/Source/WebCore/inspector/InspectorFrontendHost.h

    r161385 r161638  
    7878    void close(const String& url);
    7979
     80#if ENABLE(CONTEXT_MENUS)
    8081    // Called from [Custom] implementations.
    8182    void showContextMenu(Event*, const Vector<ContextMenuItem>& items);
     83#endif
    8284    void sendMessageToBackend(const String& message);
    8385    void dispatchEventAsContextMenuEvent(Event*);
  • trunk/Source/WebCore/make-export-file-generator

    r157496 r161638  
    3030
    3131def line_for_output line
    32   return line.chomp if line =~ /#/
     32  return line.chomp if line =~ /^#\s*(if|ifdef|ifndef|else|elif|endif)/
    3333  "    validateAndPrint(\"#{line.chomp}\");"
    3434end
  • trunk/Source/WebCore/plugins/PluginPackage.h

    r132302 r161638  
    3131#include "PluginQuirkSet.h"
    3232#include "Timer.h"
     33#if ENABLE(NETSCAPE_PLUGIN_API)
    3334#include "npruntime_internal.h"
     35#endif
    3436#include <wtf/HashMap.h>
    3537#include <wtf/RefCounted.h>
     
    7173        void setEnabled(bool);
    7274
     75#if ENABLE(NETSCAPE_PLUGIN_API)
    7376        const NPPluginFuncs* pluginFuncs() const { return &m_pluginFuncs; }
     77#endif
    7478        int compareFileVersion(const PlatformModuleVersion&) const;
    7579        int compare(const PluginPackage&) const;
     
    110114        time_t m_lastModified;
    111115
     116#if ENABLE(NETSCAPE_PLUGIN_API)
    112117        NPP_ShutdownProcPtr m_NPP_Shutdown;
    113118        NPPluginFuncs m_pluginFuncs;
    114119        NPNetscapeFuncs m_browserFuncs;
     120#endif
    115121
    116122        void freeLibrarySoon();
  • trunk/Source/WebCore/plugins/PluginViewBase.h

    r159023 r161638  
    4747#if USE(ACCELERATED_COMPOSITING)
    4848    virtual PlatformLayer* platformLayer() const { return 0; }
     49#if PLATFORM(IOS)
     50    virtual bool willProvidePluginLayer() const { return false; }
     51    virtual void attachPluginLayer() { }
     52    virtual void detachPluginLayer() { }
     53#endif
    4954#endif
    5055
  • trunk/Source/WebCore/style/StyleResolveForDocument.cpp

    r158163 r161638  
    7676    // This overrides any -webkit-user-modify inherited from the parent iframe.
    7777    documentStyle.get().setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONLY);
     78#if PLATFORM(IOS)
     79    if (document.inDesignMode())
     80        documentStyle.get().setTextSizeAdjust(TextSizeAdjustment(NoTextSizeAdjustment));
     81#endif
    7882
    7983    Element* docElement = document.documentElement();
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r161208 r161638  
    770770        return VISIBLE;
    771771
    772     RenderStyle* style = renderer->style();
    773     if (!style)
    774         return VISIBLE;
    775 
    776     Length width(style->width());
    777     Length height(style->height());
     772    RenderStyle& style = renderer->style();
     773
     774    Length width(style.width());
     775    Length height(style.height());
    778776    if ((width.isFixed() && width.value() <= 0) || (height.isFixed() && height.value() <= 0))
    779777        return HIDDEN;
    780778
    781     Length top(style->top());
    782     Length left(style->left());
     779    Length top(style.top());
     780    Length left(style.left());
    783781    if (left.isFixed() && width.isFixed() && -left.value() >= width.value())
    784782        return HIDDEN;
  • trunk/Source/WebCore/testing/Internals.cpp

    r161481 r161638  
    19691969}
    19701970
    1971 #if USE(LAZY_NATIVE_CURSOR)
     1971#if !PLATFORM(IOS) && USE(LAZY_NATIVE_CURSOR)
    19721972static const char* cursorTypeToString(Cursor::Type cursorType)
    19731973{
     
    20322032    }
    20332033
     2034#if !PLATFORM(IOS) && USE(LAZY_NATIVE_CURSOR)
    20342035    Cursor cursor = document->frame()->eventHandler().currentMouseCursor();
    20352036
    2036 #if USE(LAZY_NATIVE_CURSOR)
    20372037    StringBuilder result;
    20382038    result.append("type=");
     
    21332133        return false;
    21342134
     2135#if !PLATFORM(IOS)
    21352136    RenderMenuList* menuList = toRenderMenuList(renderer);
    21362137    return menuList->popupIsVisible();
     2138#else
     2139    return false;
     2140#endif // !PLATFORM(IOS)
    21372141}
    21382142
  • trunk/Source/WebCore/workers/WorkerThread.cpp

    r160457 r161638  
    4444#endif
    4545
     46#if PLATFORM(IOS)
     47#include "WebCoreThread.h"
     48#endif
     49
    4650namespace WebCore {
    4751
     
    142146void WorkerThread::workerThread()
    143147{
     148    // Propagate the mainThread's fenv to workers.
     149#if PLATFORM(IOS)
     150    fesetenv(&mainThreadFEnv);
     151#endif
     152
    144153    {
    145154        MutexLocker lock(m_threadCreationMutex);
  • trunk/Source/WebKit/ChangeLog

    r161591 r161638  
     12014-01-10  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Upstream WebCore and Tools miscellaneous changes
     4        https://bugs.webkit.org/show_bug.cgi?id=126698
     5
     6        Reviewed by David Kilzer.
     7
     8        * WebKit.xcodeproj/project.pbxproj:
     9
    1102014-01-09  Benjamin Poulain  <bpoulain@apple.com>
    211
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r161332 r161638  
    21382138                        runOnlyForDeploymentPostprocessing = 0;
    21392139                        shellPath = /bin/sh;
    2140                         shellScript = "exec ${SRCROOT}/mac/postprocess-headers.sh";
     2140                        shellScript = "postProcessInDirectory() {\n    cd \"$1\"\n\n    if [[ ${PLATFORM_NAME} == iphoneos ]]; then\n        local unifdefOptions=\"-DTARGET_OS_EMBEDDED=1 -DTARGET_OS_IPHONE=1 -DTARGET_IPHONE_SIMULATOR=0 -DENABLE_IOS_TOUCH_EVENTS=1 -DENABLE_IOS_GESTURE_EVENTS=1\";\n    elif [[ ${PLATFORM_NAME} == iphonesimulator ]]; then\n        local unifdefOptions=\"-DTARGET_OS_EMBEDDED=0 -DTARGET_OS_IPHONE=1 -DTARGET_IPHONE_SIMULATOR=1 -DENABLE_IOS_TOUCH_EVENTS=1 -DENABLE_IOS_GESTURE_EVENTS=1\";\n    else\n        local unifdefOptions=\"-DTARGET_OS_EMBEDDED=0 -DTARGET_OS_IPHONE=0 -DTARGET_IPHONE_SIMULATOR=0 -DENABLE_IOS_TOUCH_EVENTS=0 -DENABLE_IOS_GESTURE_EVENTS=0\";\n    fi\n\n    for header in $(find . -name '*.h' -type f); do\n        unifdef -B ${unifdefOptions} -o ${header}.unifdef ${header}\n        case $? in\n        0)\n            rm ${header}.unifdef\n            ;;\n        1)\n            mv ${header}{.unifdef,}\n            ;;\n        *)\n            exit 1\n            ;;\n        esac\n    done\n}\n\npostProcessInDirectory \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\npostProcessInDirectory \"${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}\"";
    21412141                };
    21422142                A55DEAA516703F9F003DB841 /* Check For Inappropriate Macros in External Headers */ = {
  • trunk/Source/WebKit/mac/ChangeLog

    r161518 r161638  
     12014-01-10  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Upstream WebCore and Tools miscellaneous changes
     4        https://bugs.webkit.org/show_bug.cgi?id=126698
     5
     6        Reviewed by David Kilzer.
     7
     8        * MigrateHeaders.make:
     9
    1102014-01-08  Anders Carlsson  <andersca@apple.com>
    211
  • trunk/Source/WebKit/mac/MigrateHeaders.make

    r161415 r161638  
    191191#
    192192
     193ifeq ($(findstring WTF_PLATFORM_IOS,$(FEATURE_DEFINES)), WTF_PLATFORM_IOS)
     194
     195all : \
     196    $(PUBLIC_HEADERS_DIR)/DOMGestureEvent.h \
     197    $(PRIVATE_HEADERS_DIR)/DOMHTMLTextAreaElementPrivate.h \
     198    $(PUBLIC_HEADERS_DIR)/DOMTouch.h \
     199    $(PUBLIC_HEADERS_DIR)/DOMTouchEvent.h \
     200    $(PUBLIC_HEADERS_DIR)/DOMTouchList.h \
     201    $(PRIVATE_HEADERS_DIR)/DOMUIKitExtensions.h \
     202    $(PRIVATE_HEADERS_DIR)/KeyEventCodesIOS.h \
     203    $(PRIVATE_HEADERS_DIR)/MediaPlayerProxy.h \
     204    $(PRIVATE_HEADERS_DIR)/PluginData.h \
     205    $(PRIVATE_HEADERS_DIR)/ScrollTypes.h \
     206    $(PRIVATE_HEADERS_DIR)/SystemMemory.h \
     207    $(PRIVATE_HEADERS_DIR)/WAKAppKitStubs.h \
     208    $(PRIVATE_HEADERS_DIR)/WAKResponder.h \
     209    $(PRIVATE_HEADERS_DIR)/WAKScrollView.h \
     210    $(PRIVATE_HEADERS_DIR)/WAKView.h \
     211    $(PRIVATE_HEADERS_DIR)/WAKViewPrivate.h \
     212    $(PRIVATE_HEADERS_DIR)/WAKWindow.h \
     213    $(PRIVATE_HEADERS_DIR)/WKContentObservation.h \
     214    $(PRIVATE_HEADERS_DIR)/WKGraphics.h \
     215    $(PRIVATE_HEADERS_DIR)/WKTypes.h \
     216    $(PRIVATE_HEADERS_DIR)/WKUtilities.h \
     217    $(PRIVATE_HEADERS_DIR)/WKView.h \
     218    $(PRIVATE_HEADERS_DIR)/WebAutocapitalize.h \
     219    $(PRIVATE_HEADERS_DIR)/WebCoreFrameView.h \
     220    $(PRIVATE_HEADERS_DIR)/WebCoreThread.h \
     221    $(PRIVATE_HEADERS_DIR)/WebCoreThreadMessage.h \
     222    $(PRIVATE_HEADERS_DIR)/WebCoreThreadRun.h \
     223    $(PRIVATE_HEADERS_DIR)/WebEvent.h \
     224    $(PRIVATE_HEADERS_DIR)/WebEventRegion.h \
     225
     226endif
     227
    193228REPLACE_RULES = -e s/\<WebCore/\<WebKit/ -e s/DOMDOMImplementation/DOMImplementation/
    194229HEADER_MIGRATE_CMD = sed $(REPLACE_RULES) $< > $@
    195230PUBLIC_HEADER_CHECK_CMD = @if grep -q "AVAILABLE.*TBD" "$<"; then line=$$(awk "/AVAILABLE.*TBD/ { print FNR; exit }" "$<" ); echo "$<:$$line: error: A class within a public header has unspecified availability."; false; fi
    196231
     232ifeq ($(findstring WTF_PLATFORM_IOS,$(FEATURE_DEFINES)), WTF_PLATFORM_IOS)
     233
     234$(PRIVATE_HEADERS_DIR)/WAKScrollView.h : WAKScrollView.h MigrateHeaders.make
     235    cat $< $(PROCESS_HEADER_FOR_MACOSX_TARGET_CMD) > $@
     236
     237endif
     238
    197239$(PUBLIC_HEADERS_DIR)/DOM% : DOMDOM% MigrateHeaders.make
    198240        $(PUBLIC_HEADER_CHECK_CMD)
  • trunk/Tools/ChangeLog

    r161619 r161638  
     12014-01-10  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Upstream WebCore and Tools miscellaneous changes
     4        https://bugs.webkit.org/show_bug.cgi?id=126698
     5
     6        Reviewed by David Kilzer.
     7
     8        * Scripts/check-for-inappropriate-objc-class-names:
     9        * Scripts/check-for-webkit-framework-include-consistency:
     10
    1112014-01-09  Dan Bernstein  <mitz@apple.com>
    212
  • trunk/Tools/Scripts/check-for-inappropriate-objc-class-names

    r111771 r161638  
    7979    close NM;
    8080
     81    # begin PLATFORM(IOS)
     82    # On iOS put exceptions in place for existing bad names. Future bad names will
     83    # be caught and should be fixed immediately. Fixing these is covered by:
     84    # <rdar://problem/10365008> Fix Inappropriate Objective-C Class Names found by build phase
     85    my %exceptions = (
     86        # WebCore
     87        "WKQuadObject" => 1,
     88        "TileCacheTombstone" => 1,
     89        "TileHostLayer" => 1,
     90        "TileLayer" => 1,
     91        "WAKResponder" => 1,
     92        "NSCursor" => 1,
     93        "WAKClipView" => 1,
     94        "WAKScrollView" => 1,
     95        "WAKView" => 1,
     96        "WAKWindow" => 1,
     97        # WebKit2
     98        "UIWKRemoteView" => 1,
     99        "UIWKView" => 1,
     100        "UIWKViewData" => 1
     101    );
     102    my @realBadNames;
     103    for my $className (@badNames) {
     104        push(@realBadNames, $className) unless exists($exceptions{$className});
     105    }
     106    @badNames = @realBadNames;
     107    # end PLATFORM(IOS)
     108
    81109    if (@badNames) {
    82110
  • trunk/Tools/Scripts/check-for-webkit-framework-include-consistency

    r161566 r161638  
    7575  end
    7676
     77  # iOS we want to keep the WAK headers private, even if a public header includes them,
     78  # so we are going to not show warnings for WAK headers.
     79  return if framework == "WebKit" and included_header_name =~ /^WAK/
     80
    7781  header_type = $HEADER_NAMES_TO_TYPE[included_header_name]
    7882
Note: See TracChangeset for help on using the changeset viewer.