Bug 1324619 part 4. Add a Servo API for reparenting a given style. r?emilio draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 28 Jul 2017 21:20:41 -0400
changeset 617969 4a988cbca13b3500b7aa05899fab9b671cdf785c
parent 617968 4f82a38e9a851fafa38b6f214236aad1fe4fbb3c
child 617970 1cb14620b1725e09b8892ea23889a986b6a72cd5
push id71168
push userbzbarsky@mozilla.com
push dateSat, 29 Jul 2017 01:21:16 +0000
reviewersemilio
bugs1324619
milestone56.0a1
Bug 1324619 part 4. Add a Servo API for reparenting a given style. r?emilio MozReview-Commit-ID: 2rqnMjMQKlJ
layout/reftests/bidi/reftest.list
layout/reftests/bugs/reftest.list
layout/reftests/first-line/reftest.list
layout/reftests/scoped-style/reftest.list
layout/reftests/svg/text/reftest.list
layout/style/ServoBindingList.h
layout/style/ServoStyleSet.cpp
testing/web-platform/meta/css/CSS2/cascade/cascade-009b.xht.ini
testing/web-platform/meta/css/CSS2/cascade/specificity-005.xht.ini
testing/web-platform/meta/css/CSS2/cascade/specificity-006.xht.ini
testing/web-platform/meta/css/CSS2/cascade/specificity-008.xht.ini
testing/web-platform/meta/css/CSS2/css1/c25-pseudo-elmnt-000.xht.ini
testing/web-platform/meta/css/CSS2/selectors/first-line-001.xht.ini
testing/web-platform/meta/css/CSS2/selectors/first-line-floats-002.xht.ini
testing/web-platform/meta/css/CSS2/selectors/first-line-pseudo-018.xht.ini
testing/web-platform/meta/css/CSS2/selectors/first-line-selector-013.xht.ini
testing/web-platform/meta/css/CSS2/selectors/pseudo-002.xht.ini
testing/web-platform/meta/css/CSS2/syntax/case-sensitive-003.xht.ini
testing/web-platform/meta/innerText/getter.html.ini
--- a/layout/reftests/bidi/reftest.list
+++ b/layout/reftests/bidi/reftest.list
@@ -164,12 +164,12 @@ fuzzy-if(Android,254,557) == brackets-2a
 == brackets-2b-ltr.html brackets-2b-ltr-ref.html
 == brackets-2b-rtl.html brackets-2b-rtl-ref.html
 == brackets-2c-ltr.html brackets-2c-ltr-ref.html
 fuzzy-if(Android,254,231) == brackets-2c-rtl.html brackets-2c-rtl-ref.html
 == brackets-3a-ltr.html brackets-3a-ltr-ref.html
 == brackets-3a-rtl.html brackets-3a-rtl-ref.html
 == brackets-3b-ltr.html brackets-3b-ltr-ref.html
 == brackets-3b-rtl.html brackets-3b-rtl-ref.html
-fails-if(styloVsGecko||stylo) == 1217833-1.html 1217833-1-ref.html
-fails-if(styloVsGecko||stylo) == 1217833-2.html 1217833-2-ref.html
+== 1217833-1.html 1217833-1-ref.html
+== 1217833-2.html 1217833-2-ref.html
 == 1231175-1.html 1231175-1-ref.html
 == 1366623-1.html 1366623-1-ref.html
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -30,17 +30,17 @@ HTTP(..) == 10209-3.html 10209-3-ref.htm
 == 18217-width-1b.html 18217-width-1-ref.html
 == 18217-width-2a.html 18217-width-2-ref.html
 == 18217-width-2b.html 18217-width-2-ref.html
 == 18217-zorder-1.html 18217-zorder-ref.html
 == 18217-zorder-2.html 18217-zorder-ref.html
 == 18217-zorder-3.html 18217-zorder-ref-inline.html
 == 18217-zorder-4.html 18217-zorder-ref-inline-table.html
 == 18217-zorder-5.html 18217-zorder-ref-inline-table.html
