Modified: trunk/Source/WebCore/ChangeLog (180783 => 180784)
--- trunk/Source/WebCore/ChangeLog 2015-02-27 22:50:03 UTC (rev 180783)
+++ trunk/Source/WebCore/ChangeLog 2015-02-27 23:00:03 UTC (rev 180784)
@@ -1,3 +1,19 @@
+2015-02-27 Timothy Horton <timothy_hor...@apple.com>
+
+ <attachment> should have an inactive style (gray in background)
+ https://bugs.webkit.org/show_bug.cgi?id=142103
+ <rdar://problem/19982486>
+
+ Reviewed by Dan Bernstein.
+
+ * rendering/RenderThemeMac.mm:
+ (WebCore::attachmentLabelInactiveBackgroundColor):
+ (WebCore::attachmentLabelInactiveTextColor):
+ (WebCore::RenderThemeMac::paintAttachmentLabelBackground):
+ (WebCore::RenderThemeMac::paintAttachmentLabel):
+ Use a gray background and gray text when the selection containing the
+ attachment isn't focused and active.
+
2015-02-27 Brady Eidson <beid...@apple.com>
Add a "block-cookies" rule to the user content filter.
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (180783 => 180784)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-02-27 22:50:03 UTC (rev 180783)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-02-27 23:00:03 UTC (rev 180784)
@@ -33,6 +33,7 @@
#import "FloatRoundedRect.h"
#import "FocusController.h"
#import "Frame.h"
+#import "FrameSelection.h"
#import "FrameView.h"
#import "GraphicsContextCG.h"
#import "HTMLAttachmentElement.h"
@@ -2086,6 +2087,9 @@
const CGFloat attachmentLabelBackgroundRadius = 3;
const CGFloat attachmentLabelBackgroundPadding = 3;
+static Color attachmentLabelInactiveBackgroundColor() { return Color(204, 204, 204, 255); }
+static Color attachmentLabelInactiveTextColor() { return Color(100, 100, 100, 255); }
+
const CGFloat attachmentMargin = 3;
struct AttachmentLayout {
@@ -2198,20 +2202,36 @@
context.drawNativeImage(icon.get(), iconSizeInPoints, ColorSpaceDeviceRGB, layout.iconRect, FloatRect(FloatPoint(), iconSizeInPoints));
}
-void RenderThemeMac::paintAttachmentLabelBackground(const RenderAttachment&, GraphicsContext& context, AttachmentLayout& layout) const
+void RenderThemeMac::paintAttachmentLabelBackground(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout) const
{
Path backgroundPath;
backgroundPath.addRoundedRect(layout.textBackgroundRect, FloatSize(attachmentLabelBackgroundRadius, attachmentLabelBackgroundRadius));
- context.setFillColor(convertNSColorToColor([NSColor alternateSelectedControlColor]), ColorSpaceDeviceRGB);
+
+ Color backgroundColor;
+ if (attachment.frame().selection().isFocusedAndActive())
+ backgroundColor = convertNSColorToColor([NSColor alternateSelectedControlColor]);
+ else
+ backgroundColor = attachmentLabelInactiveBackgroundColor();
+
+ context.setFillColor(backgroundColor, ColorSpaceDeviceRGB);
context.fillPath(backgroundPath);
}
-void RenderThemeMac::paintAttachmentLabel(const RenderAttachment&, GraphicsContext& context, AttachmentLayout& layout, bool useSelectedStyle) const
+void RenderThemeMac::paintAttachmentLabel(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout, bool useSelectedStyle) const
{
FloatPoint textLocation = layout.textRect.minXMaxYCorner();
textLocation.move(0, -layout.labelFontCascade.fontMetrics().descent());
- context.setFillColor(useSelectedStyle ? convertNSColorToColor([NSColor alternateSelectedControlTextColor]) : Color::black, ColorSpaceDeviceRGB);
+ Color textColor;
+ if (useSelectedStyle) {
+ if (attachment.frame().selection().isFocusedAndActive())
+ textColor = convertNSColorToColor([NSColor alternateSelectedControlTextColor]);
+ else
+ textColor = attachmentLabelInactiveTextColor();
+ } else
+ textColor = Color::black;
+
+ context.setFillColor(textColor, ColorSpaceDeviceRGB);
context.drawBidiText(layout.labelFontCascade, *layout.labelTextRun, textLocation);
}