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

Unified Diff: third_party/WebKit/Source/core/html/shadow/AppearanceSwitchElement.cpp

Issue 1958073002: Introduce :-internal-shadow-host-has-appearance pseudo class, and apply it to METER element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove null host check Created 4 years, 7 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/html/shadow/AppearanceSwitchElement.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/AppearanceSwitchElement.cpp b/third_party/WebKit/Source/core/html/shadow/AppearanceSwitchElement.cpp
deleted file mode 100644
index 2ab753d857df2ca9d598f1a535a8f848898ef2ec..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/html/shadow/AppearanceSwitchElement.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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/html/shadow/AppearanceSwitchElement.h"
-
-#include "core/dom/NodeComputedStyle.h"
-
-namespace blink {
-
-inline AppearanceSwitchElement::AppearanceSwitchElement(Document& doc, Mode mode)
- : HTMLDivElement(doc)
- , m_mode(mode)
-{
- setHasCustomStyleCallbacks();
-}
-
-AppearanceSwitchElement* AppearanceSwitchElement::create(Document& doc, Mode mode)
-{
- return new AppearanceSwitchElement(doc, mode);
-}
-
-PassRefPtr<ComputedStyle> AppearanceSwitchElement::customStyleForLayoutObject()
-{
- // We can't use setInlineStyleProperty() because it updates the DOM tree.
- // We shouldn't do it during style calculation.
- // TODO(tkent): Injecting a CSS variable by host is a better approach?
- Element* host = shadowHost();
- RefPtr<ComputedStyle> style = originalStyleForLayoutObject();
- if (!host || !host->computedStyle())
- return style.release();
- if (m_mode == ShowIfHostHasAppearance) {
- if (host->computedStyle()->hasAppearance())
- return style.release();
- } else {
- if (!host->computedStyle()->hasAppearance())
- return style.release();
- }
- if (style->display() == NONE)
- return style.release();
- RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*style);
- newStyle->setDisplay(NONE);
- newStyle->setUnique();
- return newStyle.release();
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698