Title: [181057] trunk/Source/WebCore
- Revision
- 181057
- Author
- [email protected]
- Date
- 2015-03-04 17:40:45 -0800 (Wed, 04 Mar 2015)
Log Message
<attachment> should not appear selected when the cursor is adjacent to it
https://bugs.webkit.org/show_bug.cgi?id=142311
<rdar://problem/20045862>
Reviewed by Dean Jackson.
* rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::isSelected): Deleted.
* rendering/RenderAttachment.h:
* rendering/RenderThemeMac.mm:
(WebCore::titleTextColorForAttachment):
(WebCore::RenderThemeMac::paintAttachment):
(WebCore::labelTextColorForAttachment): Deleted.
We were using the wrong (and far too complicated) mechanism to determine
if the attachment is selected (to decide which highlight color to use).
Instead, just check selectionState().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (181056 => 181057)
--- trunk/Source/WebCore/ChangeLog 2015-03-05 01:39:27 UTC (rev 181056)
+++ trunk/Source/WebCore/ChangeLog 2015-03-05 01:40:45 UTC (rev 181057)
@@ -1,3 +1,22 @@
+2015-03-04 Tim Horton <[email protected]>
+
+ <attachment> should not appear selected when the cursor is adjacent to it
+ https://bugs.webkit.org/show_bug.cgi?id=142311
+ <rdar://problem/20045862>
+
+ Reviewed by Dean Jackson.
+
+ * rendering/RenderAttachment.cpp:
+ (WebCore::RenderAttachment::isSelected): Deleted.
+ * rendering/RenderAttachment.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::titleTextColorForAttachment):
+ (WebCore::RenderThemeMac::paintAttachment):
+ (WebCore::labelTextColorForAttachment): Deleted.
+ We were using the wrong (and far too complicated) mechanism to determine
+ if the attachment is selected (to decide which highlight color to use).
+ Instead, just check selectionState().
+
2015-03-04 Timothy Horton <[email protected]>
<attachment> should show the file size as detail text below the icon
Modified: trunk/Source/WebCore/rendering/RenderAttachment.cpp (181056 => 181057)
--- trunk/Source/WebCore/rendering/RenderAttachment.cpp 2015-03-05 01:39:27 UTC (rev 181056)
+++ trunk/Source/WebCore/rendering/RenderAttachment.cpp 2015-03-05 01:40:45 UTC (rev 181057)
@@ -51,12 +51,6 @@
return downcast<HTMLAttachmentElement>(nodeForNonAnonymous());
}
-bool RenderAttachment::isSelected() const
-{
- RefPtr<Range> selectionRange = frame().selection().selection().firstRange();
- return selectionRange && selectionRange->intersectsNode(&nodeForNonAnonymous(), ASSERT_NO_EXCEPTION);
-}
-
void RenderAttachment::layout()
{
setIntrinsicSize(document().page()->theme().attachmentIntrinsicSize(*this));
Modified: trunk/Source/WebCore/rendering/RenderAttachment.h (181056 => 181057)
--- trunk/Source/WebCore/rendering/RenderAttachment.h 2015-03-05 01:39:27 UTC (rev 181056)
+++ trunk/Source/WebCore/rendering/RenderAttachment.h 2015-03-05 01:40:45 UTC (rev 181057)
@@ -42,8 +42,6 @@
void invalidate();
- bool isSelected() const;
-
private:
void element() const = delete;
virtual bool isAttachment() const override { return true; }
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (181056 => 181057)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-03-05 01:39:27 UTC (rev 181056)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-03-05 01:40:45 UTC (rev 181057)
@@ -2126,7 +2126,7 @@
static NSColor *titleTextColorForAttachment(const RenderAttachment& attachment)
{
- if (attachment.isSelected()) {
+ if (attachment.selectionState() != RenderObject::SelectionNone) {
if (attachment.frame().selection().isFocusedAndActive())
return [NSColor alternateSelectedControlTextColor];
return (NSColor *)cachedCGColor(attachmentTitleInactiveTextColor(), ColorSpaceDeviceRGB);
@@ -2518,7 +2518,7 @@
context.translate(toFloatSize(paintRect.location()));
context.translate(FloatSize((layout.attachmentRect.width() - attachmentIconBackgroundSize) / 2, 0));
- bool useSelectedStyle = attachment.isSelected();
+ bool useSelectedStyle = attachment.selectionState() != RenderObject::SelectionNone;
if (useSelectedStyle)
paintAttachmentIconBackground(attachment, context, layout);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes