| Differences between
and this patch
- Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp -2 / +15 lines
Lines 85-90 MediaControlsHost::~MediaControlsHost() Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp_sec1
85
85
86
Vector<RefPtr<TextTrack>> MediaControlsHost::sortedTrackListForMenu(TextTrackList* trackList)
86
Vector<RefPtr<TextTrack>> MediaControlsHost::sortedTrackListForMenu(TextTrackList* trackList)
87
{
87
{
88
    WTFReportBacktrace();
89
88
    if (!trackList)
90
    if (!trackList)
89
        return Vector<RefPtr<TextTrack>>();
91
        return Vector<RefPtr<TextTrack>>();
90
92
Lines 92-102 Vector<RefPtr<TextTrack>> MediaControlsH Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp_sec2
92
    if (!page)
94
    if (!page)
93
        return Vector<RefPtr<TextTrack>>();
95
        return Vector<RefPtr<TextTrack>>();
94
96
95
    return page->group().captionPreferences().sortedTrackListForMenu(trackList);
97
    auto r = page->group().captionPreferences().sortedTrackListForMenu(trackList);
98
99
    fprintf(stderr, "tracks %zu\n", r.size());
100
101
    return r;
96
}
102
}
97
103
98
Vector<RefPtr<AudioTrack>> MediaControlsHost::sortedTrackListForMenu(AudioTrackList* trackList)
104
Vector<RefPtr<AudioTrack>> MediaControlsHost::sortedTrackListForMenu(AudioTrackList* trackList)
99
{
105
{
106
    WTFReportBacktrace();
107
100
    if (!trackList)
108
    if (!trackList)
101
        return Vector<RefPtr<AudioTrack>>();
109
        return Vector<RefPtr<AudioTrack>>();
102
110
Lines 104-110 Vector<RefPtr<AudioTrack>> MediaControls Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp_sec3
104
    if (!page)
112
    if (!page)
105
        return Vector<RefPtr<AudioTrack>>();
113
        return Vector<RefPtr<AudioTrack>>();
106
114
107
    return page->group().captionPreferences().sortedTrackListForMenu(trackList);
115
    auto r =  page->group().captionPreferences().sortedTrackListForMenu(trackList);
116
117
    fprintf(stderr, "tracks %zu\n", r.size());
118
119
    return r;
120
108
}
121
}
109
122
110
String MediaControlsHost::displayNameForTrack(TextTrack* track)
123
String MediaControlsHost::displayNameForTrack(TextTrack* track)
- Source/WebCore/WebCore.xcodeproj/project.pbxproj +16 lines
Lines 6574-6579 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
6574
		E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
6574
		E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
6575
		E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
6575
		E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
6576
		E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
6576
		E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
6577
		E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */; };
6578
		E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E76DB1C7AF77600E3614D /* StyleUpdate.h */; };
6577
		E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; };
6579
		E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; };
6578
		E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
6580
		E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
6579
		E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
6581
		E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 6629-6634 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
6629
		E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
6631
		E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
6630
		E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
6632
		E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
6631
		E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
6633
		E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
6634
		E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */; };
6635
		E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */; };
6632
		E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
6636
		E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
6633
		E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
6637
		E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
6634
		E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
6638
		E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
Lines 14625-14630 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
14625
		E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyTileGridTile.mm; sourceTree = "<group>"; };
14629
		E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyTileGridTile.mm; sourceTree = "<group>"; };
14626
		E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; };
14630
		E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; };
14627
		E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; };
14631
		E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; };
14632
		E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleUpdate.cpp; sourceTree = "<group>"; };
14633
		E42E76DB1C7AF77600E3614D /* StyleUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleUpdate.h; sourceTree = "<group>"; };
14628
		E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; };
14634
		E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; };
14629
		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
14635
		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
14630
		E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
14636
		E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
Lines 14672-14677 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
14672
		E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterfaceIOS.mm; sourceTree = "<group>"; };
14678
		E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterfaceIOS.mm; sourceTree = "<group>"; };
14673
		E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; };
14679
		E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; };
14674
		E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; };
14680
		E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; };
14681
		E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeUpdater.h; sourceTree = "<group>"; };
14682
		E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdater.cpp; sourceTree = "<group>"; };
14675
		E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
14683
		E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
14676
		E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
14684
		E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
14677
		E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
14685
		E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
Lines 23557-23562 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
23557
				1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */,
23565
				1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */,
23558
				5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */,
23566
				5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */,
23559
				5824ABA91AE849C8009074B7 /* RenderTreePosition.h */,
23567
				5824ABA91AE849C8009074B7 /* RenderTreePosition.h */,
23568
				E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */,
23569
				E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */,
23560
				E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */,
23570
				E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */,
23561
				E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
23571
				E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
23562
				E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
23572
				E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
Lines 23569-23574 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
23569
				E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
23579
				E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
23570
				E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
23580
				E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
23571
				E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */,
23581
				E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */,
23582
				E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */,
23583
				E42E76DB1C7AF77600E3614D /* StyleUpdate.h */,
23572
			);
23584
			);
23573
			path = style;
23585
			path = style;
23574
			sourceTree = "<group>";
23586
			sourceTree = "<group>";
Lines 26003-26008 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
26003
				5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */,
26015
				5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */,
26004
				7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */,
26016
				7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */,
26005
				A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */,
26017
				A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */,
26018
				E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */,
26006
				A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */,
26019
				A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */,
26007
				A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */,
26020
				A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */,
26008
				A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */,
26021
				A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */,
Lines 26194-26199 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
26194
				A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */,
26207
				A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */,
26195
				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
26208
				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
26196
				977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
26209
				977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
26210
				E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */,
26197
				93309DE8099E64920056E581 /* htmlediting.h in Headers */,
26211
				93309DE8099E64920056E581 /* htmlediting.h in Headers */,
26198
				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
26212
				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
26199
				A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
26213
				A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
Lines 30599-30604 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
30599
				A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */,
30613
				A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */,
30600
				E1FF8F64180745D800132674 /* JSSubtleCrypto.cpp in Sources */,
30614
				E1FF8F64180745D800132674 /* JSSubtleCrypto.cpp in Sources */,
30601
				E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */,
30615
				E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */,
30616
				E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */,
30602
				B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
30617
				B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
30603
				24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */,
30618
				24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */,
30604
				6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */,
30619
				6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */,
Lines 31137-31142 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
31137
				0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */,
31152
				0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */,
31138
				FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */,
31153
				FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */,
31139
				49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
31154
				49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
31155
				E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */,
31140
				D0FF2A5D11F8C45A007E74E0 /* PingLoader.cpp in Sources */,
31156
				D0FF2A5D11F8C45A007E74E0 /* PingLoader.cpp in Sources */,
31141
				CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */,
31157
				CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */,
31142
				0FDF45A71BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp in Sources */,
31158
				0FDF45A71BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp in Sources */,
- Source/WebCore/css/StyleResolver.cpp -5 / +9 lines
Lines 335-341 void StyleResolver::sweepMatchedProperti Source/WebCore/css/StyleResolver.cpp_sec1
335
    m_matchedPropertiesCacheAdditionsSinceLastSweep = 0;
335
    m_matchedPropertiesCacheAdditionsSinceLastSweep = 0;