-fails-if(styloVsGecko) == 23604-1.html 23604-1-ref.html
+== 23604-1.html 23604-1-ref.html
 == 23604-2.html 23604-2-ref.html
 != 24998-1.html 24998-1-ref.html
 == 25888-1l.html 25888-1l-ref.html
 != 25888-1l.html 25888-1l-notref.html
 == 25888-1r.html 25888-1r-ref.html
 != 25888-1r.html 25888-1r-notref.html
 == 25888-2l.html 25888-2l-ref.html
 == 25888-2r.html 25888-2r-ref.html
@@ -784,17 +784,17 @@ fails-if(!styloVsGecko) == 387344-1.html
 skip-if(!winWidget) == 391045.html 391045-ref.html # windows-specific Uniscribe bug, trailing period is matched against different fonts on Mac/Linux (see 396137)
 == 391140-1.html 391140-1-ref.html
 == 391412-1a.html 391412-1-ref.html
 == 391412-1b.html 391412-1-ref.html
 == 391909-1.html 391909-1-ref.html
 skip-if(Android) == 391979.html 391979-ref.html
 == 391994-1.html 391994-1-ref.html
 == 392047.html 392047-ref.html
-fails-if(styloVsGecko||stylo) == 392435-1.html 392435-1-ref.html
+== 392435-1.html 392435-1-ref.html
 == 393330-1.html 393330-1-ref.html
 == 393490-1.html 393490-1-ref.html
 == 393517-1.xhtml about:blank  # crash test
 fuzzy-if(skiaContent,1,600) == 393649-1.html 393649-1-ref.html
 == 393655-1.html 393655-1-ref.html
 == 393655-2.html 393655-2-ref.html
 == 393655-3.html 393655-3-ref.html
 == 393655-4.html 393655-4-ref.html
@@ -841,17 +841,17 @@ fails-if(winWidget&&!styloVsGecko) fails
 == 400171-1a.html 400171-1-ref.html
 == 400171-1b.html 400171-1-ref.html
 == 400171-1c.html 400171-1-ref.html
 == 400171-2a.html 400171-2-ref.html
 == 400171-2b.html 400171-2-ref.html
 == 400171-2c.html 400171-2-ref.html
 == 400421-1.html 400421-1-ref.html
 == 400813-1.html 400813-1-ref.html
-fails-if(styloVsGecko||stylo) == 400826-1.html 400826-1-ref.html
+== 400826-1.html 400826-1-ref.html
 == 401946-1.xul about:blank
 == 402338-1.html 402338-1-ref.html
 == 402567-1.html 402567-1-ref.html
 == 402567-2.html 402567-2-ref.html
 == 402567-3.html 402567-3-ref.html
 fuzzy-if(gtkWidget,2,40) == 402567-4.html 402567-4-ref.html
 fuzzy-if(skiaContent,2,5) == 402629-1.html 402629-1-ref.html
 fuzzy-if(skiaContent,2,5) == 402629-2.html 402629-2-ref.html
@@ -1240,17 +1240,17 @@ fuzzy-if(skiaContent,1,12000) == 461512-
 == 466258-1.html 466258-1-ref.html
 == 466395-1.html 466395-1-ref.html
 == 466395-2.html 466395-2-ref.html
 == 467084-1.html 467084-1-ref.html
 == 467084-2.html 467084-2-ref.html
 == 467444-1.html 467444-1-ref.html
 == 467460-1.html 467460-1-ref.html
 == 468473-1.xul 468473-1-ref.xul
-fails-if(styloVsGecko) == 468546-1.xhtml 468546-1-ref.xhtml
+== 468546-1.xhtml 468546-1-ref.xhtml
 == 471356-1.html 471356-1-ref.html
 == 471594-1.xhtml 471594-1-ref.html
 fuzzy(255,15) == 472020-1a.xul 472020-1-ref.xul
 fails-if(!styloVsGecko) == 472020-1b.xul 472020-1-ref.xul
 fails-if(!styloVsGecko) == 472020-2.xul 472020-2-ref.xul
 == 472500-1.xul 472500-1-ref.xul
 == 472769-1a.html 472769-1-ref.html
 == 472769-1b.html 472769-1-ref.html
