| Differences between
and this patch
- Source/WebCore/ChangeLog +215 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2016-03-31  Antti Koivisto  <antti@apple.com>
2
3
        Separate render tree updating from style resolve
4
        https://bugs.webkit.org/show_bug.cgi?id=155298
5
6
        Reviewed by Andreas Kling.
7
8
        This patch splits computing document style and applying the results into two distinct steps:
9
10
        Style::TreeResolver::resolve()
11
                |
12
                | Style::Update
13
                V
14
        RenderTreeUpdater::commit()
15
16
        Style::TreeResolver::resolve() returns a Style::Update object that contains all the changes to be made
17
        for the whole composed tree. RenderTreeUpdater then applies the changes updating, building or tearing
18
        down portions of the render tree as needed.
19
20
        Style::Update consists of a map that contains new style for each newly resolved element along with some
21
        metadata. A separate map contains text nodes that require reconstruction. It also tracks change roots so
22
        RenderTreeUpdater needs to traverse the changed subtrees only.
23
24
        The patch eliminates the recursive render tree build code path replacing it with iterative functions.
25
26
        This will enable future optimizations. For example we won't need to commit to immediate rendering
27
        changes simply because some script or internal function requires up-to-date style.
28
29
        * CMakeLists.txt:
30
        * WebCore.xcodeproj/project.pbxproj:
31
        * css/StyleResolver.cpp:
32
        (WebCore::StyleResolver::State::State):
33
        (WebCore::StyleResolver::styleForElement):
34
        * css/StyleResolver.h:
35
        (WebCore::StyleResolver::setOverrideDocumentElementStyle):
36
        (WebCore::StyleResolver::State::State):
37
38
            Root element style is needed for resolving other elements. Add a way to provide it without looking
39
            into active document style.
40
41
        * dom/Document.cpp:
42
        (WebCore::Document::recalcStyle):
43
44
            Resolve the document style and commit it immediately (for now).
45
46
        (WebCore::Document::styleForElementIgnoringPendingStylesheets):
47
        * dom/Document.h:
48
        (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
49
        (WebCore::Document::inStyleRecalc):
50
        (WebCore::Document::inRenderTreeUpdate):
51
        * dom/Element.cpp:
52
        (WebCore::Element::setChildIndex):
53
54
            Setting the unique bit is now done by style relations update code.
55
56
        * dom/Node.cpp:
57
        (WebCore::Node::setNeedsStyleRecalc):
58
59
            Prevent spurious style invalidation during render tree updating.
60
61
        * rendering/RenderBox.cpp:
62
        (WebCore::RenderBox::styleDidChange):
63
64
            Capturing body element color for color:-webkit-text is now done by TreeResolver.
65
66
        * rendering/RenderElement.h:
67
        (WebCore::RenderElement::setAnimatableStyle): Deleted.
68
69
            No longer used.
70
71
        * style/RenderTreePosition.cpp:
72
        (WebCore::RenderTreePosition::nextSiblingRenderer):
73
74
            Skip over non-rendered slot elements.
75
76
        * style/RenderTreeUpdater.cpp: Added.
77
        (WebCore::RenderTreeUpdater::Parent::Parent):
78
        (WebCore::RenderTreeUpdater::RenderTreeUpdater):
79
        (WebCore::hasDisplayContents):
80
        (WebCore::findRenderingRoot):
81
        (WebCore::RenderTreeUpdater::commit):
82
83
            Call updateRenderTree for each change root.
84
85
        (WebCore::shouldCreateRenderer):
86
        (WebCore::RenderTreeUpdater::updateRenderTree):
87
88
            Iteratively traverse the composed tree starting for a change root.
89
            Apply the changes calling updateElementRenderer and updateTextRenderer as needed.
90
            Enter subtrees that haves changes to apply.
91
92
        (WebCore::RenderTreeUpdater::renderTreePosition):
93
94
            We may not create renderers for all elements (<slot> or more generally display:contents) that
95
            have rendered descendants. Search the parent stack to find the valid position.
96
97
        (WebCore::RenderTreeUpdater::pushParent):
98
        (WebCore::RenderTreeUpdater::popParent):
99
        (WebCore::RenderTreeUpdater::popParentsToDepth):
100
101
            Maintain parent stack.
102
103
        (WebCore::pseudoStyleCacheIsInvalid):
104
        (WebCore::RenderTreeUpdater::updateElementRenderer):
105
106
            Create, delete or update the renderer.
107
108
        (WebCore::moveToFlowThreadIfNeeded):
109
        (WebCore::RenderTreeUpdater::createRenderer):
110
        (WebCore::textRendererIsNeeded):
111
        (WebCore::createTextRenderer):
112
        (WebCore::RenderTreeUpdater::updateTextRenderer):
113
        (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
114
115
            This is moved from TreeResolver.
116
117
        (WebCore::needsPseudoElement):
118
        (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
119
120
            Pseudo elements are handled entirely during render tree construction. Compute their style and
121
            create or delete them as needed.
122
123
        * style/RenderTreeUpdater.h: Added.
124
        (WebCore::RenderTreeUpdater::parent):
125
        * style/StyleRelations.cpp:
126
        (WebCore::Style::commitRelationsToRenderStyle):
127
        (WebCore::Style::commitRelations):
128
129
            Commit to Style::Update instead of the document if needed.
130
131
        (WebCore::Style::commitRelationsToDocument): Deleted.
132
        * style/StyleRelations.h:
133
        * style/StyleSharingResolver.cpp:
134
        (WebCore::Style::elementHasDirectionAuto):
135
        (WebCore::Style::SharingResolver::resolve):
136
137
            Fetch the shareable style from Style::Update instead of the active document style.
138
139
        (WebCore::Style::SharingResolver::findSibling):
140
        (WebCore::Style::SharingResolver::canShareStyleWithElement):
141
        * style/StyleSharingResolver.h:
142
        * style/StyleTreeResolver.cpp:
143
        (WebCore::Style::TreeResolver::Parent::Parent):
144
145
            No need for render tree position anymore.
146
147
        (WebCore::Style::TreeResolver::popScope):
148
        (WebCore::Style::TreeResolver::styleForElement):
149
        (WebCore::Style::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
150
        (WebCore::Style::createTextRendererIfNeeded):
151
        (WebCore::Style::updateTextRendererAfterContentChange):
152
        (WebCore::Style::resetStyleForNonRenderedDescendants):
153
        (WebCore::Style::detachChildren):
154
        (WebCore::Style::detachSlotAssignees):
155
        (WebCore::Style::detachRenderTree):
156
        (WebCore::Style::TreeResolver::resolveElement):
157
158
            Just resolve the style and return it, no more applying or entering render tree construction code paths.
159
160
        (WebCore::Style::resolveTextNode):
161
        (WebCore::Style::elementImplicitVisibility):
162
        (WebCore::Style::TreeResolver::pushParent):
163
        (WebCore::Style::TreeResolver::popParent):
164
        (WebCore::Style::TreeResolver::popParentsToDepth):
165
        (WebCore::Style::shouldResolvePseudoElement):
166
        (WebCore::Style::TreeResolver::resolveComposedTree):
167
168
            Add style changes to Style::Update.
169
170
        (WebCore::Style::TreeResolver::resolve):
171
172
            Return Style::Update object if non-empty.
173
174
        (WebCore::Style::postResolutionCallbackQueue):
175
        (WebCore::Style::shouldCreateRenderer): Deleted.
176
        (WebCore::Style::moveToFlowThreadIfNeeded): Deleted.
177
        (WebCore::Style::TreeResolver::createRenderer): Deleted.
178
        (WebCore::Style::TreeResolver::createRenderTreeForChildren): Deleted.
179
        (WebCore::Style::TreeResolver::createRenderTreeForShadowRoot): Deleted.
180
        (WebCore::Style::beforeOrAfterPseudoElement): Deleted.
181
        (WebCore::Style::setBeforeOrAfterPseudoElement): Deleted.
182
        (WebCore::Style::clearBeforeOrAfterPseudoElement): Deleted.
183
        (WebCore::Style::needsPseudoElement): Deleted.
184
        (WebCore::Style::TreeResolver::createRenderTreeForBeforeOrAfterPseudoElement): Deleted.
185
        (WebCore::Style::TreeResolver::createRenderTreeForSlotAssignees): Deleted.
186
        (WebCore::Style::TreeResolver::createRenderTreeRecursively): Deleted.
187
        (WebCore::Style::pseudoStyleCacheIsInvalid): Deleted.
188
        (WebCore::Style::TreeResolver::resolveBeforeOrAfterPseudoElement): Deleted.
189
190
            Remove the recursive render tree building code path.
191
192
        * style/StyleTreeResolver.h:
193
        (WebCore::Style::TreeResolver::scope):
194
        * style/StyleUpdate.cpp: Added.
195
        (WebCore::Style::Update::Update):
196
        (WebCore::Style::Update::elementUpdate):
197
        (WebCore::Style::Update::textUpdate):
198
        (WebCore::Style::Update::elementStyle):
199
        (WebCore::Style::Update::addElement):
200
        (WebCore::Style::Update::addText):
201
        (WebCore::Style::Update::addPossibleRoot):
202
        * style/StyleUpdate.h: Added.
203
        (WebCore::Style::Update::roots):
204
        (WebCore::Style::Update::document):
205
        * svg/SVGElement.h:
206
        (WebCore::SVGElement::updateRelativeLengthsInformation):
207
        * svg/SVGUseElement.cpp:
208
        (WebCore::SVGUseElement::svgAttributeChanged):
209
        (WebCore::SVGUseElement::willRecalcStyle):
210
        (WebCore::SVGUseElement::willAttachRenderers): Deleted.
211
212
            Switvh willAttachRenderers to willRecalcStyle as the former is now called too late.
213
214
        * svg/SVGUseElement.h:
215
1
2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
216
2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2
217
3
        Remove forEach use from Fetch Headers builtin constructor
218
        Remove forEach use from Fetch Headers builtin constructor
- Source/WebCore/CMakeLists.txt +2 lines
Lines 2626-2637 set(WebCore_SOURCES Source/WebCore/CMakeLists.txt_sec1
2626
    style/IdChangeInvalidation.cpp
2626
    style/IdChangeInvalidation.cpp
2627
    style/InlineTextBoxStyle.cpp
2627
    style/InlineTextBoxStyle.cpp
2628
    style/RenderTreePosition.cpp
2628
    style/RenderTreePosition.cpp
2629
    style/RenderTreeUpdater.cpp
2629
    style/StyleChange.cpp
2630
    style/StyleChange.cpp
2630
    style/StyleFontSizeFunctions.cpp
2631
    style/StyleFontSizeFunctions.cpp
2631
    style/StyleRelations.cpp
2632
    style/StyleRelations.cpp
2632
    style/StyleResolveForDocument.cpp
2633
    style/StyleResolveForDocument.cpp
2633
    style/StyleSharingResolver.cpp
2634
    style/StyleSharingResolver.cpp
2634
    style/StyleTreeResolver.cpp
2635
    style/StyleTreeResolver.cpp
2636
    style/StyleUpdate.cpp
2635
2637
2636
    svg/SVGAElement.cpp
2638
    svg/SVGAElement.cpp
2637
    svg/SVGAltGlyphDefElement.cpp
2639
    svg/SVGAltGlyphDefElement.cpp
- Source/WebCore/WebCore.xcodeproj/project.pbxproj +16 lines
Lines 6557-6562 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
6557
		E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
6557
		E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
6558
		E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
6558
		E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
6559
		E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
6559
		E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
6560
		E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */; };
6561
		E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E76DB1C7AF77600E3614D /* StyleUpdate.h */; };
6560
		E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; };
6562
		E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; };
6561
		E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
6563
		E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
6562
		E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
6564
		E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 6612-6617 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
6612
		E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
6614
		E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
6613
		E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
6615
		E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
6614
		E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
6616
		E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
6617
		E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */; };
