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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2735283002: Combine ComputedStyle default ctor with initial style ctor. (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index e4f24e005bee513d9a4e1a402542a26e95300fbe..5f794c720cc137fe6b502374eaf22954a2bc26d8 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -95,7 +95,7 @@ struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> {
ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle);
PassRefPtr<ComputedStyle> ComputedStyle::create() {
- return adoptRef(new ComputedStyle());
sashab 2017/03/09 23:48:22 Does this have a perf cost?
shend 2017/03/14 06:05:21 Shouldn't affect perf since initialStyle() returns
+ return adoptRef(new ComputedStyle(initialStyle()));
}
PassRefPtr<ComputedStyle> ComputedStyle::createInitialStyle() {
@@ -120,24 +120,6 @@ PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other) {
return adoptRef(new ComputedStyle(other));
}
-ALWAYS_INLINE ComputedStyle::ComputedStyle()
- : ComputedStyleBase(),
- RefCounted<ComputedStyle>(),
- m_box(initialStyle().m_box),
- m_visual(initialStyle().m_visual),
- m_background(initialStyle().m_background),
- m_surround(initialStyle().m_surround),
- m_rareNonInheritedData(initialStyle().m_rareNonInheritedData),
- m_rareInheritedData(initialStyle().m_rareInheritedData),
- m_styleInheritedData(initialStyle().m_styleInheritedData),
- m_svgStyle(initialStyle().m_svgStyle) {
- initializeBitDefaults(); // Would it be faster to copy this from the default
- // style?
- static_assert((sizeof(InheritedData) <= 8), "InheritedData should not grow");
- static_assert((sizeof(NonInheritedData) <= 12),
- "NonInheritedData should not grow");
-}
-
ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag)
: ComputedStyleBase(), RefCounted<ComputedStyle>() {
initializeBitDefaults();
@@ -160,6 +142,10 @@ ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag)
m_rareInheritedData.init();
m_styleInheritedData.init();
m_svgStyle.init();
+
+ static_assert((sizeof(InheritedData) <= 8), "InheritedData should not grow");
+ static_assert((sizeof(NonInheritedData) <= 12),
+ "NonInheritedData should not grow");
meade_UTC10 2017/03/09 05:43:13 Is there a problem with moving these static_assert
shend 2017/03/09 14:59:54 Yeah I don't know why they're in the constructor.
sashab 2017/03/09 23:48:22 Hmm, you can check git blame, but this looks like
shend 2017/03/14 06:05:21 Done.
}
ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o)

Powered by Google App Engine
This is Rietveld 408576698