336
}
336
}
337
337
338
StyleResolver::State::State(Element& element, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
338
StyleResolver::State::State(Element& element, RenderStyle* parentStyle, RenderStyle* documentElementStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
339
    : m_element(&element)
339
    : m_element(&element)
340
    , m_parentStyle(parentStyle)
340
    , m_parentStyle(parentStyle)
341
    , m_regionForStyling(regionForStyling)
341
    , m_regionForStyling(regionForStyling)
Lines 346-354 StyleResolver::State::State(Element& ele Source/WebCore/css/StyleResolver.cpp_sec2
346
    if (resetStyleInheritance)
346
    if (resetStyleInheritance)
347
        m_parentStyle = nullptr;
347
        m_parentStyle = nullptr;
348
348
349
    auto& document = element.document();
349
    if (documentElementStyle)
350
    auto* documentElement = document.documentElement();
350
        m_rootElementStyle = documentElementStyle;
351
    m_rootElementStyle = (!documentElement || documentElement == &element) ? document.renderStyle() : documentElement->renderStyle();
351
    else {
352
        auto& document = element.document();
353
        auto* documentElement = document.documentElement();
354
        m_rootElementStyle = (!documentElement || documentElement == &element) ? document.renderStyle() : documentElement->renderStyle();
355
    }
352
356
353
    updateConversionData();
357
    updateConversionData();
354
}
358
}
Lines 375-381 ElementStyle StyleResolver::styleForElem Source/WebCore/css/StyleResolver.cpp_sec3
375
{
379
{
376
    RELEASE_ASSERT(!m_inLoadPendingImages);
380
    RELEASE_ASSERT(!m_inLoadPendingImages);
377
381
378
    m_state = State(element, parentStyle, regionForStyling, selectorFilter);
382
    m_state = State(element, parentStyle, m_overrideRootElementStyle.get(), regionForStyling, selectorFilter);
379
    State& state = m_state;
383
    State& state = m_state;
380
384
381
    if (state.parentStyle()) {
385
    if (state.parentStyle()) {
- Source/WebCore/css/StyleResolver.h -1 / +5 lines
Lines 164-169 public: Source/WebCore/css/StyleResolver.h_sec1
164
164
165
    const MediaQueryEvaluator& mediaQueryEvaluator() const { return *m_medium; }
165
    const MediaQueryEvaluator& mediaQueryEvaluator() const { return *m_medium; }
166
166
167
    void setOverrideRootElementStyle(RenderStyle* style) { m_overrideRootElementStyle = style; }
168
167
private:
169
private:
168
    Ref<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
170
    Ref<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
169
171
Lines 359-365 public: Source/WebCore/css/StyleResolver.h_sec2
359
    class State {
361
    class State {
360
    public:
362
    public:
361
        State() { }
363
        State() { }
362
        State(Element&, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
364
        State(Element&, RenderStyle* parentStyle, RenderStyle* documentElementStyle = nullptr, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
363
365
364
    public:
366
    public:
365
        void clear();
367
        void clear();
Lines 524-529 private: Source/WebCore/css/StyleResolver.h_sec3
524
526
525
    bool m_matchAuthorAndUserStyles;
527
    bool m_matchAuthorAndUserStyles;
526
528
529
    RefPtr<RenderStyle> m_overrideRootElementStyle;
530
527
    Vector<std::unique_ptr<MediaQueryResult>> m_viewportDependentMediaQueryResults;
531
    Vector<std::unique_ptr<MediaQueryResult>> m_viewportDependentMediaQueryResults;
528
532
529
#if ENABLE(CSS_DEVICE_ADAPTATION)
533
#if ENABLE(CSS_DEVICE_ADAPTATION)
- Source/WebCore/dom/Document.cpp -4 / +13 lines
Lines 133-138 Source/WebCore/dom/Document.cpp_sec1
133
#include "ProcessingInstruction.h"
133
#include "ProcessingInstruction.h"
134
#include "RenderChildIterator.h"
134
#include "RenderChildIterator.h"
135
#include "RenderLayerCompositor.h"
135
#include "RenderLayerCompositor.h"
136
#include "RenderTreeUpdater.h"
136
#include "RenderView.h"
137
#include "RenderView.h"
137
#include "RenderWidget.h"
138
#include "RenderWidget.h"
138
#include "ResourceLoadObserver.h"
139
#include "ResourceLoadObserver.h"
Lines 1926-1940 void Document::recalcStyle(Style::Change Source/WebCore/dom/Document.cpp_sec2
1926
        }
1927
        }
1927
1928
1928
        Style::TreeResolver resolver(*this);
1929
        Style::TreeResolver resolver(*this);
1929
        resolver.resolve(change);
1930
        auto styleUpdate = resolver.resolve(change);
1930
1931
        updatedCompositingLayers = frameView.updateCompositingLayersAfterStyleChange();
1932
1931
1933
        clearNeedsStyleRecalc();
1932
        clearNeedsStyleRecalc();
1934
        clearChildNeedsStyleRecalc();
1933
        clearChildNeedsStyleRecalc();
1935
        unscheduleStyleRecalc();
1934
        unscheduleStyleRecalc();
1936
1935
1937
        m_inStyleRecalc = false;
1936
        m_inStyleRecalc = false;
1937
1938
        if (styleUpdate) {
1939
            TemporaryChange<bool> inRenderTreeUpdate(m_inRenderTreeUpdate, true);
1940
1941
            Style::RenderTreeUpdater updater(*this);
1942
            updater.commit(WTFMove(styleUpdate));
1943
        }
1944
1945
        updatedCompositingLayers = frameView.updateCompositingLayersAfterStyleChange();
1938
    }
1946
    }
1939
1947
1940
    // If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
1948
    // If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
Lines 2052-2058 Ref<RenderStyle> Document::styleForEleme Source/WebCore/dom/Document.cpp_sec3
2052
    TemporaryChange<bool> change(m_ignorePendingStylesheets, true);
2060
    TemporaryChange<bool> change(m_ignorePendingStylesheets, true);
2053
    auto elementStyle = element.resolveStyle(parentStyle);
2061
    auto elementStyle = element.resolveStyle(parentStyle);
2054
2062
2055
    Style::commitRelationsToDocument(WTFMove(elementStyle.relations));
2063
    if (elementStyle.relations)
2064
        Style::commitRelationsToDocument(*elementStyle.relations);
2056
2065
2057
    return WTFMove(elementStyle.renderStyle);
2066
    return WTFMove(elementStyle.renderStyle);
2058
}
2067
}
- Source/WebCore/dom/Document.h -1 / +3 lines
Lines 1244-1250 public: Source/WebCore/dom/Document.h_sec1
1244
    void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
1244
    void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
1245
    void clearStyleResolver();
1245
    void clearStyleResolver();
1246
1246
1247
    bool inStyleRecalc() { return m_inStyleRecalc; }
1247
    bool inStyleRecalc() const { return m_inStyleRecalc; }
1248
    bool inRenderTreeUpdate() const { return m_inRenderTreeUpdate; }
1248
1249
1249
    // Return a Locale for the default locale if the argument is null or empty.
1250
    // Return a Locale for the default locale if the argument is null or empty.
1250
    Locale& getCachedLocale(const AtomicString& locale = nullAtom);
1251
    Locale& getCachedLocale(const AtomicString& locale = nullAtom);
Lines 1508-1513 private: Source/WebCore/dom/Document.h_sec2
1508
    bool m_pendingStyleRecalcShouldForce;
1509
    bool m_pendingStyleRecalcShouldForce;
1509
    bool m_inStyleRecalc;
1510
    bool m_inStyleRecalc;
1510
    bool m_closeAfterStyleRecalc;
1511
    bool m_closeAfterStyleRecalc;
1512
    bool m_inRenderTreeUpdate { false };
1511
1513
1512
    bool m_gotoAnchorNeededAfterStylesheetsLoad;
1514
    bool m_gotoAnchorNeededAfterStylesheetsLoad;
1513
    bool m_isDNSPrefetchEnabled;
1515
    bool m_isDNSPrefetchEnabled;
- Source/WebCore/dom/Node.cpp +4 lines
Lines 768-773 inline void Node::updateAncestorsForStyl Source/WebCore/dom/Node.cpp_sec1
768
768
769
void Node::setNeedsStyleRecalc(StyleChangeType changeType)
769
void Node::setNeedsStyleRecalc(StyleChangeType changeType)
770
{
770
{
771
    if (document().inRenderTreeUpdate()) {
772
        WTFReportBacktrace();
773
        return;
774
    }
771
    ASSERT(changeType != NoStyleChange);
775
    ASSERT(changeType != NoStyleChange);
772
    if (!inRenderedDocument())
776
    if (!inRenderedDocument())
773
        return;
777
        return;
- Source/WebCore/html/HTMLMediaElement.cpp +5 lines
Lines 862-867 void HTMLMediaElement::scheduleEvent(con Source/WebCore/html/HTMLMediaElement.cpp_sec1
862
    // Don't set the event target, the event queue will set it in GenericEventQueue::timerFired and setting it here
862
    // Don't set the event target, the event queue will set it in GenericEventQueue::timerFired and setting it here
863
    // will trigger an ASSERT if this element has been marked for deletion.
863
    // will trigger an ASSERT if this element has been marked for deletion.
864
864
865
    fprintf(stderr, "HTMLMediaElement::scheduleEvent %s\n", eventName.string().utf8().data());
866
865
    m_asyncEventQueue.enqueueEvent(event.release());
867
    m_asyncEventQueue.enqueueEvent(event.release());
866
}
868
}
867
869
Lines 5134-5139 bool HTMLMediaElement::dispatchEvent(Eve Source/WebCore/html/HTMLMediaElement.cpp_sec2
5134
{
5136
{
5135
    if (event.type() == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent)
5137
    if (event.type() == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent)
5136
        scheduleDelayedAction(CheckPlaybackTargetCompatablity);
5138
        scheduleDelayedAction(CheckPlaybackTargetCompatablity);
5139
    fprintf(stderr, "HTMLMediaElement::dispatchEvent %s\n", event.type().string().utf8().data());
5137
    return HTMLElement::dispatchEvent(event);
5140
    return HTMLElement::dispatchEvent(event);
5138
}
5141
}
5139
5142
Lines 6340-6345 void HTMLMediaElement::didAddUserAgentSh Source/WebCore/html/HTMLMediaElement.cpp_sec3
6340
    if (!ensureMediaControlsInjectedScript())
6343
    if (!ensureMediaControlsInjectedScript())
6341
        return;
6344
        return;
6342
6345
6346
    WTFReportBacktrace();
6347
6343
    ScriptController& scriptController = document().frame()->script();
6348
    ScriptController& scriptController = document().frame()->script();
6344
    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world));
6349
    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world));
6345
    JSC::ExecState* exec = globalObject->globalExec();
6350
    JSC::ExecState* exec = globalObject->globalExec();
- Source/WebCore/html/HTMLVideoElement.cpp +1 lines
Lines 310-315 void HTMLVideoElement::webkitExitFullscr Source/WebCore/html/HTMLVideoElement.cpp_sec1
310
310
311
bool HTMLVideoElement::webkitSupportsFullscreen()
311
bool HTMLVideoElement::webkitSupportsFullscreen()
312
{
312
{
313
    WTFReportBacktrace();
313
    return supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard);
314
    return supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard);
314
}
315
}
315
316
- Source/WebCore/rendering/RenderBox.cpp -4 lines
Lines 381-390 void RenderBox::styleDidChange(StyleDiff Source/WebCore/rendering/RenderBox.cpp_sec1
381
    bool isBodyRenderer = isBody();
381
    bool isBodyRenderer = isBody();
382
    bool isDocElementRenderer = isDocumentElementRenderer();
382
    bool isDocElementRenderer = isDocumentElementRenderer();
383
383
384
    // Set the text color if we're the body.
385
    if (isBodyRenderer)
386
        document().setTextColor(newStyle.visitedDependentColor(CSSPropertyColor));
387
388
    if (isDocElementRenderer || isBodyRenderer) {
384
    if (isDocElementRenderer || isBodyRenderer) {
389
        // Propagate the new writing mode and direction up to the RenderView.
385
        // Propagate the new writing mode and direction up to the RenderView.
390
        auto* documentElementRenderer = document().documentElement()->renderer();
386
        auto* documentElementRenderer = document().documentElement()->renderer();
- Source/WebCore/rendering/RenderElement.h -12 lines
Lines 50-58 public: Source/WebCore/rendering/RenderElement.h_sec1
50
    // continue even if the style isn't different from the current style.
50
    // continue even if the style isn't different from the current style.
51
    void setStyle(Ref<RenderStyle>&&, StyleDifference minimalStyleDifference = StyleDifferenceEqual);
51
    void setStyle(Ref<RenderStyle>&&, StyleDifference minimalStyleDifference = StyleDifferenceEqual);
52
52
53
    // Called to update a style that is allowed to trigger animations.
54
    void setAnimatableStyle(Ref<RenderStyle>&&, StyleDifference minimalStyleDifference);
55
56
    // The pseudo element style can be cached or uncached.  Use the cached method if the pseudo element doesn't respect
53
    // The pseudo element style can be cached or uncached.  Use the cached method if the pseudo element doesn't respect
57
    // any pseudo classes (and therefore has no concept of changing state).
54
    // any pseudo classes (and therefore has no concept of changing state).
58
    RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = nullptr) const;
55
    RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = nullptr) const;
Lines 347-361 private: Source/WebCore/rendering/RenderElement.h_sec2
347
    static bool s_noLongerAffectsParentBlock;
344
    static bool s_noLongerAffectsParentBlock;
348
};
345
};
349
346
350
inline void RenderElement::setAnimatableStyle(Ref<RenderStyle>&& style, StyleDifference minimalStyleDifference)
351
{
352
    Ref<RenderStyle> animatedStyle = WTFMove(style);
353
    if (animation().updateAnimations(*this, animatedStyle, animatedStyle))
354
        minimalStyleDifference = std::max(minimalStyleDifference, StyleDifferenceRecompositeLayer);
355
    
356
    setStyle(WTFMove(animatedStyle), minimalStyleDifference);
357
}
358
359
inline void RenderElement::setAncestorLineBoxDirty(bool f)
347
inline void RenderElement::setAncestorLineBoxDirty(bool f)
360
{
348
{
361
    m_ancestorLineBoxDirty = f;
349
    m_ancestorLineBoxDirty = f;
- Source/WebCore/style/RenderTreePosition.cpp -5 / +15 lines
Lines 27-32 Source/WebCore/style/RenderTreePosition.cpp_sec1
27
#include "RenderTreePosition.h"
27
#include "RenderTreePosition.h"
28
28
29
#include "ComposedTreeIterator.h"
29
#include "ComposedTreeIterator.h"
30
#include "HTMLSlotElement.h"
30
#include "PseudoElement.h"
31
#include "PseudoElement.h"
31
#include "RenderObject.h"
32
#include "RenderObject.h"
32
#include "ShadowRoot.h"
33
#include "ShadowRoot.h"
Lines 82-94 RenderObject* RenderTreePosition::nextSi Source/WebCore/style/RenderTreePosition.cpp_sec2
82
    if (node.isAfterPseudoElement())
83
    if (node.isAfterPseudoElement())
83
        return nullptr;
84
        return nullptr;
84
85
85
    auto composedChildren = composedTreeChildren(*parentElement);
86
    auto composedDescendants = composedTreeDescendants(*parentElement);
86
87
    auto it = node.isBeforePseudoElement() ? composedDescendants.begin() : composedDescendants.at(node);
87
    auto it = node.isBeforePseudoElement() ? composedChildren.begin() : composedChildren.at(node);
88
    auto end = composedDescendants.end();
88
    for (auto end = composedChildren.end(); it != end; ++it) {
89
89
        RenderObject* renderer = it->renderer();
90
    while (it != end) {
91
        auto& node = *it;
92
        bool hasDisplayContents = is<HTMLSlotElement>(node);
93
        if (hasDisplayContents) {
94
            it.traverseNext();
95
            continue;
96
        }
97
        RenderObject* renderer = node.renderer();
90
        if (renderer && !isRendererReparented(*renderer))
98
        if (renderer && !isRendererReparented(*renderer))
91
            return renderer;
99
            return renderer;
100
        
101
        it.traverseNextSkippingChildren();
92
    }
102
    }
93
    if (PseudoElement* after = parentElement->afterPseudoElement())
103
    if (PseudoElement* after = parentElement->afterPseudoElement())
94
        return after->renderer();
104
        return after->renderer();
- Source/WebCore/style/RenderTreeUpdater.cpp +527 lines
Line 0 Source/WebCore/style/RenderTreeUpdater.cpp_sec1
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "RenderTreeUpdater.h"
28
29
#include "AXObjectCache.h"
30
#include "ComposedTreeAncestorIterator.h"
31
#include "ComposedTreeIterator.h"
32
#include "Document.h"
33
#include "Element.h"
34
#include "FlowThreadController.h"
35
#include "HTMLSlotElement.h"
36
#include "InspectorInstrumentation.h"
37
#include "PseudoElement.h"
38
#include "RenderFullScreen.h"
39
#include "RenderNamedFlowThread.h"
40
#include "StyleResolver.h"
41
#include "StyleTreeResolver.h"
42
43
namespace WebCore {
44
namespace Style {
45
46
// Slots have implicit display:content until it is supported for reals.
47
static bool hasDisplayContent(const Node& node)
48
{
49
    return is<HTMLSlotElement>(node);
50
}
51
52
RenderTreeUpdater::Parent::Parent(Document& document)
53
    : renderTreePosition(RenderTreePosition(*document.renderView()))
54
{
55
}
56
57
RenderTreeUpdater::Parent::Parent(Element& element, Change changeType)
58
    : element(&element)
59
    , changeType(changeType)
60
    , renderTreePosition(element.renderer() ? makeOptional(RenderTreePosition(*element.renderer())) : Nullopt)
61
{
62
}
63
64
RenderTreeUpdater::RenderTreeUpdater(Document& document)
65
    : m_document(document)
66
{
67
}
68
69
void RenderTreeUpdater::commit(std::unique_ptr<const Update>&& update)
70
{
71
    ASSERT(&m_document == &update->document());
72
73
    m_update = WTFMove(update);
74
75
    auto findRenderingRoot = [this] (ContainerNode& node) -> ContainerNode& {
76
        for (ComposedTreeAncestorIterator it(m_document, node), end(m_document); it != end; ++it) {
77
            if (it->renderer())
78
                return *it;
79
            ASSERT(hasDisplayContent(*it));
80
        }
81
        ASSERT_NOT_REACHED();
82
        return m_document;
83
    };
84
85
//    fprintf(stderr, "commitToRenderTree roots %d\n", m_update->roots().size());
86
    for (auto* root : m_update->roots())
87
        updateRenderTree(findRenderingRoot(*root));
88
89
    commitRelationsToDocument(m_update->relations());
90
91
    m_update = nullptr;
92
}
93
94
RenderTreePosition& RenderTreeUpdater::renderTreePosition()
95
{
96
    for (unsigned i = m_parentStack.size(); i; --i) {
97
        if (auto& position = m_parentStack[i - 1].renderTreePosition)
98
            return *position;
99
    }
100
    ASSERT_NOT_REACHED();
101
    return *m_parentStack.last().renderTreePosition;
102
}
103
104
void RenderTreeUpdater::pushParent(Element& element, Change changeType)
105
{
106
    m_parentStack.append(Parent(element, changeType));
107
108
    updateBeforeOrAfterPseudoElement(element, changeType, BEFORE);
109
}
110
111
void RenderTreeUpdater::popParent()
112
{
113
    auto& parent = m_parentStack.last();
114
115
    if (parent.element) {
116
        updateBeforeOrAfterPseudoElement(*parent.element, parent.changeType, AFTER);
117
118
        if (parent.element->hasCustomStyleResolveCallbacks()) {
119
            if (parent.changeType == Detach && parent.element->renderer())
120
                parent.element->didAttachRenderers();
121
        }
122
    }
123
    m_parentStack.removeLast();
124
}
125
126
void RenderTreeUpdater::popParentsToDepth(unsigned depth)
127
{
128
    ASSERT(m_parentStack.size() >= depth);
129
130
    while (m_parentStack.size() > depth)
131
        popParent();
132
}
133
134
static bool shouldCreateRenderer(const Element& element, const RenderElement& parentRenderer)
135
{
136
    if (!element.document().shouldCreateRenderers())
137
        return false;
138
    if (!parentRenderer.canHaveChildren() && !(element.isPseudoElement() && parentRenderer.canHaveGeneratedChildren()))
139
        return false;
140
    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(element))
141
        return false;
142
    return true;
143
}
144
145
void RenderTreeUpdater::updateRenderTree(ContainerNode& root)
146
{
147
    fprintf(stderr, "RenderTreeUpdater::updateRenderTree %p\n", &root);
148
//    fprintf(stderr, "%s\n", composedTreeAsText(m_document, ComposedTreeAsTextMode::WithPointers).utf8().data());
149
//    fprintf(stderr, "%s\n", composedTreeAsText(root, ComposedTreeAsTextMode::WithPointers).utf8().data());
150
    ASSERT(root.renderer());
151
    ASSERT(m_parentStack.isEmpty());
152
153
    if (&root == &m_document)
154
        m_parentStack.append(Parent(m_document));
155
    else
156
        m_parentStack.append(Parent(downcast<Element>(root), NoChange));
157
158
    auto descendants = composedTreeDescendants(root);
159
    auto it = descendants.begin();
160
    auto end = descendants.end();
161
162
    // FIXME: SVG <use> element may cause tree mutations during style recalc.
163
    it.dropAssertions();
164
165
    while (it != end) {
166
        popParentsToDepth(it.depth());
167
168
        auto& node = *it;
169
170
        if (auto* renderer = node.renderer())
171
            renderTreePosition().invalidateNextSibling(*renderer);
172
173
        if (is<Text>(node)) {
174
            auto& text = downcast<Text>(node);
175
            if (parent().changeType == Detach || m_update->forText(text) || m_invalidatedWhitespaceOnlyTextSiblings.contains(&text))
176
                updateRenderer(text);
177
178
            it.traverseNextSkippingChildren();
179
            continue;
180
        }
181
182
        auto& element = downcast<Element>(node);
183
184
        auto* elementUpdate = m_update->forElement(element);
185
186
        Change changeType = NoChange;
187
        if (elementUpdate) {
188
            if (hasDisplayContent(element)) {
189
                if (shouldCreateRenderer(element, renderTreePosition().parent())) {
190
//                    fprintf(stderr, "pushing slot %p\n", &element);
191
                    pushParent(element, parent().changeType);
192
                    it.traverseNext();
193
                } else
194
                    it.traverseNextSkippingChildren();
195
                continue;
196
            }
197
198
            updateRenderer(element, *elementUpdate);
199
            changeType = elementUpdate->type;
200
        }
201
202
        if (!element.renderer() || !elementUpdate) {
203
            it.traverseNextSkippingChildren();
204
            continue;
205
        }
206
207
        pushParent(element, changeType);
208
209
        it.traverseNext();
210
    }
211
212
    popParentsToDepth(0);
213
214
    m_invalidatedWhitespaceOnlyTextSiblings.clear();
215
}
216
217
static bool pseudoStyleCacheIsInvalid(RenderElement* renderer, RenderStyle* newStyle)
218
{
219
    const RenderStyle& currentStyle = renderer->style();
220
221
    const PseudoStyleCache* pseudoStyleCache = currentStyle.cachedPseudoStyles();
222
    if (!pseudoStyleCache)
223
        return false;
224
225
    for (auto& cache : *pseudoStyleCache) {
226
        RefPtr<RenderStyle> newPseudoStyle;
227
        PseudoId pseudoId = cache->styleType();
228
        if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
229
            newPseudoStyle = renderer->uncachedFirstLineStyle(newStyle);
230
        else
231
            newPseudoStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle);
232
        if (!newPseudoStyle)
233
            return true;
234
        if (*newPseudoStyle != *cache) {
235
            if (pseudoId < FIRST_INTERNAL_PSEUDOID)
236
                newStyle->setHasPseudoStyle(pseudoId);
237
            newStyle->addCachedPseudoStyle(newPseudoStyle);
238
            if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) {
239
                // FIXME: We should do an actual diff to determine whether a repaint vs. layout
240
                // is needed, but for now just assume a layout will be required. The diff code
241
                // in RenderObject::setStyle would need to be factored out so that it could be reused.
242
                renderer->setNeedsLayoutAndPrefWidthsRecalc();
243
            }
244
            return true;
245
        }
246
    }
247
    return false;
248
}
249
250
void RenderTreeUpdater::updateRenderer(Element& element, const ElementUpdate& update)
251
{
252
    bool shouldTearDownRenderers = update.type == Detach && (element.renderer() || element.isNamedFlowContentNode());
253
    if (shouldTearDownRenderers)
254
        detachRenderTree(element, ReattachDetach);
255
256
    bool shouldCreateNewRenderer = !element.renderer() && update.style;
257
    if (shouldCreateNewRenderer) {
258
        if (element.hasCustomStyleResolveCallbacks())
259
            element.willAttachRenderers();
260
        createRenderer(element, *update.style);
261
        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(element);
262
        return;
263
    }
264
265
    if (!element.renderer())
266
        return;
267
    auto& renderer = *element.renderer();
268
269
    if (update.needsRecompositeLayers) {
270
        renderer.setStyle(*update.style, StyleDifferenceRecompositeLayer);
271
        return;
272
    }
273
274
    if (update.type == NoChange) {
275
        if (pseudoStyleCacheIsInvalid(&renderer, update.style.get()) || (parent().changeType == Force && renderer.requiresForcedStyleRecalcPropagation())) {
276
            renderer.setStyle(*update.style, StyleDifferenceEqual);
277
            return;
278
        }
279
        if (update.wasExplicitlyInvalidated) {
280
            // Although no change occurred, we use the new style so that the cousin style sharing code won't get
281
            // fooled into believing this style is the same.
282
            renderer.setStyleInternal(*update.style);
283
        }
284
        return;
285
    }
286
287
    renderer.setStyle(*update.style, StyleDifferenceEqual);
288
}
289
290
#if ENABLE(CSS_REGIONS)
291
static RenderNamedFlowThread* moveToFlowThreadIfNeeded(Element& element, const RenderStyle& style)
292
{
293
    if (!element.shouldMoveToFlowThread(style))
294
        return nullptr;
295
296
    FlowThreadController& flowThreadController = element.document().renderView()->flowThreadController();
297
    RenderNamedFlowThread& parentFlowRenderer = flowThreadController.ensureRenderFlowThreadWithName(style.flowThread());
298
    flowThreadController.registerNamedFlowContentElement(element, parentFlowRenderer);
299
    return &parentFlowRenderer;
300
}
301
#endif
302
303
void RenderTreeUpdater::createRenderer(Element& element, RenderStyle& style)
304
{
305
    if (!shouldCreateRenderer(element, renderTreePosition().parent()))
306
        return;
307
308
    RenderNamedFlowThread* parentFlowRenderer = nullptr;
309
#if ENABLE(CSS_REGIONS)
310
    parentFlowRenderer = moveToFlowThreadIfNeeded(element, style);
311
#endif
312
313
    if (!element.rendererIsNeeded(style))
314
        return;
315
316
    renderTreePosition().computeNextSibling(element);
317
318
    RenderTreePosition insertionPosition = parentFlowRenderer
319
        ? RenderTreePosition(*parentFlowRenderer, parentFlowRenderer->nextRendererForElement(element))
320
        : renderTreePosition();
321
322
    RenderElement* newRenderer = element.createElementRenderer(style, insertionPosition).leakPtr();
323
    if (!newRenderer)
324
        return;
325
    if (!insertionPosition.canInsert(*newRenderer)) {
326
        newRenderer->destroy();
327
        return;
328
    }
329
330
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
331
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
332
    newRenderer->setFlowThreadState(insertionPosition.parent().flowThreadState());
333
334
    element.setRenderer(newRenderer);
335
336
    Ref<RenderStyle> animatedStyle = newRenderer->style();
337
    newRenderer->animation().updateAnimations(*newRenderer, animatedStyle, animatedStyle);
338
    newRenderer->setStyleInternal(WTFMove(animatedStyle));
339
340
    newRenderer->initializeStyle();
341
342
#if ENABLE(FULLSCREEN_API)
343
    if (m_document.webkitIsFullScreen() && m_document.webkitCurrentFullScreenElement() == &element) {
344
        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, &insertionPosition.parent(), m_document);
345
        if (!newRenderer)
346
            return;
347
    }
348
#endif
349
    // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer.
350
    insertionPosition.insert(*newRenderer);
351
352
    if (AXObjectCache* cache = m_document.axObjectCache())
353
        cache->updateCacheAfterNodeIsAttached(&element);
354
}
355
356
static bool textRendererIsNeeded(const Text& textNode, const RenderTreePosition& renderTreePosition)
357
{
358
    const RenderElement& parentRenderer = renderTreePosition.parent();
359
    if (!parentRenderer.canHaveChildren())
360
        return false;
361
    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(textNode))
