1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "frameworks/bridge/common/dom/dom_clock.h" 17 18 #include "base/log/event_report.h" 19 #include "base/utils/linear_map.h" 20 #include "base/utils/utils.h" 21 #include "core/components/clock/clock_theme.h" 22 #include "frameworks/bridge/common/dom/dom_type.h" 23 #include "frameworks/bridge/common/utils/utils.h" 24 25 namespace OHOS::Ace::Framework { 26 DOMClock(NodeId nodeId,const std::string & nodeName)27DOMClock::DOMClock(NodeId nodeId, const std::string& nodeName) : DOMNode(nodeId, nodeName) 28 { 29 clockChild_ = AceType::MakeRefPtr<ClockComponent>(); 30 } 31 PrepareSpecializedComponent()32void DOMClock::PrepareSpecializedComponent() 33 { 34 const auto& declaration = AceType::DynamicCast<ClockDeclaration>(declaration_); 35 if (!declaration) { 36 return; 37 } 38 declaration->SetClockConfig(clockConfig_); 39 clockChild_->SetDeclaration(declaration); 40 } 41 InitializeStyle()42void DOMClock::InitializeStyle() 43 { 44 auto declaration = AceType::DynamicCast<ClockDeclaration>(declaration_); 45 if (!declaration) { 46 return; 47 } 48 declaration->InitializeStyle(); 49 } 50 ResetInitializedStyle()51void DOMClock::ResetInitializedStyle() 52 { 53 InitializeStyle(); 54 } 55 56 } // namespace OHOS::Ace::Framework