Title: [217083] trunk/Source/WebCore
- Revision
- 217083
- Author
- wenson_hs...@apple.com
- Date
- 2017-05-18 18:44:56 -0700 (Thu, 18 May 2017)
Log Message
Attachment drag preview should not have the attachment outline
https://bugs.webkit.org/show_bug.cgi?id=172327
<rdar://problem/32282831>
Reviewed by Tim Horton.
When creating a drag image for an attachment element, don't include borders around the attachment.
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* rendering/RenderAttachment.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintAttachment):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (217082 => 217083)
--- trunk/Source/WebCore/ChangeLog 2017-05-19 01:43:36 UTC (rev 217082)
+++ trunk/Source/WebCore/ChangeLog 2017-05-19 01:44:56 UTC (rev 217083)
@@ -1,3 +1,19 @@
+2017-05-18 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Attachment drag preview should not have the attachment outline
+ https://bugs.webkit.org/show_bug.cgi?id=172327
+ <rdar://problem/32282831>
+
+ Reviewed by Tim Horton.
+
+ When creating a drag image for an attachment element, don't include borders around the attachment.
+
+ * page/DragController.cpp:
+ (WebCore::DragController::startDrag):
+ * rendering/RenderAttachment.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::paintAttachment):
+
2017-05-18 Youenn Fablet <you...@apple.com>
Make WebRTC logging happen in Release
Modified: trunk/Source/WebCore/page/DragController.cpp (217082 => 217083)
--- trunk/Source/WebCore/page/DragController.cpp 2017-05-19 01:43:36 UTC (rev 217082)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-05-19 01:44:56 UTC (rev 217083)
@@ -65,6 +65,7 @@
#include "PluginDocument.h"
#include "PluginViewBase.h"
#include "Position.h"
+#include "RenderAttachment.h"
#include "RenderFileUploadControl.h"
#include "RenderImage.h"
#include "RenderView.h"
@@ -1056,6 +1057,10 @@
#if ENABLE(ATTACHMENT_ELEMENT)
if (is<HTMLAttachmentElement>(element) && m_dragSourceAction & DragSourceActionAttachment) {
+ auto* attachmentRenderer = downcast<HTMLAttachmentElement>(element).renderer();
+ if (!attachmentRenderer)
+ return false;
+
src.editor().setIgnoreSelectionChanges(true);
auto previousSelection = src.selection().selection();
if (!dataTransfer.pasteboard().hasData()) {
@@ -1079,7 +1084,9 @@
if (!dragImage) {
TextIndicatorData textIndicator;
+ attachmentRenderer->setShouldDrawBorder(false);
dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
+ attachmentRenderer->setShouldDrawBorder(true);
if (textIndicator.contentImage)
dragImage.setIndicatorData(textIndicator);
dragLoc = dragLocForSelectionDrag(src);
Modified: trunk/Source/WebCore/rendering/RenderAttachment.h (217082 => 217083)
--- trunk/Source/WebCore/rendering/RenderAttachment.h 2017-05-19 01:43:36 UTC (rev 217082)
+++ trunk/Source/WebCore/rendering/RenderAttachment.h 2017-05-19 01:44:56 UTC (rev 217083)
@@ -38,6 +38,9 @@
HTMLAttachmentElement& attachmentElement() const;
+ void setShouldDrawBorder(bool drawBorder) { m_shouldDrawBorder = drawBorder; }
+ bool shouldDrawBorder() const { return m_shouldDrawBorder; }
+
void invalidate();
private:
@@ -52,6 +55,7 @@
int baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const override;
LayoutUnit m_minimumIntrinsicWidth;
+ bool m_shouldDrawBorder { true };
};
inline RenderAttachment* HTMLAttachmentElement::renderer() const
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (217082 => 217083)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2017-05-19 01:43:36 UTC (rev 217082)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2017-05-19 01:44:56 UTC (rev 217083)
@@ -1771,9 +1771,11 @@
context.translate(toFloatSize(paintRect.location()));
- Path borderPath = attachmentBorderPath(info);
- paintAttachmentBorder(context, borderPath);
- context.clipPath(borderPath);
+ if (attachment.shouldDrawBorder()) {
+ auto borderPath = attachmentBorderPath(info);
+ paintAttachmentBorder(context, borderPath);
+ context.clipPath(borderPath);
+ }
context.translate(FloatSize(0, info.contentYOrigin));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes