Skip to content

Commit

Permalink
Cherry-pick f3dfd0c. rdar://problem/102052562
Browse files Browse the repository at this point in the history
    REGRESSION (255903@main): iWork/Numbers/Pages Keynote attachments appear upside down
    https://bugs.webkit.org/show_bug.cgi?id=248421
    <rdar://102052562>

    Unreviewed revert.

    Revert 255903@main.

    * LayoutTests/fast/attachment/mac/attachment-element-gpu-process-expected.html: Removed.
    * LayoutTests/fast/attachment/mac/attachment-element-gpu-process.html: Removed.
    * Source/WebCore/SourcesCocoa.txt:
    * Source/WebCore/WebCore.xcodeproj/project.pbxproj:
    * Source/WebCore/rendering/AttachmentLayout.h: Removed.
    * Source/WebCore/rendering/AttachmentLayout.mm: Removed.
    * Source/WebCore/rendering/RenderTheme.cpp:
    (WebCore::RenderTheme::paint):
    * Source/WebCore/rendering/RenderTheme.h:
    (WebCore::RenderTheme::paintAttachmentText): Deleted.
    * Source/WebCore/rendering/RenderThemeCocoa.h:
    * Source/WebCore/rendering/RenderThemeCocoa.mm:
    (WebCore::RenderThemeCocoa::attachmentBaseline const): Deleted.
    (WebCore::RenderThemeCocoa::paintAttachmentText): Deleted.
    * Source/WebCore/rendering/RenderThemeIOS.h:
    * Source/WebCore/rendering/RenderThemeIOS.mm:
    (WebCore::attachmentActionFont):
    (WebCore::attachmentActionColor):
    (WebCore::attachmentTitleFont):
    (WebCore::shortCaptionPointSizeWithContentSizeCategory):
    (WebCore::attachmentDynamicTypeScaleFactor):
    (WebCore::attachmentTitleColor):
    (WebCore::attachmentSubtitleFont):
    (WebCore::attachmentSubtitleColor):
    (WebCore::RenderAttachmentInfo::addLine):
    (WebCore::RenderAttachmentInfo::buildWrappedLines):
    (WebCore::RenderAttachmentInfo::buildSingleLine):
    (WebCore::getAttachmentProgress):
    (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
    (WebCore::RenderThemeIOS::attachmentBaseline const):
    (WebCore::paintAttachmentIcon):
    (WebCore::paintAttachmentText):
    (WebCore::paintAttachmentProgress):
    (WebCore::attachmentBorderPath):
    (WebCore::RenderThemeIOS::paintAttachment):
    * Source/WebCore/rendering/RenderThemeMac.h:
    * Source/WebCore/rendering/RenderThemeMac.mm:
    (WebCore::titleTextColorForAttachment):
    (WebCore::AttachmentLayout::addTitleLine):
    (WebCore::AttachmentLayout::layOutTitle):
    (WebCore::AttachmentLayout::layOutSubtitle):
    (WebCore::AttachmentLayout::AttachmentLayout):
    (WebCore::RenderThemeMac::attachmentBaseline const):
    (WebCore::paintAttachmentIcon):
    (WebCore::paintAttachmentTitle):
    (WebCore::paintAttachmentSubtitle):
    (WebCore::RenderThemeMac::paintAttachment):

    Canonical link: https://commits.webkit.org/257095@main

Canonical link: https://commits.webkit.org/257041.3@safari-7615.1.13-branch
  • Loading branch information
nmoucht authored and rjepstein committed Nov 29, 2022
1 parent ddd9d83 commit 7c163eb
Show file tree
Hide file tree
Showing 13 changed files with 532 additions and 136 deletions.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion Source/WebCore/SourcesCocoa.txt
Expand Up @@ -635,7 +635,6 @@ platform/text/cocoa/LocalizedDateCache.mm
platform/text/mac/TextBoundaries.mm
platform/text/mac/TextCheckingMac.mm
platform/xr/cocoa/PlatformXRCocoa.mm
rendering/AttachmentLayout.mm
rendering/RenderThemeCocoa.mm
rendering/RenderThemeIOS.mm
rendering/RenderThemeMac.mm
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Expand Up @@ -7013,8 +7013,6 @@
1A2C6673242AFEF8003055EC /* ShareDataReader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShareDataReader.h; sourceTree = "<group>"; };
1A2E6E580CC55213004A2062 /* SQLValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLValue.h; sourceTree = "<group>"; };
1A2E6E780CC556D5004A2062 /* SQLiteAuthorizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteAuthorizer.cpp; sourceTree = "<group>"; };
1A33AE3F28F9F290009804B4 /* AttachmentLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AttachmentLayout.h; sourceTree = "<group>"; };
1A33AE4028F9F478009804B4 /* AttachmentLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AttachmentLayout.mm; sourceTree = "<group>"; };
1A3586DD15264C450022A659 /* RenderMultiColumnFlow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMultiColumnFlow.cpp; sourceTree = "<group>"; };
1A3586DE15264C450022A659 /* RenderMultiColumnFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMultiColumnFlow.h; sourceTree = "<group>"; };
1A3763691A2E68BB009A7EE2 /* StorageNamespaceProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceProvider.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -33132,8 +33130,6 @@
BC8C8FAA0DDCD2F200B592F4 /* style */,
088C2F7412390080003D65CE /* svg */,
E47C391E1FE6E08C00BBBC6B /* updating */,
1A33AE3F28F9F290009804B4 /* AttachmentLayout.h */,
1A33AE4028F9F478009804B4 /* AttachmentLayout.mm */,
A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
E444B0AA28C8B1A800CA560E /* BackgroundPainter.cpp */,
Expand Down
80 changes: 0 additions & 80 deletions Source/WebCore/rendering/AttachmentLayout.h

This file was deleted.

8 changes: 4 additions & 4 deletions Source/WebCore/rendering/RenderTheme.cpp
Expand Up @@ -548,14 +548,14 @@ bool RenderTheme::paint(const RenderBox& box, ControlStates& controlStates, cons
case ApplePayButtonPart:
return paintApplePayButton(box, paintInfo, integralSnappedRect);
#endif
#if ENABLE(DATALIST_ELEMENT)
case ListButtonPart:
return paintListButton(box, paintInfo, devicePixelSnappedRect);
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
case AttachmentPart:
case BorderlessAttachmentPart:
return paintAttachment(box, paintInfo, integralSnappedRect);
#endif
#if ENABLE(DATALIST_ELEMENT)
case ListButtonPart:
return paintListButton(box, paintInfo, devicePixelSnappedRect);
#endif
default:
break;
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/rendering/RenderTheme.h
Expand Up @@ -32,7 +32,6 @@

namespace WebCore {

struct AttachmentLayout;
class BorderData;
class Element;
class FileList;
Expand Down Expand Up @@ -333,7 +332,6 @@ class RenderTheme {

#if ENABLE(ATTACHMENT_ELEMENT)
virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&);
virtual void paintAttachmentText(GraphicsContext&, AttachmentLayout*) { }
#endif

#if ENABLE(DATALIST_ELEMENT)
Expand Down
5 changes: 0 additions & 5 deletions Source/WebCore/rendering/RenderThemeCocoa.h
Expand Up @@ -30,7 +30,6 @@
#include <wtf/RetainPtr.h>

OBJC_CLASS NSDateComponentsFormatter;
struct AttachmentLayout;

namespace WebCore {

Expand All @@ -40,10 +39,6 @@ class RenderThemeCocoa : public RenderTheme {

protected:
virtual Color pictureFrameColor(const RenderObject&);
#if ENABLE(ATTACHMENT_ELEMENT)
int attachmentBaseline(const RenderAttachment& attachment) const final;
void paintAttachmentText(GraphicsContext&, AttachmentLayout*) final;
#endif

private:
void purgeCaches() override;
Expand Down
20 changes: 0 additions & 20 deletions Source/WebCore/rendering/RenderThemeCocoa.mm
Expand Up @@ -26,9 +26,7 @@
#import "config.h"
#import "RenderThemeCocoa.h"

#import "AttachmentLayout.h"
#import "ApplePayLogoSystemImage.h"
#import "DrawGlyphsRecorder.h"
#import "FloatRoundedRect.h"
#import "FontCacheCoreText.h"
#import "GraphicsContextCG.h"
Expand Down Expand Up @@ -244,22 +242,4 @@ static inline FontSelectionValue cssWeightOfSystemFont(CTFontRef font)
return FontSelectionValue(900);
}

#if ENABLE(ATTACHMENT_ELEMENT)

int RenderThemeCocoa::attachmentBaseline(const RenderAttachment& attachment) const
{
AttachmentLayout layout(attachment, AttachmentLayoutStyle::NonSelected);
return layout.baseline;
}

void RenderThemeCocoa::paintAttachmentText(GraphicsContext& context, AttachmentLayout* layout)
{
DrawGlyphsRecorder recorder(context, 1, DrawGlyphsRecorder::DeriveFontFromContext::Yes);

for (const auto& line : layout->lines)
recorder.drawNativeText(line.font.get(), CTFontGetSize(line.font.get()), line.line.get(), line.rect);
}

#endif

}
1 change: 1 addition & 0 deletions Source/WebCore/rendering/RenderThemeIOS.h
Expand Up @@ -171,6 +171,7 @@ class RenderThemeIOS final : public RenderThemeCocoa {

#if ENABLE(ATTACHMENT_ELEMENT)
LayoutSize attachmentIntrinsicSize(const RenderAttachment&) const override;
int attachmentBaseline(const RenderAttachment&) const override;
bool attachmentShouldAllowWidthToShrink(const RenderAttachment&) const override { return true; }
String attachmentStyleSheet() const final;
bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&) override;
Expand Down

0 comments on commit 7c163eb

Please sign in to comment.