362
        return false;
363
    if (textNode.isEditingText())
364
        return true;
365
    if (!textNode.length())
366
        return false;
367
    if (!textNode.containsOnlyWhitespace())
368
        return true;
369
    // This text node has nothing but white space. We may still need a renderer in some cases.
370
    if (parentRenderer.isTable() || parentRenderer.isTableRow() || parentRenderer.isTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isFrameSet())
371
        return false;
372
    if (parentRenderer.style().preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
373
        return true;
374
375
    RenderObject* previousRenderer = renderTreePosition.previousSiblingRenderer(textNode);
376
    if (previousRenderer && previousRenderer->isBR()) // <span><br/> <br/></span>
377
        return false;
378
379
    if (parentRenderer.isRenderInline()) {
380
        // <span><div/> <div/></span>
381
        if (previousRenderer && !previousRenderer->isInline())
382
            return false;
383
    } else {
384
        if (parentRenderer.isRenderBlock() && !parentRenderer.childrenInline() && (!previousRenderer || !previousRenderer->isInline()))
385
            return false;
386
        
387
        RenderObject* first = parentRenderer.firstChild();
388
        while (first && first->isFloatingOrOutOfFlowPositioned())
389
            first = first->nextSibling();
390
        RenderObject* nextRenderer = renderTreePosition.nextSiblingRenderer(textNode);
391
        if (!first || nextRenderer == first) {
392
            // Whitespace at the start of a block just goes away. Don't even make a render object for this text.
393
            return false;
394
        }
395
    }
396
    return true;
397
}
398
399
static void createTextRenderer(Text& textNode, RenderTreePosition& renderTreePosition)
400
{
401
    ASSERT(!textNode.renderer());
402
403
    auto newRenderer = textNode.createTextRenderer(renderTreePosition.parent().style());
404
    ASSERT(newRenderer);
405
406
    renderTreePosition.computeNextSibling(textNode);
407
408
    if (!renderTreePosition.canInsert(*newRenderer))
409
        return;
410
411
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
412
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
413
    newRenderer->setFlowThreadState(renderTreePosition.parent().flowThreadState());
414
415
    textNode.setRenderer(newRenderer.get());
416
    renderTreePosition.insert(*newRenderer.leakPtr());
417
}
418
419
void RenderTreeUpdater::updateRenderer(Text& text)
420
{
421
//    fprintf(stderr, "RenderTreeUpdater::updateRenderer text %p\n", &text);
422
423
    bool hasRenderer = text.renderer();
424
    bool needsRenderer = textRendererIsNeeded(text, renderTreePosition());
425
    if (hasRenderer) {
426
        if (needsRenderer)
427
            return;
428
        detachTextRenderer(text);
429
        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
430
        return;
431
    }
432
    if (!needsRenderer)
433
        return;
434
    createTextRenderer(text, renderTreePosition());
435
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
436
}
437
438
void RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
439
{
440
    // FIXME: This needs to traverse in composed tree order.
441
442
    // This function finds sibling text renderers where the results of textRendererIsNeeded may have changed as a result of
443
    // the current node gaining or losing the renderer. This can only affect white space text nodes.
444
    for (Node* sibling = current.nextSibling(); sibling; sibling = sibling->nextSibling()) {
445
        if (is<Element>(*sibling)) {
446
            if (m_update->forElement(downcast<Element>(*sibling)))
447
                return;
448
            // Text renderers beyond rendered elements can't be affected.
449
            if (!sibling->renderer() || RenderTreePosition::isRendererReparented(*sibling->renderer()))
450
                continue;
451
            return;
452
        }
453
        if (!is<Text>(*sibling))
454
            continue;
455
        Text& textSibling = downcast<Text>(*sibling);
456
        if (m_update->forText(textSibling))
457
            return;
458
        if (!textSibling.containsOnlyWhitespace())
459
            continue;
460
        m_invalidatedWhitespaceOnlyTextSiblings.add(&textSibling);
461
    }
462
}
463
464
static bool needsPseudoElement(Element& current, PseudoId pseudoId)
465
{
466
    if (!current.renderer() || !current.renderer()->canHaveGeneratedChildren())
467
        return false;
468
    if (current.isPseudoElement())
469
        return false;
470
    if (!pseudoElementRendererIsNeeded(current.renderer()->getCachedPseudoStyle(pseudoId)))
471
        return false;
472
    return true;
473
}
474
475
void RenderTreeUpdater::updateBeforeOrAfterPseudoElement(Element& current, Change, PseudoId pseudoId)
476
{
477
    PseudoElement* pseudoElement = pseudoId == BEFORE ? current.beforePseudoElement() : current.afterPseudoElement();
478
479
    auto* renderer = pseudoElement ? pseudoElement->renderer() : nullptr;
480
    if (renderer)
481
        renderTreePosition().invalidateNextSibling(*renderer);
482
483
    bool needsPseudoElement = Style::needsPseudoElement(current, pseudoId);
484
    if (!needsPseudoElement) {
485
        if (pseudoElement) {
486
            if (pseudoId == BEFORE)
487
                current.clearBeforePseudoElement();
488
            else
489
                current.clearAfterPseudoElement();
490
        }
491
        return;
492
    }
493
494
    ElementUpdate update;
495
496
    Ref<RenderStyle> newStyle = *current.renderer()->getCachedPseudoStyle(pseudoId, &current.renderer()->style());
497
498
    if (renderer && m_document.frame()->animation().updateAnimations(*renderer, newStyle, newStyle))
499
        update.needsRecompositeLayers = true;
500
501
    update.type = renderer ? determineChange(renderer->style(), newStyle) : Detach;
502
    update.style = WTFMove(newStyle);
503
504
    if (update.type == NoChange)
505
        return;
506
507
    if (!pseudoElement) {
508
        auto newPseudoElement = PseudoElement::create(current, pseudoId);
509
        pseudoElement = newPseudoElement.ptr();
510
        InspectorInstrumentation::pseudoElementCreated(m_document.page(), newPseudoElement);
511
        if (pseudoId == BEFORE)
512
            current.setBeforePseudoElement(WTFMove(newPseudoElement));
513
        else
514
            current.setAfterPseudoElement(WTFMove(newPseudoElement));
515
    }
516
517
//    fprintf(stderr, "updating pseudo %d\n", update.type);
518
    updateRenderer(*pseudoElement, update);
519
520
    if (update.type == Detach)
521
        pseudoElement->didAttachRenderers();
522
    else
523
        pseudoElement->didRecalcStyle(update.type);
524
}
525
526
}
527
}
- Source/WebCore/style/RenderTreeUpdater.h +88 lines
Line 0 Source/WebCore/style/RenderTreeUpdater.h_sec1
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef RenderTreeUpdater_h
27
#define RenderTreeUpdater_h
28
29
#include "RenderTreePosition.h"
30
#include "StyleChange.h"
31
#include "StyleUpdate.h"
32
#include <wtf/HashMap.h>
33
#include <wtf/HashSet.h>
34
#include <wtf/ListHashSet.h>
35
#include <wtf/RefPtr.h>
36
#include <wtf/Vector.h>
37
38
namespace WebCore {
39
40
class ContainerNode;
41
class Document;
42
class Element;
43
class Node;
44
class RenderStyle;
45
class Text;
46
47
namespace Style {
48
49
class RenderTreeUpdater {
50
public:
51
    RenderTreeUpdater(Document&);
52
53
    void commit(std::unique_ptr<const Update>&&);
54
55
private:
56
    void updateRenderTree(ContainerNode& root);
57
    void updateRenderer(Text&);
58
    void updateRenderer(Element&, const ElementUpdate&);
59
    void createRenderer(Element&, RenderStyle&);
60
    void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node&);
61
    void updateBeforeOrAfterPseudoElement(Element&, Change, PseudoId);
62
63
    struct Parent {
64
        explicit Parent(Document&);
65
        explicit Parent(Element&, Change);
66
67
        Element* element { nullptr };
68
        Change changeType { NoChange };
69
        Optional<RenderTreePosition> renderTreePosition;
70
    };
71
    Parent& parent() { return m_parentStack.last(); }
72
    RenderTreePosition& renderTreePosition();
73
74
    void pushParent(Element&, Change);
75
    void popParent();
76
    void popParentsToDepth(unsigned depth);
77
78
    Document& m_document;
79
    std::unique_ptr<const Update> m_update;
80
81
    Vector<Parent> m_parentStack;
82
83
    HashSet<Text*> m_invalidatedWhitespaceOnlyTextSiblings;
84
};
85
86
}
87
}
88
#endif
- Source/WebCore/style/StyleRelations.cpp -4 / +16 lines
Lines 85-95 std::unique_ptr<Relations> commitRelatio Source/WebCore/style/StyleRelations.cpp_sec1
85
    return remainingRelations;
85
    return remainingRelations;
