Changeset 275076 in webkit
- Timestamp:
- Mar 25, 2021, 8:27:16 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/images/image-extraction/mac/select-word-in-draggable-image-overlay-expected-mismatch.html (added)
-
LayoutTests/fast/images/image-extraction/mac/select-word-in-draggable-image-overlay.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLElement.cpp (modified) (2 diffs)
-
Source/WebCore/html/HTMLElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLImageElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLImageElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275075 r275076 1 2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Don't add `-webkit-user-select: none;` on image elements with `draggable=true` 4 https://bugs.webkit.org/show_bug.cgi?id=223774 5 <rdar://problem/75860124> 6 7 Reviewed by Tim Horton. 8 9 * fast/images/image-extraction/mac/select-word-in-draggable-image-overlay-expected-mismatch.html: Added. 10 * fast/images/image-extraction/mac/select-word-in-draggable-image-overlay.html: Added. 11 1 12 2021-03-25 Kyle Piddington <kpiddington@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r275072 r275076 1 2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Don't add `-webkit-user-select: none;` on image elements with `draggable=true` 4 https://bugs.webkit.org/show_bug.cgi?id=223774 5 <rdar://problem/75860124> 6 7 Reviewed by Tim Horton. 8 9 Avoid adding this presentational CSS style property for image elements marked with `draggable=true`. Since 10 image elements are already draggable by default and mouse drags over image elements do not trigger text 11 selection, it's not necessary for the user agent to add this style property. See below for more details. 12 13 Test: fast/images/image-extraction/mac/select-word-in-draggable-image-overlay.html 14 15 * html/HTMLElement.cpp: 16 (WebCore::HTMLElement::collectStyleForPresentationAttribute): 17 18 If the element is already draggable (barring HTML attributes), don't additionally disable text selection inside 19 the element when we additionally have `draggable=true` set on the element. 20 21 (WebCore::HTMLElement::draggable const): 22 23 Refactor this to consult `isDraggableIgnoringAttributes()` when determining whether to check if the `draggable` 24 attribute value is not `"false"` vs. equal to `"true"`. In the case where the element is already draggable, we 25 only return `false` here if `draggable=false` is explicitly set. 26 27 * html/HTMLElement.h: 28 (WebCore::HTMLElement::isDraggableIgnoringAttributes const): 29 * html/HTMLImageElement.cpp: 30 (WebCore::HTMLImageElement::draggable const): Deleted. 31 * html/HTMLImageElement.h: 32 33 Override `isDraggableIgnoringAttributes` and return `true`. 34 1 35 2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 36 -
trunk/Source/WebCore/html/HTMLElement.cpp
r275072 r275076 211 211 if (equalLettersIgnoringASCIICase(value, "true")) { 212 212 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueElement); 213 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserSelect, CSSValueNone); 213 if (!isDraggableIgnoringAttributes()) 214 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserSelect, CSSValueNone); 214 215 } else if (equalLettersIgnoringASCIICase(value, "false")) 215 216 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueNone); … … 710 711 bool HTMLElement::draggable() const 711 712 { 712 return equalLettersIgnoringASCIICase(attributeWithoutSynchronization(draggableAttr), "true"); 713 auto& value = attributeWithoutSynchronization(draggableAttr); 714 if (isDraggableIgnoringAttributes()) 715 return !equalLettersIgnoringASCIICase(value, "false"); 716 717 return equalLettersIgnoringASCIICase(value, "true"); 713 718 } 714 719 -
trunk/Source/WebCore/html/HTMLElement.h
r275072 r275076 64 64 virtual bool draggable() const; 65 65 WEBCORE_EXPORT void setDraggable(bool); 66 virtual bool isDraggableIgnoringAttributes() const { return false; } 66 67 67 68 WEBCORE_EXPORT bool spellcheck() const; -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r273622 r275076 559 559 } 560 560 561 bool HTMLImageElement::draggable() const562 {563 // Image elements are draggable by default.564 return !equalLettersIgnoringASCIICase(attributeWithoutSynchronization(draggableAttr), "false");565 }566 567 561 void HTMLImageElement::setHeight(unsigned value) 568 562 { -
trunk/Source/WebCore/html/HTMLImageElement.h
r272117 r275076 162 162 String completeURLsInAttributeValue(const URL& base, const Attribute&) const override; 163 163 164 bool draggable() const override;164 bool isDraggableIgnoringAttributes() const final { return true; } 165 165 166 166 void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
Note:
See TracChangeset
for help on using the changeset viewer.