Bug 1329919 - Skip repaint frame hint if there is no frame. r?heycam draft
authorShing Lyu <slyu@mozilla.com>
Fri, 03 Feb 2017 10:37:08 +0800
changeset 482666 e514ac1a623000cf49c05b4a11051b9a0b9782d7
parent 481601 5db06e4566a04f9dae9cc9a9a37a97cd09348441
child 545465 0ff96764885f828367d20698ee7b71b3903dd03b
push id45118
push userbmo:slyu@mozilla.com
push dateMon, 13 Feb 2017 06:43:04 +0000
reviewersheycam
bugs1329919
milestone54.0a1
Bug 1329919 - Skip repaint frame hint if there is no frame. r?heycam MozReview-Commit-ID: F46VpEBJqvU
layout/base/ServoRestyleManager.cpp
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -139,17 +139,21 @@ void
 ServoRestyleManager::RecreateStyleContexts(Element* aElement,
                                            nsStyleContext* aParentContext,
                                            ServoStyleSet* aStyleSet,
                                            nsStyleChangeList& aChangeListToProcess)
 {
   nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
 
   nsChangeHint changeHint = Servo_TakeChangeHint(aElement);
-  if (changeHint) {
+  // Although we shouldn't generate non-ReconstructFrame hints for elements with
+  // no frames, we can still get them here if they were explicitly posted by
+  // PostRestyleEvent, such as a RepaintFrame hint when a :link changes to be
+  // :visited.  Skip processing these hints if there is no frame.
+  if ((primaryFrame || changeHint & nsChangeHint_ReconstructFrame) && changeHint) {
     aChangeListToProcess.AppendChange(primaryFrame, aElement, changeHint);
   }
 
   // If our change hint is reconstruct, we delegate to the frame constructor,
   // which consumes the new style and expects the old style to be on the frame.
   //
   // XXXbholley: We should teach the frame constructor how to clear the dirty
   // descendants bit to avoid the traversal here.