haikuwebkit/LayoutTests/editing/selection/move-by-word-visually-wrong...

37 lines
1.1 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
Using ICU break iterator to simplify visual word movement implementation. https://bugs.webkit.org/show_bug.cgi?id=78856 Reviewed by Ryosuke Niwa. Source/WebCore: This patch relies on ICU word break iterator and cursor visual movement by character to get the word break position in visual order. It reduces the complexity of old implementation. Test: editing/selection/move-by-word-visually-wrong-left-right.html * editing/FrameSelection.cpp: Exclude WinCE from visual word movement since isWordTextBreak is not implemented. (WebCore::FrameSelection::modifyMovingRight): (WebCore::FrameSelection::modifyMovingLeft): * editing/visible_units.cpp: (WebCore): (WebCore::previousLeafWithSameEditability): Just moving to the top without functionality change. (WebCore::enclosingNodeWithNonInlineRenderer): ditto. (WebCore::nextLeafWithSameEditability): ditto. (WebCore::previousRootInlineBox): return previous RootInlineBox which is in different renderer. (WebCore::nextRootInlineBox): return next RootInlineBox which is in different renderer. (WebCore::boxIndexInVector): (WebCore::previousBoxInLine): returns logically previous box in one line. (WebCore::logicallyPreviousBox): returns logically previous box. (WebCore::nextBoxInLine): returns logically next box in one line. (WebCore::logicallyNextBox): returns logically next box. (WebCore::wordBreakIteratorForMinOffsetBoundary): create word break iterator for position that is a box's min offset. (WebCore::wordBreakIteratorForMaxOffsetBoundary): create word break iterator for position that is a box's max offset. (WebCore::isLogicalStartOfWord): return whether a position is logically start of word. (WebCore::islogicalEndOfWord): return whether a position is logically end of word. (WebCore::visualWordPosition): returns the visual left or right word position. (WebCore::leftWordPosition): (WebCore::rightWordPosition): * platform/text/TextBreakIterator.h: Add isWordTextBreak(). (WebCore): * platform/text/TextBreakIteratorICU.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/gtk/TextBreakIteratorGtk.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/qt/TextBreakIteratorQt.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/wince/TextBreakIteratorWinCE.cpp: (WebCore::isWordTextBreak): (WebCore): LayoutTests: * editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt: * editing/selection/move-by-word-visually-inline-block-positioned-element.html: The word break stops at the beginning of fixed positioned element, which is correct and consistent behavior. * editing/selection/move-by-word-visually-multi-line-expected.txt: * editing/selection/move-by-word-visually-multi-line.html: The word break does not stop at the end of a text if there is next line of text available under the same editable root, which is a consistent behavior cross the board. Add more test cases, including one with non InlineTextBox. * editing/selection/move-by-word-visually-single-space-inline-element-expected.txt: Fixing of previously missing or extra word break positions. * editing/selection/move-by-word-visually-single-space-one-element-expected.txt: * editing/selection/move-by-word-visually-single-space-one-element.html: Add a test case including bidi control character which renders wrong result since right-arrow could not reach a position which is the word break position. Add another test case containing non InlineTextBox. * editing/selection/move-by-word-visually-wrong-left-right-expected.txt: Added. * editing/selection/move-by-word-visually-wrong-left-right.html: Added. Add a test case which renders wrong result due to left/right-arrow returns wrong result. * editing/selection/resources/move-by-word-visually.js: (moveByWordOnEveryChar): Handle a special case when left/right arrow missing certain position. Canonical link: https://commits.webkit.org/98524@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-16 08:27:28 +00:00
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="resources/extend-selection.css" />
<script src="resources/move-by-word-visually.js"></script>
<script>
onload = function() {
try {
var sel = window.getSelection();
sel.setPosition(document.getElementById('d_1'), 0);
sel.modify("move", "right", "word");
if (sel.anchorOffset == 5)
log("PASS");
else
log("ctrl/alt+right from left of סטז should move cursor to left of opq. " +
"But it actually moved to position " + sel.anchorOffset);
} finally {
flushLog();
}
};
Editing tests should use testRunner instead of layoutTestController https://bugs.webkit.org/show_bug.cgi?id=88955 Reviewed by Darin Adler. * editing/: * platform/blackberry/editing/text-iterator/findString-markers.html: * platform/chromium-linux/editing/selection/linux_selection_color.html: * platform/chromium-win/editing/selection/paragraph-granularity-expected.txt: * platform/chromium-win/editing/selection/triple-click-in-pre-expected.txt: * platform/chromium-win/editing/selection/word-granularity-expected.txt: * platform/chromium/editing/spelling/delete-misspelled-word.html: * platform/chromium/editing/spelling/move-cursor-to-misspelled-word.html: * platform/gtk/editing/pasteboard/middle-button-paste.html: * platform/gtk/editing/pasteboard/script-tests/middle-click-onpaste.js: * platform/gtk/editing/selection/caret-mode-document-begin-end.html: * platform/gtk/editing/selection/paragraph-granularity-expected.txt: * platform/gtk/editing/selection/triple-click-in-pre-expected.txt: * platform/gtk/editing/selection/word-granularity-expected.txt: * platform/mac/editing/: * platform/qt/editing/selection/paragraph-granularity-expected.txt: * platform/qt/editing/selection/triple-click-in-pre-expected.txt: * platform/qt/editing/selection/word-granularity-expected.txt: * platform/win/editing/deleting/delete-start-block-expected.txt: * platform/win/editing/pasteboard/pasting-crlf-isnt-translated-to-crcrlf-win.html: * platform/win/editing/selection/shift-page-up-down.html: Canonical link: https://commits.webkit.org/106795@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-13 08:51:53 +00:00
if (window.testRunner && window.internals) {
testRunner.dumpAsText();
Source/WebCore: Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Move each enum type used by Settings to its own header and make them all scoped enums in preparation for using them in the generated settings code. Also converted enums used in Settings that are used as flags to use OptionSet, adding the necessary EnumTraits to make it to work. In the change, Settings still generates with getters/setters that work on the raw enum, but in subsequent changes the generation will work directly with OptionSets. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: Add new headers, adjust for renames. * Scripts/GenerateSettings.rb: Add special case for HTML prefix to keep renamed HTMLParserScriptingFlagPolicy setting using WebCore consistent capitalization. * accessibility/ForcedAccessibilityValue.h: Added. * css/FontLoadTimingOverride.h: Added. * editing/EditableLinkBehavior.h: Added. * editing/cocoa/DataDetectorTypes.h: Added. * html/parser/HTMLParserScriptingFlagPolicy.h: Added. * page/FrameFlattening.h: Added. * page/PDFImageCachingPolicy.h: Added. * page/DebugOverlayRegions.h: Added. * page/StorageBlockingPolicy.h: Added. * page/TextDirectionSubmenuInclusionBehavior.h: Added. * page/UserInterfaceDirectionPolicy.h: Added. * platform/text/FontRenderingMode.h: Added. * platform/text/TextDirection.h: Added. Add new headers. * editing/EditingBehaviorType.h: Added. * editing/EditingBehaviorTypes.h: Removed. Renamed header to match enum name. * css/CSSFontFace.cpp: (WebCore::fontLoadTimingOverride): (WebCore::CSSFontFace::fontLoadTiming const): Update uses of FontLoadTimingOverride to remove Settings scoping. * css/MediaQueryEvaluator.cpp: (WebCore::monochromeEvaluate): (WebCore::invertedColorsEvaluate): (WebCore::dynamicRangeEvaluate): (WebCore::prefersReducedMotionEvaluate): Update uses of ForcedAccessibilityValue to remove Settings scoping. * dom/Document.cpp: (WebCore::Document::applyQuickLookSandbox): Update uses of StorageBlockingPolicy to remove SecurityOrigin scoping. * editing/EditingBehavior.h: Update use of EditingBehaviorType to use scoped syntax. * editing/Editor.cpp: (WebCore::Editor::behavior const): Remove unnecessary duplication of EditingBehavior construction. * editing/cocoa/DataDetection.h: * editing/cocoa/DataDetection.mm: Switch to using OptionSet<DataDetectorTypes> rather than raw DataDetectorTypes. * editing/markup.cpp: (WebCore::createPageForSanitizingWebContent): Update for renamed setter now called setHTMLParserScriptingFlagPolicy to make it clear it is about the HTML parser. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::setActive): (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType const): Update use of EditableLinkBehavior to use scoped syntax. * html/parser/HTMLParserOptions.cpp: (WebCore::HTMLParserOptions::HTMLParserOptions): Update for renamed setting now called HTMLParserScriptingFlagPolicy to make it clear it is about the HTML parser and no longer scoped to Settings. * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Switch to using OptionSet<DataDetectorTypes> rather than raw DataDetectorTypes. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::populate): Update use of TextDirectionSubmenuInclusionBehavior to use scoped syntax. * page/DebugPageOverlays.cpp: (WebCore::DebugPageOverlays::updateOverlayRegionVisibility): (WebCore::DebugPageOverlays::settingsChanged): * page/DebugPageOverlays.h: Switch to using OptionSet<DebugOverlayRegions> rather than raw DebugOverlayRegions. * page/EventHandler.cpp: (WebCore::EventHandler::useHandCursor): Update use of EditableLinkBehavior to use scoped syntax. * page/FrameView.h: Switch to #including FrameFlattening.h since it is such a trivial include now. * page/Page.cpp: (WebCore::Page::shouldBuildEditableRegion const): Switch to using OptionSet<DebugOverlayRegions> rather than raw DebugOverlayRegions. * page/SecurityOrigin.cpp: * page/SecurityOrigin.h: Update to now include StorageBlockingPolicy.h and switch to use scoped syntax. * page/Settings.yaml: Update setting defaults to use new scoped names where appropriate and rename ParserScriptingFlagPolicy to HTMLParserScriptingFlagPolicy to make it clear which parser it is for. * page/SettingsBase.h: Replace enum definitions with #includes for the new headers. In future changes, these will be automatically included in the generated code and this won't be necessary anymore. * platform/DragImage.h: * platform/graphics/FontDescription.h: Update #includes to keep things building. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): * platform/graphics/cg/PDFDocumentImage.h: Update use of PDFImageCachingPolicy to use scoped syntax. * platform/text/TextFlags.h: Extract FontRenderingMode into its own header. * platform/text/WritingMode.h: Extract TextDirection into its own header. Also replace some macros with constexprs while I was here. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): (WebCore::RenderLayerBacking::paintContents): Switch to using OptionSet<DebugOverlayRegions> rather than raw DebugOverlayRegions. * testing/InternalSettings.cpp: * testing/InternalSettings.h: * testing/InternalSettings.idl: Use new enums rather than redeclaring them. Updates EditingBehaviorType to use the value "windows" rather than "win" which requires test changes as does changes to capitalization of PDFImageCachingPolicy enum values. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::createPageForServiceWorker): (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): * workers/service/context/ServiceWorkerThreadProxy.h: Update for extracted StorageBlockingPolicy enum. Source/WebKit: Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update enum uses for renames and scoped syntax use. * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): (WebKit::toEditableLinkBehavior): (WebKit::toStorageBlockingPolicy): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetEditableLinkBehavior): (WKPreferencesSetStorageBlockingPolicy): (WKPreferencesGetStorageBlockingPolicy): * UIProcess/API/Cocoa/WKPreferences.mm: (toStorageBlockingPolicy): (toAPI): (-[WKPreferences _storageBlockingPolicy]): (-[WKPreferences _setStorageBlockingPolicy:]): (toEditableLinkBehavior): (-[WKPreferences _setEditableLinkBehavior:]): * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::createWithLegacyDefaults): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::detectDataInAllFrames): Source/WebKitLegacy/mac: Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update enum uses for renames and scoped syntax use. * WebView/WebFrame.mm: * WebView/WebView.mm: Source/WTF: Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update enum uses in default WebPreferences values for renames and scoped syntax use. * Scripts/Preferences/WebPreferences.yaml: LayoutTests: Standardize enums that are used by Settings in preparation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update tests and results for change in EditingBahavior enum value "win" -> "windows". * editing/deleting/delete-ligature-003-expected.txt: * editing/deleting/delete-ligature-003.html: * editing/deleting/paragraph-in-preserveNewline-expected.txt: * editing/deleting/paragraph-in-preserveNewline.html: * editing/deleting/smart-editing-disabled-win.html: * editing/deleting/whitespace-pre-1-expected.txt: * editing/deleting/whitespace-pre-1.html: * editing/execCommand/query-command-state-expected.txt: * editing/execCommand/query-command-state.html: * editing/execCommand/query-text-alignment-expected.txt: * editing/execCommand/query-text-alignment.html: * editing/execCommand/remove-format-multiple-elements-win.html: * editing/execCommand/toggle-compound-styles-expected.txt: * editing/execCommand/toggle-compound-styles.html: * editing/execCommand/toggle-link-win.html: * editing/execCommand/toggle-unlink-win.html: * editing/selection/5195166-1.html: * editing/selection/5354455-1.html: * editing/selection/click-in-margins-inside-editable-div.html: * editing/selection/click-in-padding-with-multiple-line-boxes.html: * editing/selection/context-menu-text-selection-lookup.html: * editing/selection/context-menu-text-selection.html: * editing/selection/extend-after-mouse-selection.html: * editing/selection/extend-selection-after-double-click.html: * editing/selection/extend-selection-enclosing-block-win.html: * editing/selection/move-by-word-visually-crash-test-1.html: * editing/selection/move-by-word-visually-crash-test-2.html: * editing/selection/move-by-word-visually-crash-test-3.html: * editing/selection/move-by-word-visually-crash-test-4.html: * editing/selection/move-by-word-visually-crash-test-5.html: * editing/selection/move-by-word-visually-crash-test-css-generated-content.html: * editing/selection/move-by-word-visually-crash-test-textarea.html: * editing/selection/move-by-word-visually-inline-block-positioned-element.html: * editing/selection/move-by-word-visually-multi-line.html: * editing/selection/move-by-word-visually-multi-space.html: * editing/selection/move-by-word-visually-null-box.html: * editing/selection/move-by-word-visually-single-space-inline-element.html: * editing/selection/move-by-word-visually-single-space-one-element.html: * editing/selection/move-by-word-visually-textarea.html: * editing/selection/move-by-word-visually-wrong-left-right.html: * editing/selection/programmatic-selection-on-mac-is-directionless-expected.txt: * editing/selection/programmatic-selection-on-mac-is-directionless.html: * editing/selection/rtl-move-selection-right-left.html: * editing/selection/selection-extend-should-not-move-across-caret-on-mac-expected.txt: * editing/selection/selection-extend-should-not-move-across-caret-on-mac.html: * editing/selection/shift-click.html: * editing/selection/user-select-all-with-shift-expected.txt: * editing/selection/user-select-all-with-shift.html: * editing/spelling/copy-paste-crash.html: * editing/style/iframe-onload-crash-win.html: * editing/style/make-text-writing-direction-inline-win.html: * editing/style/push-down-font-styles-win.html: * editing/style/push-down-implicit-styles-around-list-win.html: * editing/style/toggle-style-bold-italic-expected.txt: * editing/style/toggle-style-bold-italic-mixed-editability-expected.txt: * editing/style/toggle-style-bold-italic-mixed-editability.html: * editing/style/toggle-style-bold-italic.html: * fast/events/backspace-navigates-back.html: * fast/forms/selection-direction-expected.txt: * fast/forms/selection-direction.html: Canonical link: https://commits.webkit.org/231641@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-17 01:34:46 +00:00
internals.settings.setEditingBehavior('windows');
Using ICU break iterator to simplify visual word movement implementation. https://bugs.webkit.org/show_bug.cgi?id=78856 Reviewed by Ryosuke Niwa. Source/WebCore: This patch relies on ICU word break iterator and cursor visual movement by character to get the word break position in visual order. It reduces the complexity of old implementation. Test: editing/selection/move-by-word-visually-wrong-left-right.html * editing/FrameSelection.cpp: Exclude WinCE from visual word movement since isWordTextBreak is not implemented. (WebCore::FrameSelection::modifyMovingRight): (WebCore::FrameSelection::modifyMovingLeft): * editing/visible_units.cpp: (WebCore): (WebCore::previousLeafWithSameEditability): Just moving to the top without functionality change. (WebCore::enclosingNodeWithNonInlineRenderer): ditto. (WebCore::nextLeafWithSameEditability): ditto. (WebCore::previousRootInlineBox): return previous RootInlineBox which is in different renderer. (WebCore::nextRootInlineBox): return next RootInlineBox which is in different renderer. (WebCore::boxIndexInVector): (WebCore::previousBoxInLine): returns logically previous box in one line. (WebCore::logicallyPreviousBox): returns logically previous box. (WebCore::nextBoxInLine): returns logically next box in one line. (WebCore::logicallyNextBox): returns logically next box. (WebCore::wordBreakIteratorForMinOffsetBoundary): create word break iterator for position that is a box's min offset. (WebCore::wordBreakIteratorForMaxOffsetBoundary): create word break iterator for position that is a box's max offset. (WebCore::isLogicalStartOfWord): return whether a position is logically start of word. (WebCore::islogicalEndOfWord): return whether a position is logically end of word. (WebCore::visualWordPosition): returns the visual left or right word position. (WebCore::leftWordPosition): (WebCore::rightWordPosition): * platform/text/TextBreakIterator.h: Add isWordTextBreak(). (WebCore): * platform/text/TextBreakIteratorICU.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/gtk/TextBreakIteratorGtk.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/qt/TextBreakIteratorQt.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/wince/TextBreakIteratorWinCE.cpp: (WebCore::isWordTextBreak): (WebCore): LayoutTests: * editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt: * editing/selection/move-by-word-visually-inline-block-positioned-element.html: The word break stops at the beginning of fixed positioned element, which is correct and consistent behavior. * editing/selection/move-by-word-visually-multi-line-expected.txt: * editing/selection/move-by-word-visually-multi-line.html: The word break does not stop at the end of a text if there is next line of text available under the same editable root, which is a consistent behavior cross the board. Add more test cases, including one with non InlineTextBox. * editing/selection/move-by-word-visually-single-space-inline-element-expected.txt: Fixing of previously missing or extra word break positions. * editing/selection/move-by-word-visually-single-space-one-element-expected.txt: * editing/selection/move-by-word-visually-single-space-one-element.html: Add a test case including bidi control character which renders wrong result since right-arrow could not reach a position which is the word break position. Add another test case containing non InlineTextBox. * editing/selection/move-by-word-visually-wrong-left-right-expected.txt: Added. * editing/selection/move-by-word-visually-wrong-left-right.html: Added. Add a test case which renders wrong result due to left/right-arrow returns wrong result. * editing/selection/resources/move-by-word-visually.js: (moveByWordOnEveryChar): Handle a special case when left/right arrow missing certain position. Canonical link: https://commits.webkit.org/98524@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-16 08:27:28 +00:00
}
</script>
<title>wrong result because VisiblePosition.left()/right() returns wrong result</title>
</head>
<body>
<div id="testMoveByWord">
<div dir=ltr contenteditable>abc ששש def <span id="d_1" dir=rtl>שנב opq סטז</span> uvw ששש xyz</div>
</div>
<ul id="console"></ul>
</body>
</html>