Diff
Modified: trunk/LayoutTests/ChangeLog (217936 => 217937)
--- trunk/LayoutTests/ChangeLog 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/LayoutTests/ChangeLog 2017-06-08 18:08:48 UTC (rev 217937)
@@ -1,3 +1,20 @@
+2017-06-08 Tim Horton <[email protected]>
+
+ Add a borderless mode to <attachment>, and make it respect its layout size
+ https://bugs.webkit.org/show_bug.cgi?id=173079
+ <rdar://problem/32491584>
+
+ Reviewed by Simon Fraser.
+
+ * TestExpectations:
+ * platform/ios/TestExpectations:
+ * fast/attachment/attachment-borderless-expected-mismatch.html: Added.
+ * fast/attachment/attachment-borderless.html: Added.
+ * fast/attachment/attachment-respects-css-size-expected-mismatch.html: Added.
+ * fast/attachment/attachment-respects-css-size.html: Added.
+ Add mismatch tests ensuring that CSS width/height and borderless-attachment
+ have *some* kind of impact on rendering.
+
2017-06-08 Marcos ChavarrÃa Teijeiro <[email protected]>
Modify security test to avoid spacing differences.
Modified: trunk/LayoutTests/TestExpectations (217936 => 217937)
--- trunk/LayoutTests/TestExpectations 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/LayoutTests/TestExpectations 2017-06-08 18:08:48 UTC (rev 217937)
@@ -81,6 +81,7 @@
# This test only makes sense on iOS
fast/attachment/attachment-wrapping-action.html
+fast/attachment/attachment-borderless.html
editing/selection/character-granularity-selected-range-after-dismissing-selection.html [ Skip ]
editing/selection/character-granularity-select-text-with-click-handler.html [ Skip ]
editing/selection/caret-after-tap-in-editable-selection.html [ Skip ]
Added: trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html (0 => 217937)
--- trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html 2017-06-08 18:08:48 UTC (rev 217937)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<script>
+ if (window.internals)
+ window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+<body>
+<attachment id="attachment" title="overridden title" subtitle="1024 bytes"></attachment>
+</body>
+</html>
Added: trunk/LayoutTests/fast/attachment/attachment-borderless.html (0 => 217937)
--- trunk/LayoutTests/fast/attachment/attachment-borderless.html (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-borderless.html 2017-06-08 18:08:48 UTC (rev 217937)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<script>
+ if (window.internals)
+ window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+<body>
+<attachment id="attachment" title="overridden title" subtitle="1024 bytes" style="-webkit-appearance: borderless-attachment;"></attachment>
+</body>
+</html>
Added: trunk/LayoutTests/fast/attachment/attachment-respects-css-size-expected-mismatch.html (0 => 217937)
--- trunk/LayoutTests/fast/attachment/attachment-respects-css-size-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-respects-css-size-expected-mismatch.html 2017-06-08 18:08:48 UTC (rev 217937)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<script>
+ if (window.internals)
+ window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+<body>
+<attachment id="attachment" title="overridden title" subtitle="1024 bytes"></attachment>
+</body>
+</html>
Added: trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html (0 => 217937)
--- trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html 2017-06-08 18:08:48 UTC (rev 217937)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<script>
+ if (window.internals)
+ window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+<body>
+<attachment id="attachment" title="overridden title" subtitle="1024 bytes" style="width: 500px; height: 500px;"></attachment>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (217936 => 217937)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-06-08 18:08:48 UTC (rev 217937)
@@ -2674,6 +2674,7 @@
media/video-seek-to-current-time.html [ Failure ]
fast/attachment/attachment-wrapping-action.html [ Pass ]
+fast/attachment/attachment-borderless.html [ Pass ]
fast/events/page-visibility-iframe-move-test.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (217936 => 217937)
--- trunk/Source/WebCore/ChangeLog 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/ChangeLog 2017-06-08 18:08:48 UTC (rev 217937)
@@ -1,3 +1,34 @@
+2017-06-08 Tim Horton <[email protected]>
+
+ Add a borderless mode to <attachment>, and make it respect its layout size
+ https://bugs.webkit.org/show_bug.cgi?id=173079
+ <rdar://problem/32491584>
+
+ Reviewed by Simon Fraser.
+
+ Tests: fast/attachment/attachment-borderless.html
+ fast/attachment/attachment-respects-css-size.html
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * css/CSSValueKeywords.in:
+ * platform/ThemeTypes.h:
+ * rendering/RenderAttachment.cpp:
+ (WebCore::RenderAttachment::shouldDrawBorder):
+ * rendering/RenderAttachment.h:
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::paint):
+ Add "-webkit-appearance: borderless-attachment;" in addition to "attachment",
+ so clients can specify the borderless appearance. This isn't specified as a
+ CSS border because it's a very custom appearance that isn't achievable that way.
+
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::AttachmentInfo::AttachmentInfo):
+ Use the layout size of the attachment, not the fixed size; we use the fixed
+ size as our intrinsic size, so most attachments will still be that size,
+ but if a client specifies a different size, we'll lay out correctly.
+
2017-06-08 Jer Noble <[email protected]>
YouTube audio stutters when page changes visibility.
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (217936 => 217937)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2017-06-08 18:08:48 UTC (rev 217937)
@@ -607,6 +607,9 @@
case AttachmentPart:
m_value.valueID = CSSValueAttachment;
break;
+ case BorderlessAttachmentPart:
+ m_value.valueID = CSSValueBorderlessAttachment;
+ break;
#endif
#if ENABLE(SERVICE_CONTROLS)
case ImageControlsButtonPart:
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (217936 => 217937)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2017-06-08 18:08:48 UTC (rev 217937)
@@ -816,6 +816,7 @@
textarea
#if defined(ENABLE_ATTACHMENT_ELEMENT) && ENABLE_ATTACHMENT_ELEMENT
attachment
+borderless-attachment
#endif
caps-lock-indicator
Modified: trunk/Source/WebCore/platform/ThemeTypes.h (217936 => 217937)
--- trunk/Source/WebCore/platform/ThemeTypes.h 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/platform/ThemeTypes.h 2017-06-08 18:08:48 UTC (rev 217937)
@@ -53,7 +53,7 @@
#endif
TextAreaPart,
#if ENABLE(ATTACHMENT_ELEMENT)
- AttachmentPart,
+ AttachmentPart, BorderlessAttachmentPart,
#endif
CapsLockIndicatorPart
};
Modified: trunk/Source/WebCore/rendering/RenderAttachment.cpp (217936 => 217937)
--- trunk/Source/WebCore/rendering/RenderAttachment.cpp 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/rendering/RenderAttachment.cpp 2017-06-08 18:08:48 UTC (rev 217937)
@@ -70,6 +70,13 @@
return theme().attachmentBaseline(*this);
}
+bool RenderAttachment::shouldDrawBorder() const
+{
+ if (style().appearance() == BorderlessAttachmentPart)
+ return false;
+ return m_shouldDrawBorder;
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/rendering/RenderAttachment.h (217936 => 217937)
--- trunk/Source/WebCore/rendering/RenderAttachment.h 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/rendering/RenderAttachment.h 2017-06-08 18:08:48 UTC (rev 217937)
@@ -39,7 +39,7 @@
HTMLAttachmentElement& attachmentElement() const;
void setShouldDrawBorder(bool drawBorder) { m_shouldDrawBorder = drawBorder; }
- bool shouldDrawBorder() const { return m_shouldDrawBorder; }
+ bool shouldDrawBorder() const;
void invalidate();
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (217936 => 217937)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-06-08 18:08:48 UTC (rev 217937)
@@ -258,6 +258,7 @@
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
case AttachmentPart:
+ case BorderlessAttachmentPart:
return adjustAttachmentStyle(styleResolver, style, element);
#endif
default:
@@ -410,6 +411,7 @@
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
case AttachmentPart:
+ case BorderlessAttachmentPart:
return paintAttachment(box, paintInfo, integralSnappedRect);
#endif
default:
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (217936 => 217937)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2017-06-08 17:57:08 UTC (rev 217936)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2017-06-08 18:08:48 UTC (rev 217937)
@@ -1661,7 +1661,7 @@
AttachmentInfo::AttachmentInfo(const RenderAttachment& attachment)
{
- attachmentRect = FloatRect(0, 0, attachmentSize.width, attachmentSize.height);
+ attachmentRect = FloatRect(0, 0, attachment.width().toFloat(), attachment.height().toFloat());
hasProgress = getAttachmentProgress(attachment, progress);