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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2727853002: [css-display] Support display: contents pseudo-elements.
Patch Set: [css-display] Support display: contents pseudo-elements. Created 3 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
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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 image->setIsGeneratedContent(); 167 image->setIsGeneratedContent();
168 } else { 168 } else {
169 image->setImageResource(LayoutImageResource::create()); 169 image->setImageResource(LayoutImageResource::create());
170 } 170 }
171 image->setStyleInternal(nullptr); 171 image->setStyleInternal(nullptr);
172 return image; 172 return image;
173 } 173 }
174 174
175 switch (style.display()) { 175 switch (style.display()) {
176 case EDisplay::None: 176 case EDisplay::None:
177 return nullptr;
177 case EDisplay::Contents: 178 case EDisplay::Contents:
178 return nullptr; 179 if (LIKELY(!element->isPseudoElement()))
180 return nullptr;
181 // fall through
179 case EDisplay::Inline: 182 case EDisplay::Inline:
180 return new LayoutInline(element); 183 return new LayoutInline(element);
181 case EDisplay::Block: 184 case EDisplay::Block:
182 case EDisplay::FlowRoot: 185 case EDisplay::FlowRoot:
183 case EDisplay::InlineBlock: 186 case EDisplay::InlineBlock:
184 if (RuntimeEnabledFeatures::layoutNGEnabled()) 187 if (RuntimeEnabledFeatures::layoutNGEnabled())
185 return new LayoutNGBlockFlow(element); 188 return new LayoutNGBlockFlow(element);
186 return new LayoutBlockFlow(element); 189 return new LayoutBlockFlow(element);
187 case EDisplay::ListItem: 190 case EDisplay::ListItem:
188 return new LayoutListItem(element); 191 return new LayoutListItem(element);
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3012 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType( 3015 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(
3013 Cached, isText() ? parent() : this, m_style.get())) 3016 Cached, isText() ? parent() : this, m_style.get()))
3014 return style.get(); 3017 return style.get();
3015 3018
3016 return m_style.get(); 3019 return m_style.get();
3017 } 3020 }
3018 3021
3019 ComputedStyle* LayoutObject::getCachedPseudoStyle( 3022 ComputedStyle* LayoutObject::getCachedPseudoStyle(
3020 PseudoId pseudo, 3023 PseudoId pseudo,
3021 const ComputedStyle* parentStyle) const { 3024 const ComputedStyle* parentStyle) const {
3025 DCHECK_NE(pseudo, PseudoIdBefore);
3026 DCHECK_NE(pseudo, PseudoIdAfter);
3027
3022 if (pseudo < FirstInternalPseudoId && !style()->hasPseudoStyle(pseudo)) 3028 if (pseudo < FirstInternalPseudoId && !style()->hasPseudoStyle(pseudo))
3023 return nullptr; 3029 return nullptr;
3024 3030
3025 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo); 3031 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo);
3026 if (cachedStyle) 3032 if (cachedStyle)
3027 return cachedStyle; 3033 return cachedStyle;
3028 3034
3029 RefPtr<ComputedStyle> result = 3035 RefPtr<ComputedStyle> result =
3030 getUncachedPseudoStyle(PseudoStyleRequest(pseudo), parentStyle); 3036 getUncachedPseudoStyle(PseudoStyleRequest(pseudo), parentStyle);
3031 if (result) 3037 if (result)
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
3529 const blink::LayoutObject* root = object1; 3535 const blink::LayoutObject* root = object1;
3530 while (root->parent()) 3536 while (root->parent())
3531 root = root->parent(); 3537 root = root->parent();
3532 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3538 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3533 } else { 3539 } else {
3534 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3540 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3535 } 3541 }
3536 } 3542 }
3537 3543
3538 #endif 3544 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698