Bug 1361207 - Changed appropriate calls to nsIFrame::IsThemed() to use overload with nsStyleDisplay* as argument to avoid redundant calls to StyleDisplay() draft
authorNeerja Pancholi <npancholi@mozilla.com>
Mon, 01 May 2017 18:16:20 -0700
changeset 571455 154a65394b3de04621086d33817279748b318038
parent 570886 57b37213d81150642f5139764e7044b07b9dccc3
child 626765 139707448f819f69d7ca2a2af7a8825e2467b1f4
push id56795
push userbmo:npancholi@mozilla.com
push dateTue, 02 May 2017 16:58:35 +0000
bugs1361207
milestone55.0a1
Bug 1361207 - Changed appropriate calls to nsIFrame::IsThemed() to use overload with nsStyleDisplay* as argument to avoid redundant calls to StyleDisplay() MozReview-Commit-ID: 65cmxFOgZeN
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsRangeFrame.cpp
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -774,19 +774,20 @@ nsComboboxControlFrame::GetIntrinsicISiz
     dropdownContentISize = NSCoordSaturatingSubtract(dropdownContentISize,
                                                      scrollbarWidth,
                                                      nscoord_MAX);
 
     displayISize = std::max(dropdownContentISize, displayISize);
   }
 
   // add room for the dropmarker button if there is one
-  if ((!IsThemed() ||
+  const nsStyleDisplay* disp = StyleDisplay();
+  if ((!IsThemed(disp) ||
        presContext->GetTheme()->ThemeNeedsComboboxDropmarker()) &&
-      StyleDisplay()->UsedAppearance() != NS_THEME_NONE) {
+      disp->UsedAppearance() != NS_THEME_NONE) {
     displayISize += scrollbarWidth;
   }
 
   return displayISize;
 
 }
 
 nscoord
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -253,17 +253,18 @@ nsDisplayRangeFocusRing::Paint(nsDisplay
   nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
 }
 
 void
 nsRangeFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                const nsRect&           aDirtyRect,
                                const nsDisplayListSet& aLists)
 {
-  if (IsThemed()) {
+  const nsStyleDisplay* disp = StyleDisplay();
+  if (IsThemed(disp)) {
     DisplayBorderBackgroundOutline(aBuilder, aLists);
     // Only create items for the thumb. Specifically, we do not want
     // the track to paint, since *our* background is used to paint
     // the track, and we don't want the unthemed track painting over
     // the top of the themed track.
     // This logic is copied from
     // nsContainerFrame::BuildDisplayListForNonBlockChildren as
     // called by BuildDisplayListForInline.
@@ -293,17 +294,16 @@ nsRangeFrame::BuildDisplayList(nsDisplay
 
   if (!mOuterFocusStyle ||
       !mOuterFocusStyle->StyleBorder()->HasBorder()) {
     // no ::-moz-focus-outer specified border (how style specifies a focus ring
     // for range)
     return;
   }
 
-  const nsStyleDisplay *disp = StyleDisplay();
   if (IsThemed(disp) &&
       PresContext()->GetTheme()->ThemeDrawsFocusForWidget(disp->UsedAppearance())) {
     return; // the native theme displays its own visual indication of focus
   }
 
   aLists.Content()->AppendNewToTop(
     new (aBuilder) nsDisplayRangeFocusRing(aBuilder, this));
 }