@@ -1378,18 +1378,18 @@ pref(browser.display.focus_ring_width,1)
 == 495385-2d.html 495385-2-ref.html
 == 495385-2e.html 495385-2-ref.html
 pref(dom.use_xbl_scopes_for_remote_xul,true) == 495385-2f.xhtml 495385-2-ref.html
 == 495385-2g.html 495385-2-ref.html
 == 495385-2h.html 495385-2-ref.html
 == 495385-2i.html 495385-2-ref.html
 == 495385-3.html 495385-3-ref.html
 == 495385-4.html 495385-4-ref.html
-fails-if(styloVsGecko) == 495385-5.html 495385-5-ref.html
-fails-if(styloVsGecko||stylo) == 496032-1.html 496032-1-ref.html
+fails-if(styloVsGecko||stylo) == 495385-5.html 495385-5-ref.html
+== 496032-1.html 496032-1-ref.html
 == 496840-1.html 496840-1-ref.html
 fuzzy-if(skiaContent,1,17000) == 498228-1.xul 498228-1-ref.xul
 == 501037.html 501037-ref.html
 == 501257-1a.html 501257-1-ref.html
 == 501257-1b.html 501257-1-ref.html
 == 501257-1.xhtml 501257-1-ref.xhtml
 == 501627-1.html 501627-1-ref.html
 == 502288-1.html 502288-1-ref.html
@@ -1691,17 +1691,17 @@ fuzzy-if(skiaContent,1,3500) == 660682-1
 fuzzy-if(d2d,1,256) skip-if(Android) fuzzy-if(skiaContent,1,68000) == 664127-1.xul 664127-1-ref.xul # Android: Intermittent failures - bug 1019131
 == 665597-1.html 665597-1-ref.html
 == 665597-2.html 665597-2-ref.html
 == 667079-1.html 667079-1-ref.html
 == 668319-1.xul about:blank
 != 669015-1.xul 669015-1-notref.xul
 skip-if(azureSkiaGL) == 670442-1.html 670442-1-ref.html
 == 670467-1.html 670467-1-ref.html
-fails-if(styloVsGecko) == 670467-2.html 670467-2-ref.html
+fails-if(styloVsGecko||stylo) == 670467-2.html 670467-2-ref.html
 == 690164-1.html 690164-1-ref.html
 == 690643-1.html 690643-1-ref.html
 != 691087-1.html 691087-1-ref.html
 == 691571-1.html 691571-1-ref.html
 fuzzy-if(skiaContent,1,200) == 696307-1.html 696307-1-ref.html
 fuzzy-if(skiaContent,1,550) == 696739-1.html 696739-1-ref.html
 needs-focus == 703186-1.html 703186-1-ref.html
 needs-focus == 703186-2.html 703186-2-ref.html
--- a/layout/reftests/first-line/reftest.list
+++ b/layout/reftests/first-line/reftest.list
@@ -1,14 +1,14 @@
 # basic functionality
-fails-if(styloVsGecko||stylo) == basic-1.html basic-ref.html
+== basic-1.html basic-ref.html
 
 # handling of out-of-flows when ::first-line happens
 == out-of-flow-1a.html out-of-flow-1-ref.html
-fails-if(styloVsGecko||stylo) == out-of-flow-1b.html out-of-flow-1-ref.html
+== out-of-flow-1b.html out-of-flow-1-ref.html
 == out-of-flow-1c.html out-of-flow-1-ref.html
 fails-if(!stylo) fails-if(styloVsGecko) == out-of-flow-1d.html out-of-flow-1-ref.html # bug 396645
 
 # parent style context correct
 == parent-style-1.html parent-style-1-ref.html
 == parent-style-2.html parent-style-2-ref.html
 == parent-style-3.html parent-style-3-ref.html
 
@@ -21,21 +21,21 @@ load stress-5.html # assertion/crash tes
 load stress-6.html # assertion/crash test
 load stress-7.html # assertion/crash test
 == stress-8.html stress-8-ref.html # assertion/crash test
 == stress-9.html stress-9-ref.html # assertion/crash test
 load stress-10.html # crash test
 == stress-11.xhtml stress-11-ref.xhtml
 
 == border-not-apply.html border-not-apply-ref.html