6618
		E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */; };
6615
		E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
6619
		E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
6616
		E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
6620
		E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
6617
		E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
6621
		E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
Lines 14591-14596 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
14591
		E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyTileGridTile.mm; sourceTree = "<group>"; };
14595
		E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyTileGridTile.mm; sourceTree = "<group>"; };
14592
		E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; };
14596
		E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; };
14593
		E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; };
14597
		E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; };
14598
		E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleUpdate.cpp; sourceTree = "<group>"; };
14599
		E42E76DB1C7AF77600E3614D /* StyleUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleUpdate.h; sourceTree = "<group>"; };
14594
		E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; };
14600
		E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; };
14595
		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
14601
		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
14596
		E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
14602
		E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
Lines 14638-14643 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
14638
		E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterfaceIOS.mm; sourceTree = "<group>"; };
14644
		E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterfaceIOS.mm; sourceTree = "<group>"; };
14639
		E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; };
14645
		E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; };
14640
		E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; };
14646
		E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; };
14647
		E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeUpdater.h; sourceTree = "<group>"; };
14648
		E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdater.cpp; sourceTree = "<group>"; };
14641
		E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
14649
		E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
14642
		E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
14650
		E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
14643
		E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
14651
		E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
Lines 23506-23511 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
23506
				1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */,
23514
				1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */,
23507
				5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */,
23515
				5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */,
23508
				5824ABA91AE849C8009074B7 /* RenderTreePosition.h */,
23516
				5824ABA91AE849C8009074B7 /* RenderTreePosition.h */,
23517
				E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */,
23518
				E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */,
23509
				E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */,
23519
				E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */,
23510
				E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
23520
				E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
23511
				E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
23521
				E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
Lines 23518-23523 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
23518
				E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
23528
				E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
23519
				E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
23529
				E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
23520
				E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */,
23530
				E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */,
23531
				E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */,
23532
				E42E76DB1C7AF77600E3614D /* StyleUpdate.h */,
23521
			);
23533
			);
23522
			path = style;
23534
			path = style;
23523
			sourceTree = "<group>";
23535
			sourceTree = "<group>";
Lines 25953-25958 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
25953
				5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */,
25965
				5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */,
25954
				7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */,
25966
				7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */,
25955
				A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */,
25967
				A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */,
25968
				E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */,
25956
				A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */,
25969
				A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */,
25957
				A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */,
25970
				A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */,
25958
				A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */,
25971
				A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */,
Lines 26144-26149 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
26144
				A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */,
26157
				A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */,
26145
				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
26158
				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
26146
				977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
26159
				977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
26160
				E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */,
26147
				93309DE8099E64920056E581 /* htmlediting.h in Headers */,
26161
				93309DE8099E64920056E581 /* htmlediting.h in Headers */,
26148
				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
26162
				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
26149
				A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
26163
				A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
Lines 30530-30535 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
30530
				A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */,
30544
				A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */,
30531
				E1FF8F64180745D800132674 /* JSSubtleCrypto.cpp in Sources */,
30545
				E1FF8F64180745D800132674 /* JSSubtleCrypto.cpp in Sources */,
30532
				E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */,
30546
				E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */,
30547
				E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */,
30533
				B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
30548
				B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
30534
				24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */,
30549
				24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */,
30535
				6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */,
30550
				6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */,
Lines 31068-31073 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
31068
				0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */,
31083
				0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */,
31069
				FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */,
31084
				FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */,
31070
				49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
31085
				49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
31086
				E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */,
31071
				D0FF2A5D11F8C45A007E74E0 /* PingLoader.cpp in Sources */,
31087
				D0FF2A5D11F8C45A007E74E0 /* PingLoader.cpp in Sources */,
31072
				CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */,
31088
				CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */,
31073
				0FDF45A71BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp in Sources */,
31089
				0FDF45A71BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp in Sources */,
