Changeset 236519 in webkit
- Timestamp:
- Sep 26, 2018 1:02:57 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 18 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r236515 r236519 1 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Selection should work across shadow boundary when initiated by a mouse drag 4 https://bugs.webkit.org/show_bug.cgi?id=151380 5 <rdar://problem/24363872> 6 7 Reviewed by Antti Koivisto and Wenson Hsieh. 8 9 Added regression tests using ref tests since getSelection() doesn't expose any node inside a shadow tree. 10 11 * editing/selection/selection-across-shadow-boundaries-mixed-editability-1-expected.html: Added. 12 * editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html: Added. 13 * editing/selection/selection-across-shadow-boundaries-mixed-editability-2-expected.html: Added. 14 * editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html: Added. 15 * editing/selection/selection-across-shadow-boundaries-mixed-editability-3-expected.html: Added. 16 * editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html: Added. 17 * editing/selection/selection-across-shadow-boundaries-mixed-editability-4-expected.html: Added. 18 * editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html: Added. 19 * editing/selection/selection-across-shadow-boundaries-mixed-editability-5-expected.html: Added. 20 * editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html: Added. 21 * editing/selection/selection-across-shadow-boundaries-readonly-1-expected.html: Added. 22 * editing/selection/selection-across-shadow-boundaries-readonly-1.html: Added. 23 * editing/selection/selection-across-shadow-boundaries-readonly-2-expected.html: Added. 24 * editing/selection/selection-across-shadow-boundaries-readonly-2.html: Added. 25 * editing/selection/selection-across-shadow-boundaries-readonly-3-expected.html: Added. 26 * editing/selection/selection-across-shadow-boundaries-readonly-3.html: Added. 27 * editing/selection/selection-across-shadow-boundaries-user-select-all-1-expected.html: Added. 28 * editing/selection/selection-across-shadow-boundaries-user-select-all-1.html: Added. 29 1 30 2018-09-26 Alicia Boya García <aboya@igalia.com> 2 31 -
trunk/LayoutTests/platform/win/TestExpectations
r236487 r236519 102 102 webkit.org/b/173281 editing/style/set-backColor-with-color-filter.html [ Skip ] 103 103 webkit.org/b/173281 editing/style/inverse-color-filter.html [ Skip ] 104 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html [ Skip ] 105 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html [ Skip ] 106 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html [ Skip ] 107 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html [ Skip ] 108 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html [ Skip ] 109 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-1.html [ Skip ] 110 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-2.html [ Skip ] 111 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-3.html [ Skip ] 112 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-user-select-all-1.html [ Skip ] 104 113 105 114 # TODO HW filters not yet supported on Windows -
trunk/Source/WebCore/ChangeLog
r236517 r236519 1 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Selection should work across shadow boundary when initiated by a mouse drag 4 https://bugs.webkit.org/show_bug.cgi?id=151380 5 <rdar://problem/24363872> 6 7 Reviewed by Antti Koivisto and Wenson Hsieh. 8 9 This patch adds the basic support for selecting content across shadow DOM boundaries to VisibleSelection, 10 which is enough to allow users to select content across shadow DOM boundaries via a mouse drag. 11 12 This is the first step in allowing users to select, copy and paste content across shadow DOM boundaries, 13 which is a serious user experience regression right now. The new behavior is disabled by default under 14 an interal debug feature flag: selectionAcrossShadowBoundariesEnabled. 15 16 Like Chrome, we are not going to support selecting editable content across shadow DOM boundaries since 17 we'd have to generalize every editing commands to make that work, and there aren't any HTML editors that 18 use shadow DOM boundaries within an editable region yet. For simplicity, we also don't support extending 19 a selection out of a shadow root which resides inside an editing region. 20 21 The keyboard based navigation & manipulation of selection as well as allowing copy & paste of content 22 across shadow DOM boundaries will be implemented by separate patches. DOMSelection will not expose this new 23 behavior either. This is tracked in the spec as https://github.com/w3c/webcomponents/issues/79 24 25 Tests: editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html 26 editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html 27 editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html 28 editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html 29 editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html 30 editing/selection/selection-across-shadow-boundaries-readonly-1.html 31 editing/selection/selection-across-shadow-boundaries-readonly-2.html 32 editing/selection/selection-across-shadow-boundaries-readonly-3.html 33 editing/selection/selection-across-shadow-boundaries-user-select-all-1.html 34 35 * editing/VisibleSelection.cpp: 36 (WebCore::isInUserAgentShadowRootOrHasEditableShadowAncestor): Added. 37 (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries): When the feature is enabled, 38 allow crossing shadow DOM boundaries except when either end is inside an user agent shadow root, or one of 39 its shadow includign ancestor is inside an editable region. The latter check is needed to disallow 40 an extension of a selection starting in a shadow tree inside a non-editable region inside an editable region 41 to outside the editable region. The rest of the editing code is not ready to deal with selection like that. 42 * page/Settings.yaml: Added an internal debug feature to enable this new behavior. 43 1 44 2018-09-26 Chris Dumez <cdumez@apple.com> 2 45 -
trunk/Source/WebCore/editing/VisibleSelection.cpp
r233778 r236519 31 31 #include "Element.h" 32 32 #include "HTMLInputElement.h" 33 #include "Settings.h" 33 34 #include "TextIterator.h" 34 35 #include "VisibleUnits.h" … … 505 506 } 506 507 508 static bool isInUserAgentShadowRootOrHasEditableShadowAncestor(Node& node) 509 { 510 auto* shadowRoot = node.containingShadowRoot(); 511 if (!shadowRoot) 512 return false; 513 514 if (shadowRoot->mode() == ShadowRootMode::UserAgent) 515 return true; 516 517 for (RefPtr<Node> currentNode = &node; currentNode; currentNode = currentNode->parentOrShadowHostNode()) { 518 if (currentNode->hasEditableStyle()) 519 return true; 520 } 521 return false; 522 } 523 507 524 void VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries() 508 525 { … … 510 527 return; 511 528 512 if (&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope()) 529 auto startNode = makeRef(*m_start.anchorNode()); 530 auto endNode = makeRef(*m_end.anchorNode()); 531 if (&startNode->treeScope() == &endNode->treeScope()) 513 532 return; 514 533 534 if (startNode->document().settings().selectionAcrossShadowBoundariesEnabled()) { 535 if (!isInUserAgentShadowRootOrHasEditableShadowAncestor(startNode) 536 && !isInUserAgentShadowRootOrHasEditableShadowAncestor(endNode)) 537 return; 538 } 539 515 540 if (m_baseIsFirst) { 516 m_extent = adjustPositionForEnd(m_end, m_start.containerNode());541 m_extent = adjustPositionForEnd(m_end, startNode.ptr()); 517 542 m_end = m_extent; 518 543 } else { 519 m_extent = adjustPositionForStart(m_start, m_end.containerNode());544 m_extent = adjustPositionForStart(m_start, endNode.ptr()); 520 545 m_start = m_extent; 521 546 } 522 523 ASSERT(&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope());524 547 } 525 548 -
trunk/Source/WebCore/page/Settings.yaml
r236424 r236519 390 390 selectTrailingWhitespaceEnabled: 391 391 initial: defaultSelectTrailingWhitespaceEnabled 392 selectionAcrossShadowBoundariesEnabled: 393 initial: false 392 394 393 395 useLegacyBackgroundSizeShorthandBehavior: -
trunk/Source/WebKit/ChangeLog
r236513 r236519 1 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Selection should work across shadow boundary when initiated by a mouse drag 4 https://bugs.webkit.org/show_bug.cgi?id=151380 5 <rdar://problem/24363872> 6 7 Reviewed by Antti Koivisto. 8 9 Added SelectionAcrossShadowBoundariesEnabled as an internal debug feature, 10 and moved CSSCustomPropertiesAndValuesEnabled to where other experimental features are located. 11 12 * Shared/WebPreferences.yaml: 13 1 14 2018-09-26 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r236497 r236519 1258 1258 webcoreName: serverTimingEnabled 1259 1259 1260 CSSCustomPropertiesAndValuesEnabled: 1261 type: bool 1262 defaultValue: false 1263 humanReadableName: "CSS Custom Properties and Values API" 1264 humanReadableDescription: "Enable CSS Custom Properties and Values API" 1265 webcoreBinding: RuntimeEnabledFeatures 1266 category: experimental 1267 1260 1268 # For internal features: 1261 1269 # The type should be boolean. … … 1342 1350 AriaReflectionEnabled: 1343 1351 type: bool 1344 defaultValue: true1352 defaultValue: false 1345 1353 humanReadableName: "ARIA Reflection" 1346 1354 humanReadableDescription: "ARIA Reflection support" … … 1356 1364 category: internal 1357 1365 1358 CSSCustomPropertiesAndValuesEnabled:1359 type: bool 1360 defaultValue: false1361 humanReadableName: " CSS Custom Properties and Values API"1362 humanReadableDescription: " Enable CSS Custom Properties and Values API"1363 webcoreBinding: RuntimeEnabledFeatures1364 category: experimental1366 SelectionAcrossShadowBoundariesEnabled: 1367 type: bool 1368 defaultValue: true 1369 humanReadableName: "Selection across shadow DOM" 1370 humanReadableDescription: "Allow user-initiated selection across shadow DOM boundaries" 1371 category: internal 1372 webcoreName: selectionAcrossShadowBoundariesEnabled -
trunk/Source/WebKitLegacy/mac/ChangeLog
r236445 r236519 1 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Selection should work across shadow boundary when initiated by a mouse drag 4 https://bugs.webkit.org/show_bug.cgi?id=151380 5 <rdar://problem/24363872> 6 7 Reviewed by Wenson Hsieh. 8 9 Added selectionAcrossShadowBoundariesEnabled as a preference to be used in DumpRenderTree. 10 11 * WebView/WebPreferenceKeysPrivate.h: 12 * WebView/WebPreferences.mm: 13 (+[WebPreferences initialize]): 14 (-[WebPreferences selectionAcrossShadowBoundariesEnabled]): 15 (-[WebPreferences setSelectionAcrossShadowBoundariesEnabled:]): 16 * WebView/WebPreferencesPrivate.h: 17 * WebView/WebView.mm: 18 (-[WebView _preferencesChanged:]): 19 1 20 2018-09-24 Wenson Hsieh <wenson_hsieh@apple.com> 2 21 -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
r235539 r236519 263 263 #define WebKitMediaCapabilitiesEnabledPreferenceKey @"WebKitMediaCapabilitiesEnabled" 264 264 #define WebKitServerTimingEnabledPreferenceKey @"WebKitServerTimingEnabled" 265 #define WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey @"WebKitSelectionAcrossShadowBoundariesEnabled" -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
r236010 r236519 665 665 [NSNumber numberWithBool:YES], WebKitPeerConnectionEnabledPreferenceKey, 666 666 #endif 667 [NSNumber numberWithBool:NO], WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey, 667 668 #if ENABLE(INTERSECTION_OBSERVER) 668 669 @NO, WebKitIntersectionObserverEnabledPreferenceKey, … … 3366 3367 } 3367 3368 3369 - (BOOL)selectionAcrossShadowBoundariesEnabled 3370 { 3371 return [self _boolValueForKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey]; 3372 } 3373 3374 - (void)setSelectionAcrossShadowBoundariesEnabled:(BOOL)flag 3375 { 3376 [self _setBoolValue:flag forKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey]; 3377 } 3378 3368 3379 @end 3369 3380 -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
r235539 r236519 582 582 - (void)setServerTimingEnabled:(BOOL)flag; 583 583 - (BOOL)serverTimingEnabled; 584 585 - (void)setSelectionAcrossShadowBoundariesEnabled:(BOOL)flag; 586 - (BOOL)selectionAcrossShadowBoundariesEnabled; 584 587 585 588 @property (nonatomic) BOOL visualViewportEnabled; -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r236445 r236519 3171 3171 3172 3172 RuntimeEnabledFeatures::sharedFeatures().setServerTimingEnabled([preferences serverTimingEnabled]); 3173 3174 settings.setSelectionAcrossShadowBoundariesEnabled(preferences.selectionAcrossShadowBoundariesEnabled); 3173 3175 } 3174 3176 -
trunk/Tools/ChangeLog
r236518 r236519 1 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Selection should work across shadow boundary when initiated by a mouse drag 4 https://bugs.webkit.org/show_bug.cgi?id=151380 5 <rdar://problem/24363872> 6 7 Reviewed by Wenson Hsieh. 8 9 Added the support for internal:selectionAcrossShadowBoundariesEnabled test option. 10 11 * DumpRenderTree/TestOptions.cpp: 12 (TestOptions::TestOptions): 13 * DumpRenderTree/TestOptions.h: 14 * DumpRenderTree/mac/DumpRenderTree.mm: 15 (resetWebPreferencesToConsistentValues): 16 (setWebPreferencesForTestOptions): 17 1 18 2018-09-26 Ryosuke Niwa <rniwa@webkit.org> 2 19 -
trunk/Tools/DumpRenderTree/TestOptions.cpp
r235948 r236519 102 102 else if (key == "experimental:WebAnimationsCSSIntegrationEnabled") 103 103 enableWebAnimationsCSSIntegration = parseBooleanTestHeaderValue(value); 104 else if (key == "internal:selectionAcrossShadowBoundariesEnabled") 105 enableSelectionAcrossShadowBoundaries = parseBooleanTestHeaderValue(value); 104 106 else if (key == "enableColorFilter") 105 107 enableColorFilter = parseBooleanTestHeaderValue(value); -
trunk/Tools/DumpRenderTree/TestOptions.h
r232733 r236519 44 44 bool allowCrossOriginSubresourcesToAskForCredentials { false }; 45 45 bool enableColorFilter { false }; 46 bool enableSelectionAcrossShadowBoundaries { false }; 46 47 std::string jscOptions; 47 48 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r235806 r236519 991 991 preferences.mediaCapabilitiesEnabled = YES; 992 992 993 preferences.selectionAcrossShadowBoundariesEnabled = NO; 994 993 995 [WebPreferences _clearNetworkLoaderSession]; 994 996 [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain]; … … 1009 1011 preferences.webAnimationsCSSIntegrationEnabled = options.enableWebAnimationsCSSIntegration; 1010 1012 preferences.colorFilterEnabled = options.enableColorFilter; 1013 preferences.selectionAcrossShadowBoundariesEnabled = options.enableSelectionAcrossShadowBoundaries; 1011 1014 } 1012 1015
Note: See TracChangeset
for help on using the changeset viewer.