Skip to content

Commit

Permalink
Unreviewed, reverting 270445@main.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264536

Seems to have regressed binary size significantly

Reverted changeset:

"Port ControlPart related controls to the new IPC serialization format"
https://bugs.webkit.org/show_bug.cgi?id=261819
https://commits.webkit.org/270445@main

Canonical link: https://commits.webkit.org/270490@main
  • Loading branch information
webkit-commit-queue authored and cdumez committed Nov 10, 2023
1 parent 927b1ff commit 8b9811c
Show file tree
Hide file tree
Showing 94 changed files with 1,231 additions and 1,192 deletions.
37 changes: 18 additions & 19 deletions Source/WebCore/Headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2028,29 +2028,28 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
platform/graphics/angle/ANGLEUtilities.h
platform/graphics/angle/GraphicsContextGLANGLE.h

platform/graphics/controls/ButtonAppearance.h
platform/graphics/controls/ColorWellAppearance.h
platform/graphics/controls/ControlAppearance.h
platform/graphics/controls/ButtonPart.h
platform/graphics/controls/ColorWellPart.h
platform/graphics/controls/ControlFactory.h
platform/graphics/controls/ControlPart.h
platform/graphics/controls/ControlStyle.h
platform/graphics/controls/ImageControlsButtonAppearance.h
platform/graphics/controls/InnerSpinButtonAppearance.h
platform/graphics/controls/MenuListAppearance.h
platform/graphics/controls/MenuListButtonAppearance.h
platform/graphics/controls/MeterAppearance.h
platform/graphics/controls/ImageControlsButtonPart.h
platform/graphics/controls/InnerSpinButtonPart.h
platform/graphics/controls/MenuListButtonPart.h
platform/graphics/controls/MenuListPart.h
platform/graphics/controls/MeterPart.h
platform/graphics/controls/PlatformControl.h
platform/graphics/controls/ProgressBarAppearance.h
platform/graphics/controls/SearchFieldAppearance.h
platform/graphics/controls/SearchFieldCancelButtonAppearance.h
platform/graphics/controls/SearchFieldResultsAppearance.h
platform/graphics/controls/SliderThumbAppearance.h
platform/graphics/controls/SliderTrackAppearance.h
platform/graphics/controls/SwitchThumbAppearance.h
platform/graphics/controls/SwitchTrackAppearance.h
platform/graphics/controls/TextAreaAppearance.h
platform/graphics/controls/TextFieldAppearance.h
platform/graphics/controls/ToggleButtonAppearance.h
platform/graphics/controls/ProgressBarPart.h
platform/graphics/controls/SearchFieldCancelButtonPart.h
platform/graphics/controls/SearchFieldPart.h
platform/graphics/controls/SearchFieldResultsPart.h
platform/graphics/controls/SliderThumbPart.h
platform/graphics/controls/SliderTrackPart.h
platform/graphics/controls/SwitchThumbPart.h
platform/graphics/controls/SwitchTrackPart.h
platform/graphics/controls/TextAreaPart.h
platform/graphics/controls/TextFieldPart.h
platform/graphics/controls/ToggleButtonPart.h

platform/graphics/displaylists/DisplayList.h
platform/graphics/displaylists/DisplayListDrawingContext.h
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2341,13 +2341,13 @@ platform/graphics/VelocityData.cpp
platform/graphics/WebMResourceClient.cpp
platform/graphics/WOFFFileFormat.cpp
platform/graphics/WidthIterator.cpp
platform/graphics/controls/ApplePayButtonAppearance.cpp
platform/graphics/controls/ApplePayButtonPart.cpp
platform/graphics/controls/ControlFactory.cpp
platform/graphics/controls/ControlPart.cpp
platform/graphics/controls/ControlStyle.cpp
platform/graphics/controls/MeterAppearance.cpp
platform/graphics/controls/ProgressBarAppearance.cpp
platform/graphics/controls/SliderTrackAppearance.cpp
platform/graphics/controls/MeterPart.cpp
platform/graphics/controls/ProgressBarPart.cpp
platform/graphics/controls/SliderTrackPart.cpp
platform/graphics/cpu/arm/filters/FEBlendNeonApplier.cpp
platform/graphics/displaylists/DisplayList.cpp
platform/graphics/displaylists/DisplayListDrawingContext.cpp
Expand Down
170 changes: 82 additions & 88 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
#include <wtf/unicode/CharacterNames.h>