- Source/WebCore/css/StyleResolver.cpp -3 / +6 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 348-354 StyleResolver::State::State(Element& ele Source/WebCore/css/StyleResolver.cpp_sec2
348
348
349
    auto& document = element.document();
349
    auto& document = element.document();
350
    auto* documentElement = document.documentElement();
350
    auto* documentElement = document.documentElement();
351
    m_rootElementStyle = (!documentElement || documentElement == &element) ? document.renderStyle() : documentElement->renderStyle();
351
    if (!documentElement || documentElement == &element)
352
        m_rootElementStyle = document.renderStyle();
353
    else
354
        m_rootElementStyle = documentElementStyle ? documentElementStyle : documentElement->renderStyle();
352
355
353
    updateConversionData();
356
    updateConversionData();
354
}
357
}
Lines 375-381 ElementStyle StyleResolver::styleForElem Source/WebCore/css/StyleResolver.cpp_sec3
375
{
378
{
376
    RELEASE_ASSERT(!m_inLoadPendingImages);
379
    RELEASE_ASSERT(!m_inLoadPendingImages);
377
380
378
    m_state = State(element, parentStyle, regionForStyling, selectorFilter);
381
    m_state = State(element, parentStyle, m_overrideDocumentElementStyle.get(), regionForStyling, selectorFilter);
379
    State& state = m_state;
382
    State& state = m_state;
380
383
381
    if (state.parentStyle()) {
384
    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 setOverrideDocumentElementStyle(RenderStyle* style) { m_overrideDocumentElementStyle = 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_overrideDocumentElementStyle;
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 / +15 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
            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::Update emptyUpdate(*this);
2065
        Style::commitRelations(WTFMove(elementStyle.relations), emptyUpdate);
2066
    }
2056
2067
2057
    return WTFMove(elementStyle.renderStyle);
2068
    return WTFMove(elementStyle.renderStyle);
2058
}
2069
}
- 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/Element.cpp -2 lines
Lines 2564-2571 void Element::setChildrenAffectedByPrope Source/WebCore/dom/Element.cpp_sec1
2564
void Element::setChildIndex(unsigned index)
2564
void Element::setChildIndex(unsigned index)
2565
{
2565
{
2566
    ElementRareData& rareData = ensureElementRareData();
2566
    ElementRareData& rareData = ensureElementRareData();
2567
    if (RenderStyle* style = renderStyle())
2568
        style->setUnique();
2569
    rareData.setChildIndex(index);
2567
    rareData.setChildIndex(index);
2570
}
2568
}
2571
2569
- Source/WebCore/dom/Node.cpp +4 lines
Lines 772-777 void Node::setNeedsStyleRecalc(StyleChan Source/WebCore/dom/Node.cpp_sec1
772
    if (!inRenderedDocument())
772
    if (!inRenderedDocument())
773
        return;
773
        return;
774
774
775
    // FIXME: This should eventually be an ASSERT.
776
    if (document().inRenderTreeUpdate())
777
        return;
778
775
    StyleChangeType existingChangeType = styleChangeType();
779
    StyleChangeType existingChangeType = styleChangeType();
776
    if (changeType > existingChangeType)
780
    if (changeType > existingChangeType)
777
        setStyleChange(changeType);
781
        setStyleChange(changeType);
- 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 343-357 private: Source/WebCore/rendering/RenderElement.h_sec2
343
    static bool s_noLongerAffectsParentBlock;
340
    static bool s_noLongerAffectsParentBlock;
344
};
341
};
345
342
346
inline void RenderElement::setAnimatableStyle(Ref<RenderStyle>&& style, StyleDifference minimalStyleDifference)
347
{
348
    Ref<RenderStyle> animatedStyle = WTFMove(style);
349
    if (animation().updateAnimations(*this, animatedStyle, animatedStyle))
350
        minimalStyleDifference = std::max(minimalStyleDifference, StyleDifferenceRecompositeLayer);
351
    
352
    setStyle(WTFMove(animatedStyle), minimalStyleDifference);
353
}
354
355
inline void RenderElement::setAncestorLineBoxDirty(bool f)
343
inline void RenderElement::setAncestorLineBoxDirty(bool f)
356
{
344
{
357
    m_ancestorLineBoxDirty = f;
345
    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 +511 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
45
RenderTreeUpdater::Parent::Parent(ContainerNode& root)
46
    : element(is<Document>(root) ? nullptr : downcast<Element>(&root))
47
    , renderTreePosition(RenderTreePosition(*root.renderer()))
48
{
49
}
50
51
RenderTreeUpdater::Parent::Parent(Element& element, Style::Change styleChange)
52
    : element(&element)
53
    , styleChange(styleChange)
54
    , renderTreePosition(element.renderer() ? makeOptional(RenderTreePosition(*element.renderer())) : Nullopt)
55
{
56
}
57
58
59
RenderTreeUpdater::RenderTreeUpdater(Document& document)
60
    : m_document(document)
61
{
62
}
63
64
// Slots have implicit display:contents until it is supported for reals.
65
static bool hasDisplayContents(const Node& node)
66
{
67
    return is<HTMLSlotElement>(node);
68
}
69
70
static ContainerNode& findRenderingRoot(ContainerNode& node)
71
{
72
    auto& document = node.document();
73
    for (ComposedTreeAncestorIterator it(document, node), end(document); it != end; ++it) {
74
        if (it->renderer())
75
            return *it;
76
        ASSERT(hasDisplayContents(*it));
77
    }
78
    ASSERT_NOT_REACHED();
79
    return document;
80
}
81
82
void RenderTreeUpdater::commit(std::unique_ptr<const Style::Update> styleUpdate)
83
{
84
    ASSERT(&m_document == &styleUpdate->document());
85
86
    if (!m_document.shouldCreateRenderers())
87
        return;
88
89
    m_styleUpdate = WTFMove(styleUpdate);
90
91
    for (auto* root : m_styleUpdate->roots())
92
        updateRenderTree(findRenderingRoot(*root));
93
94
    m_styleUpdate = nullptr;
95
}
96
97
static bool shouldCreateRenderer(const Element& element, const RenderElement& parentRenderer)
98
{
99
    if (!parentRenderer.canHaveChildren() && !(element.isPseudoElement() && parentRenderer.canHaveGeneratedChildren()))
100
        return false;
101
    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(element))
102
        return false;
103
    return true;
104
}
105
106
void RenderTreeUpdater::updateRenderTree(ContainerNode& root)
107
{
108
    ASSERT(root.renderer());
109
    ASSERT(m_parentStack.isEmpty());
110
111
    m_parentStack.append(Parent(root));
112
113
    auto descendants = composedTreeDescendants(root);
114
    auto it = descendants.begin();
115
    auto end = descendants.end();
116
117
    // FIXME: SVG <use> element may cause tree mutations during style recalc.
118
    it.dropAssertions();
119
120
    while (it != end) {
121
        popParentsToDepth(it.depth());
122
123
        auto& node = *it;
124
125
        if (auto* renderer = node.renderer())
126
            renderTreePosition().invalidateNextSibling(*renderer);
127
128
        if (is<Text>(node)) {
129
            auto& text = downcast<Text>(node);
130
            if (parent().styleChange == Style::Detach || m_styleUpdate->textUpdate(text) || m_invalidatedWhitespaceOnlyTextSiblings.contains(&text))
131
                updateTextRenderer(text);
132
133
            it.traverseNextSkippingChildren();
134
            continue;
135
        }
136
137
        auto& element = downcast<Element>(node);
138
139
        auto* elementUpdate = m_styleUpdate->elementUpdate(element);
140
141
        auto changeType = Style::NoChange;
142
        if (elementUpdate) {
143
            if (hasDisplayContents(element)) {
144
                if (!shouldCreateRenderer(element, renderTreePosition().parent())) {
145
                    it.traverseNextSkippingChildren();
146
                    continue;
147
                }
148
                pushParent(element, parent().styleChange);
149
                it.traverseNext();
150
                continue;
151
            }
152
153
            updateElementRenderer(element, *elementUpdate);
154
            changeType = elementUpdate->change;
155
        }
156
157
        if (!element.renderer() || !elementUpdate) {
158
            it.traverseNextSkippingChildren();
159
            continue;
160
        }
161
162
        pushParent(element, changeType);
163
164
        it.traverseNext();
165
    }
166
167
    popParentsToDepth(0);
168
169
    m_invalidatedWhitespaceOnlyTextSiblings.clear();
170
}
171
172
RenderTreePosition& RenderTreeUpdater::renderTreePosition()
173
{
174
    for (unsigned i = m_parentStack.size(); i; --i) {
175
        if (auto& position = m_parentStack[i - 1].renderTreePosition)
176
            return *position;
177
    }
178
    ASSERT_NOT_REACHED();
179
    return *m_parentStack.last().renderTreePosition;
180
}
181
182
void RenderTreeUpdater::pushParent(Element& element, Style::Change changeType)
183
{
184
    m_parentStack.append(Parent(element, changeType));
185
186
    updateBeforeOrAfterPseudoElement(element, BEFORE);
187
}
188
189
void RenderTreeUpdater::popParent()
190
{
191
    auto& parent = m_parentStack.last();
192
193
    if (parent.element) {
194
        updateBeforeOrAfterPseudoElement(*parent.element, AFTER);
195
196
        if (parent.element->hasCustomStyleResolveCallbacks() && parent.styleChange == Style::Detach && parent.element->renderer())
197
            parent.element->didAttachRenderers();
198
    }
199
    m_parentStack.removeLast();
200
}
201
202
void RenderTreeUpdater::popParentsToDepth(unsigned depth)
203
{
204
    ASSERT(m_parentStack.size() >= depth);
205
206
    while (m_parentStack.size() > depth)
207
        popParent();
208
}
209
210
static bool pseudoStyleCacheIsInvalid(RenderElement* renderer, RenderStyle* newStyle)
211
{
212
    const RenderStyle& currentStyle = renderer->style();
213
214
    const PseudoStyleCache* pseudoStyleCache = currentStyle.cachedPseudoStyles();
215
    if (!pseudoStyleCache)
216
        return false;
217
218
    for (auto& cache : *pseudoStyleCache) {
219
        RefPtr<RenderStyle> newPseudoStyle;
220
        PseudoId pseudoId = cache->styleType();
221
        if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
222
            newPseudoStyle = renderer->uncachedFirstLineStyle(newStyle);
223
        else
224
            newPseudoStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle);
225
        if (!newPseudoStyle)
226
            return true;
227
        if (*newPseudoStyle != *cache) {
228
            if (pseudoId < FIRST_INTERNAL_PSEUDOID)
229
                newStyle->setHasPseudoStyle(pseudoId);
230
            newStyle->addCachedPseudoStyle(newPseudoStyle);
231
            if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) {
232
                // FIXME: We should do an actual diff to determine whether a repaint vs. layout
233
                // is needed, but for now just assume a layout will be required. The diff code
234
                // in RenderObject::setStyle would need to be factored out so that it could be reused.
235
                renderer->setNeedsLayoutAndPrefWidthsRecalc();
236
            }
237
            return true;
238
        }
239
    }
240
    return false;
241
}
242
243
void RenderTreeUpdater::updateElementRenderer(Element& element, const Style::ElementUpdate& update)
244
{
245
    bool shouldTearDownRenderers = update.change == Style::Detach && (element.renderer() || element.isNamedFlowContentNode());
246
    if (shouldTearDownRenderers)
247
        detachRenderTree(element, Style::ReattachDetach);
248
249
    bool shouldCreateNewRenderer = !element.renderer() && update.style;
250
    if (shouldCreateNewRenderer) {
251
        if (element.hasCustomStyleResolveCallbacks())
252
            element.willAttachRenderers();
253
        createRenderer(element, *update.style);
254
        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(element);
255
        return;
256
    }
257
258
    if (!element.renderer())
259
        return;
260
    auto& renderer = *element.renderer();
261
262
    if (update.isSynthetic) {
263
        renderer.setStyle(*update.style, StyleDifferenceRecompositeLayer);
264
        return;
265
    }
266
267
    if (update.change == Style::NoChange) {
268
        if (pseudoStyleCacheIsInvalid(&renderer, update.style.get()) || (parent().styleChange == Style::Force && renderer.requiresForcedStyleRecalcPropagation())) {
269
            renderer.setStyle(*update.style, StyleDifferenceEqual);
270
            return;
271
        }
272
        return;
273
    }
274
275
    renderer.setStyle(*update.style, StyleDifferenceEqual);
276
}
277
278
#if ENABLE(CSS_REGIONS)
279
static RenderNamedFlowThread* moveToFlowThreadIfNeeded(Element& element, const RenderStyle& style)
280
{
281
    if (!element.shouldMoveToFlowThread(style))
282
        return nullptr;
283
284
    FlowThreadController& flowThreadController = element.document().renderView()->flowThreadController();
285
    RenderNamedFlowThread& parentFlowRenderer = flowThreadController.ensureRenderFlowThreadWithName(style.flowThread());
286
    flowThreadController.registerNamedFlowContentElement(element, parentFlowRenderer);
287
    return &parentFlowRenderer;
288
}
289
#endif
290
291
void RenderTreeUpdater::createRenderer(Element& element, RenderStyle& style)
292
{
293
    if (!shouldCreateRenderer(element, renderTreePosition().parent()))
294
        return;
295
296
    RenderNamedFlowThread* parentFlowRenderer = nullptr;
297
#if ENABLE(CSS_REGIONS)
298
    parentFlowRenderer = moveToFlowThreadIfNeeded(element, style);
299
#endif
300
301
    if (!element.rendererIsNeeded(style))
302
        return;
303
304
    renderTreePosition().computeNextSibling(element);
305
306
    RenderTreePosition insertionPosition = parentFlowRenderer
307
        ? RenderTreePosition(*parentFlowRenderer, parentFlowRenderer->nextRendererForElement(element))
308
        : renderTreePosition();
309
310
    RenderElement* newRenderer = element.createElementRenderer(style, insertionPosition).leakPtr();
311
    if (!newRenderer)
312
        return;
313
    if (!insertionPosition.canInsert(*newRenderer)) {
314
        newRenderer->destroy();
315
        return;
316
    }
317
318
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
319
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
320
    newRenderer->setFlowThreadState(insertionPosition.parent().flowThreadState());
321
322
    element.setRenderer(newRenderer);
323
324
    Ref<RenderStyle> animatedStyle = newRenderer->style();
325
    newRenderer->animation().updateAnimations(*newRenderer, animatedStyle, animatedStyle);
326
    newRenderer->setStyleInternal(WTFMove(animatedStyle));
327
328
    newRenderer->initializeStyle();
329
330
#if ENABLE(FULLSCREEN_API)
331
    if (m_document.webkitIsFullScreen() && m_document.webkitCurrentFullScreenElement() == &element) {
332
        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, &insertionPosition.parent(), m_document);
333
        if (!newRenderer)
334
            return;
335
    }
