OLD | NEW |
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 Loading... |
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 283 } |
276 | 284 |
277 CSSValue* AbstractPropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue
* internalValue) | 285 CSSValue* AbstractPropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue
* internalValue) |
278 { | 286 { |
279 if (!internalValue) | 287 if (!internalValue) |
280 return 0; | 288 return 0; |
281 | 289 |
282 // The map is here to maintain the object identity of the CSSValues over mul
tiple invocations. | 290 // The map is here to maintain the object identity of the CSSValues over mul
tiple invocations. |
283 // FIXME: It is likely that the identity is not important for web compatibil
ity and this code should be removed. | 291 // FIXME: It is likely that the identity is not important for web compatibil
ity and this code should be removed. |
284 if (!m_cssomCSSValueClones) | 292 if (!m_cssomCSSValueClones) |
285 m_cssomCSSValueClones = adoptPtrWillBeNoop(new WillBeHeapHashMap<CSSValu
e*, RefPtrWillBeMember<CSSValue> >); | 293 m_cssomCSSValueClones = adoptPtrWillBeNoop(new WillBeHeapHashMap<RawPtrW
illBeMember<CSSValue>, RefPtrWillBeMember<CSSValue> >); |
286 | 294 |
287 RefPtrWillBeMember<CSSValue>& clonedValue = m_cssomCSSValueClones->add(inter
nalValue, RefPtrWillBeMember<CSSValue>()).storedValue->value; | 295 RefPtrWillBeMember<CSSValue>& clonedValue = m_cssomCSSValueClones->add(inter
nalValue, RefPtrWillBeMember<CSSValue>()).storedValue->value; |
288 if (!clonedValue) | 296 if (!clonedValue) |
289 clonedValue = internalValue->cloneForCSSOM(); | 297 clonedValue = internalValue->cloneForCSSOM(); |
290 return clonedValue.get(); | 298 return clonedValue.get(); |
291 } | 299 } |
292 | 300 |
293 StyleSheetContents* AbstractPropertySetCSSStyleDeclaration::contextStyleSheet()
const | 301 StyleSheetContents* AbstractPropertySetCSSStyleDeclaration::contextStyleSheet()
const |
294 { | 302 { |
295 CSSStyleSheet* cssStyleSheet = parentStyleSheet(); | 303 CSSStyleSheet* cssStyleSheet = parentStyleSheet(); |
296 return cssStyleSheet ? cssStyleSheet->contents() : 0; | 304 return cssStyleSheet ? cssStyleSheet->contents() : 0; |
297 } | 305 } |
298 | 306 |
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 visitor->trace(m_cssomCSSValueClones); |
| 321 #endif |
| 322 } |
| 323 |
309 StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertyS
et& propertySetArg, CSSRule* parentRule) | 324 StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertyS
et& propertySetArg, CSSRule* parentRule) |
310 : PropertySetCSSStyleDeclaration(propertySetArg) | 325 : PropertySetCSSStyleDeclaration(propertySetArg) |
| 326 #if !ENABLE(OILPAN) |
311 , m_refCount(1) | 327 , m_refCount(1) |
| 328 #endif |
312 , m_parentRule(parentRule) | 329 , m_parentRule(parentRule) |
313 { | 330 { |
| 331 #if !ENABLE(OILPAN) |
314 m_propertySet->ref(); | 332 m_propertySet->ref(); |
| 333 #endif |
315 } | 334 } |
316 | 335 |
317 StyleRuleCSSStyleDeclaration::~StyleRuleCSSStyleDeclaration() | 336 StyleRuleCSSStyleDeclaration::~StyleRuleCSSStyleDeclaration() |
318 { | 337 { |
| 338 #if !ENABLE(OILPAN) |
319 m_propertySet->deref(); | 339 m_propertySet->deref(); |
| 340 #endif |
320 } | 341 } |
321 | 342 |
| 343 #if !ENABLE(OILPAN) |
322 void StyleRuleCSSStyleDeclaration::ref() | 344 void StyleRuleCSSStyleDeclaration::ref() |
323 { | 345 { |
324 ++m_refCount; | 346 ++m_refCount; |
325 } | 347 } |
326 | 348 |
327 void StyleRuleCSSStyleDeclaration::deref() | 349 void StyleRuleCSSStyleDeclaration::deref() |
328 { | 350 { |
329 ASSERT(m_refCount); | 351 ASSERT(m_refCount); |
330 if (!--m_refCount) | 352 if (!--m_refCount) |
331 delete this; | 353 delete this; |
332 } | 354 } |
| 355 #endif |
333 | 356 |
334 void StyleRuleCSSStyleDeclaration::willMutate() | 357 void StyleRuleCSSStyleDeclaration::willMutate() |
335 { | 358 { |
336 if (m_parentRule && m_parentRule->parentStyleSheet()) | 359 if (m_parentRule && m_parentRule->parentStyleSheet()) |
337 m_parentRule->parentStyleSheet()->willMutateRules(); | 360 m_parentRule->parentStyleSheet()->willMutateRules(); |
338 } | 361 } |
339 | 362 |
340 void StyleRuleCSSStyleDeclaration::didMutate(MutationType type) | 363 void StyleRuleCSSStyleDeclaration::didMutate(MutationType type) |
341 { | 364 { |
342 if (type == PropertyChanged) | 365 if (type == PropertyChanged) |
343 m_cssomCSSValueClones.clear(); | 366 m_cssomCSSValueClones.clear(); |
344 | 367 |
345 // Style sheet mutation needs to be signaled even if the change failed. will
MutateRules/didMutateRules must pair. | 368 // Style sheet mutation needs to be signaled even if the change failed. will
MutateRules/didMutateRules must pair. |
346 if (m_parentRule && m_parentRule->parentStyleSheet()) | 369 if (m_parentRule && m_parentRule->parentStyleSheet()) |
347 m_parentRule->parentStyleSheet()->didMutateRules(); | 370 m_parentRule->parentStyleSheet()->didMutateRules(); |
348 } | 371 } |
349 | 372 |
350 CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const | 373 CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const |
351 { | 374 { |
352 return m_parentRule ? m_parentRule->parentStyleSheet() : 0; | 375 return m_parentRule ? m_parentRule->parentStyleSheet() : 0; |
353 } | 376 } |
354 | 377 |
355 void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet& propertySet
) | 378 void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet& propertySet
) |
356 { | 379 { |
| 380 #if !ENABLE(OILPAN) |
357 m_propertySet->deref(); | 381 m_propertySet->deref(); |
| 382 #endif |
358 m_propertySet = &propertySet; | 383 m_propertySet = &propertySet; |
| 384 #if !ENABLE(OILPAN) |
359 m_propertySet->ref(); | 385 m_propertySet->ref(); |
| 386 #endif |
| 387 } |
| 388 |
| 389 void StyleRuleCSSStyleDeclaration::trace(Visitor* visitor) |
| 390 { |
| 391 visitor->trace(m_parentRule); |
| 392 PropertySetCSSStyleDeclaration::trace(visitor); |
360 } | 393 } |
361 | 394 |
362 MutableStylePropertySet& InlineCSSStyleDeclaration::propertySet() const | 395 MutableStylePropertySet& InlineCSSStyleDeclaration::propertySet() const |
363 { | 396 { |
364 return m_parentElement->ensureMutableInlineStyle(); | 397 return m_parentElement->ensureMutableInlineStyle(); |
365 } | 398 } |
366 | 399 |
367 void InlineCSSStyleDeclaration::didMutate(MutationType type) | 400 void InlineCSSStyleDeclaration::didMutate(MutationType type) |
368 { | 401 { |
369 if (type == NoChanges) | 402 if (type == NoChanges) |
370 return; | 403 return; |
371 | 404 |
372 m_cssomCSSValueClones.clear(); | 405 m_cssomCSSValueClones.clear(); |
373 | 406 |
374 if (!m_parentElement) | 407 if (!m_parentElement) |
375 return; | 408 return; |
376 | 409 |
377 m_parentElement->clearMutableInlineStyleIfEmpty(); | 410 m_parentElement->clearMutableInlineStyleIfEmpty(); |
378 m_parentElement->setNeedsStyleRecalc(LocalStyleChange); | 411 m_parentElement->setNeedsStyleRecalc(LocalStyleChange); |
379 m_parentElement->invalidateStyleAttribute(); | 412 m_parentElement->invalidateStyleAttribute(); |
380 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); | 413 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); |
381 } | 414 } |
382 | 415 |
383 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const | 416 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const |
384 { | 417 { |
385 return m_parentElement ? &m_parentElement->document().elementSheet() : 0; | 418 return m_parentElement ? &m_parentElement->document().elementSheet() : 0; |
386 } | 419 } |
387 | 420 |
| 421 #if !ENABLE(OILPAN) |
388 void InlineCSSStyleDeclaration::ref() | 422 void InlineCSSStyleDeclaration::ref() |
389 { | 423 { |
390 m_parentElement->ref(); | 424 m_parentElement->ref(); |
391 } | 425 } |
392 | 426 |
393 void InlineCSSStyleDeclaration::deref() | 427 void InlineCSSStyleDeclaration::deref() |
394 { | 428 { |
395 m_parentElement->deref(); | 429 m_parentElement->deref(); |
396 } | 430 } |
| 431 #endif |
| 432 |
| 433 void InlineCSSStyleDeclaration::trace(Visitor* visitor) |
| 434 { |
| 435 AbstractPropertySetCSSStyleDeclaration::trace(visitor); |
| 436 } |
397 | 437 |
398 } // namespace WebCore | 438 } // namespace WebCore |
OLD | NEW |