mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to catch some oddballs. TBR=eseidel@chromium.org Review URL: https://codereview.chromium.org/1206763002.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
// Copyright 2015 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 "sky/engine/core/dom/Element.h"
|
|
|
|
#include "dart/runtime/include/dart_api.h"
|
|
#include "sky/engine/core/script/dom_dart_state.h"
|
|
#include "sky/engine/tonic/dart_converter.h"
|
|
|
|
namespace blink {
|
|
namespace DartElementInternal {
|
|
|
|
void constructorCallback(Dart_NativeArguments args) {
|
|
Dart_Handle receiver = Dart_GetNativeArgument(args, 0);
|
|
DCHECK(!LogIfError(receiver));
|
|
|
|
Dart_Handle tag_name = Dart_GetField(receiver,
|
|
Dart_NewStringFromCString("tagName"));
|
|
if (!Dart_IsString(tag_name)) {
|
|
Dart_ThrowException(Dart_NewStringFromCString("tagName is not a string"));
|
|
return;
|
|
}
|
|
|
|
RefPtr<Element> element = Element::create(
|
|
QualifiedName(StringFromDart(tag_name)), DOMDartState::CurrentDocument());
|
|
|
|
// TODO(abarth): We should remove these states because elements are never
|
|
// waiting for upgrades.
|
|
element->setCustomElementState(Element::WaitingForUpgrade);
|
|
element->setCustomElementState(Element::Upgraded);
|
|
element->AssociateWithDartWrapper(args);
|
|
}
|
|
|
|
} // namespace DartElementInternal
|
|
} // namespace blink
|