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

Unified Diff: third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp

Issue 2293713002: Made ElementRareData store ComputedStyle on LayoutObject if possible. (Closed)
Patch Set: Added CORE_EXPORT to NodeRareDataBase Created 4 years, 3 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/dom/ElementRareDataTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp b/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8bc5bfa6b6a3637bdb56b325388babf75cd94aff
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp
@@ -0,0 +1,30 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/dom/ElementRareData.h"
+
+#include "core/layout/LayoutInline.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(ElementRareDataTest, ComputedStyleStorage)
+{
+ // Without LayoutObject
+ ElementRareData* rareData = ElementRareData::create(nullptr);
+ RefPtr<ComputedStyle> style = ComputedStyle::create();
+ rareData->setComputedStyle(style);
+ EXPECT_EQ(style.get(), rareData->computedStyle());
+
+ // With LayoutObject
+ LayoutObject* layoutObject = new LayoutInline(nullptr);
+ rareData = ElementRareData::create(layoutObject);
+ rareData->setComputedStyle(style);
+ EXPECT_EQ(style.get(), rareData->computedStyle());
+
+ rareData->setLayoutObject(nullptr);
+ delete layoutObject;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698