Source/WebCore:
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 08:05:36 +0000 (08:05 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 08:05:36 +0000 (08:05 +0000)
commitfa3835533e264bc25f0b1805f0439226916fe25b
tree19036460b47897f21913311439cfad1505186ea9
parent56022b416662168cdcdbd3380f091d2a2b1436b9
Source/WebCore:
First letter text renderer should be anonymous
https://bugs.webkit.org/show_bug.cgi?id=179114

Reviewed by Darin Adler.

Currently both RenderTextFragment and RenderText for first letter point to the same Text node.
There should only be one non-anonymous renderer per node.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):

    Skip the first letter text renderer instead of the fragment.

* rendering/RenderBoxModelObject.cpp:
(WebCore::firstLetterRemainingTextMap):

    Use WeakPtr.
    Modernize.

(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::firstLetterRemainingText const):

    Avoid hash lookup with the new isFirstLetter bit.

(WebCore::RenderBoxModelObject::setFirstLetterRemainingText):

* rendering/RenderElement.cpp:
(WebCore::RenderElement::RenderElement):
* rendering/RenderElement.h:
(WebCore::RenderElement::isFirstLetter const):
(WebCore::RenderElement::setIsFirstLetter):

    Add a bit for more explicit code.

* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::setText):

    Assert that RenderTextFragment is always the non-anonymous renderer.

* style/RenderTreeUpdaterFirstLetter.cpp:
(WebCore::updateFirstLetterStyle):

    Set the isFirstLetter bit.

(WebCore::createFirstLetterRenderer):

    Set the isFirstLetter bit.
    Remove the old text renderer before adding a new one.

LayoutTests:
First letter renderer should be anonymous
https://bugs.webkit.org/show_bug.cgi?id=179114

Reviewed by Darin Adler.

