Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 832 if (!node->isElementNode()) | 832 if (!node->isElementNode()) |
| 833 return nullAtom; | 833 return nullAtom; |
| 834 return toElement(node)->getAttribute(accesskeyAttr); | 834 return toElement(node)->getAttribute(accesskeyAttr); |
| 835 } | 835 } |
| 836 | 836 |
| 837 RGBA32 AXLayoutObject::backgroundColor() const | 837 RGBA32 AXLayoutObject::backgroundColor() const |
| 838 { | 838 { |
| 839 if (!getLayoutObject()) | 839 if (!getLayoutObject()) |
| 840 return AXNodeObject::backgroundColor(); | 840 return AXNodeObject::backgroundColor(); |
| 841 | 841 |
| 842 const ComputedStyle* style = getLayoutObject()->style(); | 842 Color blendedColor = Color::transparent; |
| 843 if (!style || !style->hasBackground()) | 843 for (LayoutObject* layoutObject = getLayoutObject(); layoutObject; |
|
aboxhall
2016/05/24 17:06:34
Unfortunately, walking up the parent chain often i
| |
| 844 return AXNodeObject::backgroundColor(); | 844 layoutObject = layoutObject->parent()) { |
| 845 const ComputedStyle* style = layoutObject->style(); | |
| 846 if (!style || !style->hasBackground()) | |
| 847 continue; | |
| 845 | 848 |
| 846 Color color = style->visitedDependentColor(CSSPropertyBackgroundColor); | 849 Color currentColor = style->visitedDependentColor(CSSPropertyBackgroundC olor); |
| 847 return color.rgb(); | 850 blendedColor = blendedColor.blend(currentColor); |
| 851 // Continue blending until we get opacity to more than 50% | |
| 852 if (blendedColor.alpha() > 128) | |
|
aboxhall
2016/05/24 17:06:34
I share Dominic's concern here: for example, 51% r
| |
| 853 break; | |
| 854 } | |
| 855 | |
| 856 // If we still have a low level of opacity, blend in the document base color . | |
| 857 if (blendedColor.alpha() <= 128) { | |
| 858 FrameView* view = documentFrameView(); | |
| 859 if (view) { | |
| 860 Color documentBaseColor = view->baseBackgroundColor(); | |
| 861 blendedColor = blendedColor.blend(documentBaseColor); | |
| 862 } | |
| 863 } | |
| 864 | |
| 865 return blendedColor.rgb(); | |
| 848 } | 866 } |
| 849 | 867 |
| 850 RGBA32 AXLayoutObject::color() const | 868 RGBA32 AXLayoutObject::color() const |
| 851 { | 869 { |
| 852 if (!getLayoutObject() || isColorWell()) | 870 if (!getLayoutObject() || isColorWell()) |
| 853 return AXNodeObject::color(); | 871 return AXNodeObject::color(); |
| 854 | 872 |
| 855 const ComputedStyle* style = getLayoutObject()->style(); | 873 const ComputedStyle* style = getLayoutObject()->style(); |
| 856 if (!style) | 874 if (!style) |
| 857 return AXNodeObject::color(); | 875 return AXNodeObject::color(); |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1671 | 1689 |
| 1672 Document* AXLayoutObject::getDocument() const | 1690 Document* AXLayoutObject::getDocument() const |
| 1673 { | 1691 { |
| 1674 if (!getLayoutObject()) | 1692 if (!getLayoutObject()) |
| 1675 return nullptr; | 1693 return nullptr; |
| 1676 return &getLayoutObject()->document(); | 1694 return &getLayoutObject()->document(); |
| 1677 } | 1695 } |
| 1678 | 1696 |
| 1679 FrameView* AXLayoutObject::documentFrameView() const | 1697 FrameView* AXLayoutObject::documentFrameView() const |
| 1680 { | 1698 { |
| 1681 if (!m_layoutObject) | 1699 if (!getLayoutObject()) |
| 1682 return 0; | 1700 return nullptr; |
| 1683 | 1701 |
| 1684 // this is the LayoutObject's Document's LocalFrame's FrameView | 1702 // this is the LayoutObject's Document's LocalFrame's FrameView |
| 1685 return m_layoutObject->document().view(); | 1703 return getLayoutObject()->document().view(); |
| 1686 } | 1704 } |
| 1687 | 1705 |
| 1688 Element* AXLayoutObject::anchorElement() const | 1706 Element* AXLayoutObject::anchorElement() const |
| 1689 { | 1707 { |
| 1690 if (!m_layoutObject) | 1708 if (!m_layoutObject) |
| 1691 return 0; | 1709 return 0; |
| 1692 | 1710 |
| 1693 AXObjectCacheImpl& cache = axObjectCache(); | 1711 AXObjectCacheImpl& cache = axObjectCache(); |
| 1694 LayoutObject* currLayoutObject; | 1712 LayoutObject* currLayoutObject; |
| 1695 | 1713 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2477 if (label && label->layoutObject()) { | 2495 if (label && label->layoutObject()) { |
| 2478 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); | 2496 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); |
| 2479 result.unite(labelRect); | 2497 result.unite(labelRect); |
| 2480 } | 2498 } |
| 2481 } | 2499 } |
| 2482 | 2500 |
| 2483 return result; | 2501 return result; |
| 2484 } | 2502 } |
| 2485 | 2503 |
| 2486 } // namespace blink | 2504 } // namespace blink |
| OLD | NEW |