commit | 5d3decc33dc942b75443d171adca9a7a5d0be01f | [log] [tgz] |
---|---|---|
author | darin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Sat Aug 01 15:50:36 2020 +0000 |
committer | darin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Sat Aug 01 15:50:36 2020 +0000 |
tree | 4235ad05fc6bf262b94c029095ec30cab9d8ac96 | |
parent | 9747666dc583c9ff185ea54ddeadff267b84246a [diff] |
Remove Range::create and many more uses of live ranges https://bugs.webkit.org/show_bug.cgi?id=215004 Reviewed by Sam Weinig. Source/WebCore: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange const): Use makeSimpleRange. * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Use SimpleRange. * accessibility/atk/WebKitAccessibleHyperlink.cpp: (rangeLengthForObject): Take SimpleRange. (webkitAccessibleHyperlinkGetStartIndex): Use makeSimpleRange. (webkitAccessibleHyperlinkGetEndIndex): Ditto. * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getSelectionOffsetsForObject): Ditto. * accessibility/atk/WebKitAccessibleUtil.cpp: (objectFocusedAndCaretOffsetUnignored): Ditto. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (+[WebAccessibilityTextMarker startOrEndTextMarkerForRange:isStart:cache:]): Take SimpleRange. (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]): Use makeSimpleRange. (-[WebAccessibilityObjectWrapper _convertToDOMRange:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerRange]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerForPosition:]): Use auto. (-[WebAccessibilityObjectWrapper misspellingTextMarkerRange:forward:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Add createLiveRange. (-[WebAccessibilityObjectWrapper rangeForTextMarkers:]): Return SimpleRange. (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForTextMarkers:isStart:]): Use auto. (-[WebAccessibilityObjectWrapper textMarkerRangeForMarkers:]): Get rid of local. (-[WebAccessibilityObjectWrapper textMarkersForRange:]): Take SimpleRange. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (accessibilityTextOperationForParameterizedAttribute): Remove makeSimpleRange. (accessibilityMisspellingSearchCriteriaForParameterizedAttribute): Return SimpleRange. (-[WebAccessibilityObjectWrapper textMarkerRangeFromRange:]): Take SimpleRange. (textMarkerRangeFromRange): Ditto. (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForRange:isStart:]): Ditto. (startOrEndTextmarkerForRange): Return SimpleRange. (-[WebAccessibilityObjectWrapper rangeForTextMarkerRange:]): Ditto. (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Use auto. (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): Remove createLiveRange. (-[WebAccessibilityObjectWrapper textMarkerRangeAtTextMarker:forUnit:]): Ditto. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto. * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): Use document marker range function. (WebCore::range): Added. * dom/DocumentMarkerController.h: Update for above. * dom/Position.cpp: Removed unneeded Range.h include. * dom/Range.cpp: (WebCore::Range::Range): Removed unused overload that takes start/end. (WebCore::Range::create): Removed overloads that take start/end. (WebCore::Range::setStart): Removed overload that takes Position. (WebCore::Range::setEnd): Ditto. (WebCore::Range::cloneRange const): Rewrote to use setStart/End since that's what the constructor used to do. (WebCore::Range::contains const): Use SimpleRange/createLiveRange instead of makeRange. Soon this function will be deleted. (WebCore::rangeOfContents): Deleted. (WebCore::createLiveRange): Rewrote to use setStart/End since that's what the constructor used to do. * dom/Range.h: Update for above removals. * dom/SimpleRange.h: Export commonInclusiveAncestor for use outside WebCore. * dom/StaticRange.cpp: (WebCore::StaticRange::create): Added overload that copies the SimpleRange. * dom/StaticRange.h: Update for above. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use document marker range function. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle): Use makeSimpleRange. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::mergeParagraphs): Ditto. (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection): Ditto. * editing/EditingStyle.cpp: (WebCore::EditingStyle::textDirectionForSelection): Use makeSimpleRange and intersectingNodes. * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithFragment): Use makeRangeSelectingNodeContents. (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Use makeSimpleRange. (WebCore::Editor::transpose): Ditto. (WebCore::Editor::rangeOfString): Use makeRangeSelectingNodeContents. (WebCore::Editor::handleAcceptedCandidate): Update since rangeForTextCheckingResult now returns an Optional<SimpleRange>. * editing/FrameSelection.cpp: (WebCore::FrameSelection::selectRangeOnElement): Use SimpleRange. * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand): Take SimpleRange. (WebCore::ReplaceRangeWithTextCommand::willApplyCommand): Update since m_rangeToBeReplaced is a SimpleRange. (WebCore::ReplaceRangeWithTextCommand::doApply): Ditto. (WebCore::ReplaceRangeWithTextCommand::targetRanges const): Ditto. * editing/ReplaceRangeWithTextCommand.h: Update for above. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::insertedContentRange const): Return a SimpleRange. * editing/ReplaceSelectionCommand.h: Update for above. * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand): Take a SimpleRange. (WebCore::SpellingCorrectionCommand::create): Moved here from header. * editing/SpellingCorrectionCommand.h: Update for above. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const): Use makeSimpleRange. * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Use makeSimpleRange. (WebCore::TypingCommand::willAddTypingToOpenCommand): Take SimpleRange. (WebCore::TypingCommand::deleteKeyPressed): Remove createLiveRange. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/TypingCommand.h: Update for above. * editing/VisiblePosition.cpp: (WebCore::makeRange): Deleted. (WebCore::startVisiblePosition): Deleted. (WebCore::endVisiblePosition): Deleted. (WebCore::setStart): Deleted. (WebCore::setEnd): Deleted. * editing/VisiblePosition.h: Update for above. Also export makeSimpleRange for use outside WebCore. * editing/VisibleUnits.cpp: (WebCore::suffixLengthForRange): Take SimpleRange. (WebCore::prefixLengthForRange): Ditto. (WebCore::previousBoundary): Use makeSimpleRange. (WebCore::nextBoundary): Ditto. * editing/VisibleUnits.h: Update for above. * editing/cocoa/DataDetection.mm: (WebCore::buildQuery): Remove unused local variable. * editing/ios/EditorIOS.mm: (WebCore::Editor::setDictationPhrasesAsChildOfElement): Use makeRangeSelectingNodeContents. * page/DOMSelection.cpp: (WebCore::DOMSelection::getRangeAt): Use createLiveRange. * page/DragController.cpp: (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret): Remove makeSimpleRange. * page/Frame.cpp: (WebCore::Frame::rangeForPoint): Return SimpleRange. * page/Frame.h: Update for above. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Use makeRangeSelectingNodeContents, intersectingNodes, and makeSimpleRange. * testing/Internals.cpp: (WebCore::Internals::markerRangeForNode): Use createLiveRange and the document marker range function. Source/WebKit: * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (API::PageOverlayClientImpl::actionContextForResultAtPoint): Return a structure that includes a SimpleRange. * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: (WebKit::InjectedBundleNodeHandle::visibleRange): Use makeSimpleRange. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Use SimpleRange. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection): Use SimpleRange. (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Ditto. (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::characterIndexForPointAsync): Remove makeSimpleRange. (WebKit::WebPage::deleteSurrounding): Use makeSimpleRange. * WebProcess/WebPage/WebPageOverlay.cpp: (WebKit::WebPageOverlay::actionContextForResultAtPoint): Use return value instead of out argument. * WebProcess/WebPage/WebPageOverlay.h: Update for above. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Use makeSimpleRange. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::computeEditableRootHasContentAndPlainText): Use makeSimpleRange. (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Removed unneeded null checks that are already done by makeSimpleRange. (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Use makeSimpleRange. (WebKit::WebPage::requestDictationContext): Ditto. (WebKit::WebPage::autocorrectionContext): Ditto. (WebKit::linkIndicatorPositionInformation): Use makeRangeSelectingNodeContents. (WebKit::dataDetectorLinkPositionInformation): Ditto. (WebKit::WebPage::requestDocumentEditingContext): Use makeSimpleRange. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): Update for change to the actionContextForResultAtPoint return value. Source/WebKitLegacy/ios: * WebCoreSupport/WebFrameIOS.mm: (-[WebFrame wordAtPoint:]): Use makeSimpleRange. * WebCoreSupport/WebVisiblePosition.mm: (-[WebVisiblePosition enclosingRangeWithDictationPhraseAlternatives:]): Use document marker range function. (-[WebVisiblePosition enclosingRangeWithCorrectionIndicator]): Ditto. (+[DOMRange rangeForFirstPosition:second:]): Use makeSimpleRange. Source/WebKitLegacy/mac: * DOM/DOMUIKitExtensions.mm: (-[DOMNode rangeOfContainingParagraph]): Use makeSimpleRange. * WebView/WebFrame.mm: (-[WebFrame _characterRangeAtPoint:]): Update since rangeAtPoint takes a SimpleRange. (-[WebFrame getDictationResultRanges:andMetadatas:]): Use document marker range function. * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): Use makeRangeSelectingNodeContents. (-[WebImmediateActionController _animationControllerForDataDetectedLink]): Ditto. Source/WebKitLegacy/win: * AccessibleTextImpl.cpp: (AccessibleText::scrollSubstringTo): Use makeSimpleRange. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@265176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.