-fails-if(styloVsGecko||stylo) == 287088-1.html 287088-1-ref.html
-fails-if(styloVsGecko||stylo) == 287088-2.html 287088-2-ref.html
-fails-if(styloVsGecko) == 403177-1.html 403177-1-ref.html
+== 287088-1.html 287088-1-ref.html
+== 287088-2.html 287088-2-ref.html
+== 403177-1.html 403177-1-ref.html
 == 469227-2.html 469227-2-ref.html
 == 469227-3.html 469227-3-ref.html
 
 fails-if(styloVsGecko||stylo) == restyle-inside-first-line.html restyle-inside-first-line-ref.html
-fails-if(styloVsGecko||stylo) == font-styles.html font-styles-ref.html
-fuzzy-if(OSX==1010,1,2) fails-if(styloVsGecko||stylo) == font-styles-nooverflow.html font-styles-ref.html
+== font-styles.html font-styles-ref.html
+fuzzy-if(OSX==1010,1,2) == font-styles-nooverflow.html font-styles-ref.html
 
 fails-if(!stylo) == ib-split-1.html ib-split-1-ref.html
 
 == first-line-in-columnset-1.html first-line-in-columnset-1-ref.html
--- a/layout/reftests/scoped-style/reftest.list
+++ b/layout/reftests/scoped-style/reftest.list
@@ -17,17 +17,17 @@ fails-if(styloVsGecko||stylo) == scoped-
 fails-if(styloVsGecko||stylo) == scoped-style-015.html scoped-style-015-ref.html
 == scoped-style-016.html scoped-style-016-ref.html
 fails-if(styloVsGecko||stylo) == scoped-style-017.html scoped-style-017-ref.html
 fails-if(styloVsGecko||stylo) == scoped-style-018.html scoped-style-018-ref.html
 fails-if(styloVsGecko||stylo) == scoped-style-019.svg scoped-style-019-ref.svg
 == scoped-style-020.html scoped-style-020-ref.html
 == scoped-style-021.html scoped-style-021-ref.html
 == scoped-style-022.html scoped-style-022-ref.html
-fails-if(styloVsGecko||stylo) == scoped-style-023.html scoped-style-023-ref.html
+== scoped-style-023.html scoped-style-023-ref.html
 == scoped-style-024.html scoped-style-024-ref.html
 == scoped-style-important-001.html scoped-style-important-001-ref.html
 fails-if(styloVsGecko||stylo) == scoped-style-important-002.html scoped-style-important-002-ref.html
 == scoped-style-important-003.html scoped-style-important-003-ref.html
 == scoped-style-important-004.html scoped-style-important-004-ref.html
 == scoped-style-important-005.html scoped-style-important-005-ref.html
 == scoped-style-important-006.html scoped-style-important-006-ref.html
 == scoped-style-important-007.html scoped-style-important-007-ref.html
