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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 RefPtr<RenderStyle> pseudoStyle; |
1792 if (node() && node()->shadowHost()) { | |
1793 // If the element is in shadow tree of input element, then get the Pseud oStyle | |
1794 // from the input element. | |
1795 pseudoStyle = node()->shadowHost()->renderer()->getUncachedPseudoStyle(P seudoStyleRequest(SELECTION)); | |
1796 } else { | |
1797 pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); | |
1798 } | |
1799 | |
1800 if (pseudoStyle) | |
1792 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); | 1801 return resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blend WithWhite(); |
1802 | |
1793 return frame()->selection().isFocusedAndActive() ? | 1803 return frame()->selection().isFocusedAndActive() ? |
1794 RenderTheme::theme().activeSelectionBackgroundColor() : | 1804 RenderTheme::theme().activeSelectionBackgroundColor() : |
1795 RenderTheme::theme().inactiveSelectionBackgroundColor(); | 1805 RenderTheme::theme().inactiveSelectionBackgroundColor(); |
1796 } | 1806 } |
1797 | 1807 |
1798 Color RenderObject::selectionColor(int colorProperty) const | 1808 Color RenderObject::selectionColor(int colorProperty) const |
1799 { | 1809 { |
1800 // If the element is unselectable, or we are only painting the selection, | 1810 // If the element is unselectable, or we are only painting the selection, |
1801 // don't override the foreground color with the selection foreground color. | 1811 // don't override the foreground color with the selection foreground color. |
1802 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) | 1812 if (!isSelectable() || (frame()->view()->paintBehavior() & PaintBehaviorSele ctionOnly)) |
1803 return resolveColor(colorProperty); | 1813 return resolveColor(colorProperty); |
1804 | 1814 |
1805 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ est(SELECTION))) | 1815 RefPtr<RenderStyle> pseudoStyle; |
1816 if (node() && node()->shadowHost()) { | |
1817 // If the element is in shadow tree of input element, then get the Pseud oStyle | |
1818 // from the input element. | |
1819 pseudoStyle = node()->shadowHost()->renderer()->getUncachedPseudoStyle(P seudoStyleRequest(SELECTION)); | |
1820 } else { | |
1821 pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); | |
esprehn
2014/04/09 20:36:06
Why isn't this in a method, you do the exact same
| |
1822 } | |
1823 | |
1824 if (pseudoStyle) | |
1806 return resolveColor(pseudoStyle.get(), colorProperty); | 1825 return resolveColor(pseudoStyle.get(), colorProperty); |
1826 | |
1807 if (!RenderTheme::theme().supportsSelectionForegroundColors()) | 1827 if (!RenderTheme::theme().supportsSelectionForegroundColors()) |
1808 return resolveColor(colorProperty); | 1828 return resolveColor(colorProperty); |
1809 return frame()->selection().isFocusedAndActive() ? | 1829 return frame()->selection().isFocusedAndActive() ? |
1810 RenderTheme::theme().activeSelectionForegroundColor() : | 1830 RenderTheme::theme().activeSelectionForegroundColor() : |
1811 RenderTheme::theme().inactiveSelectionForegroundColor(); | 1831 RenderTheme::theme().inactiveSelectionForegroundColor(); |
1812 } | 1832 } |
1813 | 1833 |
1814 Color RenderObject::selectionForegroundColor() const | 1834 Color RenderObject::selectionForegroundColor() const |
1815 { | 1835 { |
1816 return selectionColor(CSSPropertyWebkitTextFillColor); | 1836 return selectionColor(CSSPropertyWebkitTextFillColor); |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3357 { | 3377 { |
3358 if (object1) { | 3378 if (object1) { |
3359 const WebCore::RenderObject* root = object1; | 3379 const WebCore::RenderObject* root = object1; |
3360 while (root->parent()) | 3380 while (root->parent()) |
3361 root = root->parent(); | 3381 root = root->parent(); |
3362 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3382 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3363 } | 3383 } |
3364 } | 3384 } |
3365 | 3385 |
3366 #endif | 3386 #endif |
OLD | NEW |