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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 bool RenderObject::isSelectable() const 1782 bool RenderObject::isSelectable() const
1783 { 1783 {
1784 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY); 1784 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY);
1785 } 1785 }
1786 1786
1787 Color RenderObject::selectionBackgroundColor() const 1787 Color RenderObject::selectionBackgroundColor() const
1788 { 1788 {
1789 if (!isSelectable()) 1789 if (!isSelectable())
1790 return Color::transparent; 1790 return Color::transparent;
1791 1791
1792 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) 1792 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShad owHost())
1793 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); 1793 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite();
1794 return frame()->selection().isFocusedAndActive() ? 1794 return frame()->selection().isFocusedAndActive() ?
1795 RenderTheme::theme().activeSelectionBackgroundColor() : 1795 RenderTheme::theme().activeSelectionBackgroundColor() :
1796 RenderTheme::theme().inactiveSelectionBackgroundColor(); 1796 RenderTheme::theme().inactiveSelectionBackgroundColor();
1797 } 1797 }
1798 1798
1799 Color RenderObject::selectionColor(int colorProperty) const 1799 Color RenderObject::selectionColor(int colorProperty) const
1800 { 1800 {
1801 // If the element is unselectable, or we are only painting the selection, 1801 // If the element is unselectable, or we are only painting the selection,
1802 // don't override the foreground color with the selection foreground color. 1802 // don't override the foreground color with the selection foreground color.
1803 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) 1803 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly))
1804 return resolveColor(colorProperty); 1804 return resolveColor(colorProperty);
1805 1805
1806 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) 1806 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShad owHost())
1807 return resolveColor(pseudoStyle.get(), colorProperty); 1807 return resolveColor(pseudoStyle.get(), colorProperty);
1808 if (!RenderTheme::theme().supportsSelectionForegroundColors()) 1808 if (!RenderTheme::theme().supportsSelectionForegroundColors())
1809 return resolveColor(colorProperty); 1809 return resolveColor(colorProperty);
1810 return frame()->selection().isFocusedAndActive() ? 1810 return frame()->selection().isFocusedAndActive() ?
1811 RenderTheme::theme().activeSelectionForegroundColor() : 1811 RenderTheme::theme().activeSelectionForegroundColor() :
1812 RenderTheme::theme().inactiveSelectionForegroundColor(); 1812 RenderTheme::theme().inactiveSelectionForegroundColor();
1813 } 1813 }
1814 1814
1815 Color RenderObject::selectionForegroundColor() const 1815 Color RenderObject::selectionForegroundColor() const
1816 { 1816 {
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2965 2965
2966 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { 2966 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
2967 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing); 2967 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing);
2968 result->setStyleType(FIRST_LINE_INHERITED); 2968 result->setStyleType(FIRST_LINE_INHERITED);
2969 return result.release(); 2969 return result.release();
2970 } 2970 }
2971 2971
2972 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle); 2972 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle);
2973 } 2973 }
2974 2974
2975 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyleFromParentOrShadowHo st() const
2976 {
2977 if (!node())
2978 return nullptr;
2979
2980 if (Element* shadowHost = node()->shadowHost()) {
2981 if (shadowHost->isFormControlElement())
2982 return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyleReq uest(SELECTION));
2983 }
2984
2985 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2986 }
2987
2975 bool RenderObject::hasBlendMode() const 2988 bool RenderObject::hasBlendMode() const
2976 { 2989 {
2977 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style() ->hasBlendMode(); 2990 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style() ->hasBlendMode();
2978 } 2991 }
2979 2992
2980 static Color decorationColor(const RenderObject* object, RenderStyle* style) 2993 static Color decorationColor(const RenderObject* object, RenderStyle* style)
2981 { 2994 {
2982 // Check for text decoration color first. 2995 // Check for text decoration color first.
2983 StyleColor result = style->visitedDependentDecorationColor(); 2996 StyleColor result = style->visitedDependentDecorationColor();
2984 if (!result.isCurrentColor()) 2997 if (!result.isCurrentColor())
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3360 { 3373 {
3361 if (object1) { 3374 if (object1) {
3362 const WebCore::RenderObject* root = object1; 3375 const WebCore::RenderObject* root = object1;
3363 while (root->parent()) 3376 while (root->parent())
3364 root = root->parent(); 3377 root = root->parent();
3365 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3378 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3366 } 3379 }
3367 } 3380 }
3368 3381
3369 #endif 3382 #endif
OLDNEW
« 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