#if ENABLE(APPLE_PAY)
#include "ApplePayButtonAppearance.h"
#include "ApplePayButtonPart.h"
#endif

namespace WebCore {
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/css/CSSPrimitiveValueMappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <wtf/MathExtras.h>

#if ENABLE(APPLE_PAY)
#include "ApplePayButtonAppearance.h"
#include "ApplePayButtonPart.h"
#endif

namespace WebCore {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@

namespace WebCore {

class ApplePayButtonAppearance;
class ApplePayButtonPart;

class ApplePayButtonCocoa final : public PlatformControl {
public:
ApplePayButtonCocoa(ControlPart& owningPart);
ApplePayButtonCocoa(ApplePayButtonPart& owningMeterPart);

private:
const ApplePayButtonPart& owningApplePayButtonPart() const { return downcast<ApplePayButtonPart>(m_owningPart); }

void draw(GraphicsContext&, const FloatRoundedRect& borderRect, float deviceScaleFactor, const ControlStyle&) override;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@

#if ENABLE(APPLE_PAY)

#import "ApplePayButtonAppearance.h"
#import "ApplePayButtonPart.h"
#import "FloatRoundedRect.h"
#import "GraphicsContextCG.h"
#import <pal/cocoa/PassKitSoftLink.h>

namespace WebCore {

ApplePayButtonCocoa::ApplePayButtonCocoa(ControlPart& owningPart)
ApplePayButtonCocoa::ApplePayButtonCocoa(ApplePayButtonPart& owningPart)
: PlatformControl(owningPart)
{
ASSERT(m_owningPart.type() == StyleAppearance::ApplePayButton);
}

static PKPaymentButtonType toPKPaymentButtonType(ApplePayButtonType type)
Expand Down Expand Up @@ -106,17 +105,16 @@ static PKPaymentButtonStyle toPKPaymentButtonStyle(ApplePayButtonStyle style)
context.scale(FloatSize(1, -1));

auto logicalRect = borderRect.rect();

const auto& applePayButtonAppearance = owningPart().get<ApplePayButtonAppearance>();

const auto& applePayButtonPart = owningApplePayButtonPart();

PKDrawApplePayButtonWithCornerRadius(
context.platformContext(),
CGRectMake(logicalRect.x(), -logicalRect.maxY(), logicalRect.width(), logicalRect.height()),
1.0,
largestCornerRadius,
toPKPaymentButtonType(applePayButtonAppearance.buttonType()),
toPKPaymentButtonStyle(applePayButtonAppearance.buttonStyle()),
applePayButtonAppearance.locale()
toPKPaymentButtonType(applePayButtonPart.buttonType()),
toPKPaymentButtonStyle(applePayButtonPart.buttonStyle()),
applePayButtonPart.locale()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ControlFactoryCocoa : public ControlFactory {
using ControlFactory::ControlFactory;

#if ENABLE(APPLE_PAY)
std::unique_ptr<PlatformControl> createPlatformApplePayButton(ControlPart&) override;
std::unique_ptr<PlatformControl> createPlatformApplePayButton(ApplePayButtonPart&) override;
#endif
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
namespace WebCore {

#if ENABLE(APPLE_PAY)
std::unique_ptr<PlatformControl> ControlFactoryCocoa::createPlatformApplePayButton(ControlPart& part)
std::unique_ptr<PlatformControl> ControlFactoryCocoa::createPlatformApplePayButton(ApplePayButtonPart& part)
{
return makeUnique<ApplePayButtonCocoa>(part);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,35 @@
*/

#include "config.h"
#include "ApplePayButtonAppearance.h"
#include "ApplePayButtonPart.h"

#if ENABLE(APPLE_PAY)

#include "ControlFactory.h"

namespace WebCore {

ApplePayButtonAppearance::ApplePayButtonAppearance()
: ApplePayButtonAppearance(ApplePayButtonType::Plain, ApplePayButtonStyle::White, { })
Ref<ApplePayButtonPart> ApplePayButtonPart::create()
{
return adoptRef(*new ApplePayButtonPart(ApplePayButtonType::Plain, ApplePayButtonStyle::White, { }));
}

ApplePayButtonAppearance::ApplePayButtonAppearance(ApplePayButtonType buttonType, ApplePayButtonStyle buttonStyle, const String& locale)
: m_buttonType(buttonType)
Ref<ApplePayButtonPart> ApplePayButtonPart::create(ApplePayButtonType buttonType, ApplePayButtonStyle buttonStyle, const String& locale)
{
return adoptRef(*new ApplePayButtonPart(buttonType, buttonStyle, locale));
}

ApplePayButtonPart::ApplePayButtonPart(ApplePayButtonType buttonType, ApplePayButtonStyle buttonStyle, const String& locale)
: ControlPart(StyleAppearance::ApplePayButton)
, m_buttonType(buttonType)
, m_buttonStyle(buttonStyle)
, m_locale(locale)
{
}

std::unique_ptr<PlatformControl> ApplePayButtonAppearance::createPlatformControl(ControlPart& part, ControlFactory& controlFactory)
std::unique_ptr<PlatformControl> ApplePayButtonPart::createPlatformControl()
{
return controlFactory.createPlatformApplePayButton(part);
return controlFactory().createPlatformApplePayButton(*this);
}

} // namespace WebCore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#if ENABLE(APPLE_PAY)

#include "StyleAppearance.h"
#include "ControlPart.h"

namespace WebCore {

Expand Down Expand Up @@ -57,17 +57,10 @@ enum class ApplePayButtonStyle : uint8_t {
Black,
};

class ControlFactory;
class ControlPart;
class PlatformControl;

class ApplePayButtonAppearance {
class ApplePayButtonPart : public ControlPart {
public:
ApplePayButtonAppearance();
WEBCORE_EXPORT ApplePayButtonAppearance(ApplePayButtonType, ApplePayButtonStyle, const String& locale);

static constexpr StyleAppearance appearance = StyleAppearance::ApplePayButton;
std::unique_ptr<PlatformControl> createPlatformControl(ControlPart&, ControlFactory&);
static Ref<ApplePayButtonPart> create();
WEBCORE_EXPORT static Ref<ApplePayButtonPart> create(ApplePayButtonType, ApplePayButtonStyle, const String& locale);

ApplePayButtonType buttonType() const { return m_buttonType; }
void setButtonType(ApplePayButtonType buttonType) { m_buttonType = buttonType; }
Expand All @@ -79,11 +72,17 @@ class ApplePayButtonAppearance {
void setLocale(String locale) { m_locale = locale; }

private:
ApplePayButtonPart(ApplePayButtonType, ApplePayButtonStyle, const String& locale);

std::unique_ptr<PlatformControl> createPlatformControl() override;

ApplePayButtonType m_buttonType;
ApplePayButtonStyle m_buttonStyle;
String m_locale;
};

} // namespace WebCore

SPECIALIZE_TYPE_TRAITS_CONTROL_PART(ApplePayButton)

#endif // ENABLE(APPLE_PAY)
69 changes: 0 additions & 69 deletions Source/WebCore/platform/graphics/controls/ButtonAppearance.h

This file was deleted.

56 changes: 56 additions & 0 deletions Source/WebCore/platform/graphics/controls/ButtonPart.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2022 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

#include "ControlFactory.h"
#include "ControlPart.h"

namespace WebCore {

class ButtonPart final : public ControlPart {
public:
static Ref<ButtonPart> create(StyleAppearance type)
{
return adoptRef(*new ButtonPart(type));
}

private:
ButtonPart(StyleAppearance type)
: ControlPart(type)
{
ASSERT(type == StyleAppearance::Button
|| type == StyleAppearance::DefaultButton
|| type == StyleAppearance::PushButton
|| type == StyleAppearance::SquareButton);
}

std::unique_ptr<PlatformControl> createPlatformControl() final
{
return controlFactory().createPlatformButton(*this);
}
};

} // namespace WebCore
Loading

0 comments on commit 8b9811c

Please sign in to comment.