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

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

Issue 21625003: StyleBuilder should not know about StyleResolver. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 4 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 11 matching lines...) Expand all
22 #include "config.h" 22 #include "config.h"
23 #include "core/css/resolver/StyleResolverState.h" 23 #include "core/css/resolver/StyleResolverState.h"
24 24
25 #include "core/dom/Element.h" 25 #include "core/dom/Element.h"
26 #include "core/dom/Node.h" 26 #include "core/dom/Node.h"
27 #include "core/dom/NodeRenderStyle.h" 27 #include "core/dom/NodeRenderStyle.h"
28 #include "core/page/Page.h" 28 #include "core/page/Page.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 StyleResolverState::StyleResolverState(const Document* newDocument, Element* new Element, RenderStyle* parentStyle, RenderRegion* regionForStyling) 32 StyleResolverState::StyleResolverState(Document* document, Element* element, Ren derStyle* parentStyle, RenderRegion* regionForStyling)
33 : m_regionForStyling(0) 33 : m_regionForStyling(0)
34 , m_applyPropertyToRegularStyle(true) 34 , m_applyPropertyToRegularStyle(true)
35 , m_applyPropertyToVisitedLinkStyle(false) 35 , m_applyPropertyToVisitedLinkStyle(false)
36 , m_lineHeightValue(0) 36 , m_lineHeightValue(0)
37 , m_styleMap(*this, m_elementStyleResources) 37 , m_styleMap(*this, m_elementStyleResources)
38 { 38 {
39 ASSERT(!element() || document() == newDocument); 39 if (element) {
40 if (newElement) 40 m_elementContext = ElementResolveContext(element);
41 m_elementContext = ElementResolveContext(newElement); 41 m_document = m_elementContext.document();
42 else 42 } else {
43 m_elementContext = ElementResolveContext(); 43 m_elementContext = ElementResolveContext();
44 m_document = document;
45 }
44 46
45 m_regionForStyling = regionForStyling; 47 m_regionForStyling = regionForStyling;
46 48
47 if (m_elementContext.resetStyleInheritance()) 49 if (m_elementContext.resetStyleInheritance())
48 m_parentStyle = 0; 50 m_parentStyle = 0;
49 else if (parentStyle) 51 else if (parentStyle)
50 m_parentStyle = parentStyle; 52 m_parentStyle = parentStyle;
51 else if (m_elementContext.parentNode()) 53 else if (m_elementContext.parentNode())
52 m_parentStyle = m_elementContext.parentNode()->renderStyle(); 54 m_parentStyle = m_elementContext.parentNode()->renderStyle();
53 else 55 else
54 m_parentStyle = 0; 56 m_parentStyle = 0;
55 57
56 m_style = 0; 58 m_style = 0;
57 m_elementStyleResources.clear(); 59 m_elementStyleResources.clear();
58 m_fontBuilder.clear(); 60 m_fontBuilder.clear();
59 61
60 // FIXME: StyleResolverState is never passed between documents 62 // FIXME: StyleResolverState is never passed between documents
61 // so we should be able to do this initialization at StyleResolverState 63 // so we should be able to do this initialization at StyleResolverState
62 // createion time instead of now, correct? 64 // createion time instead of now, correct?
63 if (Page* page = newDocument->page()) 65 if (Page* page = document->page())
64 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); 66 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor());
65 } 67 }
66 68
67 StyleResolverState::~StyleResolverState() 69 StyleResolverState::~StyleResolverState()
68 { 70 {
69 m_elementContext = ElementResolveContext(); 71 m_elementContext = ElementResolveContext();
70 m_style = 0; 72 m_style = 0;
71 m_parentStyle = 0; 73 m_parentStyle = 0;
72 m_regionForStyling = 0; 74 m_regionForStyling = 0;
73 m_elementStyleResources.clear(); 75 m_elementStyleResources.clear();
74 m_fontBuilder.clear(); 76 m_fontBuilder.clear();
75 } 77 }
76 78
77 } // namespace WebCore 79 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.h ('k') | Source/core/scripts/templates/StyleBuilder.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698