Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 227123004: Using ElementTraversal::firstAncestorOrSelf API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replacing HTMLElement with Element Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698