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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Support display: contents for elements, first-line and first-letter pseudos. Created 3 years, 10 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 16 matching lines...) Expand all
27 #include "core/dom/Node.h" 27 #include "core/dom/Node.h"
28 #include "core/dom/NodeComputedStyle.h" 28 #include "core/dom/NodeComputedStyle.h"
29 #include "core/frame/FrameHost.h" 29 #include "core/frame/FrameHost.h"
30 #include "core/layout/api/LayoutViewItem.h" 30 #include "core/layout/api/LayoutViewItem.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 StyleResolverState::StyleResolverState( 34 StyleResolverState::StyleResolverState(
35 Document& document, 35 Document& document,
36 const ElementResolveContext& elementContext, 36 const ElementResolveContext& elementContext,
37 const ComputedStyle* parentStyle) 37 const ComputedStyle* parentStyle,
38 const ComputedStyle* layoutParentStyle)
38 : m_elementContext(elementContext), 39 : m_elementContext(elementContext),
39 m_document(document), 40 m_document(document),
40 m_style(nullptr), 41 m_style(nullptr),
41 // TODO(jchaffraix): We should make m_parentStyle const 42 // TODO(jchaffraix): We should make m_parentStyle const
42 // (https://crbug.com/468152) 43 // (https://crbug.com/468152)
43 m_parentStyle(const_cast<ComputedStyle*>(parentStyle)), 44 m_parentStyle(const_cast<ComputedStyle*>(parentStyle)),
45 m_layoutParentStyle(layoutParentStyle),
44 m_isAnimationInterpolationMapReady(false), 46 m_isAnimationInterpolationMapReady(false),
45 m_isAnimatingCustomProperties(false), 47 m_isAnimatingCustomProperties(false),
46 m_applyPropertyToRegularStyle(true), 48 m_applyPropertyToRegularStyle(true),
47 m_applyPropertyToVisitedLinkStyle(false), 49 m_applyPropertyToVisitedLinkStyle(false),
48 m_hasDirAutoAttribute(false), 50 m_hasDirAutoAttribute(false),
49 m_fontBuilder(document), 51 m_fontBuilder(document),
50 m_elementStyleResources(document, document.devicePixelRatio()) { 52 m_elementStyleResources(document, document.devicePixelRatio()) {
53 DCHECK(!!m_parentStyle == !!m_layoutParentStyle);
54
51 if (!m_parentStyle) { 55 if (!m_parentStyle) {
52 // TODO(jchaffraix): We should make m_parentStyle const 56 // TODO(jchaffraix): We should make m_parentStyle const
53 // (https://crbug.com/468152) 57 // (https://crbug.com/468152)
54 m_parentStyle = const_cast<ComputedStyle*>(m_elementContext.parentStyle()); 58 m_parentStyle = const_cast<ComputedStyle*>(m_elementContext.parentStyle());
55 } 59 }
56 60
61 if (!m_layoutParentStyle)
62 m_layoutParentStyle = m_elementContext.layoutParentStyle();
63
64 if (!m_layoutParentStyle)
65 m_layoutParentStyle = m_parentStyle;
66
57 DCHECK(document.isActive()); 67 DCHECK(document.isActive());
58 } 68 }
59 69
60 StyleResolverState::StyleResolverState(Document& document, 70 StyleResolverState::StyleResolverState(Document& document,
61 Element* element, 71 Element* element,
62 const ComputedStyle* parentStyle) 72 const ComputedStyle* parentStyle,
73 const ComputedStyle* layoutParentStyle)
63 : StyleResolverState(document, 74 : StyleResolverState(document,
64 element ? ElementResolveContext(*element) 75 element ? ElementResolveContext(*element)
65 : ElementResolveContext(document), 76 : ElementResolveContext(document),
66 parentStyle) {} 77 parentStyle,
78 layoutParentStyle) {}
67 79
68 StyleResolverState::~StyleResolverState() { 80 StyleResolverState::~StyleResolverState() {
69 // For performance reasons, explicitly clear HeapVectors and 81 // For performance reasons, explicitly clear HeapVectors and
70 // HeapHashMaps to avoid giving a pressure on Oilpan's GC. 82 // HeapHashMaps to avoid giving a pressure on Oilpan's GC.
71 m_animationUpdate.clear(); 83 m_animationUpdate.clear();
72 } 84 }
73 85
74 void StyleResolverState::setStyle(PassRefPtr<ComputedStyle> style) { 86 void StyleResolverState::setStyle(PassRefPtr<ComputedStyle> style) {
75 // FIXME: Improve RAII of StyleResolverState to remove this function. 87 // FIXME: Improve RAII of StyleResolverState to remove this function.
76 m_style = style; 88 m_style = style;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 HeapHashMap<CSSPropertyID, Member<const CSSValue>>* map = 123 HeapHashMap<CSSPropertyID, Member<const CSSValue>>* map =
112 m_parsedPropertiesForPendingSubstitutionCache.get(&value); 124 m_parsedPropertiesForPendingSubstitutionCache.get(&value);
113 if (!map) { 125 if (!map) {
114 map = new HeapHashMap<CSSPropertyID, Member<const CSSValue>>; 126 map = new HeapHashMap<CSSPropertyID, Member<const CSSValue>>;
115 m_parsedPropertiesForPendingSubstitutionCache.set(&value, map); 127 m_parsedPropertiesForPendingSubstitutionCache.set(&value, map);
116 } 128 }
117 return *map; 129 return *map;
118 } 130 }
119 131
120 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698