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

Unified Diff: Source/core/layout/style/LayoutStyle.cpp

Issue 1001833002: Rename default -> initial style and use singletons. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/style/LayoutStyle.h ('k') | Source/core/layout/style/SVGLayoutStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/style/LayoutStyle.cpp
diff --git a/Source/core/layout/style/LayoutStyle.cpp b/Source/core/layout/style/LayoutStyle.cpp
index b33db1415712167d320bcd811289bef196cc16a0..f5f1d8dd79129a21c59ab495b458cb5d2ed4200e 100644
--- a/Source/core/layout/style/LayoutStyle.cpp
+++ b/Source/core/layout/style/LayoutStyle.cpp
@@ -70,20 +70,14 @@ struct SameSizeAsLayoutStyle : public RefCounted<SameSizeAsLayoutStyle> {
static_assert(sizeof(LayoutStyle) == sizeof(SameSizeAsLayoutStyle), "LayoutStyle should stay small");
-inline LayoutStyle* defaultStyle()
-{
- DEFINE_STATIC_REF(LayoutStyle, s_defaultStyle, (LayoutStyle::createDefaultStyle()));
- return s_defaultStyle;
-}
-
PassRefPtr<LayoutStyle> LayoutStyle::create()
{
return adoptRef(new LayoutStyle());
}
-PassRefPtr<LayoutStyle> LayoutStyle::createDefaultStyle()
+PassRefPtr<LayoutStyle> LayoutStyle::createInitialStyle()
{
- return adoptRef(new LayoutStyle(DefaultStyle));
+ return adoptRef(new LayoutStyle(InitialStyle));
}
PassRefPtr<LayoutStyle> LayoutStyle::createAnonymousStyleWithDisplay(const LayoutStyle& parentStyle, EDisplay display)
@@ -101,21 +95,21 @@ PassRefPtr<LayoutStyle> LayoutStyle::clone(const LayoutStyle& other)
}
ALWAYS_INLINE LayoutStyle::LayoutStyle()
- : m_box(defaultStyle()->m_box)
- , visual(defaultStyle()->visual)
- , m_background(defaultStyle()->m_background)
- , surround(defaultStyle()->surround)
- , rareNonInheritedData(defaultStyle()->rareNonInheritedData)
- , rareInheritedData(defaultStyle()->rareInheritedData)
- , inherited(defaultStyle()->inherited)
- , m_svgStyle(defaultStyle()->m_svgStyle)
+ : m_box(initialStyle()->m_box)
+ , visual(initialStyle()->visual)
+ , m_background(initialStyle()->m_background)
+ , surround(initialStyle()->surround)
+ , rareNonInheritedData(initialStyle()->rareNonInheritedData)
+ , rareInheritedData(initialStyle()->rareInheritedData)
+ , inherited(initialStyle()->inherited)
+ , m_svgStyle(initialStyle()->m_svgStyle)
{
setBitDefaults(); // Would it be faster to copy this from the default style?
static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags should not grow");
static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags should not grow");
}
-ALWAYS_INLINE LayoutStyle::LayoutStyle(DefaultStyleTag)
+ALWAYS_INLINE LayoutStyle::LayoutStyle(InitialStyleTag)
{
setBitDefaults();
« no previous file with comments | « Source/core/layout/style/LayoutStyle.h ('k') | Source/core/layout/style/SVGLayoutStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698