Bug 1245424 Part 2 - Stop checking the existence of details frame before toggling. draft
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 24 Mar 2016 15:05:29 +0800
changeset 344294 9cdcf6e1faf12a4710fde87546b9a7a59724942c
parent 344293 991fe7cd31c1547407254f5aecbbec0f580a471e
child 344295 a9e100f5c8bf5a8238c85596c1be0696b5211860
child 344348 09d8788042009c05dba053220528600953745da6
push id13786
push usertlin@mozilla.com
push dateThu, 24 Mar 2016 07:09:38 +0000
bugs1245424
milestone48.0a1
Bug 1245424 Part 2 - Stop checking the existence of details frame before toggling. MozReview-Commit-ID: 6Xgyu7DDquy
dom/html/HTMLSummaryElement.cpp
layout/reftests/details-summary/reftest.list
--- a/dom/html/HTMLSummaryElement.cpp
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -57,23 +57,21 @@ HTMLSummaryElement::PostHandleEvent(Even
 
     if (mouseEvent->IsLeftClickEvent()) {
       RefPtr<HTMLDetailsElement> details = GetDetails();
       MOZ_ASSERT(details,
                  "Expected to find details since this is the main summary!");
 
       // When dispatching a synthesized mouse click event to a details element
       // with 'display: none', both Chrome and Safari do not toggle the 'open'
-      // attribute. We follow them by checking whether the details element has a
-      // frame or not.
-      if (details->GetPrimaryFrame(Flush_Frames)) {
-        details->ToggleOpen();
-        aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
-        return NS_OK;
-      }
+      // attribute. We had tried to be compatible with this behavior, but found
+      // more inconsistency in test cases in bug 1245424. So we stop doing that.
+      details->ToggleOpen();
+      aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
+      return NS_OK;
     }
   } // event->HasMouseEventMessage()
 
   if (event->HasKeyEventMessage()) {
     WidgetKeyboardEvent* keyboardEvent = event->AsKeyboardEvent();
     bool dispatchClick = false;
 
     switch (event->mMessage) {
--- a/layout/reftests/details-summary/reftest.list
+++ b/layout/reftests/details-summary/reftest.list
@@ -60,17 +60,17 @@ pref(dom.details_element.enabled,true) =
 pref(dom.details_element.enabled,true) == mouse-click-twice-single-summary.html single-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-open-single-summary.html single-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-twice-open-single-summary.html open-single-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-open-second-summary.html open-multiple-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-overflow-hidden-details.html overflow-hidden-open-details.html
 pref(dom.details_element.enabled,true) == mouse-click-twice-overflow-hidden-details.html overflow-hidden-details.html
 pref(dom.details_element.enabled,true) == mouse-click-overflow-auto-details.html overflow-auto-open-details.html
 pref(dom.details_element.enabled,true) == mouse-click-twice-overflow-auto-details.html overflow-auto-details.html
-pref(dom.details_element.enabled,true) == mouse-click-display-none-details.html single-summary.html
+pref(dom.details_element.enabled,true) == mouse-click-display-none-details.html open-single-summary.html
 
 # Dispatch mouse click to out-of-flow details or summary
 pref(dom.details_element.enabled,true) == mouse-click-fixed-summary.html open-fixed-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-twice-fixed-summary.html fixed-summary.html
 pref(dom.details_element.enabled,true) == mouse-click-float-details.html open-float-details.html
 pref(dom.details_element.enabled,true) == mouse-click-twice-float-details.html float-details.html
 
 # Dispatch keyboard event to summary