WebKit Bugzilla
Attachment 339095 Details for
Bug 185122
: Make color-filter affect <attachment>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185122-20180429105051.patch (text/plain), 7.41 KB, created by
Simon Fraser (smfr)
on 2018-04-29 10:50:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-04-29 10:50:52 PDT
Size:
7.41 KB
patch
obsolete
>Subversion Revision: 231153 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c4facc47a369b1812f35d748df2da688613ec0df..25522cf24da206ef4a3023ce6a7363bbdd4c4574 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-04-29 Simon Fraser <simon.fraser@apple.com> >+ >+ Make color-filter affect <attachment> >+ https://bugs.webkit.org/show_bug.cgi?id=185122 >+ rdar://problem/39818763 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Convert the colors used to render <attachment> through color-filter, except >+ for those parts that render over the icon (like the progress bar). >+ >+ Not easily testable. >+ >+ * rendering/RenderThemeMac.mm: >+ (WebCore::titleTextColorForAttachment): >+ (WebCore::AttachmentLayout::layOutTitle): >+ (WebCore::AttachmentLayout::layOutSubtitle): >+ (WebCore::paintAttachmentIconBackground): >+ (WebCore::paintAttachmentTitleBackground): >+ (WebCore::paintAttachmentPlaceholderBorder): >+ > 2018-04-28 Simon Fraser <simon.fraser@apple.com> > > Fix color-filter to apply to SVG colors >diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm >index c8ba2cb36073f7f0c9b9b7254479a77278b998d4..2fa3d46994e33c9ffa1788ab1b58b1e4d66b1c44 100644 >--- a/Source/WebCore/rendering/RenderThemeMac.mm >+++ b/Source/WebCore/rendering/RenderThemeMac.mm >@@ -2164,15 +2164,18 @@ private: > void addTitleLine(CTLineRef, CGFloat& yOffset, Vector<CGPoint> origins, CFIndex lineIndex, const RenderAttachment&); > }; > >-static NSColor *titleTextColorForAttachment(const RenderAttachment& attachment) >+static Color titleTextColorForAttachment(const RenderAttachment& attachment) > { >+ Color result = Color::black; >+ > if (attachment.selectionState() != RenderObject::SelectionNone) { > if (attachment.frame().selection().isFocusedAndActive()) >- return [NSColor alternateSelectedControlTextColor]; >- return (NSColor *)cachedCGColor(attachmentTitleInactiveTextColor()); >+ result = colorFromNSColor([NSColor alternateSelectedControlTextColor]); >+ else >+ result = attachmentTitleInactiveTextColor(); > } > >- return [NSColor blackColor]; >+ return attachment.style().colorByApplyingColorFilter(result); > } > > void AttachmentLayout::addTitleLine(CTLineRef line, CGFloat& yOffset, Vector<CGPoint> origins, CFIndex lineIndex, const RenderAttachment& attachment) >@@ -2221,7 +2224,7 @@ void AttachmentLayout::layOutTitle(const RenderAttachment& attachment) > > NSDictionary *textAttributes = @{ > (id)kCTFontAttributeName: (id)font.get(), >- (id)kCTForegroundColorAttributeName: titleTextColorForAttachment(attachment) >+ (id)kCTForegroundColorAttributeName: (NSColor *)cachedCGColor(titleTextColorForAttachment(attachment)) > }; > RetainPtr<NSAttributedString> attributedTitle = adoptNS([[NSAttributedString alloc] initWithString:title attributes:textAttributes]); > RetainPtr<CTFramesetterRef> titleFramesetter = adoptCF(CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedTitle.get())); >@@ -2274,11 +2277,12 @@ void AttachmentLayout::layOutSubtitle(const RenderAttachment& attachment) > if (subtitleText.isEmpty()) > return; > >+ Color subtitleColor = attachment.style().colorByApplyingColorFilter(attachmentSubtitleTextColor()); > CFStringRef language = 0; // By not specifying a language we use the system language. > RetainPtr<CTFontRef> font = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, attachmentSubtitleFontSize, language)); > NSDictionary *textAttributes = @{ > (id)kCTFontAttributeName: (id)font.get(), >- (id)kCTForegroundColorAttributeName: (NSColor *)cachedCGColor(attachmentSubtitleTextColor()) >+ (id)kCTForegroundColorAttributeName: (NSColor *)cachedCGColor(subtitleColor) > }; > RetainPtr<NSAttributedString> attributedSubtitleText = adoptNS([[NSAttributedString alloc] initWithString:subtitleText attributes:textAttributes]); > subtitleLine = adoptCF(CTLineCreateWithAttributedString((CFAttributedStringRef)attributedSubtitleText.get())); >@@ -2333,7 +2337,7 @@ int RenderThemeMac::attachmentBaseline(const RenderAttachment& attachment) const > return layout.baseline; > } > >-static void paintAttachmentIconBackground(const RenderAttachment&, GraphicsContext& context, AttachmentLayout& layout) >+static void paintAttachmentIconBackground(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout) > { > // FIXME: Finder has a discontinuous behavior here when you have a background color other than white, > // where it switches into 'bordered mode' and the border pops in on top of the background. >@@ -2343,7 +2347,8 @@ static void paintAttachmentIconBackground(const RenderAttachment&, GraphicsConte > if (paintBorder) > backgroundRect.inflate(-attachmentIconSelectionBorderThickness); > >- context.fillRoundedRect(FloatRoundedRect(backgroundRect, FloatRoundedRect::Radii(attachmentIconBackgroundRadius)), attachmentIconBackgroundColor()); >+ Color backgroundColor = attachment.style().colorByApplyingColorFilter(attachmentIconBackgroundColor()); >+ context.fillRoundedRect(FloatRoundedRect(backgroundRect, FloatRoundedRect::Radii(attachmentIconBackgroundRadius)), backgroundColor); > > if (paintBorder) { > FloatRect borderRect = layout.iconBackgroundRect; >@@ -2352,7 +2357,9 @@ static void paintAttachmentIconBackground(const RenderAttachment&, GraphicsConte > FloatSize iconBackgroundRadiusSize(attachmentIconBackgroundRadius, attachmentIconBackgroundRadius); > Path borderPath; > borderPath.addRoundedRect(borderRect, iconBackgroundRadiusSize); >- context.setStrokeColor(attachmentIconBorderColor()); >+ >+ Color borderColor = attachment.style().colorByApplyingColorFilter(attachmentIconBorderColor()); >+ context.setStrokeColor(borderColor); > context.setStrokeThickness(attachmentIconSelectionBorderThickness); > context.strokePath(borderPath); > } >@@ -2434,6 +2441,7 @@ static void paintAttachmentTitleBackground(const RenderAttachment& attachment, G > else > backgroundColor = attachmentTitleInactiveBackgroundColor(); > >+ backgroundColor = attachment.style().colorByApplyingColorFilter(backgroundColor); > context.setFillColor(backgroundColor); > > Path backgroundPath = PathUtilities::pathWithShrinkWrappedRects(backgroundRects, attachmentTitleBackgroundRadius); >@@ -2497,11 +2505,13 @@ static void paintAttachmentProgress(const RenderAttachment& attachment, Graphics > context.strokePath(borderPath); > } > >-static void paintAttachmentPlaceholderBorder(const RenderAttachment&, GraphicsContext& context, AttachmentLayout& layout) >+static void paintAttachmentPlaceholderBorder(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout) > { > Path borderPath; > borderPath.addRoundedRect(layout.attachmentRect, FloatSize(attachmentPlaceholderBorderRadius, attachmentPlaceholderBorderRadius)); >- context.setStrokeColor(attachmentPlaceholderBorderColor()); >+ >+ Color placeholderBorderColor = attachment.style().colorByApplyingColorFilter(attachmentPlaceholderBorderColor()); >+ context.setStrokeColor(placeholderBorderColor); > context.setStrokeThickness(attachmentPlaceholderBorderWidth); > context.setStrokeStyle(DashedStroke); > context.setLineDash({attachmentPlaceholderBorderDashLength}, 0);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185122
: 339095