haikuwebkit/Source/WebCore/css/CSSPaintSize.h

59 lines
1.9 KiB
C
Raw Permalink Normal View History

CSS Painting API should pass size, arguments and input properties to paint callback https://bugs.webkit.org/show_bug.cgi?id=191309 Reviewed by Chris Dumez. Source/WebCore: Call paint() callback with input properties and arguments. This patch adds a stub for the CSS Typed OM StylePropertyMapReadOnly, and passes all the arguments as strings without any syntax checking to the paint callback. Test: fast/css-custom-paint/properties.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSStyleValueCustom.cpp: Copied from Source/WebCore/css/CSSPaintCallback.h. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: * css/CSSPaintCallback.h: * css/CSSPaintCallback.idl: * css/CSSPaintImageValue.cpp: (WebCore::CSSPaintImageValue::image): * css/CSSPaintImageValue.h: * css/CSSPaintSize.h: Copied from Source/WebCore/css/CSSPaintCallback.h. (WebCore::CSSPaintSize::create): (WebCore::CSSPaintSize::width const): (WebCore::CSSPaintSize::height const): (WebCore::CSSPaintSize::CSSPaintSize): * css/CSSPaintSize.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeCustomPaint): * css/typedom/CSSNumericValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. * css/typedom/CSSNumericValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * css/typedom/CSSStyleValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. (WebCore::CSSStyleValue::isUnitValue): (WebCore::CSSStyleValue::isUnparsedValue): * css/typedom/CSSStyleValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * css/typedom/CSSUnitValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. * css/typedom/CSSUnitValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * css/typedom/CSSUnparsedValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. * css/typedom/CSSUnparsedValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * css/typedom/StylePropertyMapReadOnly.h: Copied from Source/WebCore/css/CSSPaintCallback.h. (WebCore::StylePropertyMapReadOnly::create): (WebCore::StylePropertyMapReadOnly::get): (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly): * css/typedom/StylePropertyMapReadOnly.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. * platform/graphics/CustomPaintImage.cpp: (WebCore::CustomPaintImage::CustomPaintImage): (WebCore::CustomPaintImage::doCustomPaint): * platform/graphics/CustomPaintImage.h: LayoutTests: * fast/css-custom-paint/properties-expected.html: Added. * fast/css-custom-paint/properties.html: Added. * fast/css-custom-paint/worklet.html: Canonical link: https://commits.webkit.org/206202@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-08 05:29:59 +00:00
/*
* Copyright (C) 2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(CSS_PAINTING_API)
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class CSSPaintSize : public RefCounted<CSSPaintSize> {
public:
static Ref<CSSPaintSize> create(double width, double height)
{
return adoptRef(*new CSSPaintSize(width, height));
}
double width() const { return m_width; }
double height() const { return m_height; }
private:
CSSPaintSize(double width, double height)
: m_width(width)
, m_height(height)
{
}
double m_width;
double m_height;
};
} // namespace WebCore
#endif