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

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

Issue 201293002: Add Traversal<*Element>::firstAncestor() API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Slight clean up Created 6 years, 9 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 | Annotate | Revision Log
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 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) 2951 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId))
2952 return nullptr; 2952 return nullptr;
2953 2953
2954 if (!parentStyle) { 2954 if (!parentStyle) {
2955 ASSERT(!ownStyle); 2955 ASSERT(!ownStyle);
2956 parentStyle = style(); 2956 parentStyle = style();
2957 } 2957 }
2958 2958
2959 // FIXME: This "find nearest element parent" should be a helper function. 2959 // FIXME: This "find nearest element parent" should be a helper function.
2960 Node* n = node(); 2960 Node* n = node();
2961 while (n && !n->isElementNode()) 2961 if (n && !n->isElementNode())
2962 n = n->parentNode(); 2962 n = ElementTraversal::firstAncestor(*n);
esprehn 2014/03/21 07:58:33 This just makes this code slower and more complica
Inactive 2014/03/21 14:37:24 Kept this change out.
2963 if (!n) 2963 if (!n)
2964 return nullptr; 2964 return nullptr;
2965 Element* element = toElement(n); 2965 Element* element = toElement(n);
2966 2966
2967 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { 2967 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
2968 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing); 2968 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl ement(element, parentStyle, DisallowStyleSharing);
2969 result->setStyleType(FIRST_LINE_INHERITED); 2969 result->setStyleType(FIRST_LINE_INHERITED);
2970 return result.release(); 2970 return result.release();
2971 } 2971 }
2972 2972
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 { 3351 {
3352 if (object1) { 3352 if (object1) {
3353 const WebCore::RenderObject* root = object1; 3353 const WebCore::RenderObject* root = object1;
3354 while (root->parent()) 3354 while (root->parent())
3355 root = root->parent(); 3355 root = root->parent();
3356 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3356 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3357 } 3357 }
3358 } 3358 }
3359 3359
3360 #endif 3360 #endif
OLDNEW
« Source/core/editing/FrameSelection.cpp ('K') | « Source/core/html/parser/HTMLTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698