336
#endif
337
    // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer.
338
    insertionPosition.insert(*newRenderer);
339
340
    if (AXObjectCache* cache = m_document.axObjectCache())
341
        cache->updateCacheAfterNodeIsAttached(&element);
342
}
343
344
static bool textRendererIsNeeded(const Text& textNode, const RenderTreePosition& renderTreePosition)
345
{
346
    const RenderElement& parentRenderer = renderTreePosition.parent();
347
    if (!parentRenderer.canHaveChildren())
348
        return false;
349
    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(textNode))
350
        return false;
351
    if (textNode.isEditingText())
352
        return true;
353
    if (!textNode.length())
354
        return false;
355
    if (!textNode.containsOnlyWhitespace())
356
        return true;
357
    // This text node has nothing but white space. We may still need a renderer in some cases.
358
    if (parentRenderer.isTable() || parentRenderer.isTableRow() || parentRenderer.isTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isFrameSet())
359
        return false;
360
    if (parentRenderer.style().preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
361
        return true;
362
363
    RenderObject* previousRenderer = renderTreePosition.previousSiblingRenderer(textNode);
364
    if (previousRenderer && previousRenderer->isBR()) // <span><br/> <br/></span>
365
        return false;
366
367
    if (parentRenderer.isRenderInline()) {
368
        // <span><div/> <div/></span>
369
        if (previousRenderer && !previousRenderer->isInline())
370
            return false;
371
    } else {
372
        if (parentRenderer.isRenderBlock() && !parentRenderer.childrenInline() && (!previousRenderer || !previousRenderer->isInline()))
373
            return false;
374
        
375
        RenderObject* first = parentRenderer.firstChild();
376
        while (first && first->isFloatingOrOutOfFlowPositioned())
377
            first = first->nextSibling();
378
        RenderObject* nextRenderer = renderTreePosition.nextSiblingRenderer(textNode);
379
        if (!first || nextRenderer == first) {
380
            // Whitespace at the start of a block just goes away. Don't even make a render object for this text.
381
            return false;
382
        }
383
    }
384
    return true;
385
}
386
387
static void createTextRenderer(Text& textNode, RenderTreePosition& renderTreePosition)
388
{
389
    ASSERT(!textNode.renderer());
390
391
    auto newRenderer = textNode.createTextRenderer(renderTreePosition.parent().style());
392
    ASSERT(newRenderer);
393
394
    renderTreePosition.computeNextSibling(textNode);
395
396
    if (!renderTreePosition.canInsert(*newRenderer))
397
        return;
398
399
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
400
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
401
    newRenderer->setFlowThreadState(renderTreePosition.parent().flowThreadState());
402
403
    textNode.setRenderer(newRenderer.get());
404
    renderTreePosition.insert(*newRenderer.leakPtr());
405
}
406
407
void RenderTreeUpdater::updateTextRenderer(Text& text)
408
{
409
    bool hasRenderer = text.renderer();
410
    bool needsRenderer = textRendererIsNeeded(text, renderTreePosition());
411
    if (hasRenderer) {
412
        if (needsRenderer)
413
            return;
414
        Style::detachTextRenderer(text);
415
        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
416
        return;
417
    }
418
    if (!needsRenderer)
419
        return;
420
    createTextRenderer(text, renderTreePosition());
421
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
422
}
423
424
void RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
425
{
426
    // FIXME: This needs to traverse in composed tree order.
427
428
    // This function finds sibling text renderers where the results of textRendererIsNeeded may have changed as a result of
429
    // the current node gaining or losing the renderer. This can only affect white space text nodes.
430
    for (Node* sibling = current.nextSibling(); sibling; sibling = sibling->nextSibling()) {
431
        if (is<Element>(*sibling)) {
432
            if (m_styleUpdate->elementUpdate(downcast<Element>(*sibling)))
433
                return;
434
            // Text renderers beyond rendered elements can't be affected.
435
            if (!sibling->renderer() || RenderTreePosition::isRendererReparented(*sibling->renderer()))
436
                continue;
437
            return;
438
        }
439
        if (!is<Text>(*sibling))
440
            continue;
441
        Text& textSibling = downcast<Text>(*sibling);
442
        if (m_styleUpdate->textUpdate(textSibling))
443
            return;
444
        if (!textSibling.containsOnlyWhitespace())
445
            continue;
446
        m_invalidatedWhitespaceOnlyTextSiblings.add(&textSibling);
447
    }
448
}
449
450
static bool needsPseudoElement(Element& current, PseudoId pseudoId)
451
{
452
    if (!current.renderer() || !current.renderer()->canHaveGeneratedChildren())
453
        return false;
454
    if (current.isPseudoElement())
455
        return false;
456
    if (!pseudoElementRendererIsNeeded(current.renderer()->getCachedPseudoStyle(pseudoId)))
457
        return false;
458
    return true;
459
}
460
461
void RenderTreeUpdater::updateBeforeOrAfterPseudoElement(Element& current, PseudoId pseudoId)
462
{
463
    PseudoElement* pseudoElement = pseudoId == BEFORE ? current.beforePseudoElement() : current.afterPseudoElement();
464
465
    auto* renderer = pseudoElement ? pseudoElement->renderer() : nullptr;
466
    if (renderer)
467
        renderTreePosition().invalidateNextSibling(*renderer);
468
469
    bool needsPseudoElement = WebCore::needsPseudoElement(current, pseudoId);
470
    if (!needsPseudoElement) {
471
        if (pseudoElement) {
472
            if (pseudoId == BEFORE)
473
                current.clearBeforePseudoElement();
474
            else
475
                current.clearAfterPseudoElement();
476
        }
477
        return;
478
    }
479
480
    Style::ElementUpdate elementUpdate;
481
482
    Ref<RenderStyle> newStyle = *current.renderer()->getCachedPseudoStyle(pseudoId, &current.renderer()->style());
483
484
    if (renderer && m_document.frame()->animation().updateAnimations(*renderer, newStyle, newStyle))
485
        elementUpdate.isSynthetic = true;
486
487
    elementUpdate.change = renderer ? Style::determineChange(renderer->style(), newStyle) : Style::Detach;
488
    elementUpdate.style = WTFMove(newStyle);
489
490
    if (elementUpdate.change == Style::NoChange)
491
        return;
492
493
    if (!pseudoElement) {
494
        auto newPseudoElement = PseudoElement::create(current, pseudoId);
495
        pseudoElement = newPseudoElement.ptr();
496
        InspectorInstrumentation::pseudoElementCreated(m_document.page(), newPseudoElement);
497
        if (pseudoId == BEFORE)
498
            current.setBeforePseudoElement(WTFMove(newPseudoElement));
499
        else
500
            current.setAfterPseudoElement(WTFMove(newPseudoElement));
501
    }
502
503
    updateElementRenderer(*pseudoElement, elementUpdate);
504
505
    if (elementUpdate.change == Style::Detach)
506
        pseudoElement->didAttachRenderers();
507
    else
508
        pseudoElement->didRecalcStyle(elementUpdate.change);
509
}
510
511
}
- Source/WebCore/style/RenderTreeUpdater.h +85 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
class RenderTreeUpdater {
48
public:
49
    RenderTreeUpdater(Document&);
50
51
    void commit(std::unique_ptr<const Style::Update>);
52
53
private:
54
    void updateRenderTree(ContainerNode& root);
55
    void updateTextRenderer(Text&);
56
    void updateElementRenderer(Element&, const Style::ElementUpdate&);
57
    void createRenderer(Element&, RenderStyle&);
58
    void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node&);
59
    void updateBeforeOrAfterPseudoElement(Element&, PseudoId);
60
61
    struct Parent {
62
        Element* element { nullptr };
63
        Style::Change styleChange { Style::NoChange };
64
        Optional<RenderTreePosition> renderTreePosition;
65
66
        Parent(ContainerNode& root);
67
        Parent(Element&, Style::Change);
68
    };
69
    Parent& parent() { return m_parentStack.last(); }
70
    RenderTreePosition& renderTreePosition();
71
72
    void pushParent(Element&, Style::Change);
73
    void popParent();
74
    void popParentsToDepth(unsigned depth);
75
76
    Document& m_document;
77
    std::unique_ptr<const Style::Update> m_styleUpdate;
78
79
    Vector<Parent> m_parentStack;
80
81
    HashSet<Text*> m_invalidatedWhitespaceOnlyTextSiblings;
