Changeset 198847 in webkit
- Timestamp:
- Mar 30, 2016 11:24:26 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 deleted
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198844 r198847 1 2016-03-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r198828. 4 https://bugs.webkit.org/show_bug.cgi?id=156030 5 6 Confirming PLT regression (Requested by anttik on #webkit). 7 8 Reverted changeset: 9 10 "Separate render tree updating from style resolve" 11 https://bugs.webkit.org/show_bug.cgi?id=155298 12 http://trac.webkit.org/changeset/198828 13 1 14 2016-03-30 Keith Miller <keith_miller@apple.com> 2 15 -
trunk/LayoutTests/TestExpectations
r198843 r198847 989 989 webkit.org/b/155028 storage/indexeddb/modern/256-open-databases.html [ Skip ] 990 990 991 # Fixed by upcoming MathML refactoring992 webkit.org/b/155019 mathml/presentation/menclose-notation-attribute-change-value.html [ Skip ]993 994 991 ### END OF IndexedDB failures 995 992 ######################################## -
trunk/LayoutTests/css3/blending/repaint/blend-mode-isolate-stacking-context-expected.txt
r198828 r198847 22 22 (rect 28 290 60 60) 23 23 (rect 48 290 60 60) 24 (rect 48 408 60 60) 25 (rect 48 408 60 60) 24 26 (rect 28 526 60 60) 25 27 (rect 48 526 60 60) 26 (rect 48 408 60 60)27 (rect 48 408 60 60)28 28 (rect 48 644 60 60) 29 29 (rect 68 644 60 60) -
trunk/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt
r198828 r198847 18 18 PASS getComputedStyle(test).width is "450px" 19 19 PASS getComputedStyle(testpseudo, ':after').marginLeft is "120px" 20 PASS getComputedStyle(testpseudo, ':after').paddingRight is "225px" 20 FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 225px. Was 200px. 21 21 PASS innerWidth is 900 22 22 PASS innerHeight is 640 23 23 PASS getComputedStyle(test).fontSize is "32px" 24 24 PASS getComputedStyle(test).width is "450px" 25 PASS getComputedStyle(testpseudo, ':after').marginLeft is "128px" 26 PASS getComputedStyle(testpseudo, ':after').paddingRight is "225px" 25 FAIL getComputedStyle(testpseudo, ':after').marginLeft should be 128px. Was 120px. 26 FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 225px. Was 200px. 27 27 PASS innerWidth is 500 28 28 PASS innerHeight is 640 29 29 PASS getComputedStyle(test).fontSize is "32px" 30 30 PASS getComputedStyle(test).width is "250px" 31 PASS getComputedStyle(testpseudo, ':after').marginLeft is "100px" 32 PASS getComputedStyle(testpseudo, ':after').paddingRight is "160px" 31 FAIL getComputedStyle(testpseudo, ':after').marginLeft should be 100px. Was 120px. 32 FAIL getComputedStyle(testpseudo, ':after').paddingRight should be 160px. Was 200px. 33 33 PASS innerWidth is 800 34 34 PASS innerHeight is 600 -
trunk/LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt
r198828 r198847 280 280 text run at (0,0) width 154: "would' wouldn't" 281 281 text run at (153,0) width 7: " " 282 caret: position 16 of child 0 {#text} of child 6{DIV} of child 3 {DIV} of body282 caret: position 16 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body -
trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt
r198828 r198847 83 83 RenderBlock {DIV} at (14,70) size 756x28 84 84 RenderBR {BR} at (0,0) size 0x28 85 caret: position 0 of child 0 {BR} of child 5{DIV} of child 5 {DIV} of body85 caret: position 0 of child 0 {BR} of child 4 {DIV} of child 5 {DIV} of body -
trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt
r198828 r198847 79 79 RenderBlock {DIV} at (14,42) size 756x28 80 80 RenderBR {BR} at (0,0) size 0x28 81 caret: position 0 of child 0 {BR} of child 3{DIV} of child 5 {DIV} of body81 caret: position 0 of child 0 {BR} of child 2 {DIV} of child 5 {DIV} of body -
trunk/LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt
r198828 r198847 138 138 RenderText {#text} at (0,0) size 138x28 139 139 text run at (0,0) width 138: "the notational," 140 caret: position 15 of child 0 {#text} of child 3{DIV} of child 7 {DIV} of body140 caret: position 15 of child 0 {#text} of child 2 {DIV} of child 7 {DIV} of body -
trunk/LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt
r198828 r198847 77 77 | "<#selection-anchor>xxxxxx<#selection-focus>" 78 78 | " xxxxxx" 79 | "80 "81 79 | <span> 82 80 | id="test" -
trunk/LayoutTests/editing/style/typing-style-003-expected.txt
r198828 r198847 53 53 xxxxxxxxxxxxxxx 54 54 execTypeCharacterCommand: x <span id="test"></span> 55 execTypeCharacterCommand: xx 56 execTypeCharacterCommand: xxx 57 execBoldCommand: xxx 58 execTypeCharacterCommand: xxx<b>x</b> 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 59 execTypeCharacterCommand: xxx<b>xx</b><span id="test"></span> 60 60 execTypeCharacterCommand: xxx<b>xxx</b><span id="test"></span> -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r198828 r198847 2044 2044 fast/regions/percentage-margins-rtl-variable-width-regions.html [ ImageOnlyFailure ] 2045 2045 fast/regions/percentage-margins-variable-width-regions.html [ ImageOnlyFailure ] 2046 fast/regions/position-writing-modes-in-variable-width-regions.html [ ImageOnlyFailure ]2047 2046 fast/regions/positioning/fixed-in-named-flow-position-changed.html [ ImageOnlyFailure ] 2048 2047 fast/regions/positioning/fixed-inside-fixed-in-named-flow.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt
r198828 r198847 260 260 text run at (0,0) width 166: "wouldn' wouldn't" 261 261 text run at (165,0) width 7: " " 262 caret: position 17 of child 0 {#text} of child 6{DIV} of child 3 {DIV} of body262 caret: position 17 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body -
trunk/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt
r198828 r198847 23 23 text run at (766,18) width 5: " " 24 24 text run at (0,36) width 132: "block flow element)." 25 RenderText {#text} at (0,0) size 0x0 25 26 RenderBlock {DIV} at (0,54) size 784x18 26 27 RenderBR {BR} at (0,0) size 0x18 -
trunk/LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt
r198828 r198847 66 66 RenderText {#text} at (1,1) size 8x18 67 67 text run at (1,1) width 8: "c" 68 RenderText {#text} at (0,0) size 0x0 68 69 RenderBlock {P} at (0,268) size 784x18 69 70 RenderText {#text} at (0,0) size 240x18 … … 81 82 RenderText {#text} at (0,0) size 8x18 82 83 text run at (0,0) width 8: "c" 84 RenderText {#text} at (0,0) size 0x0 83 85 RenderBlock {P} at (1,35) size 706x0 84 86 caret: position 1 of child 0 {#text} of child 21 {DIV} of body -
trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt
r198828 r198847 30 30 RenderText {#text} at (0,0) size 8x18 31 31 text run at (0,0) width 8: "x" 32 RenderText {#text} at (0,0) size 0x0 32 33 caret: position 1 of child 5 {#text} of child 5 {DIV} of body -
trunk/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt
r198828 r198847 13 13 text run at (735,103) width 5: " " 14 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 15 17 caret: position 164 of child 4 {#text} of body -
trunk/LayoutTests/platform/mac/editing/selection/4983858-expected.txt
r198828 r198847 11 11 text run at (780,0) width 4: " " 12 12 text run at (0,18) width 165: "below should be selected:" 13 RenderText {#text} at (0,0) size 0x0 13 14 RenderBlock {DIV} at (0,36) size 784x18 14 15 RenderText {#text} at (0,0) size 22x18 -
trunk/Source/WebCore/CMakeLists.txt
r198828 r198847 2627 2627 style/InlineTextBoxStyle.cpp 2628 2628 style/RenderTreePosition.cpp 2629 style/RenderTreeUpdater.cpp2630 2629 style/StyleChange.cpp 2631 2630 style/StyleFontSizeFunctions.cpp … … 2634 2633 style/StyleSharingResolver.cpp 2635 2634 style/StyleTreeResolver.cpp 2636 style/StyleUpdate.cpp2637 2635 2638 2636 svg/SVGAElement.cpp -
trunk/Source/WebCore/ChangeLog
r198844 r198847 1 2016-03-30 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r198828. 4 https://bugs.webkit.org/show_bug.cgi?id=156030 5 6 Confirming PLT regression (Requested by anttik on #webkit). 7 8 Reverted changeset: 9 10 "Separate render tree updating from style resolve" 11 https://bugs.webkit.org/show_bug.cgi?id=155298 12 http://trac.webkit.org/changeset/198828 13 1 14 2016-03-30 Keith Miller <keith_miller@apple.com> 2 15 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r198828 r198847 6556 6556 E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; }; 6557 6557 E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6558 E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */; };6559 E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E76DB1C7AF77600E3614D /* StyleUpdate.h */; };6560 6558 E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; }; 6561 6559 E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 6613 6611 E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; }; 6614 6612 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; }; 6615 E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */; };6616 E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */; };6617 6613 E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; }; 6618 6614 E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; }; … … 14592 14588 E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; }; 14593 14589 E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; }; 14594 E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleUpdate.cpp; sourceTree = "<group>"; };14595 E42E76DB1C7AF77600E3614D /* StyleUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleUpdate.h; sourceTree = "<group>"; };14596 14590 E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; }; 14597 14591 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; }; … … 14641 14635 E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; }; 14642 14636 E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; }; 14643 E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeUpdater.h; sourceTree = "<group>"; };14644 E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdater.cpp; sourceTree = "<group>"; };14645 14637 E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; }; 14646 14638 E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; }; … … 23509 23501 5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */, 23510 23502 5824ABA91AE849C8009074B7 /* RenderTreePosition.h */, 23511 E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */,23512 E46180281C8A06CD0026C02C /* RenderTreeUpdater.h */,23513 23503 E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */, 23514 23504 E401E0A31C3C0B8300F34D10 /* StyleChange.h */, … … 23523 23513 E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */, 23524 23514 E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */, 23525 E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */,23526 E42E76DB1C7AF77600E3614D /* StyleUpdate.h */,23527 23515 ); 23528 23516 path = style; … … 25960 25948 7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */, 25961 25949 A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */, 25962 E46180291C8A06CD0026C02C /* RenderTreeUpdater.h in Headers */,25963 25950 A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */, 25964 25951 A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */, … … 26152 26139 93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */, 26153 26140 977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */, 26154 E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */,26155 26141 93309DE8099E64920056E581 /* htmlediting.h in Headers */, 26156 26142 93F198E608245E59001E9ABC /* HTMLElement.h in Headers */, … … 30538 30524 E1FF8F64180745D800132674 /* JSSubtleCrypto.cpp in Sources */, 30539 30525 E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */, 30540 E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */,30541 30526 B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */, 30542 30527 24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */, … … 31077 31062 FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */, 31078 31063 49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */, 31079 E42E76DA1C7AF76C00E3614D /* StyleUpdate.cpp in Sources */,31080 31064 D0FF2A5D11F8C45A007E74E0 /* PingLoader.cpp in Sources */, 31081 31065 CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */, -
trunk/Source/WebCore/css/StyleResolver.cpp
r198828 r198847 336 336 } 337 337 338 StyleResolver::State::State(Element& element, RenderStyle* parentStyle, RenderStyle* documentElementStyle,const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)338 StyleResolver::State::State(Element& element, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter) 339 339 : m_element(&element) 340 340 , m_parentStyle(parentStyle) … … 349 349 auto& document = element.document(); 350 350 auto* documentElement = document.documentElement(); 351 if (!documentElement || documentElement == &element) 352 m_rootElementStyle = document.renderStyle(); 353 else 354 m_rootElementStyle = documentElementStyle ? documentElementStyle : documentElement->renderStyle(); 351 m_rootElementStyle = (!documentElement || documentElement == &element) ? document.renderStyle() : documentElement->renderStyle(); 355 352 356 353 updateConversionData(); … … 379 376 RELEASE_ASSERT(!m_inLoadPendingImages); 380 377 381 m_state = State(element, parentStyle, m_overrideDocumentElementStyle.get(),regionForStyling, selectorFilter);378 m_state = State(element, parentStyle, regionForStyling, selectorFilter); 382 379 State& state = m_state; 383 380 -
trunk/Source/WebCore/css/StyleResolver.h
r198828 r198847 165 165 const MediaQueryEvaluator& mediaQueryEvaluator() const { return *m_medium; } 166 166 167 void setOverrideDocumentElementStyle(RenderStyle* style) { m_overrideDocumentElementStyle = style; }168 169 167 private: 170 168 Ref<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&); … … 362 360 public: 363 361 State() { } 364 State(Element&, RenderStyle* parentStyle, RenderStyle* documentElementStyle = nullptr,const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);362 State(Element&, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr); 365 363 366 364 public: … … 527 525 bool m_matchAuthorAndUserStyles; 528 526 529 RefPtr<RenderStyle> m_overrideDocumentElementStyle;530 531 527 Vector<std::unique_ptr<MediaQueryResult>> m_viewportDependentMediaQueryResults; 532 528 -
trunk/Source/WebCore/dom/Document.cpp
r198828 r198847 134 134 #include "RenderChildIterator.h" 135 135 #include "RenderLayerCompositor.h" 136 #include "RenderTreeUpdater.h"137 136 #include "RenderView.h" 138 137 #include "RenderWidget.h" … … 1928 1927 1929 1928 Style::TreeResolver resolver(*this); 1930 auto styleUpdate = resolver.resolve(change); 1929 resolver.resolve(change); 1930 1931 updatedCompositingLayers = frameView.updateCompositingLayersAfterStyleChange(); 1931 1932 1932 1933 clearNeedsStyleRecalc(); … … 1935 1936 1936 1937 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();1946 1938 } 1947 1939 … … 2061 2053 auto elementStyle = element.resolveStyle(parentStyle); 2062 2054 2063 if (elementStyle.relations) { 2064 Style::Update emptyUpdate(*this); 2065 Style::commitRelations(WTFMove(elementStyle.relations), emptyUpdate); 2066 } 2055 Style::commitRelationsToDocument(WTFMove(elementStyle.relations)); 2067 2056 2068 2057 return WTFMove(elementStyle.renderStyle); -
trunk/Source/WebCore/dom/Document.h
r198828 r198847 1245 1245 void clearStyleResolver(); 1246 1246 1247 bool inStyleRecalc() const { return m_inStyleRecalc; } 1248 bool inRenderTreeUpdate() const { return m_inRenderTreeUpdate; } 1247 bool inStyleRecalc() { return m_inStyleRecalc; } 1249 1248 1250 1249 // Return a Locale for the default locale if the argument is null or empty. … … 1510 1509 bool m_inStyleRecalc; 1511 1510 bool m_closeAfterStyleRecalc; 1512 bool m_inRenderTreeUpdate { false };1513 1511 1514 1512 bool m_gotoAnchorNeededAfterStylesheetsLoad; -
trunk/Source/WebCore/dom/Element.cpp
r198828 r198847 2565 2565 { 2566 2566 ElementRareData& rareData = ensureElementRareData(); 2567 if (RenderStyle* style = renderStyle()) 2568 style->setUnique(); 2567 2569 rareData.setChildIndex(index); 2568 2570 } -
trunk/Source/WebCore/dom/Node.cpp
r198828 r198847 773 773 return; 774 774 775 // FIXME: This should eventually be an ASSERT.776 if (document().inRenderTreeUpdate())777 return;778 779 775 StyleChangeType existingChangeType = styleChangeType(); 780 776 if (changeType > existingChangeType) -
trunk/Source/WebCore/rendering/RenderBox.cpp
r198843 r198847 382 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 384 388 if (isDocElementRenderer || isBodyRenderer) { 385 389 // Propagate the new writing mode and direction up to the RenderView. -
trunk/Source/WebCore/rendering/RenderElement.h
r198828 r198847 51 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 53 56 // The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect 54 57 // any pseudo classes (and therefore has no concept of changing state). … … 341 344 }; 342 345 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 343 355 inline void RenderElement::setAncestorLineBoxDirty(bool f) 344 356 { -
trunk/Source/WebCore/style/RenderTreePosition.cpp
r198828 r198847 28 28 29 29 #include "ComposedTreeIterator.h" 30 #include "HTMLSlotElement.h"31 30 #include "PseudoElement.h" 32 31 #include "RenderObject.h" … … 84 83 return nullptr; 85 84 86 auto composedDescendants = composedTreeDescendants(*parentElement); 87 auto it = node.isBeforePseudoElement() ? composedDescendants.begin() : composedDescendants.at(node); 88 auto end = composedDescendants.end(); 85 auto composedChildren = composedTreeChildren(*parentElement); 89 86 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(); 87 auto it = node.isBeforePseudoElement() ? composedChildren.begin() : composedChildren.at(node); 88 for (auto end = composedChildren.end(); it != end; ++it) { 89 RenderObject* renderer = it->renderer(); 98 90 if (renderer && !isRendererReparented(*renderer)) 99 91 return renderer; 100 101 it.traverseNextSkippingChildren();102 92 } 103 93 if (PseudoElement* after = parentElement->afterPseudoElement()) -
trunk/Source/WebCore/style/StyleRelations.cpp
r198828 r198847 30 30 #include "NodeRenderStyle.h" 31 31 #include "RenderStyle.h" 32 #include "StyleUpdate.h"33 32 34 33 namespace WebCore { … … 87 86 } 88 87 89 void commitRelations (std::unique_ptr<Relations> relations, Update& update)88 void commitRelationsToDocument(std::unique_ptr<Relations> relations) 90 89 { 91 90 if (!relations) … … 126 125 break; 127 126 case Relation::FirstChild: 128 if (auto* style = update.elementStyle(element))127 if (auto* style = element.renderStyle()) 129 128 style->setFirstChildState(); 130 129 break; 131 130 case Relation::LastChild: 132 if (auto* style = update.elementStyle(element))131 if (auto* style = element.renderStyle()) 133 132 style->setLastChildState(); 134 133 break; 135 134 case Relation::NthChildIndex: 136 if (auto* style = update.elementStyle(element))137 style->setUnique();138 135 element.setChildIndex(relation.value); 139 136 break; 140 137 case Relation::Unique: 141 if (auto* style = update.elementStyle(element))138 if (auto* style = element.renderStyle()) 142 139 style->setUnique(); 143 140 break; -
trunk/Source/WebCore/style/StyleRelations.h
r198828 r198847 36 36 namespace Style { 37 37 38 class Update;39 40 38 struct Relation { 41 39 enum Type { … … 69 67 70 68 std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&); 71 void commitRelations (std::unique_ptr<Relations>, Update&);69 void commitRelationsToDocument(std::unique_ptr<Relations>); 72 70 73 71 } -
trunk/Source/WebCore/style/StyleSharingResolver.cpp
r198828 r198847 34 34 #include "RenderStyle.h" 35 35 #include "SVGElement.h" 36 #include "StyleUpdate.h"37 36 #include "StyledElement.h" 38 37 #include "VisitedLinkState.h" … … 46 45 47 46 struct SharingResolver::Context { 48 const Update& update;49 47 const StyledElement& element; 50 48 bool elementAffectedByClassRules; … … 70 68 } 71 69 72 RefPtr<RenderStyle> SharingResolver::resolve(const Element& searchElement , const Update& update)70 RefPtr<RenderStyle> SharingResolver::resolve(const Element& searchElement) 73 71 { 74 72 if (!is<StyledElement>(searchElement)) … … 80 78 if (parentElement.shadowRoot()) 81 79 return nullptr; 82 if (! update.elementStyle(parentElement))80 if (!parentElement.renderStyle()) 83 81 return nullptr; 84 82 // If the element has inline style it is probably unique. … … 98 96 99 97 Context context { 100 update,101 98 element, 102 99 element.hasClass() && classNamesAffectedByRules(element.classNames()), … … 131 128 m_elementsSharingStyle.add(&element, shareElement); 132 129 133 return RenderStyle::clone( update.elementStyle(*shareElement));130 return RenderStyle::clone(shareElement->renderStyle()); 134 131 } 135 132 … … 199 196 { 200 197 auto& element = context.element; 201 auto* style = c ontext.update.elementStyle(candidateElement);198 auto* style = candidateElement.renderStyle(); 202 199 if (!style) 203 200 return false; -
trunk/Source/WebCore/style/StyleSharingResolver.h
r198828 r198847 43 43 namespace Style { 44 44 45 class Update;46 47 45 class SharingResolver { 48 46 public: 49 47 SharingResolver(const Document&, const DocumentRuleSets&, const SelectorFilter&); 50 48 51 RefPtr<RenderStyle> resolve(const Element& , const Update&);49 RefPtr<RenderStyle> resolve(const Element&); 52 50 53 51 private: -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r198828 r198847 5 5 * (C) 2001 Dirk Mueller (mueller@kde.org) 6 6 * (C) 2007 David Smith (catfish.man@gmail.com) 7 * Copyright (C) 2004-2010, 2012-201 6Apple Inc. All rights reserved.7 * Copyright (C) 2004-2010, 2012-2014 Apple Inc. All rights reserved. 8 8 * (C) 2007 Eric Seidel (eric@webkit.org) 9 9 * … … 27 27 #include "StyleTreeResolver.h" 28 28 29 #include "AXObjectCache.h" 30 #include "AnimationController.h" 29 31 #include "AuthorStyleSheets.h" 30 32 #include "CSSFontSelector.h" … … 32 34 #include "ComposedTreeIterator.h" 33 35 #include "ElementIterator.h" 34 #include "HTMLBodyElement.h" 36 #include "ElementRareData.h" 37 #include "FlowThreadController.h" 35 38 #include "HTMLSlotElement.h" 39 #include "InspectorInstrumentation.h" 36 40 #include "LoaderStrategy.h" 37 41 #include "MainFrame.h" 38 42 #include "NodeRenderStyle.h" 43 #include "NodeTraversal.h" 39 44 #include "PlatformStrategies.h" 45 #include "RenderFullScreen.h" 46 #include "RenderNamedFlowThread.h" 47 #include "RenderText.h" 48 #include "RenderTreePosition.h" 49 #include "RenderWidget.h" 40 50 #include "Settings.h" 41 51 #include "ShadowRoot.h" … … 51 61 namespace Style { 52 62 63 enum DetachType { NormalDetach, ReattachDetach }; 64 53 65 static void attachTextRenderer(Text&, RenderTreePosition&); 66 static void detachRenderTree(Element&, DetachType); 54 67 static void resolveTextNode(Text&, RenderTreePosition&); 55 68 … … 119 132 : element(nullptr) 120 133 , style(*document.renderStyle()) 134 , renderTreePosition(*document.renderView()) 121 135 , change(change) 122 136 { 123 137 } 124 138 125 TreeResolver::Parent::Parent(Element& element, ElementUpdate& update)139 TreeResolver::Parent::Parent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change) 126 140 : element(&element) 127 , style(*update.style) 128 , change(update.change) 141 , style(style) 142 , renderTreePosition(renderTreePosition) 143 , change(change) 129 144 { 130 145 } … … 144 159 { 145 160 return m_scopeStack.removeLast(); 161 } 162 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; 146 172 } 147 173 … … 153 179 } 154 180 155 scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());156 157 181 if (element.hasCustomStyleResolveCallbacks()) { 158 RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;182 RenderStyle* shadowHostStyle = scope().shadowRoot ? scope().shadowRoot->host()->renderStyle() : nullptr; 159 183 if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) { 160 if (customStyle->relations) 161 commitRelations(WTFMove(customStyle->relations), *m_update); 162 184 Style::commitRelationsToDocument(WTFMove(customStyle->relations)); 163 185 return WTFMove(customStyle->renderStyle); 164 186 } 165 187 } 166 188 167 if (auto style = scope().sharingResolver.resolve(element , *m_update))189 if (auto style = scope().sharingResolver.resolve(element)) 168 190 return *style; 169 191 170 192 auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter); 171 193 172 if (elementStyle.relations) 173 commitRelations(WTFMove(elementStyle.relations), *m_update); 174 194 Style::commitRelationsToDocument(WTFMove(elementStyle.relations)); 175 195 return WTFMove(elementStyle.renderStyle); 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 238 // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style 239 // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail. 240 newRenderer->setFlowThreadState(insertionPosition.parent().flowThreadState()); 241 242 // Code below updateAnimations() can depend on Element::renderer() already being set. 243 element.setRenderer(newRenderer); 244 245 // FIXME: There's probably a better way to factor this. 246 // This just does what setAnimatedStyle() does, except with setStyleInternal() instead of setStyle(). 247 Ref<RenderStyle> animatedStyle = newRenderer->style(); 248 newRenderer->animation().updateAnimations(*newRenderer, animatedStyle, animatedStyle); 249 newRenderer->setStyleInternal(WTFMove(animatedStyle)); 250 251 newRenderer->initializeStyle(); 252 253 #if ENABLE(FULLSCREEN_API) 254 if (m_document.webkitIsFullScreen() && m_document.webkitCurrentFullScreenElement() == &element) { 255 newRenderer = RenderFullScreen::wrapRenderer(newRenderer, &insertionPosition.parent(), m_document); 256 if (!newRenderer) 257 return; 258 } 259 #endif 260 // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer. 261 insertionPosition.insert(*newRenderer); 176 262 } 177 263 … … 263 349 264 350 textNode.setRenderer(newRenderer.get()); 351 // Parent takes care of the animations, no need to call setAnimatableStyle. 265 352 renderTreePosition.insert(*newRenderer.leakPtr()); 266 353 } … … 295 382 } 296 383 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 297 446 static void resetStyleForNonRenderedDescendants(Element& current) 298 447 { 299 448 // FIXME: This is not correct with shadow trees. This should be done with ComposedTreeIterator. 449 ASSERT(!current.renderer()); 300 450 bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle = false; 301 451 for (auto& child : childrenOfType<Element>(current)) { 452 ASSERT(!child.renderer()); 302 453 bool affectedByPreviousSibling = child.styleIsAffectedByPreviousSibling() && elementNeedingStyleRecalcAffectsNextSiblingElementStyle; 303 454 if (child.needsStyleRecalc() || elementNeedingStyleRecalcAffectsNextSiblingElementStyle) … … 314 465 } 315 466 } 467 } 468 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(¤t); 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(); 316 572 } 317 573 … … 351 607 #endif 352 608 353 void detachRenderTree(Element& current, DetachType detachType)609 static void detachRenderTree(Element& current, DetachType detachType) 354 610 { 355 611 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; … … 382 638 } 383 639 384 ElementUpdate TreeResolver::resolveElement(Element& element) 385 { 386 ElementUpdate update; 387 388 auto newStyle = styleForElement(element, parent().style); 389 390 auto* renderer = element.renderer(); 391 bool needsNewRenderer = !renderer || element.styleChangeType() == ReconstructRenderTree || parent().change == Detach; 392 393 if (!needsNewRenderer && m_document.frame()->animation().updateAnimations(*renderer, newStyle, newStyle)) 394 update.isSynthetic = true; 395 396 update.change = needsNewRenderer ? Detach : determineChange(renderer->style(), newStyle); 397 update.style = WTFMove(newStyle); 398 399 if (element.styleChangeType() == SyntheticStyleChange) 400 update.isSynthetic = true; 401 402 if (&element == m_document.documentElement()) { 403 m_documentElementStyle = update.style; 404 405 // If "rem" units are used anywhere in the document, and if the document element's font size changes, then force font updating 406 // 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). 407 if (m_document.authorStyleSheets().usesRemUnits() && update.change != NoChange && renderer && update.style && renderer->style().fontSize() != update.style->fontSize()) { 408 // Cached RenderStyles may depend on the rem units. 409 scope().styleResolver.invalidateMatchedPropertiesCache(); 410 update.change = Force; 411 } 412 } 413 414 // This is needed for resolving color:-webkit-text for subsequent elements. 415 // FIXME: We shouldn't mutate document when resolving style. 416 if (&element == m_document.body()) 417 m_document.setTextColor(update.style->visitedDependentColor(CSSPropertyColor)); 418 419 if (update.change != Detach && (parent().change == Force || element.styleChangeType() >= FullStyleChange)) 420 update.change = Force; 421 422 return update; 640 static bool pseudoStyleCacheIsInvalid(RenderElement* renderer, RenderStyle* newStyle) 641 { 642 const RenderStyle& currentStyle = renderer->style(); 643 644 const PseudoStyleCache* pseudoStyleCache = currentStyle.cachedPseudoStyles(); 645 if (!pseudoStyleCache) 646 return false; 647 648 for (auto& cache : *pseudoStyleCache) { 649 RefPtr<RenderStyle> newPseudoStyle; 650 PseudoId pseudoId = cache->styleType(); 651 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) 652 newPseudoStyle = renderer->uncachedFirstLineStyle(newStyle); 653 else 654 newPseudoStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle); 655 if (!newPseudoStyle) 656 return true; 657 if (*newPseudoStyle != *cache) { 658 if (pseudoId < FIRST_INTERNAL_PSEUDOID) 659 newStyle->setHasPseudoStyle(pseudoId); 660 newStyle->addCachedPseudoStyle(newPseudoStyle); 661 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) { 662 // FIXME: We should do an actual diff to determine whether a repaint vs. layout 663 // is needed, but for now just assume a layout will be required. The diff code 664 // in RenderObject::setStyle would need to be factored out so that it could be reused. 665 renderer->setNeedsLayoutAndPrefWidthsRecalc(); 666 } 667 return true; 668 } 669 } 670 return false; 671 } 672 673 Change TreeResolver::resolveElement(Element& current) 674 { 675 Change localChange = Detach; 676 RefPtr<RenderStyle> newStyle; 677 RefPtr<RenderStyle> currentStyle = current.renderStyle(); 678 679 if (currentStyle && current.styleChangeType() != ReconstructRenderTree) { 680 Ref<RenderStyle> style(styleForElement(current, parent().style)); 681 newStyle = style.ptr(); 682 localChange = determineChange(*currentStyle, style); 683 } 684 if (localChange == Detach) { 685 if (current.renderer() || current.isNamedFlowContentNode()) 686 detachRenderTree(current, ReattachDetach); 687 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT) 688 else if (is<HTMLSlotElement>(current)) 689 detachRenderTree(current, ReattachDetach); 690 #endif 691 createRenderTreeRecursively(current, parent().style, parent().renderTreePosition, newStyle.release()); 692 invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(current); 693 694 return Detach; 695 } 696 697 if (RenderElement* renderer = current.renderer()) { 698 if (localChange != NoChange || pseudoStyleCacheIsInvalid(renderer, newStyle.get()) || (parent().change == Force && renderer->requiresForcedStyleRecalcPropagation()) || current.styleChangeType() == SyntheticStyleChange) 699 renderer->setAnimatableStyle(*newStyle, current.styleChangeType() == SyntheticStyleChange ? StyleDifferenceRecompositeLayer : StyleDifferenceEqual); 700 } 701 702 // 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). 704 if (m_document.authorStyleSheets().usesRemUnits() && m_document.documentElement() == ¤t && localChange != NoChange && currentStyle && newStyle && currentStyle->fontSize() != newStyle->fontSize()) { 705 // Cached RenderStyles may depend on the re units. 706 scope().styleResolver.invalidateMatchedPropertiesCache(); 707 return Force; 708 } 709 if (parent().change == Force || current.styleChangeType() >= FullStyleChange) 710 return Force; 711 712 return localChange; 423 713 } 424 714 … … 440 730 attachTextRenderer(text, renderTreePosition); 441 731 invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text); 732 } 733 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); 442 756 } 443 757 … … 496 810 #endif // PLATFORM(IOS) 497 811 498 void TreeResolver::pushParent(Element& element, ElementUpdate& update)812 void TreeResolver::pushParent(Element& element, RenderStyle& style, RenderTreePosition renderTreePosition, Change change) 499 813 { 500 814 scope().selectorFilter.pushParent(&element); 501 815 502 Parent parent(element, update);816 Parent parent(element, style, renderTreePosition, change); 503 817 504 818 if (auto* shadowRoot = element.shadowRoot()) { … … 514 828 515 829 m_parentStack.append(WTFMove(parent)); 830 831 resolveBeforeOrAfterPseudoElement(element, change, BEFORE, renderTreePosition); 516 832 } 517 833 … … 519 835 { 520 836 auto& parentElement = *parent().element; 837 838 resolveBeforeOrAfterPseudoElement(parentElement, parent().change, AFTER, parent().renderTreePosition); 521 839 522 840 parentElement.clearNeedsStyleRecalc(); … … 538 856 while (m_parentStack.size() > depth) 539 857 popParent(); 540 }541 542 static bool shouldResolvePseudoElement(PseudoElement* pseudoElement)543 {544 if (!pseudoElement)545 return false;546 bool needsStyleRecalc = pseudoElement->needsStyleRecalc();547 pseudoElement->clearNeedsStyleRecalc();548 return needsStyleRecalc;549 858 } 550 859 … … 570 879 ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot()); 571 880 881 if (auto* existingRenderer = node.renderer()) 882 parent.renderTreePosition.invalidateNextSibling(*existingRenderer); 883 572 884 if (is<Text>(node)) { 573 auto& text = downcast<Text>(node); 574 if (text.styleChangeType() == ReconstructRenderTree && parent.change != Detach) 575 m_update->addText(text, parent.element); 576 577 text.clearNeedsStyleRecalc(); 885 if (node.needsStyleRecalc()) 886 resolveTextNode(downcast<Text>(node), parent.renderTreePosition); 578 887 it.traverseNextSkippingChildren(); 579 888 continue; … … 587 896 parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle(); 588 897 589 bool shouldResolveForPseudoElement = shouldResolvePseudoElement(element.beforePseudoElement()) || shouldResolvePseudoElement(element.afterPseudoElement()); 590 591 ElementUpdate update; 592 update.style = element.renderStyle(); 593 594 bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling; 898 Change change = NoChange; 899 900 bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || affectedByPreviousSibling; 595 901 if (shouldResolve) { 596 902 #if PLATFORM(IOS) … … 605 911 } 606 912 } 607 update = resolveElement(element); 913 change = resolveElement(element); 914 915 element.clearNeedsStyleRecalc(); 608 916 609 917 if (element.hasCustomStyleResolveCallbacks()) 610 element.didRecalcStyle( update.change);611 612 if ( affectedByPreviousSibling && update.change != Detach)613 update.change = Force;614 615 m_update->addElement(element, parent.element, update);616 617 element.clearNeedsStyleRecalc();618 }619 918 element.didRecalcStyle(change); 919 920 if (change == Detach) { 921 it.traverseNextSkippingChildren(); 922 continue; 923 } 924 925 if (affectedByPreviousSibling) 926 change = Force; 927 } 620 928 621 929 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT) 622 930 if (is<HTMLSlotElement>(element)) { 623 931 // FIXME: We should compute style for the slot and use it as parent style. 624 // Duplicate the style from the parent context. 625 ElementUpdate slotUpdate; 626 slotUpdate.style = parent.style.ptr(); 627 slotUpdate.change = update.change; 628 if (!shouldResolve) 629 m_update->addElement(element, parent.element, update); 630 pushParent(element, slotUpdate); 932 // FIXME: This should be display:contents check. 933 // Duplicate the style and render tree position from the current context. 934 pushParent(element, parent.style.get(), parent.renderTreePosition, change); 631 935 it.traverseNext(); 632 936 continue; 633 937 } 634 938 #endif 635 if (!update.style) { 939 auto* renderer = element.renderer(); 940 if (!renderer) { 636 941 resetStyleForNonRenderedDescendants(element); 637 942 element.clearChildNeedsStyleRecalc(); 638 943 } 639 944 640 bool shouldIterateChildren = update.style && (element.childNeedsStyleRecalc() || update.change != NoChange);945 bool shouldIterateChildren = renderer && (element.childNeedsStyleRecalc() || change != NoChange); 641 946 if (!shouldIterateChildren) { 642 947 it.traverseNextSkippingChildren(); … … 644 949 } 645 950 646 pushParent(element, update);951 pushParent(element, renderer->style(), RenderTreePosition(*renderer), change); 647 952 648 953 it.traverseNext(); … … 652 957 } 653 958 654 std::unique_ptr<const Update>TreeResolver::resolve(Change change)959 void TreeResolver::resolve(Change change) 655 960 { 656 961 auto& renderView = *m_document.renderView(); … … 658 963 Element* documentElement = m_document.documentElement(); 659 964 if (!documentElement) 660 return nullptr;965 return; 661 966 if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc()) 662 return nullptr; 663 664 m_update = std::make_unique<Update>(m_document); 967 return; 968 665 969 m_scopeStack.append(adoptRef(*new Scope(m_document))); 666 m_parentStack.append(Parent(m_document, change));667 970 668 971 // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc. … … 670 973 renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules()); 671 974 975 m_parentStack.append(Parent(m_document, change)); 976 672 977 resolveComposedTree(); 673 978 … … 677 982 m_parentStack.clear(); 678 983 m_scopeStack.clear(); 679 680 if (m_update->roots().isEmpty()) 681 return nullptr; 682 683 return WTFMove(m_update);984 } 985 986 void detachRenderTree(Element& element) 987 { 988 detachRenderTree(element, NormalDetach); 684 989 } 685 990 -
trunk/Source/WebCore/style/StyleTreeResolver.h
r198828 r198847 33 33 #include "StyleChange.h" 34 34 #include "StyleSharingResolver.h" 35 #include "StyleUpdate.h"36 35 #include <functional> 37 #include <wtf/HashMap.h>38 36 #include <wtf/RefPtr.h> 39 37 … … 50 48 class StyleResolver; 51 49 class Text; 52 class TreeChange;53 50 54 51 namespace Style { … … 58 55 TreeResolver(Document&); 59 56 60 std::unique_ptr<const Update>resolve(Change);57 void resolve(Change); 61 58 62 59 private: … … 64 61 65 62 void resolveComposedTree(); 66 ElementUpdate resolveElement(Element&); 63 Change 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 67 76 68 77 struct Scope : RefCounted<Scope> { … … 80 89 Element* element; 81 90 Ref<RenderStyle> style; 91 RenderTreePosition renderTreePosition; 82 92 Change change; 83 93 bool didPushScope { false }; … … 85 95 86 96 Parent(Document&, Change); 87 Parent(Element&, ElementUpdate&);97 Parent(Element&, RenderStyle&, RenderTreePosition, Change); 88 98 }; 89 99 … … 95 105 void popScope(); 96 106 97 void pushParent(Element&, ElementUpdate&);107 void pushParent(Element&, RenderStyle&, RenderTreePosition, Change); 98 108 void popParent(); 99 109 void popParentsToDepth(unsigned depth); 100 110 101 111 Document& m_document; 102 RefPtr<RenderStyle> m_documentElementStyle;103 104 112 Vector<Ref<Scope>, 4> m_scopeStack; 105 113 Vector<Parent, 32> m_parentStack; 106 107 std::unique_ptr<Update> m_update;108 114 }; 109 115 110 enum DetachType { NormalDetach, ReattachDetach }; 111 void detachRenderTree(Element&, DetachType = NormalDetach); 116 void detachRenderTree(Element&); 112 117 void detachTextRenderer(Text&); 113 118 -
trunk/Source/WebCore/svg/SVGElement.h
r198828 r198847 184 184 void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement*); 185 185 186 bool willRecalcStyle(Style::Change) override;187 188 186 class InstanceInvalidationGuard; 189 187 190 188 private: 191 189 RenderStyle* computedStyle(PseudoId = NOPSEUDO) final; 190 bool willRecalcStyle(Style::Change) override; 192 191 193 192 virtual bool isSupported(StringImpl* feature, StringImpl* version) const; -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r198828 r198847 179 179 } 180 180 181 bool SVGUseElement::willRecalcStyle(Style::Change change) 182 { 183 // FIXME: Shadow tree should be updated before style recalc. 181 void SVGUseElement::willAttachRenderers() 182 { 184 183 if (m_shadowTreeNeedsUpdate) 185 184 updateShadowTree(); 186 return SVGGraphicsElement::willRecalcStyle(change);185 SVGGraphicsElement::willAttachRenderers(); 187 186 } 188 187 -
trunk/Source/WebCore/svg/SVGUseElement.h
r198828 r198847 64 64 void parseAttribute(const QualifiedName&, const AtomicString&) override; 65 65 void svgAttributeChanged(const QualifiedName&) override; 66 bool willRecalcStyle(Style::Change) override;66 void willAttachRenderers() override; 67 67 RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override; 68 68 void toClipPath(Path&) override;
Note: See TracChangeset
for help on using the changeset viewer.