Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY); | 1773 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY); |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 Color RenderObject::selectionBackgroundColor() const | 1776 Color RenderObject::selectionBackgroundColor() const |
| 1777 { | 1777 { |
| 1778 if (!isSelectable()) | 1778 if (!isSelectable()) |
| 1779 return Color::transparent; | 1779 return Color::transparent; |
| 1780 | 1780 |
| 1781 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) | 1781 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) |
| 1782 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); | 1782 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); |
| 1783 | |
| 1784 // If the element is in shadow tree of input element, then get the PseudoSty le | |
| 1785 // from the input element. | |
| 1786 if (node() && node()->shadowHost()) { | |
| 1787 RenderObject* shadowHostRenderer = node()->shadowHost()->renderer(); | |
|
esprehn
2014/04/03 19:59:07
Your host must have a renderer if you do. The null
deepak.sa
2014/04/07 15:20:00
Done.
| |
| 1788 if (shadowHostRenderer && shadowHostRenderer->isTextControl()) { | |
| 1789 if (RefPtr<RenderStyle> pseudoStyle = shadowHostRenderer->getUncache dPseudoStyle(PseudoStyleRequest(SELECTION))) | |
| 1790 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColo r).blendWithWhite(); | |
| 1791 } | |
| 1792 } | |
| 1793 | |
| 1783 return frame()->selection().isFocusedAndActive() ? | 1794 return frame()->selection().isFocusedAndActive() ? |
| 1784 RenderTheme::theme().activeSelectionBackgroundColor() : | 1795 RenderTheme::theme().activeSelectionBackgroundColor() : |
| 1785 RenderTheme::theme().inactiveSelectionBackgroundColor(); | 1796 RenderTheme::theme().inactiveSelectionBackgroundColor(); |
| 1786 } | 1797 } |
| 1787 | 1798 |
| 1788 Color RenderObject::selectionColor(int colorProperty) const | 1799 Color RenderObject::selectionColor(int colorProperty) const |
| 1789 { | 1800 { |
| 1790 // 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, |
| 1791 // don't override the foreground color with the selection foreground color. | 1802 // don't override the foreground color with the selection foreground color. |
| 1792 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) | 1803 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) |
| 1793 return resolveColor(colorProperty); | 1804 return resolveColor(colorProperty); |
| 1794 | 1805 |
| 1795 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) | 1806 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) |
| 1796 return resolveColor(pseudoStyle.get(), colorProperty); | 1807 return resolveColor(pseudoStyle.get(), colorProperty); |
| 1808 | |
| 1809 // If the element is in shadow tree of input element, then get the PseudoSty le | |
| 1810 // from the input element. | |
| 1811 if (node() && node()->shadowHost()) { | |
| 1812 RenderObject* shadowHostRenderer = node()->shadowHost()->renderer(); | |
| 1813 if (shadowHostRenderer && shadowHostRenderer->isTextControl()) { | |
| 1814 if (RefPtr<RenderStyle> pseudoStyle = shadowHostRenderer->getUncache dPseudoStyle(PseudoStyleRequest(SELECTION))) | |
| 1815 return resolveColor(pseudoStyle.get(), colorProperty); | |
| 1816 } | |
| 1817 } | |
| 1818 | |
| 1797 if (!RenderTheme::theme().supportsSelectionForegroundColors()) | 1819 if (!RenderTheme::theme().supportsSelectionForegroundColors()) |
| 1798 return resolveColor(colorProperty); | 1820 return resolveColor(colorProperty); |
| 1799 return frame()->selection().isFocusedAndActive() ? | 1821 return frame()->selection().isFocusedAndActive() ? |
| 1800 RenderTheme::theme().activeSelectionForegroundColor() : | 1822 RenderTheme::theme().activeSelectionForegroundColor() : |
| 1801 RenderTheme::theme().inactiveSelectionForegroundColor(); | 1823 RenderTheme::theme().inactiveSelectionForegroundColor(); |
| 1802 } | 1824 } |
| 1803 | 1825 |
| 1804 Color RenderObject::selectionForegroundColor() const | 1826 Color RenderObject::selectionForegroundColor() const |
| 1805 { | 1827 { |
| 1806 return selectionColor(CSSPropertyWebkitTextFillColor); | 1828 return selectionColor(CSSPropertyWebkitTextFillColor); |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3368 { | 3390 { |
| 3369 if (object1) { | 3391 if (object1) { |
| 3370 const WebCore::RenderObject* root = object1; | 3392 const WebCore::RenderObject* root = object1; |
| 3371 while (root->parent()) | 3393 while (root->parent()) |
| 3372 root = root->parent(); | 3394 root = root->parent(); |
| 3373 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3395 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3374 } | 3396 } |
| 3375 } | 3397 } |
| 3376 | 3398 |
| 3377 #endif | 3399 #endif |
| OLD | NEW |