| 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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 showRenderObject(printedCharacters); | 1636 showRenderObject(printedCharacters); |
| 1637 if (!this) | 1637 if (!this) |
| 1638 return; | 1638 return; |
| 1639 | 1639 |
| 1640 for (const RenderObject* child = firstChild(); child; child = child->nextSib
ling()) | 1640 for (const RenderObject* child = firstChild(); child; child = child->nextSib
ling()) |
| 1641 child->showRenderTreeAndMark(markedObject1, markedLabel1, markedObject2,
markedLabel2, depth + 1); | 1641 child->showRenderTreeAndMark(markedObject1, markedLabel1, markedObject2,
markedLabel2, depth + 1); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 #endif // NDEBUG | 1644 #endif // NDEBUG |
| 1645 | 1645 |
| 1646 static bool shouldUseSelectionColor(const RenderStyle& style) |
| 1647 { |
| 1648 return style.userSelect() != SELECT_NONE || style.userModify() != READ_ONLY; |
| 1649 } |
| 1650 |
| 1646 Color RenderObject::selectionBackgroundColor() const | 1651 Color RenderObject::selectionBackgroundColor() const |
| 1647 { | 1652 { |
| 1648 Color color; | 1653 Color color; |
| 1649 if (style()->userSelect() != SELECT_NONE) { | 1654 if (shouldUseSelectionColor(*style())) { |
| 1650 RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ
est(SELECTION)); | 1655 RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ
est(SELECTION)); |
| 1651 if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgro
undColor).isValid()) | 1656 if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgro
undColor).isValid()) |
| 1652 color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColo
r).blendWithWhite(); | 1657 color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColo
r).blendWithWhite(); |
| 1653 else | 1658 else |
| 1654 color = frame()->selection()->isFocusedAndActive() ? | 1659 color = frame()->selection()->isFocusedAndActive() ? |
| 1655 theme()->activeSelectionBackgroundColor() : | 1660 theme()->activeSelectionBackgroundColor() : |
| 1656 theme()->inactiveSelectionBackgroundColor(); | 1661 theme()->inactiveSelectionBackgroundColor(); |
| 1657 } | 1662 } |
| 1658 | 1663 |
| 1659 return color; | 1664 return color; |
| 1660 } | 1665 } |
| 1661 | 1666 |
| 1662 Color RenderObject::selectionColor(int colorProperty) const | 1667 Color RenderObject::selectionColor(int colorProperty) const |
| 1663 { | 1668 { |
| 1664 Color color; | 1669 Color color; |
| 1665 // If the element is unselectable, or we are only painting the selection, | 1670 // If the element is unselectable, or we are only painting the selection, |
| 1666 // don't override the foreground color with the selection foreground color. | 1671 // don't override the foreground color with the selection foreground color. |
| 1667 if (style()->userSelect() == SELECT_NONE | 1672 if (!shouldUseSelectionColor(*style()) |
| 1668 || (frame()->view()->paintBehavior() & PaintBehaviorSelectionOnly)) | 1673 || (frame()->view()->paintBehavior() & PaintBehaviorSelectionOnly)) |
| 1669 return color; | 1674 return color; |
| 1670 | 1675 |
| 1671 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ
est(SELECTION))) { | 1676 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequ
est(SELECTION))) { |
| 1672 color = pseudoStyle->visitedDependentColor(colorProperty); | 1677 color = pseudoStyle->visitedDependentColor(colorProperty); |
| 1673 if (!color.isValid()) | 1678 if (!color.isValid()) |
| 1674 color = pseudoStyle->visitedDependentColor(CSSPropertyColor); | 1679 color = pseudoStyle->visitedDependentColor(CSSPropertyColor); |
| 1675 } else | 1680 } else |
| 1676 color = frame()->selection()->isFocusedAndActive() ? | 1681 color = frame()->selection()->isFocusedAndActive() ? |
| 1677 theme()->activeSelectionForegroundColor() : | 1682 theme()->activeSelectionForegroundColor() : |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3232 { | 3237 { |
| 3233 if (object1) { | 3238 if (object1) { |
| 3234 const WebCore::RenderObject* root = object1; | 3239 const WebCore::RenderObject* root = object1; |
| 3235 while (root->parent()) | 3240 while (root->parent()) |
| 3236 root = root->parent(); | 3241 root = root->parent(); |
| 3237 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3242 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3238 } | 3243 } |
| 3239 } | 3244 } |
| 3240 | 3245 |
| 3241 #endif | 3246 #endif |
| OLD | NEW |