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(); |