bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) { COMPtr<IDOMDocument> document; if (FAILED(frame->DOMDocument(&document))) return false; wstring idWstring = jsStringRefToWString(id); BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); COMPtr<IDOMElement> element; HRESULT result = document->getElementById(idBSTR, &element); SysFreeString(idBSTR); if (FAILED(result)) return false; COMPtr<IWebFramePrivate> framePrivate(Query, frame); if (!framePrivate) return false; BOOL autoCompletes; if (FAILED(framePrivate->elementDoesAutoComplete(element.get(), &autoCompletes))) return false; return autoCompletes; }
bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) { COMPtr<IDOMDocument> document; if (FAILED(frame->DOMDocument(&document))) return false; BSTR idBSTR = JSStringCopyBSTR(animationId); COMPtr<IDOMElement> element; HRESULT hr = document->getElementById(idBSTR, &element); SysFreeString(idBSTR); if (FAILED(hr)) return false; COMPtr<IWebFramePrivate> framePrivate(Query, frame); if (!framePrivate) return false; BSTR elementIdBSTR = JSStringCopyBSTR(elementId); BOOL wasRunning = FALSE; hr = framePrivate->pauseSVGAnimation(elementIdBSTR, element.get(), time, &wasRunning); SysFreeString(elementIdBSTR); return SUCCEEDED(hr) && wasRunning; }
bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) { COMPtr<IDOMDocument> document; if (FAILED(frame->DOMDocument(&document))) return false; BSTR idBSTR = JSStringCopyBSTR(elementId); COMPtr<IDOMElement> element; HRESULT hr = document->getElementById(idBSTR, &element); SysFreeString(idBSTR); if (FAILED(hr)) return false; COMPtr<IWebFramePrivate> framePrivate(Query, frame); if (!framePrivate) return false; BSTR nameBSTR = JSStringCopyBSTR(propertyName); BOOL wasRunning = FALSE; hr = framePrivate->pauseTransition(nameBSTR, element.get(), time, &wasRunning); SysFreeString(nameBSTR); return SUCCEEDED(hr) && wasRunning; }