--- a/layout/reftests/svg/text/reftest.list
+++ b/layout/reftests/svg/text/reftest.list
@@ -142,18 +142,18 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(
 == ignore-margin.svg ignore-prop-ref.svg
 == ignore-padding.svg ignore-prop-ref.svg
 == ignore-vertical-align.svg ignore-vertical-align-ref.svg
 == ignore-overflow-scroll.svg ignore-prop-ref.svg
 == ignore-text-align.svg ignore-prop-ref.svg
 == ignore-text-align-2.svg ignore-text-align-2-ref.svg
 
 # pseudo-elements
-fails-if(styloVsGecko||stylo) == pseudo-first-line.svg pseudo-first-line-ref.svg
-fails-if(styloVsGecko||stylo) == pseudo-first-line-2.svg pseudo-first-line-2-ref.svg
+== pseudo-first-line.svg pseudo-first-line-ref.svg
+== pseudo-first-line-2.svg pseudo-first-line-2-ref.svg
 == pseudo-first-letter.svg pseudo-first-letter-ref.svg
 == pseudo-first-letter-2.svg pseudo-first-letter-2-ref.svg
 == ignore-before-after.svg ignore-prop-ref.svg
 
 # invalid child nodes
 == ignore-invalid-child.svg ignore-invalid-child-ref.svg
 == ignore-invalid-child-2.svg ignore-invalid-child-2-ref.svg
 
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -534,16 +534,27 @@ SERVO_BINDING_FUNC(Servo_HasAuthorSpecif
 // performed, and this function maintains that invariant.
 SERVO_BINDING_FUNC(Servo_ResolveStyleLazily, ServoStyleContextStrong,
                    RawGeckoElementBorrowed element,
                    mozilla::CSSPseudoElementType pseudo_type,
                    mozilla::StyleRuleInclusion rule_inclusion,
                    const mozilla::ServoElementSnapshotTable* snapshots,
                    RawServoStyleSetBorrowed set)
 
+// Reparents style to the new parents.
+SERVO_BINDING_FUNC(Servo_ReparentStyle, ServoStyleContextStrong,
+                   ServoStyleContextBorrowed style_to_reparent,
+                   ServoStyleContextBorrowed parent_style,
+                   ServoStyleContextBorrowed parent_style_ignoring_first_line,
+                   ServoStyleContextBorrowed layout_parent_style,
+                   // element is null if there is no content node involved, or
+                   // if it's not an element.
+                   RawGeckoElementBorrowedOrNull element,
+                   RawServoStyleSetBorrowed set);
+
 // Use ServoStyleSet::PrepareAndTraverseSubtree instead of calling this
 // directly
 SERVO_BINDING_FUNC(Servo_TraverseSubtree,
                    bool,
                    RawGeckoElementBorrowed root,
                    RawServoStyleSetBorrowed set,
                    const mozilla::ServoElementSnapshotTable* snapshots,
                    mozilla::ServoTraversalFlags flags)
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1292,15 +1292,14 @@ ServoStyleSet::HasStateDependency(const 
 
 already_AddRefed<ServoStyleContext>
 ServoStyleSet::ReparentStyleContext(ServoStyleContext* aStyleContext,
                                     ServoStyleContext* aNewParent,
                                     ServoStyleContext* aNewParentIgnoringFirstLine,
                                     ServoStyleContext* aNewLayoutParent,
                                     Element* aElement)
 {
-  // For now just return aStyleContext; actually doing something here is coming
-  // up next.
-  RefPtr<ServoStyleContext> ctx = aStyleContext;
-  return ctx.forget();
+  return Servo_ReparentStyle(aStyleContext, aNewParent,
+                             aNewParentIgnoringFirstLine, aNewLayoutParent,
+                             aElement, mRawSet.get()).Consume();
 }
 
 ServoStyleSet* ServoStyleSet::sInServoTraversal = nullptr;
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/cascade/cascade-009b.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[cascade-009b.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/cascade/specificity-005.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[specificity-005.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/cascade/specificity-006.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[specificity-006.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/cascade/specificity-008.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[specificity-008.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/css1/c25-pseudo-elmnt-000.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[c25-pseudo-elmnt-000.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/selectors/first-line-001.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[first-line-001.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/selectors/first-line-floats-002.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[first-line-floats-002.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/selectors/first-line-pseudo-018.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[first-line-pseudo-018.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/selectors/first-line-selector-013.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[first-line-selector-013.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/selectors/pseudo-002.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[pseudo-002.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/CSS2/syntax/case-sensitive-003.xht.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[case-sensitive-003.xht]
-  type: reftest
-  expected:
-    if stylo: FAIL
--- a/testing/web-platform/meta/innerText/getter.html.ini
+++ b/testing/web-platform/meta/innerText/getter.html.ini
@@ -7,12 +7,8 @@
     expected: FAIL
 
   [display:block <rp> with whitespace ("<div><rp style='display:block'> abc </rp>def")]
     expected: FAIL
 
   [<rp> in a <select> ("<div><select class='poke-rp'></select>")]
     expected: FAIL
 
-  [::first-line styles applied ("<div class='first-line-uppercase' style='width:0'>abc def")]
-    expected:
-      if stylo: FAIL
-