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

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

Issue 220343006: Fix for ::selection pseudo element to work on input elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding another Layout Test Created 6 years, 8 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/rendering/RenderObject.h ('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 ffbb8161d1213220211d9dd58676820c19496d45..0da6967868e4f2a723e88c7d015be3b4dfb76782 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1789,7 +1789,7 @@ Color RenderObject::selectionBackgroundColor() const
if (!isSelectable())
return Color::transparent;
- if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)))
+ if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShadowHost())
return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blendWithWhite();
return frame()->selection().isFocusedAndActive() ?
RenderTheme::theme().activeSelectionBackgroundColor() :
@@ -1803,7 +1803,7 @@ Color RenderObject::selectionColor(int colorProperty) const
if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSelectionOnly))
return resolveColor(colorProperty);
- if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)))
+ if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShadowHost())
return resolveColor(pseudoStyle.get(), colorProperty);
if (!RenderTheme::theme().supportsSelectionForegroundColors())
return resolveColor(colorProperty);
@@ -2972,6 +2972,19 @@ PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe
return document().ensureStyleResolver().pseudoStyleForElement(element, pseudoStyleRequest, parentStyle);
}
+PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyleFromParentOrShadowHost() const
+{
+ if (!node())
+ return nullptr;
+
+ if (Element* shadowHost = node()->shadowHost()) {
+ if (shadowHost->isFormControlElement())
+ return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
+ }
+
+ return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
+}
+
bool RenderObject::hasBlendMode() const
{
return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style()->hasBlendMode();
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698