| 1 | /* |
| 2 | This file is part of the WebKit open source project. |
| 3 | This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Library General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Library General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Library General Public License |
| 16 | along with this library; see the file COPYING.LIB. If not, write to |
| 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #include "config.h" |
| 22 | #include "JSTextMetrics.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertNumbers.h" |
| 28 | #include "JSDOMExceptionHandling.h" |
| 29 | #include "JSDOMWrapperCache.h" |
| 30 | #include "ScriptExecutionContext.h" |
| 31 | #include <JavaScriptCore/FunctionPrototype.h> |
| 32 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 33 | #include <JavaScriptCore/JSCInlines.h> |
| 34 | #include <wtf/GetPtr.h> |
| 35 | #include <wtf/PointerPreparations.h> |
| 36 | #include <wtf/URL.h> |
| 37 | |
| 38 | |
| 39 | namespace WebCore { |
| 40 | using namespace JSC; |
| 41 | |
| 42 | // Attributes |
| 43 | |
| 44 | JSC::EncodedJSValue jsTextMetricsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 45 | bool setJSTextMetricsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 46 | JSC::EncodedJSValue jsTextMetricsWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 47 | JSC::EncodedJSValue jsTextMetricsActualBoundingBoxLeft(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 48 | JSC::EncodedJSValue jsTextMetricsActualBoundingBoxRight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 49 | JSC::EncodedJSValue jsTextMetricsFontBoundingBoxAscent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 50 | JSC::EncodedJSValue jsTextMetricsFontBoundingBoxDescent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 51 | JSC::EncodedJSValue jsTextMetricsActualBoundingBoxAscent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | JSC::EncodedJSValue jsTextMetricsActualBoundingBoxDescent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 53 | JSC::EncodedJSValue jsTextMetricsEmHeightAscent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | JSC::EncodedJSValue jsTextMetricsEmHeightDescent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 55 | JSC::EncodedJSValue jsTextMetricsHangingBaseline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | JSC::EncodedJSValue jsTextMetricsAlphabeticBaseline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 57 | JSC::EncodedJSValue jsTextMetricsIdeographicBaseline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | |
| 59 | class JSTextMetricsPrototype : public JSC::JSNonFinalObject { |
| 60 | public: |
| 61 | using Base = JSC::JSNonFinalObject; |
| 62 | static JSTextMetricsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 63 | { |
| 64 | JSTextMetricsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextMetricsPrototype>(vm.heap)) JSTextMetricsPrototype(vm, globalObject, structure); |
| 65 | ptr->finishCreation(vm); |
| 66 | return ptr; |
| 67 | } |
| 68 | |
| 69 | DECLARE_INFO; |
| 70 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 71 | { |
| 72 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 73 | } |
| 74 | |
| 75 | private: |
| 76 | JSTextMetricsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 77 | : JSC::JSNonFinalObject(vm, structure) |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | void finishCreation(JSC::VM&); |
| 82 | }; |
| 83 | |
| 84 | using JSTextMetricsConstructor = JSDOMConstructorNotConstructable<JSTextMetrics>; |
| 85 | |
| 86 | template<> JSValue JSTextMetricsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 87 | { |
| 88 | UNUSED_PARAM(vm); |
| 89 | return globalObject.functionPrototype(); |
| 90 | } |
| 91 | |
| 92 | template<> void JSTextMetricsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 93 | { |
| 94 | putDirect(vm, vm.propertyNames->prototype, JSTextMetrics::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 95 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TextMetrics"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 96 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 97 | } |
| 98 | |
| 99 | template<> const ClassInfo JSTextMetricsConstructor::s_info = { "TextMetrics" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetricsConstructor) }; |
| 100 | |
| 101 | /* Hash table for prototype */ |
| 102 | |
| 103 | static const HashTableValue JSTextMetricsPrototypeTableValues[] = |
| 104 | { |
| 105 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTextMetricsConstructor) } }, |
| 106 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 107 | { "actualBoundingBoxLeft" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsActualBoundingBoxLeft), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 108 | { "actualBoundingBoxRight" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsActualBoundingBoxRight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 109 | { "fontBoundingBoxAscent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsFontBoundingBoxAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 110 | { "fontBoundingBoxDescent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsFontBoundingBoxDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 111 | { "actualBoundingBoxAscent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsActualBoundingBoxAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 112 | { "actualBoundingBoxDescent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsActualBoundingBoxDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 113 | { "emHeightAscent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsEmHeightAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 114 | { "emHeightDescent" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsEmHeightDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 115 | { "hangingBaseline" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsHangingBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 116 | { "alphabeticBaseline" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsAlphabeticBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 117 | { "ideographicBaseline" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsIdeographicBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 118 | }; |
| 119 | |
| 120 | const ClassInfo JSTextMetricsPrototype::s_info = { "TextMetricsPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetricsPrototype) }; |
| 121 | |
| 122 | void JSTextMetricsPrototype::finishCreation(VM& vm) |
| 123 | { |
| 124 | Base::finishCreation(vm); |
| 125 | reifyStaticProperties(vm, JSTextMetrics::info(), JSTextMetricsPrototypeTableValues, *this); |
| 126 | } |
| 127 | |
| 128 | const ClassInfo JSTextMetrics::s_info = { "TextMetrics" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetrics) }; |
| 129 | |
| 130 | JSTextMetrics::JSTextMetrics(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TextMetrics>&& impl) |
| 131 | : JSDOMWrapper<TextMetrics>(structure, globalObject, WTFMove(impl)) |
| 132 | { |
| 133 | } |
| 134 | |
| 135 | void JSTextMetrics::finishCreation(VM& vm) |
| 136 | { |
| 137 | Base::finishCreation(vm); |
| 138 | ASSERT(inherits(vm, info())); |
| 139 | |
| 140 | } |
| 141 | |
| 142 | JSObject* JSTextMetrics::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 143 | { |
| 144 | return JSTextMetricsPrototype::create(vm, &globalObject, JSTextMetricsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 145 | } |
| 146 | |
| 147 | JSObject* JSTextMetrics::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 148 | { |
| 149 | return getDOMPrototype<JSTextMetrics>(vm, globalObject); |
| 150 | } |
| 151 | |
| 152 | JSValue JSTextMetrics::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 153 | { |
| 154 | return getDOMConstructor<JSTextMetricsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 155 | } |
| 156 | |
| 157 | void JSTextMetrics::destroy(JSC::JSCell* cell) |
| 158 | { |
| 159 | JSTextMetrics* thisObject = static_cast<JSTextMetrics*>(cell); |
| 160 | thisObject->JSTextMetrics::~JSTextMetrics(); |
| 161 | } |
| 162 | |
| 163 | template<> inline JSTextMetrics* IDLAttribute<JSTextMetrics>::cast(ExecState& state, EncodedJSValue thisValue) |
| 164 | { |
| 165 | return jsDynamicCast<JSTextMetrics*>(state.vm(), JSValue::decode(thisValue)); |
| 166 | } |
| 167 | |
| 168 | EncodedJSValue jsTextMetricsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 169 | { |
| 170 | VM& vm = state->vm(); |
| 171 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 172 | auto* prototype = jsDynamicCast<JSTextMetricsPrototype*>(vm, JSValue::decode(thisValue)); |
| 173 | if (UNLIKELY(!prototype)) |
| 174 | return throwVMTypeError(state, throwScope); |
| 175 | return JSValue::encode(JSTextMetrics::getConstructor(state->vm(), prototype->globalObject())); |
| 176 | } |
| 177 | |
| 178 | bool setJSTextMetricsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 179 | { |
| 180 | VM& vm = state->vm(); |
| 181 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 182 | auto* prototype = jsDynamicCast<JSTextMetricsPrototype*>(vm, JSValue::decode(thisValue)); |
| 183 | if (UNLIKELY(!prototype)) { |
| 184 | throwVMTypeError(state, throwScope); |
| 185 | return false; |
| 186 | } |
| 187 | // Shadowing a built-in constructor |
| 188 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 189 | } |
| 190 | |
| 191 | static inline JSValue jsTextMetricsWidthGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 192 | { |
| 193 | UNUSED_PARAM(throwScope); |
| 194 | UNUSED_PARAM(state); |
| 195 | auto& impl = thisObject.wrapped(); |
| 196 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.width()); |
| 197 | return result; |
| 198 | } |
| 199 | |
| 200 | EncodedJSValue jsTextMetricsWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 201 | { |
| 202 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
| 203 | } |
| 204 | |
| 205 | static inline JSValue jsTextMetricsActualBoundingBoxLeftGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 206 | { |
| 207 | UNUSED_PARAM(throwScope); |
| 208 | UNUSED_PARAM(state); |
| 209 | auto& impl = thisObject.wrapped(); |
| 210 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.actualBoundingBoxLeft()); |
| 211 | return result; |
| 212 | } |
| 213 | |
| 214 | EncodedJSValue jsTextMetricsActualBoundingBoxLeft(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 215 | { |
| 216 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsActualBoundingBoxLeftGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "actualBoundingBoxLeft" ); |
| 217 | } |
| 218 | |
| 219 | static inline JSValue jsTextMetricsActualBoundingBoxRightGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 220 | { |
| 221 | UNUSED_PARAM(throwScope); |
| 222 | UNUSED_PARAM(state); |
| 223 | auto& impl = thisObject.wrapped(); |
| 224 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.actualBoundingBoxRight()); |
| 225 | return result; |
| 226 | } |
| 227 | |
| 228 | EncodedJSValue jsTextMetricsActualBoundingBoxRight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 229 | { |
| 230 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsActualBoundingBoxRightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "actualBoundingBoxRight" ); |
| 231 | } |
| 232 | |
| 233 | static inline JSValue jsTextMetricsFontBoundingBoxAscentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 234 | { |
| 235 | UNUSED_PARAM(throwScope); |
| 236 | UNUSED_PARAM(state); |
| 237 | auto& impl = thisObject.wrapped(); |
| 238 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.fontBoundingBoxAscent()); |
| 239 | return result; |
| 240 | } |
| 241 | |
| 242 | EncodedJSValue jsTextMetricsFontBoundingBoxAscent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 243 | { |
| 244 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsFontBoundingBoxAscentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fontBoundingBoxAscent" ); |
| 245 | } |
| 246 | |
| 247 | static inline JSValue jsTextMetricsFontBoundingBoxDescentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 248 | { |
| 249 | UNUSED_PARAM(throwScope); |
| 250 | UNUSED_PARAM(state); |
| 251 | auto& impl = thisObject.wrapped(); |
| 252 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.fontBoundingBoxDescent()); |
| 253 | return result; |
| 254 | } |
| 255 | |
| 256 | EncodedJSValue jsTextMetricsFontBoundingBoxDescent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 257 | { |
| 258 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsFontBoundingBoxDescentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fontBoundingBoxDescent" ); |
| 259 | } |
| 260 | |
| 261 | static inline JSValue jsTextMetricsActualBoundingBoxAscentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 262 | { |
| 263 | UNUSED_PARAM(throwScope); |
| 264 | UNUSED_PARAM(state); |
| 265 | auto& impl = thisObject.wrapped(); |
| 266 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.actualBoundingBoxAscent()); |
| 267 | return result; |
| 268 | } |
| 269 | |
| 270 | EncodedJSValue jsTextMetricsActualBoundingBoxAscent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 271 | { |
| 272 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsActualBoundingBoxAscentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "actualBoundingBoxAscent" ); |
| 273 | } |
| 274 | |
| 275 | static inline JSValue jsTextMetricsActualBoundingBoxDescentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 276 | { |
| 277 | UNUSED_PARAM(throwScope); |
| 278 | UNUSED_PARAM(state); |
| 279 | auto& impl = thisObject.wrapped(); |
| 280 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.actualBoundingBoxDescent()); |
| 281 | return result; |
| 282 | } |
| 283 | |
| 284 | EncodedJSValue jsTextMetricsActualBoundingBoxDescent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 285 | { |
| 286 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsActualBoundingBoxDescentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "actualBoundingBoxDescent" ); |
| 287 | } |
| 288 | |
| 289 | static inline JSValue jsTextMetricsEmHeightAscentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 290 | { |
| 291 | UNUSED_PARAM(throwScope); |
| 292 | UNUSED_PARAM(state); |
| 293 | auto& impl = thisObject.wrapped(); |
| 294 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.emHeightAscent()); |
| 295 | return result; |
| 296 | } |
| 297 | |
| 298 | EncodedJSValue jsTextMetricsEmHeightAscent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 299 | { |
| 300 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsEmHeightAscentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "emHeightAscent" ); |
| 301 | } |
| 302 | |
| 303 | static inline JSValue jsTextMetricsEmHeightDescentGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 304 | { |
| 305 | UNUSED_PARAM(throwScope); |
| 306 | UNUSED_PARAM(state); |
| 307 | auto& impl = thisObject.wrapped(); |
| 308 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.emHeightDescent()); |
| 309 | return result; |
| 310 | } |
| 311 | |
| 312 | EncodedJSValue jsTextMetricsEmHeightDescent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 313 | { |
| 314 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsEmHeightDescentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "emHeightDescent" ); |
| 315 | } |
| 316 | |
| 317 | static inline JSValue jsTextMetricsHangingBaselineGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 318 | { |
| 319 | UNUSED_PARAM(throwScope); |
| 320 | UNUSED_PARAM(state); |
| 321 | auto& impl = thisObject.wrapped(); |
| 322 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.hangingBaseline()); |
| 323 | return result; |
| 324 | } |
| 325 | |
| 326 | EncodedJSValue jsTextMetricsHangingBaseline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 327 | { |
| 328 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsHangingBaselineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "hangingBaseline" ); |
| 329 | } |
| 330 | |
| 331 | static inline JSValue jsTextMetricsAlphabeticBaselineGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 332 | { |
| 333 | UNUSED_PARAM(throwScope); |
| 334 | UNUSED_PARAM(state); |
| 335 | auto& impl = thisObject.wrapped(); |
| 336 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.alphabeticBaseline()); |
| 337 | return result; |
| 338 | } |
| 339 | |
| 340 | EncodedJSValue jsTextMetricsAlphabeticBaseline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 341 | { |
| 342 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsAlphabeticBaselineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "alphabeticBaseline" ); |
| 343 | } |
| 344 | |
| 345 | static inline JSValue jsTextMetricsIdeographicBaselineGetter(ExecState& state, JSTextMetrics& thisObject, ThrowScope& throwScope) |
| 346 | { |
| 347 | UNUSED_PARAM(throwScope); |
| 348 | UNUSED_PARAM(state); |
| 349 | auto& impl = thisObject.wrapped(); |
| 350 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.ideographicBaseline()); |
| 351 | return result; |
| 352 | } |
| 353 | |
| 354 | EncodedJSValue jsTextMetricsIdeographicBaseline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 355 | { |
| 356 | return IDLAttribute<JSTextMetrics>::get<jsTextMetricsIdeographicBaselineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ideographicBaseline" ); |
| 357 | } |
| 358 | |
| 359 | void JSTextMetrics::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 360 | { |
| 361 | auto* thisObject = jsCast<JSTextMetrics*>(cell); |
| 362 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 363 | if (thisObject->scriptExecutionContext()) |
| 364 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 365 | Base::heapSnapshot(cell, builder); |
| 366 | } |
| 367 | |
| 368 | bool JSTextMetricsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 369 | { |
| 370 | UNUSED_PARAM(handle); |
| 371 | UNUSED_PARAM(visitor); |
| 372 | UNUSED_PARAM(reason); |
| 373 | return false; |
| 374 | } |
| 375 | |
| 376 | void JSTextMetricsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 377 | { |
| 378 | auto* jsTextMetrics = static_cast<JSTextMetrics*>(handle.slot()->asCell()); |
| 379 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 380 | uncacheWrapper(world, &jsTextMetrics->wrapped(), jsTextMetrics); |
| 381 | } |
| 382 | |
| 383 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TextMetrics>&& impl) |
| 384 | { |
| 385 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
| 386 | // attribute. You should remove that attribute. If the class has subclasses |
| 387 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
| 388 | // attribute to TextMetrics. |
| 389 | static_assert(!std::is_polymorphic<TextMetrics>::value, "TextMetrics is polymorphic but the IDL claims it is not" ); |
| 390 | return createWrapper<TextMetrics>(globalObject, WTFMove(impl)); |
| 391 | } |
| 392 | |
| 393 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TextMetrics& impl) |
| 394 | { |
| 395 | return wrap(state, globalObject, impl); |
| 396 | } |
| 397 | |
| 398 | TextMetrics* JSTextMetrics::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 399 | { |
| 400 | if (auto* wrapper = jsDynamicCast<JSTextMetrics*>(vm, value)) |
| 401 | return &wrapper->wrapped(); |
| 402 | return nullptr; |
| 403 | } |
| 404 | |
| 405 | } |
| 406 | |