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

Side by Side Diff: Source/core/css/PropertySetCSSStyleDeclaration.cpp

Issue 195953003: Oilpan: Move CSSStyleDeclaration and subclasses to the heap using transistion types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 RefPtr<MutationRecord> m_mutation; 118 RefPtr<MutationRecord> m_mutation;
119 }; 119 };
120 120
121 unsigned StyleAttributeMutationScope::s_scopeCount = 0; 121 unsigned StyleAttributeMutationScope::s_scopeCount = 0;
122 AbstractPropertySetCSSStyleDeclaration* StyleAttributeMutationScope::s_currentDe cl = 0; 122 AbstractPropertySetCSSStyleDeclaration* StyleAttributeMutationScope::s_currentDe cl = 0;
123 bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; 123 bool StyleAttributeMutationScope::s_shouldNotifyInspector = false;
124 bool StyleAttributeMutationScope::s_shouldDeliver = false; 124 bool StyleAttributeMutationScope::s_shouldDeliver = false;
125 125
126 } // namespace 126 } // namespace
127 127
128 #if !ENABLE(OILPAN)
128 void PropertySetCSSStyleDeclaration::ref() 129 void PropertySetCSSStyleDeclaration::ref()
129 { 130 {
130 m_propertySet->ref(); 131 m_propertySet->ref();
131 } 132 }
132 133
133 void PropertySetCSSStyleDeclaration::deref() 134 void PropertySetCSSStyleDeclaration::deref()
134 { 135 {
135 m_propertySet->deref(); 136 m_propertySet->deref();
136 } 137 }
138 #endif
139
140 void PropertySetCSSStyleDeclaration::trace(Visitor* visitor)
141 {
142 visitor->trace(m_propertySet);
143 AbstractPropertySetCSSStyleDeclaration::trace(visitor);
144 }
137 145
138 unsigned AbstractPropertySetCSSStyleDeclaration::length() const 146 unsigned AbstractPropertySetCSSStyleDeclaration::length() const
139 { 147 {
140 return propertySet().propertyCount(); 148 return propertySet().propertyCount();
141 } 149 }
142 150
143 String AbstractPropertySetCSSStyleDeclaration::item(unsigned i) const 151 String AbstractPropertySetCSSStyleDeclaration::item(unsigned i) const
144 { 152 {
145 if (i >= propertySet().propertyCount()) 153 if (i >= propertySet().propertyCount())
146 return ""; 154 return "";
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 PassRefPtrWillBeRawPtr<MutableStylePropertySet> AbstractPropertySetCSSStyleDecla ration::copyProperties() const 307 PassRefPtrWillBeRawPtr<MutableStylePropertySet> AbstractPropertySetCSSStyleDecla ration::copyProperties() const
300 { 308 {
301 return propertySet().mutableCopy(); 309 return propertySet().mutableCopy();
302 } 310 }
303 311
304 bool AbstractPropertySetCSSStyleDeclaration::cssPropertyMatches(CSSPropertyID pr opertyID, const CSSValue* propertyValue) const 312 bool AbstractPropertySetCSSStyleDeclaration::cssPropertyMatches(CSSPropertyID pr opertyID, const CSSValue* propertyValue) const
305 { 313 {
306 return propertySet().propertyMatches(propertyID, propertyValue); 314 return propertySet().propertyMatches(propertyID, propertyValue);
307 } 315 }
308 316
317 void AbstractPropertySetCSSStyleDeclaration::trace(Visitor* visitor)
318 {
319 #if ENABLE(OILPAN)
320 // We don't support tracing OwnPtr<HashMap<X, Y> > since the hashmaps trace
haraken 2014/03/20 11:22:38 FIXME: oilpan: Or you can just drop this comment.
wibling-chromium 2014/03/20 11:59:33 Removed the comment.
321 // method expects a DefaultDummyVisitor in non-oilpan mode, but is passed a
322 // WebCore::Visitor. We could fix this by forward declarding the
323 // WebCore::Visitor in wtf, but that is not worth it unless this becomes a
324 // common issue.
325 visitor->trace(m_cssomCSSValueClones);
326 #endif
327 CSSStyleDeclaration::trace(visitor);
328 }
329
309 StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertyS et& propertySetArg, CSSRule* parentRule) 330 StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertyS et& propertySetArg, CSSRule* parentRule)
310 : PropertySetCSSStyleDeclaration(propertySetArg) 331 : PropertySetCSSStyleDeclaration(propertySetArg)
332 #if !ENABLE(OILPAN)
311 , m_refCount(1) 333 , m_refCount(1)
334 #endif
312 , m_parentRule(parentRule) 335 , m_parentRule(parentRule)
313 { 336 {
337 #if !ENABLE(OILPAN)
314 m_propertySet->ref(); 338 m_propertySet->ref();
339 #endif
315 } 340 }
316 341
317 StyleRuleCSSStyleDeclaration::~StyleRuleCSSStyleDeclaration() 342 StyleRuleCSSStyleDeclaration::~StyleRuleCSSStyleDeclaration()
318 { 343 {
344 #if !ENABLE(OILPAN)
319 m_propertySet->deref(); 345 m_propertySet->deref();
346 #endif
320 } 347 }
321 348
349 #if !ENABLE(OILPAN)
322 void StyleRuleCSSStyleDeclaration::ref() 350 void StyleRuleCSSStyleDeclaration::ref()
323 { 351 {
324 ++m_refCount; 352 ++m_refCount;
325 } 353 }
326 354
327 void StyleRuleCSSStyleDeclaration::deref() 355 void StyleRuleCSSStyleDeclaration::deref()
328 { 356 {
329 ASSERT(m_refCount); 357 ASSERT(m_refCount);
330 if (!--m_refCount) 358 if (!--m_refCount)
331 delete this; 359 delete this;
332 } 360 }
361 #endif
333 362
334 void StyleRuleCSSStyleDeclaration::willMutate() 363 void StyleRuleCSSStyleDeclaration::willMutate()
335 { 364 {
336 if (m_parentRule && m_parentRule->parentStyleSheet()) 365 if (m_parentRule && m_parentRule->parentStyleSheet())
337 m_parentRule->parentStyleSheet()->willMutateRules(); 366 m_parentRule->parentStyleSheet()->willMutateRules();
338 } 367 }
339 368
340 void StyleRuleCSSStyleDeclaration::didMutate(MutationType type) 369 void StyleRuleCSSStyleDeclaration::didMutate(MutationType type)
341 { 370 {
342 if (type == PropertyChanged) 371 if (type == PropertyChanged)
343 m_cssomCSSValueClones.clear(); 372 m_cssomCSSValueClones.clear();
344 373
345 // Style sheet mutation needs to be signaled even if the change failed. will MutateRules/didMutateRules must pair. 374 // Style sheet mutation needs to be signaled even if the change failed. will MutateRules/didMutateRules must pair.
346 if (m_parentRule && m_parentRule->parentStyleSheet()) 375 if (m_parentRule && m_parentRule->parentStyleSheet())
347 m_parentRule->parentStyleSheet()->didMutateRules(); 376 m_parentRule->parentStyleSheet()->didMutateRules();
348 } 377 }
349 378
350 CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const 379 CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const
351 { 380 {
352 return m_parentRule ? m_parentRule->parentStyleSheet() : 0; 381 return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
353 } 382 }
354 383
355 void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet& propertySet ) 384 void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet& propertySet )
356 { 385 {
386 #if !ENABLE(OILPAN)
357 m_propertySet->deref(); 387 m_propertySet->deref();
388 #endif
358 m_propertySet = &propertySet; 389 m_propertySet = &propertySet;
390 #if !ENABLE(OILPAN)
359 m_propertySet->ref(); 391 m_propertySet->ref();
392 #endif
393 }
394
395 void StyleRuleCSSStyleDeclaration::trace(Visitor* visitor)
396 {
397 visitor->trace(m_parentRule);
398 PropertySetCSSStyleDeclaration::trace(visitor);
360 } 399 }
361 400
362 MutableStylePropertySet& InlineCSSStyleDeclaration::propertySet() const 401 MutableStylePropertySet& InlineCSSStyleDeclaration::propertySet() const
363 { 402 {
364 return m_parentElement->ensureMutableInlineStyle(); 403 return m_parentElement->ensureMutableInlineStyle();
365 } 404 }
366 405
367 void InlineCSSStyleDeclaration::didMutate(MutationType type) 406 void InlineCSSStyleDeclaration::didMutate(MutationType type)
368 { 407 {
369 if (type == NoChanges) 408 if (type == NoChanges)
370 return; 409 return;
371 410
372 m_cssomCSSValueClones.clear(); 411 m_cssomCSSValueClones.clear();
373 412
374 if (!m_parentElement) 413 if (!m_parentElement)
375 return; 414 return;
376 415
377 m_parentElement->clearMutableInlineStyleIfEmpty(); 416 m_parentElement->clearMutableInlineStyleIfEmpty();
378 m_parentElement->setNeedsStyleRecalc(LocalStyleChange); 417 m_parentElement->setNeedsStyleRecalc(LocalStyleChange);
379 m_parentElement->invalidateStyleAttribute(); 418 m_parentElement->invalidateStyleAttribute();
380 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); 419 StyleAttributeMutationScope(this).didInvalidateStyleAttr();
381 } 420 }
382 421
383 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const 422 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const
384 { 423 {
385 return m_parentElement ? &m_parentElement->document().elementSheet() : 0; 424 return m_parentElement ? &m_parentElement->document().elementSheet() : 0;
386 } 425 }
387 426
427 #if !ENABLE(OILPAN)
388 void InlineCSSStyleDeclaration::ref() 428 void InlineCSSStyleDeclaration::ref()
389 { 429 {
390 m_parentElement->ref(); 430 m_parentElement->ref();
391 } 431 }
392 432
393 void InlineCSSStyleDeclaration::deref() 433 void InlineCSSStyleDeclaration::deref()
394 { 434 {
395 m_parentElement->deref(); 435 m_parentElement->deref();
396 } 436 }
437 #endif
438
439 void InlineCSSStyleDeclaration::trace(Visitor* visitor)
440 {
441 AbstractPropertySetCSSStyleDeclaration::trace(visitor);
442 }
397 443
398 } // namespace WebCore 444 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698