Chromium Code Reviews| Index: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
| diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
| index 78acfb0d75c97ab3fd9c16728662883efc8baebf..0dc0fea85520b55967942ac60bbacbdef6748bf6 100644 |
| --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
| +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
| @@ -839,12 +839,30 @@ RGBA32 AXLayoutObject::backgroundColor() const |
| if (!getLayoutObject()) |
| return AXNodeObject::backgroundColor(); |
| - const ComputedStyle* style = getLayoutObject()->style(); |
| - if (!style || !style->hasBackground()) |
| - return AXNodeObject::backgroundColor(); |
| + Color blendedColor = Color::transparent; |
| + for (LayoutObject* layoutObject = getLayoutObject(); layoutObject; |
|
aboxhall
2016/05/24 17:06:34
Unfortunately, walking up the parent chain often i
|
| + layoutObject = layoutObject->parent()) { |
| + const ComputedStyle* style = layoutObject->style(); |
| + if (!style || !style->hasBackground()) |
| + continue; |
| - Color color = style->visitedDependentColor(CSSPropertyBackgroundColor); |
| - return color.rgb(); |
| + Color currentColor = style->visitedDependentColor(CSSPropertyBackgroundColor); |
| + blendedColor = blendedColor.blend(currentColor); |
| + // Continue blending until we get opacity to more than 50% |
| + if (blendedColor.alpha() > 128) |
|
aboxhall
2016/05/24 17:06:34
I share Dominic's concern here: for example, 51% r
|
| + break; |
| + } |
| + |
| + // If we still have a low level of opacity, blend in the document base color. |
| + if (blendedColor.alpha() <= 128) { |
| + FrameView* view = documentFrameView(); |
| + if (view) { |
| + Color documentBaseColor = view->baseBackgroundColor(); |
| + blendedColor = blendedColor.blend(documentBaseColor); |
| + } |
| + } |
| + |
| + return blendedColor.rgb(); |
| } |
| RGBA32 AXLayoutObject::color() const |
| @@ -1678,11 +1696,11 @@ Document* AXLayoutObject::getDocument() const |
| FrameView* AXLayoutObject::documentFrameView() const |
| { |
| - if (!m_layoutObject) |
| - return 0; |
| + if (!getLayoutObject()) |
| + return nullptr; |
| // this is the LayoutObject's Document's LocalFrame's FrameView |
| - return m_layoutObject->document().view(); |
| + return getLayoutObject()->document().view(); |
| } |
| Element* AXLayoutObject::anchorElement() const |