86
}
86
}
87
87
88
void commitRelationsToDocument(std::unique_ptr<Relations> relations)
88
void commitRelationsToDocument(const Relations& relations)
89
{
89
{
90
    if (!relations)
90
    for (auto& relation : relations) {
91
        return;
92
    for (auto& relation : *relations) {
93
        auto& element = const_cast<Element&>(relation.element);
91
        auto& element = const_cast<Element&>(relation.element);
94
        switch (relation.type) {
92
        switch (relation.type) {
95
        case Relation::AffectedByActive:
93
        case Relation::AffectedByActive:
Lines 142-146 void commitRelationsToDocument(std::uniq Source/WebCore/style/StyleRelations.cpp_sec2
142
    }
140
    }
143
}
141
}
144
142
143
void commitNthChildRelationsToDocument(const Relations& relations)
144
{
145
    for (auto& relation : relations) {
146
        auto& element = const_cast<Element&>(relation.element);
147
        switch (relation.type) {
148
        case Relation::NthChildIndex:
149
            element.setChildIndex(relation.value);
150
            break;
151
        default:
152
            break;
153
        }
154
    }
155
}
156
145
}
157
}
146
}
158
}
- Source/WebCore/style/StyleRelations.h -1 / +2 lines
Lines 66-72 struct Relation { Source/WebCore/style/StyleRelations.h_sec1
66
using Relations = Vector<Relation, 8>;
66
using Relations = Vector<Relation, 8>;
67
67
68
std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&);
68
std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&);
69
void commitRelationsToDocument(std::unique_ptr<Relations>);
69
void commitNthChildRelationsToDocument(const Relations&);
70
void commitRelationsToDocument(const Relations&);
70
71
71
}
72
}
72
}
73
}
- Source/WebCore/style/StyleSharingResolver.cpp -9 / +12 lines
Lines 33-38 Source/WebCore/style/StyleSharingResolver.cpp_sec1
33
#include "NodeRenderStyle.h"
33
#include "NodeRenderStyle.h"
34
#include "RenderStyle.h"
34
#include "RenderStyle.h"
35
#include "SVGElement.h"
35
#include "SVGElement.h"
36
#include "StyleUpdate.h"
36
#include "StyledElement.h"
37
#include "StyledElement.h"
37
#include "VisitedLinkState.h"
38
#include "VisitedLinkState.h"
38
#include "WebVTTElement.h"
39
#include "WebVTTElement.h"
Lines 45-50 static const unsigned cStyleSearchThresh Source/WebCore/style/StyleSharingResolver.cpp_sec2
45
static const unsigned cStyleSearchLevelThreshold = 10;
46
static const unsigned cStyleSearchLevelThreshold = 10;
46
47
47
struct SharingResolver::Context {
48
struct SharingResolver::Context {
49
    const Update& update;
48
    const StyledElement& element;
50
    const StyledElement& element;
49
    bool elementAffectedByClassRules;
51
    bool elementAffectedByClassRules;
50
    EInsideLink elementLinkState;
52
    EInsideLink elementLinkState;
Lines 68-74 static inline bool elementHasDirectionAu Source/WebCore/style/StyleSharingResolver.cpp_sec3
68
    return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
70
    return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
69
}
71
}
70
72
71
const Element* SharingResolver::resolve(const Element& searchElement) const
73
RenderStyle* SharingResolver::resolve(const Element& searchElement, const Update& update) const
72
{
74
{
73
    if (!is<StyledElement>(searchElement))
75
    if (!is<StyledElement>(searchElement))
74
        return nullptr;
76
        return nullptr;
Lines 78-84 const Element* SharingResolver::resolve( Source/WebCore/style/StyleSharingResolver.cpp_sec4
78
    auto& parentElement = *element.parentElement();
80
    auto& parentElement = *element.parentElement();
79
    if (parentElement.shadowRoot())
81
    if (parentElement.shadowRoot())
80
        return nullptr;
82
        return nullptr;
81
    if (!parentElement.renderStyle())
83
    if (!update.elementStyle(parentElement))
82
        return nullptr;
84
        return nullptr;
83
    // If the element has inline style it is probably unique.
85
    // If the element has inline style it is probably unique.
84
    if (element.inlineStyle())
86
    if (element.inlineStyle())
Lines 96-101 const Element* SharingResolver::resolve( Source/WebCore/style/StyleSharingResolver.cpp_sec5
96
        return nullptr;
98
        return nullptr;
97
99
98
    Context context {
100
    Context context {
101
        update,
99
        element,
102
        element,
100
        element.hasClass() && classNamesAffectedByRules(element.classNames()),
103
        element.hasClass() && classNamesAffectedByRules(element.classNames()),
101
        m_document.visitedLinkState().determineLinkState(element)
104
        m_document.visitedLinkState().determineLinkState(element)
Lines 110-116 const Element* SharingResolver::resolve( Source/WebCore/style/StyleSharingResolver.cpp_sec6
110
        shareElement = findSibling(context, cousinList, count);
113
        shareElement = findSibling(context, cousinList, count);
111
        if (shareElement)
114
        if (shareElement)
112
            break;
115
            break;
113
        cousinList = locateCousinList(cousinList->parentElement(), visitedNodeCount);
116
        cousinList = locateCousinList(context, cousinList->parentElement(), visitedNodeCount);
114
    }
117
    }
115
118
116
    // If we have exhausted all our budget or our cousins.
119
    // If we have exhausted all our budget or our cousins.
Lines 127-133 const Element* SharingResolver::resolve( Source/WebCore/style/StyleSharingResolver.cpp_sec7
127
    if (parentElementPreventsSharing(parentElement))
130
    if (parentElementPreventsSharing(parentElement))
128
        return nullptr;
131
        return nullptr;
129
132
130
    return shareElement;
133
    return update.elementStyle(*shareElement);
131
}
134
}
132
135
133
StyledElement* SharingResolver::findSibling(const Context& context, Node* node, unsigned& count) const
136
StyledElement* SharingResolver::findSibling(const Context& context, Node* node, unsigned& count) const
Lines 143-149 StyledElement* SharingResolver::findSibl Source/WebCore/style/StyleSharingResolver.cpp_sec8
143
    return downcast<StyledElement>(node);
146
    return downcast<StyledElement>(node);
144
}
147
}
145
148
146
Node* SharingResolver::locateCousinList(Element* parent, unsigned& visitedNodeCount) const
149
Node* SharingResolver::locateCousinList(const Context& context, Element* parent, unsigned& visitedNodeCount) const
147
{
150
{
148
    if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold)
151
    if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold)
149
        return nullptr;
152
        return nullptr;
Lines 157-163 Node* SharingResolver::locateCousinList( Source/WebCore/style/StyleSharingResolver.cpp_sec9
157
    if (styledParent.hasID() && m_ruleSets.features().idsInRules.contains(styledParent.idForStyleResolution().impl()))
160
    if (styledParent.hasID() && m_ruleSets.features().idsInRules.contains(styledParent.idForStyleResolution().impl()))
158
        return nullptr;
161
        return nullptr;
159
162
160
    RenderStyle* parentStyle = styledParent.renderStyle();
163
    RenderStyle* parentStyle = context.update.elementStyle(styledParent);
161
    unsigned subcount = 0;
164
    unsigned subcount = 0;
162
    Node* thisCousin = &styledParent;
165
    Node* thisCousin = &styledParent;
163
    Node* currentNode = styledParent.previousSibling();
166
    Node* currentNode = styledParent.previousSibling();
Lines 172-178 Node* SharingResolver::locateCousinList( Source/WebCore/style/StyleSharingResolver.cpp_sec10
172
            if (!is<Element>(*currentNode))
175
            if (!is<Element>(*currentNode))
173
                continue;
176
                continue;
174
            auto& currentElement = downcast<Element>(*currentNode);
177
            auto& currentElement = downcast<Element>(*currentNode);
175
            if (currentElement.renderStyle() != parentStyle)
178
            if (context.update.elementStyle(currentElement) != parentStyle)
176
                continue;
179
                continue;
177
            if (!currentElement.lastChild())
180
            if (!currentElement.lastChild())
178
                continue;
181
                continue;
Lines 182-188 Node* SharingResolver::locateCousinList( Source/WebCore/style/StyleSharingResolver.cpp_sec11
182
                return currentNode->lastChild();
185
                return currentNode->lastChild();
183
            }
186
            }
184
        }
187
        }
185
        currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeCount);
188
        currentNode = locateCousinList(context, thisCousin->parentElement(), visitedNodeCount);
186
        thisCousin = currentNode;
189
        thisCousin = currentNode;
187
    }
190
    }