82
};
83
84
}
85
#endif
- Source/WebCore/style/StyleRelations.cpp -4 / +7 lines
Lines 29-34 Source/WebCore/style/StyleRelations.cpp_sec1
29
#include "Element.h"
29
#include "Element.h"
30
#include "NodeRenderStyle.h"
30
#include "NodeRenderStyle.h"
31
#include "RenderStyle.h"
31
#include "RenderStyle.h"
32
#include "StyleUpdate.h"
32
33
33
namespace WebCore {
34
namespace WebCore {
34
namespace Style {
35
namespace Style {
Lines 85-91 std::unique_ptr<Relations> commitRelatio Source/WebCore/style/StyleRelations.cpp_sec2
85
    return remainingRelations;
86
    return remainingRelations;
86
}
87
}
87
88
88
void commitRelationsToDocument(std::unique_ptr<Relations> relations)
89
void commitRelations(std::unique_ptr<Relations> relations, Update& update)
89
{
90
{
90
    if (!relations)
91
    if (!relations)
91
        return;
92
        return;
Lines 124-141 void commitRelationsToDocument(std::uniq Source/WebCore/style/StyleRelations.cpp_sec3
124
            element.setChildrenAffectedByLastChildRules();
125
            element.setChildrenAffectedByLastChildRules();
125
            break;
126
            break;
126
        case Relation::FirstChild:
127
        case Relation::FirstChild:
127
            if (auto* style = element.renderStyle())
128
            if (auto* style = update.elementStyle(element))
128
                style->setFirstChildState();
129
                style->setFirstChildState();
129
            break;
130
            break;
130
        case Relation::LastChild:
131
        case Relation::LastChild:
131
            if (auto* style = element.renderStyle())
132
            if (auto* style = update.elementStyle(element))
132
                style->setLastChildState();
133
                style->setLastChildState();
133
            break;
134
            break;
134
        case Relation::NthChildIndex:
135
        case Relation::NthChildIndex:
136
            if (auto* style = update.elementStyle(element))
137
                style->setUnique();
135
            element.setChildIndex(relation.value);
138
            element.setChildIndex(relation.value);
136
            break;
139
            break;
137
        case Relation::Unique:
140
        case Relation::Unique:
138
            if (auto* style = element.renderStyle())
141
            if (auto* style = update.elementStyle(element))
139
                style->setUnique();
142
                style->setUnique();
140
            break;
143
            break;
141
        }
144
        }
- Source/WebCore/style/StyleRelations.h -1 / +3 lines
Lines 35-40 class RenderStyle; Source/WebCore/style/StyleRelations.h_sec1
35
35
36
namespace Style {
36
namespace Style {
37
37
38
class Update;
39
38
struct Relation {
40
struct Relation {
39
    enum Type {
41
    enum Type {
40
        AffectedByActive,
42
        AffectedByActive,
Lines 66-72 struct Relation { Source/WebCore/style/StyleRelations.h_sec2
66
using Relations = Vector<Relation, 8>;
68
using Relations = Vector<Relation, 8>;
67
69
68
std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&);
70
std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&);
69
void commitRelationsToDocument(std::unique_ptr<Relations>);
71
void commitRelations(std::unique_ptr<Relations>, Update&);
70
72
71
}
73
}
72
}
74
}
- Source/WebCore/style/StyleSharingResolver.cpp -4 / +7 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 44-49 namespace Style { Source/WebCore/style/StyleSharingResolver.cpp_sec2
44
static const unsigned cStyleSearchThreshold = 10;
45
static const unsigned cStyleSearchThreshold = 10;
45
46
46
struct SharingResolver::Context {
47
struct SharingResolver::Context {
48
    const Update& update;
47
    const StyledElement& element;
49
    const StyledElement& element;
48
    bool elementAffectedByClassRules;
50
    bool elementAffectedByClassRules;
49
    EInsideLink elementLinkState;
51
    EInsideLink elementLinkState;
Lines 67-73 static inline bool elementHasDirectionAu Source/WebCore/style/StyleSharingResolver.cpp_sec3
67
    return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
69
    return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
68
}
70
}
69
71
70
RefPtr<RenderStyle> SharingResolver::resolve(const Element& searchElement)
72
RefPtr<RenderStyle> SharingResolver::resolve(const Element& searchElement, const Update& update)
71
{
73
{
72
    if (!is<StyledElement>(searchElement))
74
    if (!is<StyledElement>(searchElement))
73
        return nullptr;
75
        return nullptr;
Lines 77-83 RefPtr<RenderStyle> SharingResolver::res Source/WebCore/style/StyleSharingResolver.cpp_sec4
77
    auto& parentElement = *element.parentElement();
79
    auto& parentElement = *element.parentElement();
78
    if (parentElement.shadowRoot())
80
    if (parentElement.shadowRoot())
79
        return nullptr;
81
        return nullptr;
80
    if (!parentElement.renderStyle())
82
    if (!update.elementStyle(parentElement))
81
        return nullptr;
83
        return nullptr;
82
    // If the element has inline style it is probably unique.
84
    // If the element has inline style it is probably unique.
83
    if (element.inlineStyle())
85
    if (element.inlineStyle())
Lines 95-100 RefPtr<RenderStyle> SharingResolver::res Source/WebCore/style/StyleSharingResolver.cpp_sec5
95
        return nullptr;
97
        return nullptr;
96
98
97
    Context context {
99
    Context context {
100
        update,
98
        element,
101
        element,
99
        element.hasClass() && classNamesAffectedByRules(element.classNames()),
102
        element.hasClass() && classNamesAffectedByRules(element.classNames()),
100
        m_document.visitedLinkState().determineLinkState(element)
103
        m_document.visitedLinkState().determineLinkState(element)
Lines 127-133 RefPtr<RenderStyle> SharingResolver::res Source/WebCore/style/StyleSharingResolver.cpp_sec6
127
130
128
    m_elementsSharingStyle.add(&element, shareElement);
131
    m_elementsSharingStyle.add(&element, shareElement);
129
132
130
    return RenderStyle::clone(shareElement->renderStyle());
133
    return RenderStyle::clone(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 195-201 static bool canShareStyleWithControl(con Source/WebCore/style/StyleSharingResolver.cpp_sec7
195
bool SharingResolver::canShareStyleWithElement(const Context& context, const StyledElement& candidateElement) const
198
bool SharingResolver::canShareStyleWithElement(const Context& context, const StyledElement& candidateElement) const
196
{
199
{
197
    auto& element = context.element;
200
    auto& element = context.element;
198
    auto* style = candidateElement.renderStyle();
201
    auto* style = context.update.elementStyle(candidateElement);
199
    if (!style)
202
    if (!style)
200
        return false;
203
        return false;
201
    if (style->unique())
204
    if (style->unique())
- Source/WebCore/style/StyleSharingResolver.h -1 / +3 lines
Lines 42-52 class StyledElement; Source/WebCore/style/StyleSharingResolver.h_sec1
42
42
43
namespace Style {
43
namespace Style {
44
44
45
class Update;
46
45
class SharingResolver {
47
class SharingResolver {
46
public:
48
public:
47
    SharingResolver(const Document&, const DocumentRuleSets&, const SelectorFilter&);
49
    SharingResolver(const Document&, const DocumentRuleSets&, const SelectorFilter&);
48
50
49
    RefPtr<RenderStyle> resolve(const Element&);
51
    RefPtr<RenderStyle> resolve(const Element&, const Update&);
50
52
51
private:
53
private:
52
    struct Context;
54
    struct Context;
- Source/WebCore/style/StyleTreeResolver.cpp -397 / +102 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 114-119 TreeResolver::TreeResolver(Document& doc Source/WebCore/style/StyleTreeResolver.cpp_sec4
114
    ensurePlaceholderStyle(document);
101
    ensurePlaceholderStyle(document);
115
}
102
}
116
103
104
TreeResolver::~TreeResolver()
105
{
106
}
107
117
TreeResolver::Scope::Scope(Document& document)
108
TreeResolver::Scope::Scope(Document& document)
118
    : styleResolver(document.ensureStyleResolver())
109
    : styleResolver(document.ensureStyleResolver())
119
    , sharingResolver(document, styleResolver.ruleSets(), selectorFilter)
110
    , sharingResolver(document, styleResolver.ruleSets(), selectorFilter)
Lines 131-146 TreeResolver::Scope::Scope(ShadowRoot& s Source/WebCore/style/StyleTreeResolver.cpp_sec5
131
TreeResolver::Parent::Parent(Document& document, Change change)
122
TreeResolver::Parent::Parent(Document& document, Change change)
132
    : element(nullptr)
123
    : element(nullptr)
133
    , style(*document.renderStyle())
124
    , style(*document.renderStyle())
134
    , renderTreePosition(*document.renderView())
135
    , change(change)
125
    , change(change)
136
{
126
{
137
}
127
}
138
128
139
TreeResolver::Parent::Parent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change)
129
TreeResolver::Parent::Parent(Element& element, ElementUpdate& update)
140
    : element(&element)
130
    : element(&element)
141
    , style(style)
131
    , style(*update.style)
142
    , renderTreePosition(renderTreePosition)
132
    , change(update.change)
143
    , change(change)
144
{
133
{
145
}
134
}
146
135
Lines 160-176 void TreeResolver::popScope() Source/WebCore/style/StyleTreeResolver.cpp_sec6
160
    return m_scopeStack.removeLast();
149
    return m_scopeStack.removeLast();
161
}
150
}
162
151
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)
152
Ref<RenderStyle> TreeResolver::styleForElement(Element& element, RenderStyle& inheritedStyle)
175
{
153
{
176
    if (!m_document.haveStylesheetsLoaded() && !element.renderer()) {
154
    if (!m_document.haveStylesheetsLoaded() && !element.renderer()) {
Lines 178-264 Ref<RenderStyle> TreeResolver::styleForE Source/WebCore/style/StyleTreeResolver.cpp_sec7
178
        return *placeholderStyle;
156
        return *placeholderStyle;
179
    }
157
    }
180
158
159
    scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
160
181
    if (element.hasCustomStyleResolveCallbacks()) {
161
    if (element.hasCustomStyleResolveCallbacks()) {
182
        RenderStyle* shadowHostStyle = scope().shadowRoot ? scope().shadowRoot->host()->renderStyle() : nullptr;
162
        RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;
183
        if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
163
        if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
184
            Style::commitRelationsToDocument(WTFMove(customStyle->relations));
164
            if (customStyle->relations)
165
                commitRelations(WTFMove(customStyle->relations), *m_update);
166
185
            return WTFMove(customStyle->renderStyle);
167
            return WTFMove(customStyle->renderStyle);
186
        }
168
        }
187
    }
169
    }
188
170
189
    if (auto style = scope().sharingResolver.resolve(element))
171
    if (auto style = scope().sharingResolver.resolve(element, *m_update))
190
        return *style;
172
        return *style;
191
173
192
    auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
174
    auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
193
175
194
    Style::commitRelationsToDocument(WTFMove(elementStyle.relations));
176
    if (elementStyle.relations)
195
    return WTFMove(elementStyle.renderStyle);
177
        commitRelations(WTFMove(elementStyle.relations), *m_update);
196
}
197
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
178
238
    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
179
    return WTFMove(elementStyle.renderStyle);
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
}
180
}
263
181
264
static void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
182
static void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
Lines 348-354 static void createTextRendererIfNeeded(T Source/WebCore/style/StyleTreeResolver.cpp_sec8
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_sec9
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_sec10
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_sec11
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-715 static void detachRenderTree(Element& cu Source/WebCore/style/StyleTreeResolver.cpp_sec12
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
    auto newStyle = styleForElement(element, parent().style);
643
391
644
    const PseudoStyleCache* pseudoStyleCache = currentStyle.cachedPseudoStyles();
392
    auto* renderer = element.renderer();
645
    if (!pseudoStyleCache)
646
        return false;
647
393
648
    for (auto& cache : *pseudoStyleCache) {
394
    bool affectsRenderedSubtree = renderer || newStyle->display() != NONE || newStyle->hasFlowInto();
649
        RefPtr<RenderStyle> newPseudoStyle;
395
    if (!affectsRenderedSubtree)
650
        PseudoId pseudoId = cache->styleType();
396
        return { };
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
397
673
Change TreeResolver::resolveElement(Element& current)
398
    ElementUpdate update;
674
{
675
    Change localChange = Detach;
676
    RefPtr<RenderStyle> newStyle;
677
    RefPtr<RenderStyle> currentStyle = current.renderStyle();
678
399
679
    if (currentStyle && current.styleChangeType() != ReconstructRenderTree) {
400
    bool needsNewRenderer = !renderer || element.styleChangeType() == ReconstructRenderTree || parent().change == Detach;
680
        Ref<RenderStyle> style(styleForElement(current, parent().style));
401
    if (!needsNewRenderer && m_document.frame()->animation().updateAnimations(*renderer, newStyle, newStyle))
681
        newStyle = style.ptr();
402
        update.isSynthetic = true;
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
403
694
        return Detach;
404
    update.change = needsNewRenderer ? Detach : determineChange(renderer->style(), newStyle);
695
    }
405
    update.style = WTFMove(newStyle);
696
406
697
    if (RenderElement* renderer = current.renderer()) {
407
    if (element.styleChangeType() == SyntheticStyleChange)
698
        if (localChange != NoChange || pseudoStyleCacheIsInvalid(renderer, newStyle.get()) || (parent().change == Force && renderer->requiresForcedStyleRecalcPropagation()) || current.styleChangeType() == SyntheticStyleChange)
408
        update.isSynthetic = true;
699
            renderer->setAnimatableStyle(*newStyle, current.styleChangeType() == SyntheticStyleChange ? StyleDifferenceRecompositeLayer : StyleDifferenceEqual);
409
700
    }
410
    if (&element == m_document.documentElement()) {
411
        m_documentElementStyle = update.style;
701
412
702
    // If "rem" units are used anywhere in the document, and if the document element's font size changes, then force font updating
413
        // If "rem" units are used anywhere in the document, and if the document element's font size changes, then force font updating
703
    // 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).
414
        // 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).
704
    if (m_document.authorStyleSheets().usesRemUnits() && m_document.documentElement() == &current && localChange != NoChange && currentStyle && newStyle && currentStyle->fontSize() != newStyle->fontSize()) {
415
        if (m_document.authorStyleSheets().usesRemUnits() && update.change != NoChange && renderer && renderer->style().fontSize() != update.style->fontSize()) {
705
        // Cached RenderStyles may depend on the re units.
416
            // Cached RenderStyles may depend on the rem units.
706
        scope().styleResolver.invalidateMatchedPropertiesCache();
417
            scope().styleResolver.invalidateMatchedPropertiesCache();
707
        return Force;
418
            update.change = Force;
419
        }
708
    }
420
    }
709
    if (parent().change == Force || current.styleChangeType() >= FullStyleChange)
710
        return Force;
711
421
712
    return localChange;
422
    // This is needed for resolving color:-webkit-text for subsequent elements.
423
    // FIXME: We shouldn't mutate document when resolving style.
424
    if (&element == m_document.body())
425
        m_document.setTextColor(update.style->visitedDependentColor(CSSPropertyColor));
426
427
    if (update.change != Detach && (parent().change == Force || element.styleChangeType() >= FullStyleChange))
428
        update.change = Force;
429
430
    return update;
713
}
431
}
714
432
715
void resolveTextNode(Text& text, RenderTreePosition& renderTreePosition)
433
void resolveTextNode(Text& text, RenderTreePosition& renderTreePosition)
Lines 731-760 void resolveTextNode(Text& text, RenderT Source/WebCore/style/StyleTreeResolver.cpp_sec13
731
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
449
    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
732
}
450
}
733
451
734
void TreeResolver::resolveBeforeOrAfterPseudoElement(Element& current, Change change, PseudoId pseudoId, RenderTreePosition& renderTreePosition)
735
{
736
    if (!current.renderer())
737
        return;
738
    PseudoElement* existingPseudoElement = beforeOrAfterPseudoElement(current, pseudoId);
739
    if (!existingPseudoElement) {
740
        createRenderTreeForBeforeOrAfterPseudoElement(current, pseudoId, renderTreePosition);
741
        return;
742
    }
743
744
    if (existingPseudoElement->renderer())
745
        renderTreePosition.invalidateNextSibling(*existingPseudoElement->renderer());
746
747
    if (change == NoChange && !existingPseudoElement->needsStyleRecalc())
748
        return;
749
750
    if (needsPseudoElement(current, pseudoId)) {
751
        auto change = resolveElement(*existingPseudoElement);
752
        existingPseudoElement->didRecalcStyle(change);
753
        existingPseudoElement->clearNeedsStyleRecalc();
754
    } else
755
        clearBeforeOrAfterPseudoElement(current, pseudoId);
756
}
757
758
#if PLATFORM(IOS)
452
#if PLATFORM(IOS)
759
static EVisibility elementImplicitVisibility(const Element* element)
453
static EVisibility elementImplicitVisibility(const Element* element)
760
{
454
{
Lines 809-819 private: Source/WebCore/style/StyleTreeResolver.cpp_sec14
809
};
503
};
810
#endif // PLATFORM(IOS)
504
#endif // PLATFORM(IOS)
811
505
812
void TreeResolver::pushParent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change)
506
void TreeResolver::pushParent(Element& element, ElementUpdate& update)
813
{
507
{
814
    scope().selectorFilter.pushParent(&element);
508
    scope().selectorFilter.pushParent(&element);
815
509
816
    Parent parent(element, style, renderTreePosition, change);
510
    Parent parent(element, update);
817
511
818
    if (auto* shadowRoot = element.shadowRoot()) {
512
    if (auto* shadowRoot = element.shadowRoot()) {
819
        pushScope(*shadowRoot);
513
        pushScope(*shadowRoot);
Lines 827-842 void TreeResolver::pushParent(Element& e Source/WebCore/style/StyleTreeResolver.cpp_sec15
827
#endif
521
#endif
828
522
829
    m_parentStack.append(WTFMove(parent));
523
    m_parentStack.append(WTFMove(parent));
830
831
    resolveBeforeOrAfterPseudoElement(element, change, BEFORE, renderTreePosition);
832
}
524
}
833
525
834
void TreeResolver::popParent()
526
void TreeResolver::popParent()
835
{
527
{
836
    auto& parentElement = *parent().element;
528
    auto& parentElement = *parent().element;
837
529
838
    resolveBeforeOrAfterPseudoElement(parentElement, parent().change, AFTER, parent().renderTreePosition);
839
840
    parentElement.clearNeedsStyleRecalc();
530
    parentElement.clearNeedsStyleRecalc();
841
    parentElement.clearChildNeedsStyleRecalc();
531
    parentElement.clearChildNeedsStyleRecalc();
842
532
Lines 857-862 void TreeResolver::popParentsToDepth(uns Source/WebCore/style/StyleTreeResolver.cpp_sec16
857
        popParent();
547
        popParent();
858
}
548
}
859
549
550
static bool shouldResolvePseudoElement(PseudoElement* pseudoElement)
551
{
552
    if (!pseudoElement)
553
        return false;
554
    bool needsStyleRecalc = pseudoElement->needsStyleRecalc();
555
    pseudoElement->clearNeedsStyleRecalc();
556
    return needsStyleRecalc;
557
}
558
860
void TreeResolver::resolveComposedTree()
559
void TreeResolver::resolveComposedTree()
861
{
560
{
862
    ASSERT(m_parentStack.size() == 1);
561
    ASSERT(m_parentStack.size() == 1);
Lines 878-889 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec17
878
        ASSERT(node.containingShadowRoot() == scope().shadowRoot);
577
        ASSERT(node.containingShadowRoot() == scope().shadowRoot);
879
        ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot());
578
        ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot());
880
579
881
        if (auto* existingRenderer = node.renderer())
882
            parent.renderTreePosition.invalidateNextSibling(*existingRenderer);
883
884
        if (is<Text>(node)) {
580
        if (is<Text>(node)) {
885
            if (node.needsStyleRecalc())
581
            auto& text = downcast<Text>(node);
886
                resolveTextNode(downcast<Text>(node), parent.renderTreePosition);
582
            if (text.styleChangeType() == ReconstructRenderTree && parent.change != Detach)
583
                m_update->addText(text, parent.element);
584
585
            text.clearNeedsStyleRecalc();
887
            it.traverseNextSkippingChildren();
586
            it.traverseNextSkippingChildren();
888
            continue;
587
            continue;
889
        }
588
        }
Lines 895-903 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec18
895
        if (element.needsStyleRecalc() || parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
594
        if (element.needsStyleRecalc() || parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
896
            parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle();
595
            parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle();
897
596
898
        Change change = NoChange;
597
        bool shouldResolveForPseudoElement = shouldResolvePseudoElement(element.beforePseudoElement()) || shouldResolvePseudoElement(element.afterPseudoElement());
899
598
900
        bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || affectedByPreviousSibling;
599
        ElementUpdate update;
600
        update.style = element.renderStyle();
601
602
        bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling;
901
        if (shouldResolve) {
603
        if (shouldResolve) {
902
#if PLATFORM(IOS)
604
#if PLATFORM(IOS)
903
            CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());
605
            CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());
Lines 910-954 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec19
910
                    continue;
612
                    continue;
911
                }
613
                }
912
            }
614
            }
913
            change = resolveElement(element);
914
615
915
            element.clearNeedsStyleRecalc();
616
            update = resolveElement(element);
916
617
917
            if (element.hasCustomStyleResolveCallbacks())
618
            if (element.hasCustomStyleResolveCallbacks())
918
                element.didRecalcStyle(change);
619
                element.didRecalcStyle(update.change);
919
620
920
            if (change == Detach) {
621
            if (affectedByPreviousSibling && update.change != Detach)
921
                it.traverseNextSkippingChildren();
622
                update.change = Force;
922
                continue;
623
923
            }
624
            if (update.style)
625
                m_update->addElement(element, parent.element, update);
924
626
925
            if (affectedByPreviousSibling)
627
            element.clearNeedsStyleRecalc();
926
                change = Force;
927
        }
628
        }
928
629
630
929
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
631
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
930
        if (is<HTMLSlotElement>(element)) {
632
        if (is<HTMLSlotElement>(element)) {
931
            // FIXME: We should compute style for the slot and use it as parent style.
633
            // FIXME: We should compute style for the slot and use it as parent style.
932
            // FIXME: This should be display:contents check.
634
            // Duplicate the style from the parent context.
933
            // Duplicate the style and render tree position from the current context.
635
            ElementUpdate slotUpdate;
934
            pushParent(element, parent.style.get(), parent.renderTreePosition, change);
636
            slotUpdate.style = parent.style.ptr();
637
            slotUpdate.change = update.change;
638
            if (!shouldResolve)
639
                m_update->addElement(element, parent.element, update);
640
            pushParent(element, slotUpdate);
935
            it.traverseNext();
641
            it.traverseNext();
936
            continue;
642
            continue;
937
        }
643
        }
938
#endif
644
#endif
939
        auto* renderer = element.renderer();
645
        if (!update.style) {
940
        if (!renderer) {
941
            resetStyleForNonRenderedDescendants(element);
646
            resetStyleForNonRenderedDescendants(element);
942
            element.clearChildNeedsStyleRecalc();
647
            element.clearChildNeedsStyleRecalc();
943
        }
648
        }
944
649
945
        bool shouldIterateChildren = renderer && (element.childNeedsStyleRecalc() || change != NoChange);
650
        bool shouldIterateChildren = update.style && (element.childNeedsStyleRecalc() || update.change != NoChange);
946
        if (!shouldIterateChildren) {
651
        if (!shouldIterateChildren) {
947
            it.traverseNextSkippingChildren();
652
            it.traverseNextSkippingChildren();
948
            continue;
653
            continue;
949
        }
654
        }
950
655
951
        pushParent(element, renderer->style(), RenderTreePosition(*renderer), change);
656
        pushParent(element, update);
952
657
953
        it.traverseNext();
658
        it.traverseNext();
954
    }
659
    }
Lines 956-979 void TreeResolver::resolveComposedTree() Source/WebCore/style/StyleTreeResolver.cpp_sec20
956
    popParentsToDepth(1);
661
    popParentsToDepth(1);
957
}
662
}
958
663
959
void TreeResolver::resolve(Change change)
664
std::unique_ptr<const Update> TreeResolver::resolve(Change change)
960
{
665
{
961
    auto& renderView = *m_document.renderView();
666
    auto& renderView = *m_document.renderView();
962
667
963
    Element* documentElement = m_document.documentElement();
668
    Element* documentElement = m_document.documentElement();
964
    if (!documentElement)
669
    if (!documentElement)
965
        return;
670
        return nullptr;
966
    if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
671
    if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
967
        return;
672
        return nullptr;
968
673
674
    m_update = std::make_unique<Update>(m_document);
969
    m_scopeStack.append(adoptRef(*new Scope(m_document)));
675
    m_scopeStack.append(adoptRef(*new Scope(m_document)));
676
    m_parentStack.append(Parent(m_document, change));
970
677
971
    // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
678
    // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
972
    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
679
    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
973
    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
680
    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
974
681
975
    m_parentStack.append(Parent(m_document, change));
976
977
    resolveComposedTree();
682
    resolveComposedTree();
978
683
979
    renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
684
    renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
Lines 981-991 void TreeResolver::resolve(Change change Source/WebCore/style/StyleTreeResolver.cpp_sec21
981
686
982
    m_parentStack.clear();
687
    m_parentStack.clear();
983
    m_scopeStack.clear();
688
    m_scopeStack.clear();
984
}
985
689
986
void detachRenderTree(Element& element)
690
    if (m_update->roots().isEmpty())
987
{
691
        return { };
988
    detachRenderTree(element, NormalDetach);
692
693
    return WTFMove(m_update);
989
}
694
}
990
695
991
static Vector<std::function<void ()>>& postResolutionCallbackQueue()
696
static Vector<std::function<void ()>>& postResolutionCallbackQueue()
- Source/WebCore/style/StyleTreeResolver.h -18 / +14 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-78 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
53
class TreeResolver {
56
class TreeResolver {
54
public:
57
public:
55
    TreeResolver(Document&);
58
    TreeResolver(Document&);
59
    ~TreeResolver();
56
60
57
    void resolve(Change);
61
    std::unique_ptr<const Update> resolve(Change);
58
62
59
private:
63
private:
60
    Ref<RenderStyle> styleForElement(Element&, RenderStyle& inheritedStyle);
64
    Ref<RenderStyle> styleForElement(Element&, RenderStyle& inheritedStyle);
61
65
62
    void resolveComposedTree();
66
    void resolveComposedTree();
63
    Change resolveElement(Element&);
67
    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
68
77
    struct Scope : RefCounted<Scope> {
69
    struct Scope : RefCounted<Scope> {
78
        StyleResolver& styleResolver;
70
        StyleResolver& styleResolver;
Lines 88-100 private: Source/WebCore/style/StyleTreeResolver.h_sec3
88
    struct Parent {
80
    struct Parent {
89
        Element* element;
81
        Element* element;
90
        Ref<RenderStyle> style;
82
        Ref<RenderStyle> style;
91
        RenderTreePosition renderTreePosition;
92
        Change change;
83
        Change change;
93
        bool didPushScope { false };
84
        bool didPushScope { false };
94
        bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle { false };
85
        bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle { false };
95
86
96
        Parent(Document&, Change);
87
        Parent(Document&, Change);
97
        Parent(Element&, RenderStyle&, RenderTreePosition, Change);
88
        Parent(Element&, ElementUpdate&);
98
    };
89
    };
99
90
100
    Scope& scope() { return m_scopeStack.last(); }
91
    Scope& scope() { return m_scopeStack.last(); }
Lines 104-119 private: Source/WebCore/style/StyleTreeResolver.h_sec4
104
    void pushEnclosingScope();
95
    void pushEnclosingScope();
105
    void popScope();
96
    void popScope();
106
97
107
    void pushParent(Element&, RenderStyle&, RenderTreePosition, Change);
98
    void pushParent(Element&, ElementUpdate&);
108
    void popParent();
99
    void popParent();
109
    void popParentsToDepth(unsigned depth);
100
    void popParentsToDepth(unsigned depth);
110
101
111
    Document& m_document;
102
    Document& m_document;
103
    RefPtr<RenderStyle> m_documentElementStyle;
104
112
    Vector<Ref<Scope>, 4> m_scopeStack;
105
    Vector<Ref<Scope>, 4> m_scopeStack;
113
    Vector<Parent, 32> m_parentStack;
106
    Vector<Parent, 32> m_parentStack;
107
108
    std::unique_ptr<Update> m_update;
114
};
109
};
115
110
116
void detachRenderTree(Element&);
111
enum DetachType { NormalDetach, ReattachDetach };
112
void detachRenderTree(Element&, DetachType = NormalDetach);
117
void detachTextRenderer(Text&);
113
void detachTextRenderer(Text&);
118
114
119
void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
115
void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
- Source/WebCore/style/StyleUpdate.cpp +93 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 "ComposedTreeAncestorIterator.h"
30
#include "Document.h"
31
#include "Element.h"
32
#include "NodeRenderStyle.h"
33
#include "Text.h"
34
35
namespace WebCore {
36
namespace Style {
37
38
Update::Update(Document& document)
39
    : m_document(document)
40
{
41
}
42
43
const ElementUpdate* Update::elementUpdate(const Element& element) const
44
{
45
    auto it = m_elements.find(&element);
46
    if (it == m_elements.end())
47
        return nullptr;
48
    return &it->value;
49
}
50
51
bool Update::textUpdate(const Text& text) const
52
{
53
    return m_texts.contains(&text);
54
}
55
56
RenderStyle* Update::elementStyle(const Element& element) const
57
{
58
    if (auto* update = elementUpdate(element))
59
        return update->style.get();
60
    return element.renderStyle();
61
}
62
63
void Update::addElement(Element& element, Element* parent, ElementUpdate& change)
64
{
65
    ASSERT(!m_elements.contains(&element));
66
    ASSERT(!parent || composedTreeAncestors(element).first() == parent);
67
68
    addPossibleRoot(parent);
69
    m_elements.add(&element, change);
70
}
71
72
void Update::addText(Text& text, Element* parent)
73
{
74
    ASSERT(!m_texts.contains(&text));
75
    ASSERT(!parent || composedTreeAncestors(text).first() == parent);
76
77
    addPossibleRoot(parent);
78
    m_texts.add(&text);
79
}
80
81
void Update::addPossibleRoot(Element* element)
82
{
83
    if (!element) {
84
        m_roots.add(&m_document);
85
        return;
86
    }
87
    if (m_elements.contains(element))
88
        return;
89
    m_roots.add(element);
90
}
91
92
}
93
}
- Source/WebCore/style/StyleUpdate.h +81 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/ListHashSet.h>
35
#include <wtf/RefPtr.h>
36
37
namespace WebCore {
38
39
class ContainerNode;
40
class Document;
41
class Element;
42
class Node;
43
class RenderStyle;
44
class Text;
45
46
namespace Style {
47
48
struct ElementUpdate {
49
    RefPtr<RenderStyle> style;
50
    Change change { NoChange };
51
    bool isSynthetic { false };
52
};
53
54
class Update {
55
public:
56
    Update(Document&);
57
58
    const ListHashSet<ContainerNode*>& roots() const { return m_roots; }
59
60
    const ElementUpdate* elementUpdate(const Element&) const;
61
    bool textUpdate(const Text&) const;
62
63
    RenderStyle* elementStyle(const Element&) const;
64
65
    const Document& document() const { return m_document; }
66
67
    void addElement(Element&, Element* parent, ElementUpdate&);
68
    void addText(Text&, Element* parent);
69
70
private:
71
    void addPossibleRoot(Element*);
72
73
    Document& m_document;
74
    ListHashSet<ContainerNode*> m_roots;
75
    HashMap<const Element*, ElementUpdate> m_elements;
76
    HashSet<const Text*> m_texts;
77
};
78
79
}
80
}
81
#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/ChangeLog +39 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2016-03-31  Antti Koivisto  <antti@apple.com>
2
3
        Separate render tree updating from style resolve
4
        https://bugs.webkit.org/show_bug.cgi?id=155298
5
6
        Reviewed by Andreas Kling.
7
8
        * TestExpectations:
9
10
            Skip mathml/presentation/menclose-notation-attribute-change-value.html. It will be fixed by upcoming MathML refactoring.
11
12
        * css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt:
13
        * css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt:
14
15
            This is a progression.
16
17
        * editing/mac/spelling/autocorrection-contraction-expected.txt:
18
        * editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt:
19
        * editing/mac/spelling/autocorrection-removing-underline-expected.txt:
20
        * editing/mac/spelling/autocorrection-simple-expected.txt:
21
        * editing/style/remove-underline-from-stylesheet-expected.txt:
22
        * editing/style/typing-style-003-expected.txt:
23
24
            Non-rendered whitespace related changes.
25
26
        * platform/ios-simulator/TestExpectations:
27
28
            Skip fast/regions/position-writing-modes-in-variable-width-regions.html on iOS. Similar tests are mostly already skipped.
29
30
        * platform/ios-simulator/editing/style/typing-style-003-expected.txt: Added.
31
        * platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt:
32
        * platform/mac/editing/inserting/editable-html-element-expected.txt:
33
        * platform/mac/editing/inserting/editing-empty-divs-expected.txt:
34
        * platform/mac/editing/inserting/insert-at-end-02-expected.txt:
35
        * platform/mac/editing/pasteboard/4989774-expected.txt:
36
        * platform/mac/editing/selection/4983858-expected.txt:
37
38
            Non-rendered whitespace related changes.
39
1
2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
40
2016-03-31  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2
41
3
        Remove forEach use from Fetch Headers builtin constructor
42
        Remove forEach use from Fetch Headers builtin constructor
- LayoutTests/TestExpectations +3 lines
Lines 990-995 webkit.org/b/154686 inspector/indexeddb/ LayoutTests/TestExpectations_sec1
990
storage/indexeddb/modern/exceed-open-file-limit.html [ Skip ]
990
storage/indexeddb/modern/exceed-open-file-limit.html [ Skip ]
991
webkit.org/b/155028 storage/indexeddb/modern/256-open-databases.html [ Skip ]
991
webkit.org/b/155028 storage/indexeddb/modern/256-open-databases.html [ Skip ]
992
992
993
# Fixed by upcoming MathML refactoring
994
webkit.org/b/155019 mathml/presentation/menclose-notation-attribute-change-value.html [ Skip ]
995
993
### END OF IndexedDB failures
996
### END OF IndexedDB failures
994
########################################
997
########################################
995
998
- 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/fast/dom/beforeload/remove-bad-object-in-beforeload-listener-expected.txt +1 lines
Lines 1-3 LayoutTests/fast/dom/beforeload/remove-bad-object-in-beforeload-listener-expected.txt_sec1
1
This page tests that you can correctly remove an object element with an invalid data URL in its beforeload listener without causing a crash.
1
This page tests that you can correctly remove an object element with an invalid data URL in its beforeload listener without causing a crash.
2
2
3
PASS
3
PASS
4
- LayoutTests/fast/regions/br-content-node-crash-expected.txt -1 lines
Lines 1-3 LayoutTests/fast/regions/br-content-node-crash-expected.txt_sec1
1
Test that moving a br element to a named flow does not crash when the br element should not have a renderer created.
1
Test that moving a br element to a named flow does not crash when the br element should not have a renderer created.
2
To manually test, move the mouse to the upper left corner of the document and try to make a selection to the bottom of the document. It should not crash.
2
To manually test, move the mouse to the upper left corner of the document and try to make a selection to the bottom of the document. It should not crash.
3
- LayoutTests/platform/ios-simulator/TestExpectations +1 lines
Lines 2043-2048 fast/regions/percentage-margins-mixed-lt LayoutTests/platform/ios-simulator/TestExpectations_sec1
2043
fast/regions/percentage-margins-mixed-rtl-dominant-regions.html [ ImageOnlyFailure ]
2043
fast/regions/percentage-margins-mixed-rtl-dominant-regions.html [ ImageOnlyFailure ]
2044
fast/regions/percentage-margins-rtl-variable-width-regions.html [ ImageOnlyFailure ]
2044
fast/regions/percentage-margins-rtl-variable-width-regions.html [ ImageOnlyFailure ]
2045
fast/regions/percentage-margins-variable-width-regions.html [ ImageOnlyFailure ]
2045
fast/regions/percentage-margins-variable-width-regions.html [ ImageOnlyFailure ]
2046
fast/regions/position-writing-modes-in-variable-width-regions.html [ ImageOnlyFailure ]
2046
fast/regions/positioning/fixed-in-named-flow-position-changed.html [ ImageOnlyFailure ]
2047
fast/regions/positioning/fixed-in-named-flow-position-changed.html [ ImageOnlyFailure ]
2047
fast/regions/positioning/fixed-inside-fixed-in-named-flow.html [ ImageOnlyFailure ]
2048
fast/regions/positioning/fixed-inside-fixed-in-named-flow.html [ ImageOnlyFailure ]
2048
fast/regions/positioning/fixed-inside-named-flow-zIndex.html [ ImageOnlyFailure ]
2049
fast/regions/positioning/fixed-inside-named-flow-zIndex.html [ ImageOnlyFailure ]
- LayoutTests/platform/ios-simulator/editing/style/typing-style-003-expected.txt +72 lines
Line 0 LayoutTests/platform/ios-simulator/editing/style/typing-style-003-expected.txt_sec1
1
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
2
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
3
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
4
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
5
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
6
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
7
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
8
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
9
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
10
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
11
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
12
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
13
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
14
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
15
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
16
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
17
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > B > DIV > BODY > HTML > #document to 2 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
18
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
19
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
20
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > B > DIV > BODY > HTML > #document to 2 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > B > DIV > BODY > HTML > #document to 3 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
21
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
22
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
23
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
24
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
25
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
26
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
27
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > I > B > DIV > BODY > HTML > #document to 2 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
28
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
29
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
30
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > I > B > DIV > BODY > HTML > #document to 2 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > I > B > DIV > BODY > HTML > #document to 3 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
31
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
32
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
33
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
34
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
35
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
36
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
37
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > I > DIV > BODY > HTML > #document to 2 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
38
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
39
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
40
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > I > DIV > BODY > HTML > #document to 2 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > I > DIV > BODY > HTML > #document to 3 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
41
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
42
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
43
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
44
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
45
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
46
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
47
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
48
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
49
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
50
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
51
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
52
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
53
xxxxxxxxxxxxxxx
54
execTypeCharacterCommand: x <span id="test"></span>
55
execTypeCharacterCommand: xx<span id="test"></span>
56
execTypeCharacterCommand: xxx<span id="test"></span>
57
execBoldCommand: xxx<span id="test"></span>
58
execTypeCharacterCommand: xxx<b>x</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>
61
execItalicCommand: xxx<b>xxx</b><span id="test"></span>
62
execTypeCharacterCommand: xxx<b>xxx<i>x</i></b><span id="test"></span>
63
execTypeCharacterCommand: xxx<b>xxx<i>xx</i></b><span id="test"></span>
64
execTypeCharacterCommand: xxx<b>xxx<i>xxx</i></b><span id="test"></span>
65
execBoldCommand: xxx<b>xxx<i>xxx</i></b><span id="test"></span>
66
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>x</i><span id="test"></span>
67
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xx</i><span id="test"></span>
68
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i><span id="test"></span>
69
execItalicCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i><span id="test"></span>
70
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>x<span id="test"></span>
71
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>xx<span id="test"></span>
72
execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>xxx<span id="test"></span>
- 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