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 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe
quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons
t | 2960 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe
quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons
t |
2960 { | 2961 { |
2961 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s
tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) | 2962 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s
tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) |
2962 return nullptr; | 2963 return nullptr; |
2963 | 2964 |
2964 if (!parentStyle) { | 2965 if (!parentStyle) { |
2965 ASSERT(!ownStyle); | 2966 ASSERT(!ownStyle); |
2966 parentStyle = style(); | 2967 parentStyle = style(); |
2967 } | 2968 } |
2968 | 2969 |
2969 // FIXME: This "find nearest element parent" should be a helper function. | 2970 if (!node()) |
2970 Node* n = node(); | |
2971 while (n && !n->isElementNode()) | |
2972 n = n->parentNode(); | |
2973 if (!n) | |
2974 return nullptr; | 2971 return nullptr; |
2975 Element* element = toElement(n); | 2972 |
| 2973 Element* element = Traversal<Element>::firstAncestorOrSelf(*node()); |
| 2974 if (!element) |
| 2975 return nullptr; |
2976 | 2976 |
2977 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { | 2977 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { |
2978 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl
ement(element, parentStyle, DisallowStyleSharing); | 2978 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl
ement(element, parentStyle, DisallowStyleSharing); |
2979 result->setStyleType(FIRST_LINE_INHERITED); | 2979 result->setStyleType(FIRST_LINE_INHERITED); |
2980 return result.release(); | 2980 return result.release(); |
2981 } | 2981 } |
2982 | 2982 |
2983 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud
oStyleRequest, parentStyle); | 2983 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud
oStyleRequest, parentStyle); |
2984 } | 2984 } |
2985 | 2985 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 { | 3357 { |
3358 if (object1) { | 3358 if (object1) { |
3359 const WebCore::RenderObject* root = object1; | 3359 const WebCore::RenderObject* root = object1; |
3360 while (root->parent()) | 3360 while (root->parent()) |
3361 root = root->parent(); | 3361 root = root->parent(); |
3362 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3362 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3363 } | 3363 } |
3364 } | 3364 } |
3365 | 3365 |
3366 #endif | 3366 #endif |
OLD | NEW |