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

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 RefTests 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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 bool RenderObject::isSelectable() const 1781 bool RenderObject::isSelectable() const
1782 { 1782 {
1783 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY); 1783 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY);
1784 } 1784 }
1785 1785
1786 Color RenderObject::selectionBackgroundColor() const 1786 Color RenderObject::selectionBackgroundColor() const
1787 { 1787 {
1788 if (!isSelectable()) 1788 if (!isSelectable())
1789 return Color::transparent; 1789 return Color::transparent;
1790 1790
1791 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) 1791 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShad owHost())
1792 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); 1792 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite();
1793 return frame()->selection().isFocusedAndActive() ? 1793 return frame()->selection().isFocusedAndActive() ?
1794 RenderTheme::theme().activeSelectionBackgroundColor() : 1794 RenderTheme::theme().activeSelectionBackgroundColor() :
1795 RenderTheme::theme().inactiveSelectionBackgroundColor(); 1795 RenderTheme::theme().inactiveSelectionBackgroundColor();
1796 } 1796 }
1797 1797
1798 Color RenderObject::selectionColor(int colorProperty) const 1798 Color RenderObject::selectionColor(int colorProperty) const
1799 { 1799 {
1800 // If the element is unselectable, or we are only painting the selection, 1800 // If the element is unselectable, or we are only painting the selection,
1801 // don't override the foreground color with the selection foreground color. 1801 // don't override the foreground color with the selection foreground color.
1802 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) 1802 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly))
1803 return resolveColor(colorProperty); 1803 return resolveColor(colorProperty);
1804 1804
1805 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) 1805 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyleFromParentOrShad owHost())
1806 return resolveColor(pseudoStyle.get(), colorProperty); 1806 return resolveColor(pseudoStyle.get(), colorProperty);
1807 if (!RenderTheme::theme().supportsSelectionForegroundColors()) 1807 if (!RenderTheme::theme().supportsSelectionForegroundColors())
1808 return resolveColor(colorProperty); 1808 return resolveColor(colorProperty);
1809 return frame()->selection().isFocusedAndActive() ? 1809 return frame()->selection().isFocusedAndActive() ?
1810 RenderTheme::theme().activeSelectionForegroundColor() : 1810 RenderTheme::theme().activeSelectionForegroundColor() :
1811 RenderTheme::theme().inactiveSelectionForegroundColor(); 1811 RenderTheme::theme().inactiveSelectionForegroundColor();
1812 } 1812 }
1813 1813
1814 Color RenderObject::selectionForegroundColor() const 1814 Color RenderObject::selectionForegroundColor() const
1815 { 1815 {
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2976 2976
2977 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { 2977 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
2978 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing); 2978 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing);
2979 result->setStyleType(FIRST_LINE_INHERITED); 2979 result->setStyleType(FIRST_LINE_INHERITED);
2980 return result.release(); 2980 return result.release();
2981 } 2981 }
2982 2982
2983 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle); 2983 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle);
2984 } 2984 }
2985 2985
2986 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyleFromParentOrShadowHo st() const
2987 {
2988 if (node() && node()->shadowHost())
2989 return node()->shadowHost()->renderer()->getUncachedPseudoStyle(PseudoSt yleRequest(SELECTION));
esprehn 2014/04/10 22:20:38 I don't think this is right. Now if you have: <di
2990 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2991 }
2992
2986 bool RenderObject::hasBlendMode() const 2993 bool RenderObject::hasBlendMode() const
2987 { 2994 {
2988 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style() ->hasBlendMode(); 2995 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style() ->hasBlendMode();
2989 } 2996 }
2990 2997
2991 static Color decorationColor(const RenderObject* object, RenderStyle* style) 2998 static Color decorationColor(const RenderObject* object, RenderStyle* style)
2992 { 2999 {
2993 // Check for text decoration color first. 3000 // Check for text decoration color first.
2994 StyleColor result = style->visitedDependentDecorationColor(); 3001 StyleColor result = style->visitedDependentDecorationColor();
2995 if (!result.isCurrentColor()) 3002 if (!result.isCurrentColor())
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3357 { 3364 {
3358 if (object1) { 3365 if (object1) {
3359 const WebCore::RenderObject* root = object1; 3366 const WebCore::RenderObject* root = object1;
3360 while (root->parent()) 3367 while (root->parent())
3361 root = root->parent(); 3368 root = root->parent();
3362 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3369 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3363 } 3370 }
3364 } 3371 }
3365 3372
3366 #endif 3373 #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