* fast/dynamic/first-letter-after-list-marker-expected.txt:
* platform/mac/css1/pseudo/firstletter-expected.txt:
* platform/mac/css1/pseudo/multiple_pseudo_elements-expected.txt:
* platform/mac/css2.1/t051202-c24-first-lttr-00-b-expected.txt:
* platform/mac/css2.1/t051202-c26-psudo-nest-00-c-expected.txt:
* platform/mac/css3/selectors3/html/css3-modsel-166-expected.txt:
* platform/mac/css3/selectors3/html/css3-modsel-166a-expected.txt:
* platform/mac/css3/selectors3/html/css3-modsel-39-expected.txt:
* platform/mac/css3/selectors3/html/css3-modsel-39b-expected.txt:
* platform/mac/css3/selectors3/xhtml/css3-modsel-166-expected.txt:
* platform/mac/css3/selectors3/xhtml/css3-modsel-166a-expected.txt:
* platform/mac/css3/selectors3/xhtml/css3-modsel-39-expected.txt:
* platform/mac/css3/selectors3/xhtml/css3-modsel-39b-expected.txt:
* platform/mac/css3/selectors3/xml/css3-modsel-166-expected.txt:
* platform/mac/css3/selectors3/xml/css3-modsel-166a-expected.txt:
* platform/mac/css3/selectors3/xml/css3-modsel-39-expected.txt:
* platform/mac/css3/selectors3/xml/css3-modsel-39b-expected.txt:
* platform/mac/editing/selection/extend-by-word-002-expected.txt:
* platform/mac/fast/block/lineboxcontain/glyphs-expected.txt:
* platform/mac/fast/box-shadow/basic-shadows-expected.txt:
* platform/mac/fast/css-generated-content/003-expected.txt:
* platform/mac/fast/css-generated-content/007-expected.txt:
* platform/mac/fast/css-generated-content/009-expected.txt:
* platform/mac/fast/css-generated-content/012-expected.txt:
* platform/mac/fast/css-generated-content/first-letter-in-nested-before-table-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-clearance-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt:
* platform/mac/fast/css/first-letter-capitalized-expected.txt:
* platform/mac/fast/css/first-letter-detach-expected.txt:
* platform/mac/fast/css/first-letter-first-line-hover-expected.txt:
* platform/mac/fast/css/first-letter-float-after-float-expected.txt:
* platform/mac/fast/css/first-letter-float-expected.txt:
* platform/mac/fast/css/first-letter-hover-expected.txt:
* platform/mac/fast/css/first-letter-punctuation-expected.txt:
* platform/mac/fast/css/first-letter-recalculation-expected.txt:
* platform/mac/fast/css/first-letter-visibility-expected.txt:
* platform/mac/fast/dynamic/first-letter-display-change-expected.txt:
* platform/mac/fast/multicol/shadow-breaking-expected.txt:
* platform/mac/fast/selectors/039-expected.txt:
* platform/mac/fast/selectors/039b-expected.txt:
* platform/mac/fast/selectors/166a-expected.txt:
* platform/mac/fast/text/firstline/002-expected.txt:
* platform/mac/fast/text/firstline/003-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
106 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.txt
LayoutTests/platform/ios-wk2/fast/css/first-letter-hover-expected.txt
LayoutTests/platform/ios/css1/pseudo/firstletter-expected.txt
LayoutTests/platform/ios/css1/pseudo/multiple_pseudo_elements-expected.txt
LayoutTests/platform/ios/css2.1/t051202-c24-first-lttr-00-b-expected.txt
LayoutTests/platform/ios/css2.1/t051202-c26-psudo-nest-00-c-expected.txt
LayoutTests/platform/ios/css3/selectors3/html/css3-modsel-166-expected.txt
LayoutTests/platform/ios/css3/selectors3/html/css3-modsel-166a-expected.txt
LayoutTests/platform/ios/css3/selectors3/html/css3-modsel-39-expected.txt
LayoutTests/platform/ios/css3/selectors3/html/css3-modsel-39b-expected.txt
LayoutTests/platform/ios/css3/selectors3/xhtml/css3-modsel-166-expected.txt
LayoutTests/platform/ios/css3/selectors3/xhtml/css3-modsel-166a-expected.txt
LayoutTests/platform/ios/css3/selectors3/xhtml/css3-modsel-39-expected.txt
LayoutTests/platform/ios/css3/selectors3/xhtml/css3-modsel-39b-expected.txt
LayoutTests/platform/ios/css3/selectors3/xml/css3-modsel-166-expected.txt
LayoutTests/platform/ios/css3/selectors3/xml/css3-modsel-166a-expected.txt
LayoutTests/platform/ios/css3/selectors3/xml/css3-modsel-39-expected.txt
LayoutTests/platform/ios/css3/selectors3/xml/css3-modsel-39b-expected.txt
LayoutTests/platform/ios/fast/block/lineboxcontain/glyphs-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/003-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/007-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/009-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/012-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/first-letter-in-nested-before-table-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-basic-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-border-padding-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-clearance-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-descender-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-raised-expected.txt
LayoutTests/platform/ios/fast/css-generated-content/initial-letter-sunken-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-capitalized-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-detach-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-first-line-hover-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-float-after-float-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-float-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-punctuation-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-recalculation-expected.txt
LayoutTests/platform/ios/fast/css/first-letter-visibility-expected.txt
LayoutTests/platform/ios/fast/dynamic/first-letter-display-change-expected.txt
LayoutTests/platform/ios/fast/multicol/shadow-breaking-expected.txt
LayoutTests/platform/ios/fast/selectors/039-expected.txt
LayoutTests/platform/ios/fast/selectors/039b-expected.txt
LayoutTests/platform/ios/fast/selectors/166a-expected.txt
LayoutTests/platform/ios/fast/text/firstline/002-expected.txt
LayoutTests/platform/ios/fast/text/firstline/003-expected.txt
LayoutTests/platform/ios/ietestcenter/css3/text/textshadow-004-expected.txt
LayoutTests/platform/mac-sierra/fast/css-generated-content/initial-letter-basic-expected.txt
LayoutTests/platform/mac-sierra/fast/css-generated-content/initial-letter-border-padding-expected.txt
LayoutTests/platform/mac-sierra/fast/css-generated-content/initial-letter-raised-expected.txt
LayoutTests/platform/mac-sierra/fast/css-generated-content/initial-letter-sunken-expected.txt
LayoutTests/platform/mac/css1/pseudo/firstletter-expected.txt
LayoutTests/platform/mac/css1/pseudo/multiple_pseudo_elements-expected.txt
LayoutTests/platform/mac/css2.1/t051202-c24-first-lttr-00-b-expected.txt
LayoutTests/platform/mac/css2.1/t051202-c26-psudo-nest-00-c-expected.txt
LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-166-expected.txt
LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-166a-expected.txt
LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-39-expected.txt
LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-39b-expected.txt
LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-166-expected.txt
LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-166a-expected.txt
LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-39-expected.txt
LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-39b-expected.txt
LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-166-expected.txt
LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-166a-expected.txt
LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-39-expected.txt
LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-39b-expected.txt
LayoutTests/platform/mac/editing/selection/extend-by-word-002-expected.txt
LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.txt
LayoutTests/platform/mac/fast/box-shadow/basic-shadows-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/003-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/007-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/009-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/012-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/first-letter-in-nested-before-table-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-clearance-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-capitalized-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-detach-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-float-after-float-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-float-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-hover-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-punctuation-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-recalculation-expected.txt
LayoutTests/platform/mac/fast/css/first-letter-visibility-expected.txt
LayoutTests/platform/mac/fast/dynamic/first-letter-display-change-expected.txt
LayoutTests/platform/mac/fast/multicol/shadow-breaking-expected.txt
LayoutTests/platform/mac/fast/selectors/039-expected.txt
LayoutTests/platform/mac/fast/selectors/039b-expected.txt
LayoutTests/platform/mac/fast/selectors/166a-expected.txt
LayoutTests/platform/mac/fast/text/firstline/002-expected.txt
LayoutTests/platform/mac/fast/text/firstline/003-expected.txt
LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-004-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderTextFragment.cpp
Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp