Chromium Code Reviews| Index: Source/core/rendering/RenderObject.cpp |
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
| index 36cc3c3a510e50dfaeb972df4d7b9afffce99ba7..b8530fdfa7e6f578e7297735311318d09bed8b67 100644 |
| --- a/Source/core/rendering/RenderObject.cpp |
| +++ b/Source/core/rendering/RenderObject.cpp |
| @@ -32,6 +32,7 @@ |
| #include "core/accessibility/AXObjectCache.h" |
| #include "core/animation/ActiveAnimations.h" |
| #include "core/css/resolver/StyleResolver.h" |
| +#include "core/dom/ElementTraversal.h" |
| #include "core/editing/EditingBoundary.h" |
| #include "core/editing/FrameSelection.h" |
| #include "core/editing/htmlediting.h" |
| @@ -2984,13 +2985,12 @@ PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe |
| parentStyle = style(); |
| } |
| - // FIXME: This "find nearest element parent" should be a helper function. |
| - Node* n = node(); |
| - while (n && !n->isElementNode()) |
| - n = n->parentNode(); |
| - if (!n) |
| + if (!node()) |
| + return nullptr; |
| + |
| + Element* element = Traversal<HTMLElement>::firstAncestorOrSelf(*node()); |
|
Inactive
2014/04/08 16:49:12
If I remember correctly, my initial patch did this
Inactive
2014/04/08 16:54:30
Oh and using Traversal<HTMLElement> seems really w
|
| + if (!element) |
| return nullptr; |
| - Element* element = toElement(n); |
| if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { |
| RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForElement(element, parentStyle, DisallowStyleSharing); |