Index: Source/core/rendering/RenderObject.cpp |
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
index da52773b9c681e0a141c09e87d073e96df4c1b23..44edf1cd4d741683e17034324c60a2d792c69f80 100644 |
--- a/Source/core/rendering/RenderObject.cpp |
+++ b/Source/core/rendering/RenderObject.cpp |
@@ -1643,10 +1643,15 @@ void RenderObject::showRenderTreeAndMark(const RenderObject* markedObject1, cons |
#endif // NDEBUG |
+static bool shouldUseSelectionColor(const RenderStyle& style) |
+{ |
+ return style.userSelect() != SELECT_NONE || style.userModify() != READ_ONLY; |
+} |
+ |
Color RenderObject::selectionBackgroundColor() const |
{ |
Color color; |
- if (style()->userSelect() != SELECT_NONE) { |
+ if (shouldUseSelectionColor(*style())) { |
RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); |
if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) |
color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite(); |
@@ -1664,7 +1669,7 @@ Color RenderObject::selectionColor(int colorProperty) const |
Color color; |
// If the element is unselectable, or we are only painting the selection, |
// don't override the foreground color with the selection foreground color. |
- if (style()->userSelect() == SELECT_NONE |
+ if (!shouldUseSelectionColor(*style()) |
|| (frame()->view()->paintBehavior() & PaintBehaviorSelectionOnly)) |
return color; |