⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280973 in webkit


Ignore:
Timestamp:
Aug 12, 2021, 11:58:47 AM (5 years ago)
Author:
Devin Rousso
Message:

Fix some NSAttributedString inconsistencies between WK1 and WK2
https://bugs.webkit.org/show_bug.cgi?id=229013
<rdar://problem/81215696>

Reviewed by Timothy Hatcher.

Source/WebCore:

NSAttributedString now uses WK2, which has caused us to discover some inconsistencies (and bugs).

Tests: NSAttributedStringWebKitAdditions.DefaultFontSize

NSAttributedStringWebKitAdditions.MultipleParagraphs

  • editing/cocoa/HTMLConverter.mm:

(HTMLConverter::_blockLevelElementForNode):
Check the given node before looking at the parent as it could already be a block. This
allows for sequental <p> to each have their own positioning instead of only the first one.
(HTMLConverter::computedAttributesForElement):
Fix typo that used margin-right instead of margin-bottom when setting paragraphSpacing.

Source/WebKit:

NSAttributedString now uses WK2, which has caused us to discover some inconsistencies (and bugs).

  • UIProcess/API/Cocoa/NSAttributedString.mm:

(+[_WKAttributedStringWebViewCache configuration]):
Change the default font size to 12 to match WK1.

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/NSAttributedStringWebKitAdditions.mm: Added.

(TEST.NSAttributedStringWebKitAdditions.DefaultFontSize):
(TEST.NSAttributedStringWebKitAdditions.MultipleParagraphs):

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r280972 r280973  
     12021-08-12  Devin Rousso  <drousso@apple.com>
     2
     3        Fix some `NSAttributedString` inconsistencies between WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=229013
     5        <rdar://problem/81215696>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        `NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
     10
     11        Tests: NSAttributedStringWebKitAdditions.DefaultFontSize
     12               NSAttributedStringWebKitAdditions.MultipleParagraphs
     13
     14        * editing/cocoa/HTMLConverter.mm:
     15        (HTMLConverter::_blockLevelElementForNode):
     16        Check the given node before looking at the parent as it could already be a block. This
     17        allows for sequental `<p>` to each have their own positioning instead of only the first one.
     18        (HTMLConverter::computedAttributesForElement):
     19        Fix typo that used `margin-right` instead of `margin-bottom` when setting `paragraphSpacing`.
     20
    1212021-08-12  Youenn Fablet  <youenn@apple.com>
    222
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r279320 r280973  
    837837Element* HTMLConverter::_blockLevelElementForNode(Node* node)
    838838{
    839     Element* element = node->parentElement();
     839    Element* element = is<Element>(node) ? downcast<Element>(node) : node->parentElement();
    840840    if (element && !_caches->isBlockElement(*element))
    841841        element = _blockLevelElementForNode(element->parentInComposedTree());
     
    11291129                [paragraphStyle setTailIndent:-marginRight];
    11301130            float marginBottom = 0.0;
    1131             if (_caches->floatPropertyValueForNode(coreBlockElement, CSSPropertyMarginRight, marginBottom) && marginBottom > 0.0)
     1131            if (_caches->floatPropertyValueForNode(coreBlockElement, CSSPropertyMarginBottom, marginBottom) && marginBottom > 0.0)
    11321132                [paragraphStyle setParagraphSpacing:marginBottom];
    11331133        }
  • trunk/Source/WebKit/ChangeLog

    r280964 r280973  
     12021-08-12  Devin Rousso  <drousso@apple.com>
     2
     3        Fix some `NSAttributedString` inconsistencies between WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=229013
     5        <rdar://problem/81215696>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        `NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
     10
     11        * UIProcess/API/Cocoa/NSAttributedString.mm:
     12        (+[_WKAttributedStringWebViewCache configuration]):
     13        Change the default font size to 12 to match WK1.
     14
    1152021-08-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.mm

    r276621 r280973  
    3131#import <WebKit/WKNavigationActionPrivate.h>
    3232#import <WebKit/WKNavigationDelegate.h>
    33 #import <WebKit/WKPreferences.h>
     33#import <WebKit/WKPreferencesPrivate.h>
    3434#import <WebKit/WKProcessPoolPrivate.h>
    3535#import <WebKit/WKWebViewConfigurationPrivate.h>
     
    152152        [configuration _setClientNavigationsRunAtForegroundPriority:YES];
    153153#endif
     154
     155        [configuration preferences]._defaultFontSize = 12;
    154156    }
    155157
  • trunk/Tools/ChangeLog

    r280972 r280973  
     12021-08-12  Devin Rousso  <drousso@apple.com>
     2
     3        Fix some `NSAttributedString` inconsistencies between WK1 and WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=229013
     5        <rdar://problem/81215696>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/NSAttributedStringWebKitAdditions.mm: Added.
     10        (TEST.NSAttributedStringWebKitAdditions.DefaultFontSize):
     11        (TEST.NSAttributedStringWebKitAdditions.MultipleParagraphs):
     12
     13        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     14
    1152021-08-12  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r280651 r280973  
    889889                950E4CC1252E75240071659F /* iOSStylusSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950E4CC0252E75230071659F /* iOSStylusSupport.mm */; };
    890890                953ABB3525C0D682004C8B73 /* WKWebViewUnderPageBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */; };
     891                958B70E126C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 958B70E026C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm */; };
    891892                95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */; };
    892893                95B6B3B7251EBF2F00FC4382 /* MediaDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */; };
     
    26172618                950E4CC0252E75230071659F /* iOSStylusSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOSStylusSupport.mm; sourceTree = "<group>"; };
    26182619                953ABB3425C0D681004C8B73 /* WKWebViewUnderPageBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewUnderPageBackgroundColor.mm; sourceTree = "<group>"; };
     2620                958B70E026C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSAttributedStringWebKitAdditions.mm; sourceTree = "<group>"; };
    26192621                95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewThemeColor.mm; sourceTree = "<group>"; };
    26202622                95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaDocument.mm; sourceTree = "<group>"; };
     
    35433545                                CD2D0D19213465560018C784 /* NowPlaying.mm */,
    35443546                                2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */,
     3547                                958B70E026C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm */,
    35453548                                A10F047C1E3AD29C00C95E19 /* NSFileManagerExtras.mm */,
    35463549                                F4EB4E8F2328AC3000574DAB /* NSItemProviderAdditions.h */,
     
    56805683                                2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */,
    56815684                                5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */,
     5685                                958B70E126C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm in Sources */,
    56825686                                A10F047E1E3AD29C00C95E19 /* NSFileManagerExtras.mm in Sources */,
    56835687                                F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.