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 14 matching lines...) Expand all Loading... | |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/rendering/RenderObject.h" | 28 #include "core/rendering/RenderObject.h" |
29 | 29 |
30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
31 #include "RuntimeEnabledFeatures.h" | 31 #include "RuntimeEnabledFeatures.h" |
32 #include "core/accessibility/AXObjectCache.h" | 32 #include "core/accessibility/AXObjectCache.h" |
33 #include "core/animation/ActiveAnimations.h" | 33 #include "core/animation/ActiveAnimations.h" |
34 #include "core/css/resolver/StyleResolver.h" | 34 #include "core/css/resolver/StyleResolver.h" |
35 #include "core/dom/ElementTraversal.h" | |
35 #include "core/editing/EditingBoundary.h" | 36 #include "core/editing/EditingBoundary.h" |
36 #include "core/editing/FrameSelection.h" | 37 #include "core/editing/FrameSelection.h" |
37 #include "core/editing/htmlediting.h" | 38 #include "core/editing/htmlediting.h" |
38 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
39 #include "core/fetch/ResourceLoader.h" | 40 #include "core/fetch/ResourceLoader.h" |
40 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
41 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
42 #include "core/html/HTMLAnchorElement.h" | 43 #include "core/html/HTMLAnchorElement.h" |
43 #include "core/html/HTMLElement.h" | 44 #include "core/html/HTMLElement.h" |
44 #include "core/html/HTMLHtmlElement.h" | 45 #include "core/html/HTMLHtmlElement.h" |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2977 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons t | 2978 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons t |
2978 { | 2979 { |
2979 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) | 2980 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) |
2980 return nullptr; | 2981 return nullptr; |
2981 | 2982 |
2982 if (!parentStyle) { | 2983 if (!parentStyle) { |
2983 ASSERT(!ownStyle); | 2984 ASSERT(!ownStyle); |
2984 parentStyle = style(); | 2985 parentStyle = style(); |
2985 } | 2986 } |
2986 | 2987 |
2987 // FIXME: This "find nearest element parent" should be a helper function. | 2988 if (!node()) |
2988 Node* n = node(); | |
2989 while (n && !n->isElementNode()) | |
2990 n = n->parentNode(); | |
2991 if (!n) | |
2992 return nullptr; | 2989 return nullptr; |
2993 Element* element = toElement(n); | 2990 |
2991 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
| |
2992 if (!element) | |
2993 return nullptr; | |
2994 | 2994 |
2995 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { | 2995 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { |
2996 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing); | 2996 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing); |
2997 result->setStyleType(FIRST_LINE_INHERITED); | 2997 result->setStyleType(FIRST_LINE_INHERITED); |
2998 return result.release(); | 2998 return result.release(); |
2999 } | 2999 } |
3000 | 3000 |
3001 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle); | 3001 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud oStyleRequest, parentStyle); |
3002 } | 3002 } |
3003 | 3003 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3375 { | 3375 { |
3376 if (object1) { | 3376 if (object1) { |
3377 const WebCore::RenderObject* root = object1; | 3377 const WebCore::RenderObject* root = object1; |
3378 while (root->parent()) | 3378 while (root->parent()) |
3379 root = root->parent(); | 3379 root = root->parent(); |
3380 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3380 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3381 } | 3381 } |
3382 } | 3382 } |
3383 | 3383 |
3384 #endif | 3384 #endif |
OLD | NEW |