188
191
Lines 224-230 static bool canShareStyleWithControl(con Source/WebCore/style/StyleSharingResolver.cpp_sec12
224
bool SharingResolver::canShareStyleWithElement(const Context& context, const StyledElement& candidateElement) const
227
bool SharingResolver::canShareStyleWithElement(const Context& context, const StyledElement& candidateElement) const
225
{
228
{
226
    auto& element = context.element;
229
    auto& element = context.element;
227
    auto* style = candidateElement.renderStyle();
230
    auto* style = context.update.elementStyle(candidateElement);
228
    if (!style)
231
    if (!style)
229
        return false;
232
        return false;
230
    if (style->unique())
233
    if (style->unique())
- Source/WebCore/style/StyleSharingResolver.h -2 / +5 lines
Lines 32-37 class Document; Source/WebCore/style/StyleSharingResolver.h_sec1
32
class DocumentRuleSets;
32
class DocumentRuleSets;
33
class Element;
33
class Element;
34
class Node;
34
class Node;
35
class RenderStyle;
35
class RuleSet;
36
class RuleSet;
36
class SelectorFilter;
37
class SelectorFilter;
37
class SpaceSplitString;
38
class SpaceSplitString;
Lines 39-55 class StyledElement; Source/WebCore/style/StyleSharingResolver.h_sec2
39
40
40
namespace Style {
41
namespace Style {
41
42
43
class Update;
44
42
class SharingResolver {
45
class SharingResolver {
43
public:
46
public:
44
    SharingResolver(const Document&, const DocumentRuleSets&, const SelectorFilter&);
47
    SharingResolver(const Document&, const DocumentRuleSets&, const SelectorFilter&);
45
48
46
    const Element* resolve(const Element&) const;
49
    RenderStyle* resolve(const Element&, const Update&) const;
47
50
48
private:
51
private:
49
    struct Context;
52
    struct Context;
50
53
51
    StyledElement* findSibling(const Context&, Node*, unsigned& count) const;
54
    StyledElement* findSibling(const Context&, Node*, unsigned& count) const;
52
    Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
55
    Node* locateCousinList(const Context&, Element* parent, unsigned& visitedNodeCount) const;
53
    bool canShareStyleWithElement(const Context&, const StyledElement& candidateElement) const;
56
    bool canShareStyleWithElement(const Context&, const StyledElement& candidateElement) const;
54
    bool styleSharingCandidateMatchesRuleSet(const StyledElement&, const RuleSet*) const;
57
    bool styleSharingCandidateMatchesRuleSet(const StyledElement&, const RuleSet*) const;
55
    bool sharingCandidateHasIdenticalStyleAffectingAttributes(const Context&, const StyledElement& sharingCandidate) const;
58
    bool sharingCandidateHasIdenticalStyleAffectingAttributes(const Context&, const StyledElement& sharingCandidate) const;
- Source/WebCore/style/StyleTreeResolver.cpp -403 / +116 lines
Lines 4-10 Source/WebCore/style/StyleTreeResolver.cpp_sec1
4
 *           (C) 2001 Peter Kelly (pmk@post.com)
4
 *           (C) 2001 Peter Kelly (pmk@post.com)
5
 *           (C) 2001 Dirk Mueller (mueller@kde.org)
5
 *           (C) 2001 Dirk Mueller (mueller@kde.org)
6
 *           (C) 2007 David Smith (catfish.man@gmail.com)
6
 *           (C) 2007 David Smith (catfish.man@gmail.com)
7
 * Copyright (C) 2004-2010, 2012-2014 Apple Inc. All rights reserved.
7
 * Copyright (C) 2004-2010, 2012-2016 Apple Inc. All rights reserved.
8
 *           (C) 2007 Eric Seidel (eric@webkit.org)
8
 *           (C) 2007 Eric Seidel (eric@webkit.org)
9
 *
9
 *
10
 * This library is free software; you can redistribute it and/or
10
 * This library is free software; you can redistribute it and/or
Lines 26-52 Source/WebCore/style/StyleTreeResolver.cpp_sec2
26
#include "config.h"
26
#include "config.h"
27
#include "StyleTreeResolver.h"
27
#include "StyleTreeResolver.h"
28
28
29
#include "AXObjectCache.h"
30
#include "AnimationController.h"
31
#include "AuthorStyleSheets.h"
29
#include "AuthorStyleSheets.h"
32
#include "CSSFontSelector.h"
30
#include "CSSFontSelector.h"
33
#include "ComposedTreeAncestorIterator.h"
31
#include "ComposedTreeAncestorIterator.h"
34
#include "ComposedTreeIterator.h"
32
#include "ComposedTreeIterator.h"
35
#include "ElementIterator.h"
33
#include "ElementIterator.h"
36
#include "ElementRareData.h"
34
#include "HTMLBodyElement.h"
37
#include "FlowThreadController.h"
38
#include "HTMLSlotElement.h"
35
#include "HTMLSlotElement.h"
39
#include "InspectorInstrumentation.h"
40
#include "LoaderStrategy.h"
36
#include "LoaderStrategy.h"
41
#include "MainFrame.h"
37
#include "MainFrame.h"
42
#include "NodeRenderStyle.h"
38
#include "NodeRenderStyle.h"
43
#include "NodeTraversal.h"
44
#include "PlatformStrategies.h"
39
#include "PlatformStrategies.h"
45
#include "RenderFullScreen.h"
46
#include "RenderNamedFlowThread.h"
47
#include "RenderText.h"
48
#include "RenderTreePosition.h"
49
#include "RenderWidget.h"
50
#include "Settings.h"
40
#include "Settings.h"
51
#include "ShadowRoot.h"
41
#include "ShadowRoot.h"
52
#include "StyleResolver.h"
42
#include "StyleResolver.h"
Lines 60-69 namespace WebCore { Source/WebCore/style/StyleTreeResolver.cpp_sec3
60
50
61
namespace Style {
51
namespace Style {
62
52
63
enum DetachType { NormalDetach, ReattachDetach };
64
65
static void attachTextRenderer(Text&, RenderTreePosition&);
53
static void attachTextRenderer(Text&, RenderTreePosition&);
66
static void detachRenderTree(Element&, DetachType);
67
static void resolveTextNode(Text&, RenderTreePosition&);
54
static void resolveTextNode(Text&, RenderTreePosition&);
68
55
69
class SelectorFilterPusher {
56
class SelectorFilterPusher {
Lines 131-146 TreeResolver::Scope::Scope(ShadowRoot& s Source/WebCore/style/StyleTreeResolver.cpp_sec4
131
TreeResolver::Parent::Parent(Document& document, Change change)
118
TreeResolver::Parent::Parent(Document& document, Change change)
132
    : element(nullptr)
119
    : element(nullptr)
133
    , style(*document.renderStyle())
120
    , style(*document.renderStyle())
134
    , renderTreePosition(*document.renderView())
135
    , change(change)
121
    , change(change)
136
{
122
{
137
}
123
}
138
124
139
TreeResolver::Parent::Parent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change)
125
TreeResolver::Parent::Parent(Element& element, ElementUpdate& change)
140
    : element(&element)
126
    : element(&element)
141
    , style(style)
127
    , style(*change.style)
142
    , renderTreePosition(renderTreePosition)
128
    , change(change.type)
143
    , change(change)
144
{
129
{
145
}
130
}
146
131
Lines 160-266 void TreeResolver::popScope() Source/WebCore/style/StyleTreeResolver.cpp_sec5
160
    return m_scopeStack.removeLast();
145
    return m_scopeStack.removeLast();
161
}
146
}
162
147
163
static bool shouldCreateRenderer(const Element& element, const RenderElement& parentRenderer)
164
{
165
    if (!element.document().shouldCreateRenderers())
166
        return false;
167
    if (!parentRenderer.canHaveChildren() && !(element.isPseudoElement() && parentRenderer.canHaveGeneratedChildren()))
168
        return false;
169
    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(element))
170
        return false;
171
    return true;
172
}
173
174
Ref<RenderStyle> TreeResolver::styleForElement(Element& element, RenderStyle& inheritedStyle)
148
Ref<RenderStyle> TreeResolver::styleForElement(Element& element, RenderStyle& inheritedStyle)
175
{
149
{
150
    auto addRelations = [this] (std::unique_ptr<Relations> relations)
151
    {
152
        if (!relations)
153
            return;
154
        commitNthChildRelationsToDocument(*relations);
155
        m_update->addRelations(WTFMove(relations));
156
    };
157
176
    if (!m_document.haveStylesheetsLoaded() && !element.renderer()) {
158
    if (!m_document.haveStylesheetsLoaded() && !element.renderer()) {
177
        m_document.setHasNodesWithPlaceholderStyle();
159
        m_document.setHasNodesWithPlaceholderStyle();
178
        return *placeholderStyle;
160
        return *placeholderStyle;
179
    }
161
    }
180
162
163
    scope().styleResolver.setOverrideRootElementStyle(m_documentElementStyle.get());
164
181
    if (element.hasCustomStyleResolveCallbacks()) {
165
    if (element.hasCustomStyleResolveCallbacks()) {
182
        RenderStyle* shadowHostStyle = scope().shadowRoot ? scope().shadowRoot->host()->renderStyle() : nullptr;
166
        RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;
183
        if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
167
        if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
184
            Style::commitRelationsToDocument(WTFMove(customStyle->relations));
168
            addRelations(WTFMove(customStyle->relations));
185
            return WTFMove(customStyle->renderStyle);
169
            return WTFMove(customStyle->renderStyle);
186
        }
170
        }
187
    }
171
    }
188
172
189
    if (auto* sharingElement = scope().sharingResolver.resolve(element))
173
//    if (auto* sharedStyle = scope().sharingResolver.resolve(element, *m_update))
190
        return *sharingElement->renderStyle();
174
//        return *sharedStyle;
191
175
192
    auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
176
    auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
193
177
194
    Style::commitRelationsToDocument(WTFMove(elementStyle.relations));
178
    addRelations(WTFMove(elementStyle.relations));
195
    return WTFMove(elementStyle.renderStyle);
179
    return WTFMove(elementStyle.renderStyle);
196
}
180
}
197
181
198
#if ENABLE(CSS_REGIONS)
199
static RenderNamedFlowThread* moveToFlowThreadIfNeeded(Element& element, const RenderStyle& style)
200
{
201
    if (!element.shouldMoveToFlowThread(style))
202
        return 0;
203
204
    FlowThreadController& flowThreadController = element.document().renderView()->flowThreadController();
205
    RenderNamedFlowThread& parentFlowRenderer = flowThreadController.ensureRenderFlowThreadWithName(style.flowThread());
206
    flowThreadController.registerNamedFlowContentElement(element, parentFlowRenderer);
207
    return &parentFlowRenderer;
208
}
209
#endif
210
211
void TreeResolver::createRenderer(Element& element, RenderTreePosition& renderTreePosition, RefPtr<RenderStyle>&& resolvedStyle)
212
{
213
    ASSERT(shouldCreateRenderer(element, renderTreePosition.parent()));
214
    ASSERT(resolvedStyle);
215
216
    RenderNamedFlowThread* parentFlowRenderer = 0;
217
#if ENABLE(CSS_REGIONS)
218
    parentFlowRenderer = moveToFlowThreadIfNeeded(element, *resolvedStyle);
219
#endif
220
221
    if (!element.rendererIsNeeded(*resolvedStyle))
222
        return;
223
224
    renderTreePosition.computeNextSibling(element);
225
226
    RenderTreePosition insertionPosition = parentFlowRenderer
227
        ? RenderTreePosition(*parentFlowRenderer, parentFlowRenderer->nextRendererForElement(element))
228
        : renderTreePosition;
229
230
    RenderElement* newRenderer = element.createElementRenderer(resolvedStyle.releaseNonNull(), insertionPosition).leakPtr();
231
    if (!newRenderer)
232
        return;
233
    if (!insertionPosition.canInsert(*newRenderer)) {
234
        newRenderer->destroy();
235
        return;
236
    }
237
238
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
239
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
240
    newRenderer->setFlowThreadState(insertionPosition.parent().flowThreadState());
241
242
    // Code below updateAnimations() can depend on Element::renderer() already being set.
243
    element.setRenderer(newRenderer);
244
245
    // FIXME: There's probably a better way to factor this.
246
    // This just does what setAnimatedStyle() does, except with setStyleInternal() instead of setStyle().
247
    Ref<RenderStyle> animatedStyle = newRenderer->style();
248
    newRenderer->animation().updateAnimations(*newRenderer, animatedStyle, animatedStyle);
249
    newRenderer->setStyleInternal(WTFMove(animatedStyle));
250
251
    newRenderer->initializeStyle();
252
253
#if ENABLE(FULLSCREEN_API)
254
    if (m_document.webkitIsFullScreen() && m_document.webkitCurrentFullScreenElement() == &element) {
255
        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, &insertionPosition.parent(), m_document);
256
        if (!newRenderer)
257
            return;
258
    }
259
#endif
260
    // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer.
261
    insertionPosition.insert(*newRenderer);
262
}
263
264
static void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
182
static void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
265
{
183
{
266
    // FIXME: This needs to traverse in composed tree order.
184
    // FIXME: This needs to traverse in composed tree order.
Lines 348-354 static void createTextRendererIfNeeded(T Source/WebCore/style/StyleTreeResolver.cpp_sec6
348
    newRenderer->setFlowThreadState(renderTreePosition.parent().flowThreadState());
266
    newRenderer->setFlowThreadState(renderTreePosition.parent().flowThreadState());
349
267
350
    textNode.setRenderer(newRenderer.get());
268
    textNode.setRenderer(newRenderer.get());
351
    // Parent takes care of the animations, no need to call setAnimatableStyle.
352
    renderTreePosition.insert(*newRenderer.leakPtr());
269
    renderTreePosition.insert(*newRenderer.leakPtr());
353
}
270
}
354
271
Lines 381-455 void updateTextRendererAfterContentChang Source/WebCore/style/StyleTreeResolver.cpp_sec7
381
        textNode.renderer()->setTextWithOffset(textNode.data(), offsetOfReplacedData, lengthOfReplacedData);
298
        textNode.renderer()->setTextWithOffset(textNode.data(), offsetOfReplacedData, lengthOfReplacedData);
382
}
299
}
383
300
384
void TreeResolver::createRenderTreeForChildren(ContainerNode& current, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition)
385
{
386
    for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
387
        ASSERT((!child->renderer() || child->isNamedFlowContentNode()) || current.shadowRoot());
388
        if (child->renderer()) {
389
            renderTreePosition.invalidateNextSibling(*child->renderer());
390
            continue;
391
        }
392
        if (is<Text>(*child)) {
393
            attachTextRenderer(downcast<Text>(*child), renderTreePosition);
394
            continue;
395
        }
396
        if (is<Element>(*child))
397
            createRenderTreeRecursively(downcast<Element>(*child), inheritedStyle, renderTreePosition, nullptr);
398
    }
399
}
400
401
void TreeResolver::createRenderTreeForShadowRoot(ShadowRoot& shadowRoot)
402
{
403
    ASSERT(shadowRoot.host());
404
    ASSERT(shadowRoot.host()->renderer());
405
406
    pushScope(shadowRoot);
407
408
    auto& renderer = *shadowRoot.host()->renderer();
409
    RenderTreePosition renderTreePosition(renderer);
410
    createRenderTreeForChildren(shadowRoot, renderer.style(), renderTreePosition);
411
412
    popScope();
413
414
    shadowRoot.clearNeedsStyleRecalc();
415
    shadowRoot.clearChildNeedsStyleRecalc();
416
}
417
418
static PseudoElement* beforeOrAfterPseudoElement(Element& current, PseudoId pseudoId)
419
{
420
    ASSERT(pseudoId == BEFORE || pseudoId == AFTER);
421
    if (pseudoId == BEFORE)
422
        return current.beforePseudoElement();
423
    return current.afterPseudoElement();
424
}
425
426
static void setBeforeOrAfterPseudoElement(Element& current, Ref<PseudoElement>&& pseudoElement, PseudoId pseudoId)
427
{
428
    ASSERT(pseudoId == BEFORE || pseudoId == AFTER);
429
    if (pseudoId == BEFORE) {
430
        current.setBeforePseudoElement(WTFMove(pseudoElement));
431
        return;
432
    }
433
    current.setAfterPseudoElement(WTFMove(pseudoElement));
434
}
435
436
static void clearBeforeOrAfterPseudoElement(Element& current, PseudoId pseudoId)
437
{
438
    ASSERT(pseudoId == BEFORE || pseudoId == AFTER);
439
    if (pseudoId == BEFORE) {
440
        current.clearBeforePseudoElement();
441
        return;
442
    }
443
    current.clearAfterPseudoElement();
444
}
445
446
static void resetStyleForNonRenderedDescendants(Element& current)
301
static void resetStyleForNonRenderedDescendants(Element& current)
447
{
302
{
448
    // FIXME: This is not correct with shadow trees. This should be done with ComposedTreeIterator.
303
    // FIXME: This is not correct with shadow trees. This should be done with ComposedTreeIterator.
449
    ASSERT(!current.renderer());
450
    bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle = false;
304
    bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle = false;
451
    for (auto& child : childrenOfType<Element>(current)) {
305
    for (auto& child : childrenOfType<Element>(current)) {
452
        ASSERT(!child.renderer());
453
        bool affectedByPreviousSibling = child.styleIsAffectedByPreviousSibling() && elementNeedingStyleRecalcAffectsNextSiblingElementStyle;
306
        bool affectedByPreviousSibling = child.styleIsAffectedByPreviousSibling() && elementNeedingStyleRecalcAffectsNextSiblingElementStyle;
454
        if (child.needsStyleRecalc() || elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
307
        if (child.needsStyleRecalc() || elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
455
            elementNeedingStyleRecalcAffectsNextSiblingElementStyle = child.affectsNextSiblingElementStyle();
308
            elementNeedingStyleRecalcAffectsNextSiblingElementStyle = child.affectsNextSiblingElementStyle();
Lines 466-576 static void resetStyleForNonRenderedDesc Source/WebCore/style/StyleTreeResolver.cpp_sec8
466
    }
319
    }
467
}
320
}
468
321
469
static bool needsPseudoElement(Element& current, PseudoId pseudoId)
470
{
471
    if (!current.renderer() || !current.renderer()->canHaveGeneratedChildren())
472
        return false;
473
    if (current.isPseudoElement())
474
        return false;
475
    if (!pseudoElementRendererIsNeeded(current.renderer()->getCachedPseudoStyle(pseudoId)))
476
        return false;
477
    return true;
478
}
479
480
void TreeResolver::createRenderTreeForBeforeOrAfterPseudoElement(Element& current, PseudoId pseudoId, RenderTreePosition& renderTreePosition)
481
{
482
    if (!needsPseudoElement(current, pseudoId))
483
        return;
484
    Ref<PseudoElement> pseudoElement = PseudoElement::create(current, pseudoId);
485
    InspectorInstrumentation::pseudoElementCreated(m_document.page(), pseudoElement.get());
486
    setBeforeOrAfterPseudoElement(current, pseudoElement.copyRef(), pseudoId);
487
    createRenderTreeRecursively(pseudoElement.get(), *current.renderStyle(), renderTreePosition, nullptr);
488
}
489
490
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
491
void TreeResolver::createRenderTreeForSlotAssignees(HTMLSlotElement& slot, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition)
492
{
493
    ASSERT(shouldCreateRenderer(slot, renderTreePosition.parent()));
494
495
    if (auto* assignedNodes = slot.assignedNodes()) {
496
        pushEnclosingScope();
497
        for (auto* child : *assignedNodes) {
498
            if (is<Text>(*child))
499
                attachTextRenderer(downcast<Text>(*child), renderTreePosition);
500
            else if (is<Element>(*child))
501
                createRenderTreeRecursively(downcast<Element>(*child), inheritedStyle, renderTreePosition, nullptr);
502
        }
503
        popScope();
504
    } else {
505
        SelectorFilterPusher selectorFilterPusher(scope().selectorFilter, slot);
506
        createRenderTreeForChildren(slot, inheritedStyle, renderTreePosition);
507
    }
508
509
    slot.clearNeedsStyleRecalc();
510
    slot.clearChildNeedsStyleRecalc();
511
}
512
#endif
513
514
void TreeResolver::createRenderTreeRecursively(Element& current, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition, RefPtr<RenderStyle>&& resolvedStyle)
515
{
516
    ASSERT(!current.renderer());
517
518
    PostResolutionCallbackDisabler callbackDisabler(m_document);
519
    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
520
521
    bool shouldCallCreateRenderer = shouldCreateRenderer(current, renderTreePosition.parent());
522
523
    RefPtr<RenderStyle> style = resolvedStyle;
524
    if (!style)
525
        style = styleForElement(current, inheritedStyle);
526
527
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
528
    if (is<HTMLSlotElement>(current)) {
529
        if (shouldCallCreateRenderer && current.rendererIsNeeded(*style))
530
            createRenderTreeForSlotAssignees(downcast<HTMLSlotElement>(current), inheritedStyle, renderTreePosition);
531
        return;
532
    }
533
#endif
534
535
    if (current.hasCustomStyleResolveCallbacks())
536
        current.willAttachRenderers();
537
538
    if (shouldCallCreateRenderer)
539
        createRenderer(current, renderTreePosition, style.releaseNonNull());
540
541
    if (auto* renderer = current.renderer()) {
542
        SelectorFilterPusher selectorFilterPusher(scope().selectorFilter, current, SelectorFilterPusher::NoPush);
543
544
        RenderTreePosition childRenderTreePosition(*renderer);
545
        createRenderTreeForBeforeOrAfterPseudoElement(current, BEFORE, childRenderTreePosition);
546
547
        auto* shadowRoot = current.shadowRoot();
548
        if (shadowRoot) {
549
            selectorFilterPusher.push();
550
            createRenderTreeForShadowRoot(*shadowRoot);
551
        } else if (current.firstChild())
552
            selectorFilterPusher.push();
553
554
        bool skipChildren = shadowRoot;
555
        if (!skipChildren)
556
            createRenderTreeForChildren(current, renderer->style(), childRenderTreePosition);
557
558
        if (AXObjectCache* cache = m_document.axObjectCache())
559
            cache->updateCacheAfterNodeIsAttached(&current);
560
561
        createRenderTreeForBeforeOrAfterPseudoElement(current, AFTER, childRenderTreePosition);
562
563
        current.updateFocusAppearanceAfterAttachIfNeeded();
564
    } else
565
        resetStyleForNonRenderedDescendants(current);
566
567
    current.clearNeedsStyleRecalc();
568
    current.clearChildNeedsStyleRecalc();
569
570
    if (current.hasCustomStyleResolveCallbacks())
571
        current.didAttachRenderers();
572
}
573
574
static void detachChildren(ContainerNode& current, DetachType detachType)
322
static void detachChildren(ContainerNode& current, DetachType detachType)
575
{
323
{
576
    for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
324
    for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
Lines 606-612 static void detachSlotAssignees(HTMLSlot Source/WebCore/style/StyleTreeResolver.cpp_sec9
606
}
354
}
607
#endif
355
#endif
608
356
609
static void detachRenderTree(Element& current, DetachType detachType)
357
void detachRenderTree(Element& current, DetachType detachType)
610
{
358
{
611
    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
359
    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
612
360
Lines 637-720 static void detachRenderTree(Element& cu Source/WebCore/style/StyleTreeResolver.cpp_sec10
637
        current.didDetachRenderers();
385
        current.didDetachRenderers();
638
}
386
}
639
387
640
static bool pseudoStyleCacheIsInvalid(RenderElement* renderer, RenderStyle* newStyle)
388
ElementUpdate TreeResolver::resolveElement(Element& element)
641
{
389
{
642
    const RenderStyle& currentStyle = renderer->style();
390
    ElementUpdate update;
643
391
644
    const PseudoStyleCache* pseudoStyleCache = currentStyle.cachedPseudoStyles();
392
    update.wasExplicitlyInvalidated = element.styleChangeType() != NoStyleChange;
645
    if (!pseudoStyleCache)
393
    update.needsRecompositeLayers = element.styleChangeType() == SyntheticStyleChange;
646
        return false;
647
394
648
    for (auto& cache : *pseudoStyleCache) {
395
    auto newStyle = styleForElement(element, parent().style);
649
        RefPtr<RenderStyle> newPseudoStyle;
650
        PseudoId pseudoId = cache->styleType();
651
        if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
652
            newPseudoStyle = renderer->uncachedFirstLineStyle(newStyle);
653
        else
654
            newPseudoStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle);
655
        if (!newPseudoStyle)
656
            return true;
657
        if (*newPseudoStyle != *cache) {
658
            if (pseudoId < FIRST_INTERNAL_PSEUDOID)
659
                newStyle->setHasPseudoStyle(pseudoId);
660
            newStyle->addCachedPseudoStyle(newPseudoStyle);
661
            if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) {
662
                // FIXME: We should do an actual diff to determine whether a repaint vs. layout
663
                // is needed, but for now just assume a layout will be required. The diff code
664
                // in RenderObject::setStyle would need to be factored out so that it could be reused.
665
                renderer->setNeedsLayoutAndPrefWidthsRecalc();
666
            }
667
            return true;
668
        }
669
    }
670
    return false;
671
}
672
396
673
Change TreeResolver::resolveElement(Element& current)
397
    auto* renderer = element.renderer();
674
{
398
    bool needsNewRenderer = !renderer || element.styleChangeType() == ReconstructRenderTree || parent().change == Detach;
675
    Change localChange = Detach;
676
    RefPtr<RenderStyle> newStyle;
677
    RefPtr<RenderStyle> currentStyle = current.renderStyle();
678
399
679
    if (currentStyle && current.styleChangeType() != ReconstructRenderTree) {
400
    if (!needsNewRenderer && m_document.frame()->animation().updateAnimations(*renderer, newStyle, newStyle))
680
        Ref<RenderStyle> style(styleForElement(current, parent().style));
401
        update.needsRecompositeLayers = true;
681
        newStyle = style.ptr();
682
        localChange = determineChange(*currentStyle, style);
683
    }
684
    if (localChange == Detach) {
685
        if (current.renderer() || current.isNamedFlowContentNode())
686
            detachRenderTree(current, ReattachDetach);
687
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
688
        else if (is<HTMLSlotElement>(current))
689
            detachRenderTree(current, ReattachDetach);
690
#endif
691
        createRenderTreeRecursively(current, parent().style, parent().renderTreePosition, newStyle.release());
692
        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(current);
693
402
694
        return Detach;
403
    update.type = needsNewRenderer ? Detach : determineChange(renderer->style(), newStyle);
695
    }
404
    update.style = WTFMove(newStyle);
405
//
406
//    if (update.type == NoChange && !update.wasExplicitlyInvalidated)
407
//        update.style = &renderer->style();
408
//    else
409
//        update.style = WTFMove(newStyle);
410
//
411
    if (&element == m_document.documentElement()) {
412
        m_documentElementStyle = update.style;
696
413
697
    if (RenderElement* renderer = current.renderer()) {
414
        // If "rem" units are used anywhere in the document, and if the document element's font size changes, then force font updating
698
        if (localChange != NoChange || pseudoStyleCacheIsInvalid(renderer, newStyle.get()) || (parent().change == Force && renderer->requiresForcedStyleRecalcPropagation()) || current.styleChangeType() == SyntheticStyleChange)
415
        // all the way down the tree. This is simpler than having to maintain a cache of objects (and such font size changes should be rare anyway).
699
            renderer->setAnimatableStyle(*newStyle, current.styleChangeType() == SyntheticStyleChange ? StyleDifferenceRecompositeLayer : StyleDifferenceEqual);
416
        if (m_document.authorStyleSheets().usesRemUnits() && update.type != NoChange && renderer && update.style && renderer->style().fontSize() != update.style->fontSize()) {
700
        else if (current.needsStyleRecalc()) {
417
            // Cached RenderStyles may depend on the rem units.
701
            // Although no change occurred, we use the new style so that the cousin style sharing code won't get
418
            scope().styleResolver.invalidateMatchedPropertiesCache();
702
            // fooled into believing this style is the same.
419
            update.type = Force;
703
            renderer->setStyleInternal(*newStyle);
704
        }
420
        }
705
    }
421
    }
706
422
707
    // If "rem" units are used anywhere in the document, and if the document element's font size changes, then force font updating
423
    // This is needed for resolving color:-webkit-text for subsequent elements.
708
    // all the way down the tree. This is simpler than having to maintain a cache of objects (and such font size changes should be rare anyway).
424
    // FIXME: We shouldn't mutate document when resolving style.
709
    if (m_document.authorStyleSheets().usesRemUnits() && m_document.documentElement() == &current && localChange != NoChange && currentStyle && newStyle && currentStyle->fontSize() != newStyle->fontSize()) {
425
    if (&element == m_document.body())
710
        // Cached RenderStyles may depend on the re units.
426
        m_document.setTextColor(update.style->visitedDependentColor(CSSPropertyColor));
711
        scope().styleResolver.invalidateMatchedPropertiesCache();
712
        return Force;
713
    }
714
    if (parent().change == Force || current.styleChangeType() >= FullStyleChange)
715
        return Force;
716
427
717
    return localChange;
428
    if (update.type != Detach && (parent().change == Force || element.styleChangeType() >= FullStyleChange))
429
        update.type = Force;
430
431
    return update;
718
}
432
}
719
433
720
void resolveTextNode(Text& text, RenderTreePosition& renderTreePosition)
434
void resolveTextNode(Text& text, RenderTreePosition& renderTreePosition)
Lines 736-765 void resolveTextNode(Text& text, RenderT Source/WebCore/style/StyleTreeResolver.cpp_sec11
736
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
450
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
737
}
451
}
738
452
739
void TreeResolver::resolveBeforeOrAfterPseudoElement(Element& current, Change change, PseudoId pseudoId, RenderTreePosition& renderTreePosition)
740
{
741
    if (!current.renderer())
742
        return;
743
    PseudoElement* existingPseudoElement = beforeOrAfterPseudoElement(current, pseudoId);
744
    if (!existingPseudoElement) {
745
        createRenderTreeForBeforeOrAfterPseudoElement(current, pseudoId, renderTreePosition);
746
        return;
747
    }
748
749
    if (existingPseudoElement->renderer())
750
        renderTreePosition.invalidateNextSibling(*existingPseudoElement->renderer());
751
752
    if (change == NoChange && !existingPseudoElement->needsStyleRecalc())
753
        return;
754
755
    if (needsPseudoElement(current, pseudoId)) {
756
        auto change = resolveElement(*existingPseudoElement);
757
        existingPseudoElement->didRecalcStyle(change);
758
        existingPseudoElement->clearNeedsStyleRecalc();
759
    } else
760
        clearBeforeOrAfterPseudoElement(current, pseudoId);
761
}
762
763
#if PLATFORM(IOS)
453
#if PLATFORM(IOS)
764
static EVisibility elementImplicitVisibility(const Element* element)
454
static EVisibility elementImplicitVisibility(const Element* element)
765
{
455
{
Lines 814-824 private: Source/WebCore/style/StyleTreeResolver.cpp_sec12
814
};
504
};
815
#endif // PLATFORM(IOS)
505
#endif // PLATFORM(IOS)
816
506
817
void TreeResolver::pushParent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change)
507
void TreeResolver::pushParent(Element& element, ElementUpdate& update)
818
{
508
{
819
    scope().selectorFilter.pushParent(&element);
509
    scope().selectorFilter.pushParent(&element);
820
510
821
    Parent parent(element, style, renderTreePosition, change);
511
    Parent parent(element, update);
822
512
823
    if (auto* shadowRoot = element.shadowRoot()) {
513
    if (auto* shadowRoot = element.shadowRoot()) {
824
        pushScope(*shadowRoot);
514
        pushScope(*shadowRoot);
Lines 832-847 void TreeResolver::pushParent(Element& e Source/WebCore/style/StyleTreeResolver.cpp_sec13
832
#endif
522
#endif
833
523
834
    m_parentStack.append(WTFMove(parent));
524
    m_parentStack.append(WTFMove(parent));
835
836
    resolveBeforeOrAfterPseudoElement(element, change, BEFORE, renderTreePosition);
837
}
525
}
838
526
839
void TreeResolver::popParent()
527
void TreeResolver::popParent()
840
{
528
{
841
    auto& parentElement = *parent().element;
529
    auto& parentElement = *parent().element;
842
530
843
    resolveBeforeOrAfterPseudoElement(parentElement, parent().change, AFTER, parent().renderTreePosition);
844
845
    parentElement.clearNeedsStyleRecalc();
531
    parentElement.clearNeedsStyleRecalc();
846
    parentElement.clearChildNeedsStyleRecalc();
532
    parentElement.clearChildNeedsStyleRecalc();
847
533
Lines 862-869 void TreeResolver::popParentsToDepth(uns Source/WebCore/style/StyleTreeResolver.cpp_sec14
862
        popParent();
548
        popParent();
863
}
549
}
864
550
551
552
void TreeResolver::addUpdate(Text& text)
553
{
554
    m_update->add(text, parent().element);
555
}
556
557
void TreeResolver::addUpdate(Element& element, ElementUpdate& update)
558
{
559
    m_update->add(element, parent().element, update);
560
}
561
562
static bool shouldResolvePseudoElement(PseudoElement* pseudoElement)
563
{
564
    if (!pseudoElement)
565
        return false;
566
    bool needsStyleRecalc = pseudoElement->needsStyleRecalc();
567
    pseudoElement->clearNeedsStyleRecalc();
568
    return needsStyleRecalc;
569
}
570
865
void TreeResolver::resolveComposedTree()
571
void TreeResolver::resolveComposedTree()
866
{
572
{
573
    fprintf(stderr, "resolveComposedTree\n");
574
//    fprintf(stderr, "%s\n", composedTreeAsText(m_document, ComposedTreeAsTextMode::WithPointers).utf8().data());
575
867
    ASSERT(m_parentStack.size() == 1);
576
    ASSERT(m_parentStack.size() == 1);
868
    ASSERT(m_scopeStack.size() == 1);
577
    ASSERT(m_scopeStack.size() == 1);
869
578
Lines 883-894 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec15
883
        ASSERT(node.containingShadowRoot() == scope().shadowRoot);
592
        ASSERT(node.containingShadowRoot() == scope().shadowRoot);
884
        ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot());
593
        ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot());
885
594
886
        if (auto* existingRenderer = node.renderer())
887
            parent.renderTreePosition.invalidateNextSibling(*existingRenderer);
888
889
        if (is<Text>(node)) {
595
        if (is<Text>(node)) {
890
            if (node.needsStyleRecalc())
596
            auto& text = downcast<Text>(node);
891
                resolveTextNode(downcast<Text>(node), parent.renderTreePosition);
597
            if (text.styleChangeType() == ReconstructRenderTree && parent.change != Detach)
598
                addUpdate(text);
599
600
            text.clearNeedsStyleRecalc();
892
            it.traverseNextSkippingChildren();
601
            it.traverseNextSkippingChildren();
893
            continue;
602
            continue;
894
        }
603
        }
Lines 900-908 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec16
900
        if (element.needsStyleRecalc() || parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
609
        if (element.needsStyleRecalc() || parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
901
            parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle();
610
            parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle();
902
611
903
        Change change = NoChange;
612
        bool shouldResolveForPseudoElement = shouldResolvePseudoElement(element.beforePseudoElement()) || shouldResolvePseudoElement(element.afterPseudoElement());
904
613
905
        bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || affectedByPreviousSibling;
614
        ElementUpdate update;
615
        update.style = element.renderStyle();
616
617
        bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling;
906
        if (shouldResolve) {
618
        if (shouldResolve) {
907
#if PLATFORM(IOS)
619
#if PLATFORM(IOS)
908
            CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());
620
            CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());
Lines 915-959 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec17
915
                    continue;
627
                    continue;
916
                }
628
                }
917
            }
629
            }
918
            change = resolveElement(element);
630
            update = resolveElement(element);
919
920
            element.clearNeedsStyleRecalc();
921
631
922
            if (element.hasCustomStyleResolveCallbacks())
632
            if (element.hasCustomStyleResolveCallbacks())
923
                element.didRecalcStyle(change);
633
                element.didRecalcStyle(update.type);
924
634
925
            if (change == Detach) {
635
            if (affectedByPreviousSibling && update.type != Detach)
926
                it.traverseNextSkippingChildren();
636
                update.type = Force;
927
                continue;
928
            }
929
637
930
            if (affectedByPreviousSibling)
638
            addUpdate(element, update);
931
                change = Force;
639
640
            element.clearNeedsStyleRecalc();
932
        }
641
        }
933
642
643
934
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
644
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
935
        if (is<HTMLSlotElement>(element)) {
645
        if (is<HTMLSlotElement>(element)) {
936
            // FIXME: We should compute style for the slot and use it as parent style.
646
            // FIXME: We should compute style for the slot and use it as parent style.
937
            // FIXME: This should be display:contents check.
647
            // Duplicate the style from the parent context.
938
            // Duplicate the style and render tree position from the current context.
648
            ElementUpdate slotUpdate;
939
            pushParent(element, parent.style.get(), parent.renderTreePosition, change);
649
            slotUpdate.style = parent.style.ptr();
650
            slotUpdate.type = update.type;
651
            if (!shouldResolve)
652
                addUpdate(element, slotUpdate);
653
            pushParent(element, slotUpdate);
940
            it.traverseNext();
654
            it.traverseNext();
941
            continue;
655
            continue;
942
        }
656
        }
943
#endif
657
#endif
944
        auto* renderer = element.renderer();
658
        if (!update.style) {
945
        if (!renderer) {
946
            resetStyleForNonRenderedDescendants(element);
659
            resetStyleForNonRenderedDescendants(element);
947
            element.clearChildNeedsStyleRecalc();
660
            element.clearChildNeedsStyleRecalc();
948
        }
661
        }
949
662
950
        bool shouldIterateChildren = renderer && (element.childNeedsStyleRecalc() || change != NoChange);
663
        bool shouldIterateChildren = update.style && (element.childNeedsStyleRecalc() || update.type != NoChange);
951
        if (!shouldIterateChildren) {
664
        if (!shouldIterateChildren) {
952
            it.traverseNextSkippingChildren();
665
            it.traverseNextSkippingChildren();
953
            continue;
666
            continue;
954
        }
667
        }
955
668
956
        pushParent(element, renderer->style(), RenderTreePosition(*renderer), change);
669
        pushParent(element, update);
957
670
958
        it.traverseNext();
671
        it.traverseNext();
959
    }
672
    }
Lines 961-984 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec18
961
    popParentsToDepth(1);
674
    popParentsToDepth(1);
962
}
675
}
963
676
964
void TreeResolver::resolve(Change change)
677
std::unique_ptr<const Update> TreeResolver::resolve(Change change)
965
{
678
{
966
    auto& renderView = *m_document.renderView();
679
    auto& renderView = *m_document.renderView();
967
680
968
    Element* documentElement = m_document.documentElement();
681
    Element* documentElement = m_document.documentElement();
969
    if (!documentElement)
682
    if (!documentElement)
970
        return;
683
        return nullptr;
971
    if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
684
    if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
972
        return;
685
        return nullptr;
973
686
687
    m_update = std::make_unique<Update>(m_document);
974
    m_scopeStack.append(adoptRef(*new Scope(m_document)));
688
    m_scopeStack.append(adoptRef(*new Scope(m_document)));
689
    m_parentStack.append(Parent(m_document, change));
975
690
976
    // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
691
    // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
977
    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
692
    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
978
    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
693
    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
979
694
980
    m_parentStack.append(Parent(m_document, change));
981
982
    resolveComposedTree();
695
    resolveComposedTree();
983
696
984
    renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
697
    renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
Lines 986-996 void TreeResolver::resolve(Change change Source/WebCore/style/StyleTreeResolver.cpp_sec19
986
699
987
    m_parentStack.clear();
700
    m_parentStack.clear();
988
    m_scopeStack.clear();
701
    m_scopeStack.clear();
989
}
990
702
991
void detachRenderTree(Element& element)
703
    if (m_update->roots().isEmpty())
992
{
704
        m_update = { };
993
    detachRenderTree(element, NormalDetach);
705
706
    return WTFMove(m_update);
994
}
707
}
995
708
996
static Vector<std::function<void ()>>& postResolutionCallbackQueue()
709
static Vector<std::function<void ()>>& postResolutionCallbackQueue()
- Source/WebCore/style/StyleTreeResolver.h -18 / +16 lines
Lines 32-38 Source/WebCore/style/StyleTreeResolver.h_sec1
32
#include "SelectorFilter.h"
32
#include "SelectorFilter.h"
33
#include "StyleChange.h"
33
#include "StyleChange.h"
34
#include "StyleSharingResolver.h"
34
#include "StyleSharingResolver.h"
35
#include "StyleUpdate.h"
35
#include <functional>
36
#include <functional>
37
#include <wtf/HashMap.h>
36
#include <wtf/RefPtr.h>
38
#include <wtf/RefPtr.h>
37
39
38
namespace WebCore {
40
namespace WebCore {
Lines 47-52 class Settings; Source/WebCore/style/StyleTreeResolver.h_sec2
47
class ShadowRoot;
49
class ShadowRoot;
48
class StyleResolver;
50
class StyleResolver;
49
class Text;
51
class Text;
52
class TreeChange;
50
53
51
namespace Style {
54
namespace Style {
52
55
Lines 54-78 class TreeResolver { Source/WebCore/style/StyleTreeResolver.h_sec3
54
public:
57
public:
55
    TreeResolver(Document&);
58
    TreeResolver(Document&);
56
59
57
    void resolve(Change);
60
    std::unique_ptr<const Update> resolve(Change);
58
61
59
private:
62
private:
60
    Ref<RenderStyle> styleForElement(Element&, RenderStyle& inheritedStyle);
63
    Ref<RenderStyle> styleForElement(Element&, RenderStyle& inheritedStyle);
61
64
62
    void resolveComposedTree();
65
    void resolveComposedTree();
63
    Change resolveElement(Element&);
66
    ElementUpdate resolveElement(Element&);
64
    void resolveBeforeOrAfterPseudoElement(Element&, Change, PseudoId, RenderTreePosition&);
65
66
67
    void createRenderTreeRecursively(Element&, RenderStyle&, RenderTreePosition&, RefPtr<RenderStyle>&& resolvedStyle);
68
    void createRenderer(Element&, RenderTreePosition&, RefPtr<RenderStyle>&& resolvedStyle);
69
    void createRenderTreeForBeforeOrAfterPseudoElement(Element&, PseudoId, RenderTreePosition&);
70
    void createRenderTreeForChildren(ContainerNode&, RenderStyle&, RenderTreePosition&);
71
    void createRenderTreeForShadowRoot(ShadowRoot&);
72
73
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
74
    void createRenderTreeForSlotAssignees(HTMLSlotElement&, RenderStyle& inheritedStyle, RenderTreePosition&);
75
#endif
76
67
77
    struct Scope : RefCounted<Scope> {
68
    struct Scope : RefCounted<Scope> {
78
        StyleResolver& styleResolver;
69
        StyleResolver& styleResolver;
Lines 88-100 private: Source/WebCore/style/StyleTreeResolver.h_sec4
88
    struct Parent {
79
    struct Parent {
89
        Element* element;
80
        Element* element;
90
        Ref<RenderStyle> style;
81
        Ref<RenderStyle> style;
91
        RenderTreePosition renderTreePosition;
92
        Change change;
82
        Change change;
93
        bool didPushScope { false };
83
        bool didPushScope { false };
94
        bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle { false };
84
        bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle { false };
95
85
96
        Parent(Document&, Change);
86
        Parent(Document&, Change);
97
        Parent(Element&, RenderStyle&, RenderTreePosition, Change);
87
        Parent(Element&, ElementUpdate&);
98
    };
88
    };
99
89
100
    Scope& scope() { return m_scopeStack.last(); }
90
    Scope& scope() { return m_scopeStack.last(); }
Lines 104-119 private: Source/WebCore/style/StyleTreeResolver.h_sec5
104
    void pushEnclosingScope();
94
    void pushEnclosingScope();
105
    void popScope();
95
    void popScope();
106
96
107
    void pushParent(Element&, RenderStyle&, RenderTreePosition, Change);
97
    void pushParent(Element&, ElementUpdate&);
108
    void popParent();
98
    void popParent();
109
    void popParentsToDepth(unsigned depth);
99
    void popParentsToDepth(unsigned depth);
110
100
101
    void addUpdate(Text&);
102
    void addUpdate(Element&, ElementUpdate&);
103
111
    Document& m_document;
104
    Document& m_document;
105
    RefPtr<RenderStyle> m_documentElementStyle;
106
112
    Vector<Ref<Scope>, 4> m_scopeStack;
107
    Vector<Ref<Scope>, 4> m_scopeStack;
113
    Vector<Parent, 32> m_parentStack;
108
    Vector<Parent, 32> m_parentStack;
109
110
    std::unique_ptr<Update> m_update;
114
};
111
};
115
112
116
void detachRenderTree(Element&);
113
enum DetachType { NormalDetach, ReattachDetach };
114
void detachRenderTree(Element&, DetachType = NormalDetach);
117
void detachTextRenderer(Text&);
115
void detachTextRenderer(Text&);
118
116
119
void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
117
void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
- Source/WebCore/style/StyleUpdate.cpp +104 lines
Line 0 Source/WebCore/style/StyleUpdate.cpp_sec1
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "StyleUpdate.h"
28
29
#include "ComposedTreeIterator.h"
30
#include "Document.h"
31
#include "Element.h"
32
#include "FlowThreadController.h"
33
#include "HTMLSlotElement.h"
34
#include "InspectorInstrumentation.h"
35
#include "NodeRenderStyle.h"
36
#include "PseudoElement.h"
37
#include "RenderFullScreen.h"
38
#include "RenderNamedFlowThread.h"
39
#include "StyleResolver.h"
40
#include "StyleTreeResolver.h"
41
42
namespace WebCore {
43
namespace Style {
44
45
Update::Update(Document& document)
46
    : m_document(document)
47
{
48
}
49
50
const ElementUpdate* Update::forElement(const Element& element) const
51
{
52
    auto it = m_elements.find(&element);
53
    if (it == m_elements.end())
54
        return nullptr;
55
    return &it->value;
56
}
57
58
bool Update::forText(const Text& text) const
59
{
60
    return m_texts.contains(&text);
61
}
62
63
void Update::addPossibleRoot(Element* element)
64
{
65
    if (element && m_elements.contains(element))
66
        return;
67
    ContainerNode* root = element;
68
    if (!root)
69
        root = &m_document;
70
    m_roots.add(root);
71
}
72
73
void Update::add(Element& element, Element* parent, ElementUpdate& change)
74
{
75
    ASSERT(!m_elements.contains(&element));
76
77
    addPossibleRoot(parent);
78
    m_elements.add(&element, change);
79
}
80
81
void Update::add(Text& text, Element* parent)
82
{
83
    ASSERT(!m_texts.contains(&text));
84
85
    addPossibleRoot(parent);
86
    m_texts.add(&text);
87
}
88
89
RenderStyle* Update::elementStyle(const Element& element) const
90
{
91
    if (auto* update = forElement(element))
92
        return update->style.get();
93
    return element.renderStyle();
94
}
95
96
void Update::addRelations(std::unique_ptr<Relations> relations)
97
{
98
    if (!relations)
99
        return;
100
    m_relations.appendVector(*relations);
101
}
102
103
}
104
}
- Source/WebCore/style/StyleUpdate.h +87 lines
Line 0 Source/WebCore/style/StyleUpdate.h_sec1
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef StyleUpdate_h
27
#define StyleUpdate_h
28
29
#include "Node.h"
30
#include "StyleChange.h"
31
#include "StyleRelations.h"
32
#include <wtf/HashMap.h>
33
#include <wtf/HashSet.h>
34
#include <wtf/IteratorRange.h>
35
#include <wtf/ListHashSet.h>
36
#include <wtf/RefPtr.h>
37
38
namespace WebCore {
39
40
class ContainerNode;
41
class Document;
42
class Element;
43
class Node;
44
class RenderStyle;
45
class Text;
46
47
namespace Style {
48
49
struct ElementUpdate {
50
    RefPtr<RenderStyle> style;
51
    Change type { NoChange };
52
    bool wasExplicitlyInvalidated { false };
53
    bool needsRecompositeLayers { false };
54
};
55
56
class Update {
57
public:
58
    Update(Document&);
59
60
    const ListHashSet<ContainerNode*>& roots() const { return m_roots; }
61
62
    const ElementUpdate* forElement(const Element&) const;
63
    bool forText(const Text&) const;
64
65
    RenderStyle* elementStyle(const Element&) const;
66
67
    const Relations& relations() const { return m_relations; }
68
69
    const Document& document() const { return m_document; }
70
71
    void add(Element&, Element* parent, ElementUpdate&);
72
    void add(Text&, Element* parent);
73
    void addRelations(std::unique_ptr<Relations>);
74
75
private:
76
    void addPossibleRoot(Element*);
77
78
    Document& m_document;
79
    ListHashSet<ContainerNode*> m_roots;
80
    HashMap<const Element*, ElementUpdate> m_elements;
81
    HashSet<const Text*> m_texts;
82
    Relations m_relations;
83
};
84
85
}
86
}
87
#endif
- Source/WebCore/svg/SVGElement.h -1 / +2 lines
Lines 183-193 protected: Source/WebCore/svg/SVGElement.h_sec1
183
    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
183
    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
184
    void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement*);
184
    void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement*);
185
185
186
    bool willRecalcStyle(Style::Change) override;
187
186
    class InstanceInvalidationGuard;
188
    class InstanceInvalidationGuard;
187
189
188
private:
190
private:
189
    RenderStyle* computedStyle(PseudoId = NOPSEUDO) final;
191
    RenderStyle* computedStyle(PseudoId = NOPSEUDO) final;
190
    bool willRecalcStyle(Style::Change) override;
191
192
192
    virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
193
    virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
193
194
- Source/WebCore/svg/SVGUseElement.cpp -2 / +3 lines
Lines 178-188 void SVGUseElement::svgAttributeChanged( Source/WebCore/svg/SVGUseElement.cpp_sec1
178
    SVGGraphicsElement::svgAttributeChanged(attrName);
178
    SVGGraphicsElement::svgAttributeChanged(attrName);
179
}
179
}
180
180
181
void SVGUseElement::willAttachRenderers()
181
bool SVGUseElement::willRecalcStyle(Style::Change change)
182
{
182
{
183
    // FIXME: Shadow tree should be updated before style recalc.
183
    if (m_shadowTreeNeedsUpdate)
184
    if (m_shadowTreeNeedsUpdate)
184
        updateShadowTree();
185
        updateShadowTree();
185
    SVGGraphicsElement::willAttachRenderers();
186
    return SVGGraphicsElement::willRecalcStyle(change);
186
}
187
}
187
188
188
static HashSet<AtomicString> createAllowedElementSet()
189
static HashSet<AtomicString> createAllowedElementSet()
- Source/WebCore/svg/SVGUseElement.h -1 / +1 lines
Lines 63-69 private: Source/WebCore/svg/SVGUseElement.h_sec1
63
    void buildPendingResource() override;
63
    void buildPendingResource() override;
64
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
64
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
65
    void svgAttributeChanged(const QualifiedName&) override;
65
    void svgAttributeChanged(const QualifiedName&) override;
66
    void willAttachRenderers() override;
66
    bool willRecalcStyle(Style::Change) override;
67
    RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
67
    RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
68
    void toClipPath(Path&) override;
68
    void toClipPath(Path&) override;
69
    bool haveLoadedRequiredResources() override;
69
    bool haveLoadedRequiredResources() override;
- LayoutTests/TestExpectations +3 lines
Lines 986-991 webkit.org/b/154686 inspector/indexeddb/ LayoutTests/TestExpectations_sec1
986
storage/indexeddb/modern/exceed-open-file-limit.html [ Skip ]
986
storage/indexeddb/modern/exceed-open-file-limit.html [ Skip ]
987
webkit.org/b/155028 storage/indexeddb/modern/256-open-databases.html [ Skip ]
987
webkit.org/b/155028 storage/indexeddb/modern/256-open-databases.html [ Skip ]
988
988
989
# Fixed by upcoming MathML refactoring
990
webkit.org/b/155019 mathml/presentation/menclose-notation-attribute-change-value.html [ Skip ]
991
989
### END OF IndexedDB failures
992
### END OF IndexedDB failures
990
########################################
993
########################################
991
994
- LayoutTests/css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt -2 / +2 lines
Lines 21-30 Test if unsetting a parent's stacking co LayoutTests/css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt_sec1
21
  (rect 48 290 60 60)
21
  (rect 48 290 60 60)
22
  (rect 28 290 60 60)
22
  (rect 28 290 60 60)
23
  (rect 48 290 60 60)
23
  (rect 48 290 60 60)
24
  (rect 48 408 60 60)
25
  (rect 48 408 60 60)
26
  (rect 28 526 60 60)
24
  (rect 28 526 60 60)
27
  (rect 48 526 60 60)
25
  (rect 48 526 60 60)
26
  (rect 48 408 60 60)
27
  (rect 48 408 60 60)
28
  (rect 48 644 60 60)
28
  (rect 48 644 60 60)
29
  (rect 68 644 60 60)
29
  (rect 68 644 60 60)
30
  (rect 48 644 60 60)
30
  (rect 48 644 60 60)
- LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt -5 / +5 lines
Lines 17-35 PASS innerHeight is 600 LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt_sec1
17
PASS getComputedStyle(test).fontSize is "30px"
17
PASS getComputedStyle(test).fontSize is "30px"
18
PASS getComputedStyle(test).width is "450px"
18
PASS getComputedStyle(test).width is "450px"
19
PASS getComputedStyle(testpseudo, ':after').marginLeft is "120px"
19
PASS getComputedStyle(testpseudo, ':after').marginLeft is "120px"
20
FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 225px. Was 200px.
20
PASS getComputedStyle(testpseudo, ':after').paddingRight is "225px"
21
PASS innerWidth is 900
21
PASS innerWidth is 900
22
PASS innerHeight is 640
22
PASS innerHeight is 640
23
PASS getComputedStyle(test).fontSize is "32px"
23
PASS getComputedStyle(test).fontSize is "32px"
24
PASS getComputedStyle(test).width is "450px"
24
PASS getComputedStyle(test).width is "450px"
25
FAIL getComputedStyle(testpseudo, ':after').marginLeft should be 128px. Was 120px.
25
PASS getComputedStyle(testpseudo, ':after').marginLeft is "128px"
26
FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 225px. Was 200px.
26
PASS getComputedStyle(testpseudo, ':after').paddingRight is "225px"
27
PASS innerWidth is 500
27
PASS innerWidth is 500
28
PASS innerHeight is 640
28
PASS innerHeight is 640
29
PASS getComputedStyle(test).fontSize is "32px"
29
PASS getComputedStyle(test).fontSize is "32px"
30
PASS getComputedStyle(test).width is "250px"
30
PASS getComputedStyle(test).width is "250px"
31
FAIL getComputedStyle(testpseudo, ':after').marginLeft should be 100px. Was 120px.
31
PASS getComputedStyle(testpseudo, ':after').marginLeft is "100px"
32
FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 160px. Was 200px.
32
PASS getComputedStyle(testpseudo, ':after').paddingRight is "160px"
33
PASS innerWidth is 800
33
PASS innerWidth is 800
34
PASS innerHeight is 600
34
PASS innerHeight is 600
35
PASS getComputedStyle(test).fontSize is "30px"
35
PASS getComputedStyle(test).fontSize is "30px"
- LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt -1 / +1 lines
Lines 279-282 layer at (0,0) size 800x600 LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt_sec1
279
          RenderText {#text} at (0,0) size 160x28
279
          RenderText {#text} at (0,0) size 160x28
280
            text run at (0,0) width 154: "would' wouldn't"
280
            text run at (0,0) width 154: "would' wouldn't"
281
            text run at (153,0) width 7: " "
281
            text run at (153,0) width 7: " "
282
caret: position 16 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body
282
caret: position 16 of child 0 {#text} of child 6 {DIV} of child 3 {DIV} of body
- LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt -1 / +1 lines
Lines 82-85 layer at (0,0) size 800x600 LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt_sec1
82
            text run at (0,28) width 34: "baz"
82
            text run at (0,28) width 34: "baz"
83
        RenderBlock {DIV} at (14,70) size 756x28
83
        RenderBlock {DIV} at (14,70) size 756x28
84
          RenderBR {BR} at (0,0) size 0x28
84
          RenderBR {BR} at (0,0) size 0x28
85
caret: position 0 of child 0 {BR} of child 4 {DIV} of child 5 {DIV} of body
85
caret: position 0 of child 0 {BR} of child 5 {DIV} of child 5 {DIV} of body
- LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt -1 / +1 lines
Lines 78-81 layer at (0,0) size 800x600 LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt_sec1
78
          RenderInline {SPAN} at (0,0) size 1x28
78
          RenderInline {SPAN} at (0,0) size 1x28
79
        RenderBlock {DIV} at (14,42) size 756x28
79
        RenderBlock {DIV} at (14,42) size 756x28
80
          RenderBR {BR} at (0,0) size 0x28
80
          RenderBR {BR} at (0,0) size 0x28
81
caret: position 0 of child 0 {BR} of child 2 {DIV} of child 5 {DIV} of body
81
caret: position 0 of child 0 {BR} of child 3 {DIV} of child 5 {DIV} of body
- LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt -1 / +1 lines
Lines 137-140 layer at (0,0) size 800x600 LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt_sec1
137
        RenderBlock {DIV} at (14,42) size 756x28
137
        RenderBlock {DIV} at (14,42) size 756x28
138
          RenderText {#text} at (0,0) size 138x28
138
          RenderText {#text} at (0,0) size 138x28
139
            text run at (0,0) width 138: "the notational,"
139
            text run at (0,0) width 138: "the notational,"
140
caret: position 15 of child 0 {#text} of child 2 {DIV} of child 7 {DIV} of body
140
caret: position 15 of child 0 {#text} of child 3 {DIV} of child 7 {DIV} of body
- LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt +2 lines
Lines 76-80 This tests removing underline from style LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt_sec1
76
| "xxxxxx "
76
| "xxxxxx "
77
| "<#selection-anchor>xxxxxx<#selection-focus>"
77
| "<#selection-anchor>xxxxxx<#selection-focus>"
78
| " xxxxxx"
78
| " xxxxxx"
79
| "
80
"
79
| <span>
81
| <span>
80
|   id="test"
82
|   id="test"
- LayoutTests/editing/style/typing-style-003-expected.txt -4 / +4 lines
Lines 52-61 EDITING DELEGATE: webViewDidChangeSelect LayoutTests/editing/style/typing-style-003-expected.txt_sec1
52
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
52
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
53
xxxxxxxxxxxxxxx
53
xxxxxxxxxxxxxxx
54
execTypeCharacterCommand: x <span id="test"></span>
54
execTypeCharacterCommand: x <span id="test"></span>
55
execTypeCharacterCommand: xx<span id="test"></span>
55
execTypeCharacterCommand: xx <span id="test"></span>
56
execTypeCharacterCommand: xxx<span id="test"></span>
56
execTypeCharacterCommand: xxx <span id="test"></span>
57
execBoldCommand: xxx<span id="test"></span>
57
execBoldCommand: xxx <span id="test"></span>
58
execTypeCharacterCommand: xxx<b>x</b><span id="test"></span>
58
execTypeCharacterCommand: xxx<b>x</b> <span id="test"></span>
59
execTypeCharacterCommand: xxx<b>xx</b><span id="test"></span>
59
execTypeCharacterCommand: xxx<b>xx</b><span id="test"></span>
60
execTypeCharacterCommand: xxx<b>xxx</b><span id="test"></span>
60
execTypeCharacterCommand: xxx<b>xxx</b><span id="test"></span>
61
execItalicCommand: xxx<b>xxx</b><span id="test"></span>
61
execItalicCommand: xxx<b>xxx</b><span id="test"></span>
- LayoutTests/media/trackmenu-test.js -11 / +4 lines
Lines 2-19 var captionsButtonCoordinates = null; LayoutTests/media/trackmenu-test.js_sec1
2
2
3
function clickCCButton()
3
function clickCCButton()
4
{
4
{
5
    if (!captionsButtonCoordinates) {
5
    var button = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
6
        try {
7
            captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
8
        } catch (exception) {
9
            failTest(exception.description);
10
            return;
11
        }
12
    }
13
6
14
    eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordinates[1]);
7
    var event = document.createEvent('Events');
15
    eventSender.mouseDown();
8
    event.initEvent("click", true, false);
16
    eventSender.mouseUp();
9
    button.dispatchEvent(event);
17
}
10
}
18
11
19
function startTrackMenuTest(testFunction)
12
function startTrackMenuTest(testFunction)
- LayoutTests/media/controls/controls-test-helpers.js -2 / +5 lines
Lines 58-65 ControlsTest = class ControlsTest { LayoutTests/media/controls/controls-test-helpers.js_sec1
58
    handleEvent(event)
58
    handleEvent(event)
59
    {
59
    {
60
        this.logMessage(`EVENT: ${event.type}`);
60
        this.logMessage(`EVENT: ${event.type}`);
61
        if (event.type == this.eventTrigger && this.callback && window.testRunner)
61
        if (event.type == this.eventTrigger && this.callback && window.testRunner) {
62
            this.callback();
62
            setTimeout(() => {
63
                this.callback();
64
            }, 0);
65
        }
63
    }
66
    }
64
67
65
    logSuccess(msg)
68
    logSuccess(msg)
- LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt -1 / +1 lines
Lines 259-262 layer at (0,0) size 800x600 LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt_sec1
259
          RenderText {#text} at (0,0) size 172x28
259
          RenderText {#text} at (0,0) size 172x28
260
            text run at (0,0) width 166: "wouldn' wouldn't"
260
            text run at (0,0) width 166: "wouldn' wouldn't"
261
            text run at (165,0) width 7: " "
261
            text run at (165,0) width 7: " "
262
caret: position 17 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body
262
caret: position 17 of child 0 {#text} of child 6 {DIV} of child 3 {DIV} of body
- LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt -1 lines
Lines 22-28 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt_sec1
22
          text run at (0,18) width 767: "inserting a paragraph separator doesn't split the body (inserting a paragraph separator usually splits/clones the enclosing"
22
          text run at (0,18) width 767: "inserting a paragraph separator doesn't split the body (inserting a paragraph separator usually splits/clones the enclosing"
23
          text run at (766,18) width 5: " "
23
          text run at (766,18) width 5: " "
24
          text run at (0,36) width 132: "block flow element)."
24
          text run at (0,36) width 132: "block flow element)."
25
        RenderText {#text} at (0,0) size 0x0
26
      RenderBlock {DIV} at (0,54) size 784x18
25
      RenderBlock {DIV} at (0,54) size 784x18
27
        RenderBR {BR} at (0,0) size 0x18
26
        RenderBR {BR} at (0,0) size 0x18
28
caret: position 0 of child 0 {BR} of child 2 {DIV} of body
27
caret: position 0 of child 0 {BR} of child 2 {DIV} of body
- LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt -2 lines
Lines 65-71 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt_sec1
65
      RenderBlock {DIV} at (0,230) size 708x22 [border: (1px dotted #0000FF)]
65
      RenderBlock {DIV} at (0,230) size 708x22 [border: (1px dotted #0000FF)]
66
        RenderText {#text} at (1,1) size 8x18
66
        RenderText {#text} at (1,1) size 8x18
67
          text run at (1,1) width 8: "c"
67
          text run at (1,1) width 8: "c"
68
        RenderText {#text} at (0,0) size 0x0
69
      RenderBlock {P} at (0,268) size 784x18
68
      RenderBlock {P} at (0,268) size 784x18
70
        RenderText {#text} at (0,0) size 240x18
69
        RenderText {#text} at (0,0) size 240x18
71
          text run at (0,0) width 240: "This div contains a self-closing p tag."
70
          text run at (0,0) width 240: "This div contains a self-closing p tag."
Lines 81-86 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt_sec2
81
        RenderBlock (anonymous) at (1,1) size 706x18
80
        RenderBlock (anonymous) at (1,1) size 706x18
82
          RenderText {#text} at (0,0) size 8x18
81
          RenderText {#text} at (0,0) size 8x18
83
            text run at (0,0) width 8: "c"
82
            text run at (0,0) width 8: "c"
84
          RenderText {#text} at (0,0) size 0x0
85
        RenderBlock {P} at (1,35) size 706x0
83
        RenderBlock {P} at (1,35) size 706x0
86
caret: position 1 of child 0 {#text} of child 21 {DIV} of body
84
caret: position 1 of child 0 {#text} of child 21 {DIV} of body
- LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt -1 lines
Lines 29-33 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt_sec1
29
        RenderBlock (anonymous) at (2,46) size 780x18
29
        RenderBlock (anonymous) at (2,46) size 780x18
30
          RenderText {#text} at (0,0) size 8x18
30
          RenderText {#text} at (0,0) size 8x18
31
            text run at (0,0) width 8: "x"
31
            text run at (0,0) width 8: "x"
32
          RenderText {#text} at (0,0) size 0x0
33
caret: position 1 of child 5 {#text} of child 5 {DIV} of body
32
caret: position 1 of child 5 {#text} of child 5 {DIV} of body
- LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt -2 lines
Lines 12-17 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt_sec1
12
        text run at (634,103) width 102: "You should see"
12
        text run at (634,103) width 102: "You should see"
13
        text run at (735,103) width 5: " "
13
        text run at (735,103) width 5: " "
14
        text run at (0,121) width 364: "several pictures above all in the same line/paragraph."
14
        text run at (0,121) width 364: "several pictures above all in the same line/paragraph."
15
      RenderText {#text} at (0,0) size 0x0
16
      RenderText {#text} at (0,0) size 0x0
17
caret: position 164 of child 4 {#text} of body
15
caret: position 164 of child 4 {#text} of body
- LayoutTests/platform/mac/editing/selection/4983858-expected.txt -1 lines
Lines 10-16 layer at (0,0) size 800x600 LayoutTests/platform/mac/editing/selection/4983858-expected.txt_sec1
10
          text run at (716,0) width 65: "paragraph"
10
          text run at (716,0) width 65: "paragraph"
11
          text run at (780,0) width 4: " "
11
          text run at (780,0) width 4: " "
12
          text run at (0,18) width 165: "below should be selected:"
12
          text run at (0,18) width 165: "below should be selected:"
13
        RenderText {#text} at (0,0) size 0x0
14
      RenderBlock {DIV} at (0,36) size 784x18
13
      RenderBlock {DIV} at (0,36) size 784x18
15
        RenderText {#text} at (0,0) size 22x18
14
        RenderText {#text} at (0,0) size 22x18
16
          text run at (0,0) width 22: "foo"
15
          text run at (0,0) width 22: "foo"

Return to Bug 155298