OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 m_nonInheritedData.m_isLink = false; | 376 m_nonInheritedData.m_isLink = false; |
377 m_nonInheritedData.m_hasRemUnits = false; | 377 m_nonInheritedData.m_hasRemUnits = false; |
378 | 378 |
379 // All independently inherited properties default to being inherited. | 379 // All independently inherited properties default to being inherited. |
380 m_nonInheritedData.m_isPointerEventsInherited = true; | 380 m_nonInheritedData.m_isPointerEventsInherited = true; |
381 m_nonInheritedData.m_isVisibilityInherited = true; | 381 m_nonInheritedData.m_isVisibilityInherited = true; |
382 } | 382 } |
383 | 383 |
384 private: | 384 private: |
385 // TODO(sashab): Move these to the bottom of ComputedStyle. | 385 // TODO(sashab): Move these to the bottom of ComputedStyle. |
386 ALWAYS_INLINE ComputedStyle(); | 386 ComputedStyle(); |
387 | 387 |
388 enum InitialStyleTag { | 388 enum InitialStyleTag { |
389 InitialStyle | 389 InitialStyle |
390 }; | 390 }; |
391 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag); | 391 explicit ComputedStyle(InitialStyleTag); |
392 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 392 ComputedStyle(const ComputedStyle&); |
393 | 393 |
394 static PassRefPtr<ComputedStyle> createInitialStyle(); | 394 static PassRefPtr<ComputedStyle> createInitialStyle(); |
395 static inline ComputedStyle& mutableInitialStyle() | 395 static ComputedStyle& mutableInitialStyle() |
396 { | 396 { |
397 LEAK_SANITIZER_DISABLED_SCOPE; | 397 LEAK_SANITIZER_DISABLED_SCOPE; |
398 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, (ComputedStyle::createI nitialStyle())); | 398 |
399 return *s_initialStyle; | 399 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<ComputedStyle*>, s_initia lStyle, |
400 new ThreadSpecific<ComputedStyle*>()); | |
esprehn
2016/09/12 20:53:12
Can't put TLS here, it's too slow
| |
401 if (!*s_initialStyle) { | |
402 *s_initialStyle = PassRefPtr<ComputedStyle>(ComputedStyle::createIni tialStyle()).leakRef(); | |
403 } | |
404 return **s_initialStyle; | |
400 } | 405 } |
401 | 406 |
402 public: | 407 public: |
403 static PassRefPtr<ComputedStyle> create(); | 408 static PassRefPtr<ComputedStyle> create(); |
404 static PassRefPtr<ComputedStyle> createAnonymousStyleWithDisplay(const Compu tedStyle& parentStyle, EDisplay); | 409 static PassRefPtr<ComputedStyle> createAnonymousStyleWithDisplay(const Compu tedStyle& parentStyle, EDisplay); |
405 static PassRefPtr<ComputedStyle> clone(const ComputedStyle&); | 410 static PassRefPtr<ComputedStyle> clone(const ComputedStyle&); |
406 static const ComputedStyle& initialStyle() { return mutableInitialStyle(); } | 411 static const ComputedStyle& initialStyle() { return mutableInitialStyle(); } |
407 static void invalidateInitialStyle(); | 412 static void invalidateInitialStyle(); |
408 | 413 |
409 // Computes how the style change should be propagated down the tree. | 414 // Computes how the style change should be propagated down the tree. |
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 } | 2618 } |
2614 | 2619 |
2615 inline bool ComputedStyle::hasPseudoElementStyle() const | 2620 inline bool ComputedStyle::hasPseudoElementStyle() const |
2616 { | 2621 { |
2617 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 2622 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
2618 } | 2623 } |
2619 | 2624 |
2620 } // namespace blink | 2625 } // namespace blink |
2621 | 2626 |
2622 #endif // ComputedStyle_h | 2627 #endif // ComputedStyle_h |
OLD | NEW |