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

Side by Side Diff: third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp

Issue 1970183002: Don't use canCollapseAnonymousBlockChild() to determine whether to truncate text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Declaration soup - aka LayoutTest. Created 4 years, 7 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
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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // If we are looking at a first letter element then we need to find the 102 // If we are looking at a first letter element then we need to find the
103 // first letter text layoutObject from the parent node, and not ourselves. 103 // first letter text layoutObject from the parent node, and not ourselves.
104 if (element.isFirstLetterPseudoElement()) 104 if (element.isFirstLetterPseudoElement())
105 parentLayoutObject = element.parentOrShadowHostElement()->layoutObject() ; 105 parentLayoutObject = element.parentOrShadowHostElement()->layoutObject() ;
106 else 106 else
107 parentLayoutObject = element.layoutObject(); 107 parentLayoutObject = element.layoutObject();
108 108
109 if (!parentLayoutObject 109 if (!parentLayoutObject
110 || !parentLayoutObject->style()->hasPseudoStyle(PseudoIdFirstLetter) 110 || !parentLayoutObject->style()->hasPseudoStyle(PseudoIdFirstLetter)
111 || !canHaveGeneratedChildren(*parentLayoutObject) 111 || !canHaveGeneratedChildren(*parentLayoutObject)
112 || !parentLayoutObject->canHaveFirstLineOrFirstLetterStyle()) 112 || !parentLayoutObject->behavesLikeBlockContainer())
113 return nullptr; 113 return nullptr;
114 114
115 // Drill down into our children and look for our first text child. 115 // Drill down into our children and look for our first text child.
116 LayoutObject* firstLetterTextLayoutObject = parentLayoutObject->slowFirstChi ld(); 116 LayoutObject* firstLetterTextLayoutObject = parentLayoutObject->slowFirstChi ld();
117 while (firstLetterTextLayoutObject) { 117 while (firstLetterTextLayoutObject) {
118 // This can be called when the first letter layoutObject is already in t he tree. We do not 118 // This can be called when the first letter layoutObject is already in t he tree. We do not
119 // want to consider that layoutObject for our text layoutObject so we go to the sibling (which is 119 // want to consider that layoutObject for our text layoutObject so we go to the sibling (which is
120 // the LayoutTextFragment for the remaining text). 120 // the LayoutTextFragment for the remaining text).
121 if (firstLetterTextLayoutObject->style() && firstLetterTextLayoutObject- >style()->styleType() == PseudoIdFirstLetter) { 121 if (firstLetterTextLayoutObject->style() && firstLetterTextLayoutObject- >style()->styleType() == PseudoIdFirstLetter) {
122 firstLetterTextLayoutObject = firstLetterTextLayoutObject->nextSibli ng(); 122 firstLetterTextLayoutObject = firstLetterTextLayoutObject->nextSibli ng();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 // We only manage the style for the generated content items. 313 // We only manage the style for the generated content items.
314 if (!child->isText() && !child->isQuote() && !child->isImage()) 314 if (!child->isText() && !child->isQuote() && !child->isImage())
315 continue; 315 continue;
316 316
317 child->setPseudoStyle(layoutObject->mutableStyle()); 317 child->setPseudoStyle(layoutObject->mutableStyle());
318 } 318 }
319 } 319 }
320 320
321 } // namespace blink 321 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698