Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 17225002: Make user-select:none not to affect editability (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-06-19T18:10:01 Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698