From cf309d59077656b2051e66fdf708f3c0fde4fbb8 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Fri, 26 May 2017 16:56:55 +0000 Subject: [PATCH 01/21] Bug 1367906: Cache the presence of rounded corners upon style changes. r=dbaron r=mattwoodrow Profiling indicates a significant amount of time is spent during displaylist building accessing style information in order to detect border radii. This is a cost that for frames with no border radii only needs to be paid when the style changes. Since nsIFrame still has 16 bits available for storing data without growing it in size, this patch recomputes whether there are border radii upon DidGetStyleContext and stores that information in one of these unused bits. MozReview-Commit-ID: 4Jm29qUwXq3 --- layout/generic/nsFrame.cpp | 16 +++++++++++++--- layout/generic/nsIFrame.h | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 0fed14dcef4c..572358dfb563 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1013,6 +1013,8 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) RemoveStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS | NS_FRAME_SIMPLE_DISPLAYLIST); + + mMayHaveRoundedCorners = true; } void @@ -1587,6 +1589,11 @@ nsIFrame::OutsetBorderRadii(nscoord aRadii[8], const nsMargin &aOffsets) nsIFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, Sides aSkipSides, nscoord aRadii[8]) const { + if (!mMayHaveRoundedCorners) { + memset(aRadii, 0, sizeof(nscoord) * 8); + return false; + } + if (IsThemed()) { // When we're themed, the native theme code draws the border and // background, and therefore it doesn't make sense to tell other @@ -1600,9 +1607,12 @@ nsIFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, } return false; } - return ComputeBorderRadii(StyleBorder()->mBorderRadius, - aFrameSize, aBorderArea, - aSkipSides, aRadii); + + const_cast(this)->mMayHaveRoundedCorners = + ComputeBorderRadii(StyleBorder()->mBorderRadius, + aFrameSize, aBorderArea, + aSkipSides, aRadii); + return mMayHaveRoundedCorners; } bool diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index e879a381ad99..b39d8ed99aba 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -616,6 +616,7 @@ public: , mPrevSibling(nullptr) , mState(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY) , mClass(aID) + , mMayHaveRoundedCorners(false) { mozilla::PodZero(&mOverflow); } @@ -3921,6 +3922,9 @@ protected: /** The ClassID of the concrete class of this instance. */ ClassID mClass; // 1 byte + bool mMayHaveRoundedCorners : 1; + // There should be a 15-bit gap left here. + // Helpers /** * Can we stop inside this frame when we're skipping non-rendered whitespace? From c3de804e399707ea22b3ab98e54798707729f7a5 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 26 May 2017 12:59:29 -0400 Subject: [PATCH 02/21] Bug 1364691 - don't use walk_convex_edges in Skia path rendering unless edge count is at least 2. r=mchang MozReview-Commit-ID: 8lN0tpqZIEh --- gfx/skia/skia/src/core/SkScan_AAAPath.cpp | 2 +- gfx/skia/skia/src/core/SkScan_Path.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/skia/skia/src/core/SkScan_AAAPath.cpp b/gfx/skia/skia/src/core/SkScan_AAAPath.cpp index d7c63ff3de6d..47e5bff69dc7 100644 --- a/gfx/skia/skia/src/core/SkScan_AAAPath.cpp +++ b/gfx/skia/skia/src/core/SkScan_AAAPath.cpp @@ -1682,7 +1682,7 @@ static SK_ALWAYS_INLINE void aaa_fill_path(const SkPath& path, const SkIRect& cl rightBound = SkTMin(rightBound, SkIntToFixed(ir.fRight)); } - if (!path.isInverseFillType() && path.isConvex()) { + if (!path.isInverseFillType() && path.isConvex() && count >= 2) { SkASSERT(count >= 2); // convex walker does not handle missing right edges aaa_walk_convex_edges(&headEdge, blitter, start_y, stop_y, leftBound, rightBound, isUsingMask); diff --git a/gfx/skia/skia/src/core/SkScan_Path.cpp b/gfx/skia/skia/src/core/SkScan_Path.cpp index 0415b2f99a82..d7dfc048ed7c 100644 --- a/gfx/skia/skia/src/core/SkScan_Path.cpp +++ b/gfx/skia/skia/src/core/SkScan_Path.cpp @@ -467,7 +467,7 @@ void sk_fill_path(const SkPath& path, const SkIRect& clipRect, SkBlitter* blitte proc = PrePostInverseBlitterProc; } - if (path.isConvex() && (nullptr == proc)) { + if (path.isConvex() && (nullptr == proc) && count >= 2) { SkASSERT(count >= 2); // convex walker does not handle missing right edges walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, nullptr); } else { From 02edabbff551b7b8f67f70394526f2a3ac5a1c67 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Wed, 24 May 2017 17:05:07 -0700 Subject: [PATCH 03/21] Bug 1367612 - (intersection-observer) Add missing dependencies to disabled web platform tests. r=jet --HG-- extra : rebase_source : ad5fe21d987337c60bab3be165c9c06210b87389 --- .../meta/intersection-observer/display-none.html.ini | 2 ++ .../meta/intersection-observer/multiple-thresholds.html.ini | 4 +++- .../meta/intersection-observer/root-margin.html.ini | 4 +++- .../meta/intersection-observer/same-document-no-root.html.ini | 4 +++- .../same-document-zero-size-target.html.ini | 4 +++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/testing/web-platform/meta/intersection-observer/display-none.html.ini b/testing/web-platform/meta/intersection-observer/display-none.html.ini index 3c93628f0380..a72f001a8a35 100644 --- a/testing/web-platform/meta/intersection-observer/display-none.html.ini +++ b/testing/web-platform/meta/intersection-observer/display-none.html.ini @@ -1,3 +1,5 @@ [display-none.html] type: testharness disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1358668 + [Intersecting notification after first rAF.] + disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359318 diff --git a/testing/web-platform/meta/intersection-observer/multiple-thresholds.html.ini b/testing/web-platform/meta/intersection-observer/multiple-thresholds.html.ini index b9023815d7bf..6abffe8b375c 100644 --- a/testing/web-platform/meta/intersection-observer/multiple-thresholds.html.ini +++ b/testing/web-platform/meta/intersection-observer/multiple-thresholds.html.ini @@ -1,3 +1,5 @@ [multiple-thresholds.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 + disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359318 + [First rAF.] + https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 diff --git a/testing/web-platform/meta/intersection-observer/root-margin.html.ini b/testing/web-platform/meta/intersection-observer/root-margin.html.ini index 6e5eab584983..b0fb59cbb25b 100644 --- a/testing/web-platform/meta/intersection-observer/root-margin.html.ini +++ b/testing/web-platform/meta/intersection-observer/root-margin.html.ini @@ -1,3 +1,5 @@ [root-margin.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 + disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359318 + [First rAF.] + https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 diff --git a/testing/web-platform/meta/intersection-observer/same-document-no-root.html.ini b/testing/web-platform/meta/intersection-observer/same-document-no-root.html.ini index 4d4f0a809ccf..703786596410 100644 --- a/testing/web-platform/meta/intersection-observer/same-document-no-root.html.ini +++ b/testing/web-platform/meta/intersection-observer/same-document-no-root.html.ini @@ -1,3 +1,5 @@ [same-document-no-root.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 + disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359318 + [First rAF.] + https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 diff --git a/testing/web-platform/meta/intersection-observer/same-document-zero-size-target.html.ini b/testing/web-platform/meta/intersection-observer/same-document-zero-size-target.html.ini index 06245a792a63..ec291157df7d 100644 --- a/testing/web-platform/meta/intersection-observer/same-document-zero-size-target.html.ini +++ b/testing/web-platform/meta/intersection-observer/same-document-zero-size-target.html.ini @@ -1,3 +1,5 @@ [same-document-zero-size-target.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 + disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359318 + [First rAF.] + https://bugzilla.mozilla.org/show_bug.cgi?id=1335644 From 6b78ec48000f4124cc8cdfa279d2cf6bda74bd0c Mon Sep 17 00:00:00 2001 From: Evan Tseng Date: Tue, 9 May 2017 17:00:45 -0400 Subject: [PATCH 04/21] Bug 1352481 - Add searchkeywords attributes for subdialog buttons and search the keywords in the searchWithinNode method. r=jaws MozReview-Commit-ID: HM6HPLM5wPj --HG-- extra : rebase_source : 951570dc5680a9463a40d507ae3df5f4335fb1d7 --- .../preferences/in-content/advanced.xul | 3 +- .../preferences/in-content/findInPage.js | 30 +++--- .../preferences/in-content/main.xul | 84 ++++++++++++++++- .../preferences/in-content/preferences.xul | 28 ++++++ .../preferences/in-content/privacy.js | 56 ++++++++++- .../preferences/in-content/privacy.xul | 94 ++++++++++++++++--- .../preferences/in-content/tests/browser.ini | 4 + ..._search_subdialogs_within_preferences_1.js | 53 +++++++++++ ..._search_subdialogs_within_preferences_2.js | 53 +++++++++++ ..._search_subdialogs_within_preferences_3.js | 53 +++++++++++ ..._search_subdialogs_within_preferences_4.js | 17 ++++ .../browser_search_within_preferences.js | 6 +- .../preferences/in-content/tests/head.js | 20 ++++ 13 files changed, 467 insertions(+), 34 deletions(-) create mode 100644 browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_1.js create mode 100644 browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_2.js create mode 100644 browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_3.js create mode 100644 browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_4.js diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul index e541b5e42bf2..2dccd4df318d 100644 --- a/browser/components/preferences/in-content/advanced.xul +++ b/browser/components/preferences/in-content/advanced.xul @@ -72,7 +72,8 @@ class="accessory-button" label="&updateHistory2.label;" accesskey="&updateHistory2.accesskey;" - preference="app.update.disable_button.showUpdateHistory"/> + preference="app.update.disable_button.showUpdateHistory" + searchkeywords="&history.title; &history.intro;"/> #endif diff --git a/browser/components/preferences/in-content/findInPage.js b/browser/components/preferences/in-content/findInPage.js index 6009416df1dc..baad7210e790 100644 --- a/browser/components/preferences/in-content/findInPage.js +++ b/browser/components/preferences/in-content/findInPage.js @@ -44,7 +44,7 @@ var gSearchResultsPane = { */ stringMatchesFilters(str, filter) { if (!filter || !str) { - return true; + return false; } let searchStr = str.toLowerCase(); let filterStrings = filter.toLowerCase().split(/\s+/); @@ -282,8 +282,6 @@ var gSearchResultsPane = { let nodeSizes = []; let allNodeText = ""; let runningSize = 0; - let labelResult = false; - let valueResult = false; let accessKeyTextNodes = this.textNodeDescendants(nodeObject.boxObject); for (let node of accessKeyTextNodes) { @@ -296,9 +294,7 @@ var gSearchResultsPane = { let complexTextNodesResult = this.highlightMatches(accessKeyTextNodes, nodeSizes, allNodeText.toLowerCase(), searchPhrase); // Searching some elements, such as xul:button, have a 'label' attribute that contains the user-visible text. - if (nodeObject.getAttribute("label")) { - labelResult = this.stringMatchesFilters(nodeObject.getAttribute("label"), searchPhrase); - } + let labelResult = this.stringMatchesFilters(nodeObject.getAttribute("label"), searchPhrase); // Creating tooltips for buttons if (labelResult && nodeObject.tagName === "button") { @@ -306,20 +302,26 @@ var gSearchResultsPane = { } // Searching some elements, such as xul:label, store their user-visible text in a "value" attribute. - if (nodeObject.getAttribute("value")) { - valueResult = this.stringMatchesFilters(nodeObject.getAttribute("value"), searchPhrase); - } - - if (nodeObject.tagName == "button" && (labelResult || valueResult)) { - nodeObject.setAttribute("highlightable", "true"); - } + let valueResult = this.stringMatchesFilters(nodeObject.getAttribute("value"), searchPhrase); // Creating tooltips for buttons if (valueResult && nodeObject.tagName === "button") { this.listSearchTooltips.push(nodeObject); } - matchesFound = matchesFound || complexTextNodesResult || labelResult || valueResult; + // Searching some elements, such as xul:button, buttons to open subdialogs. + let keywordsResult = this.stringMatchesFilters(nodeObject.getAttribute("searchkeywords"), searchPhrase); + + // Creating tooltips for buttons + if (keywordsResult && nodeObject.tagName === "button") { + this.listSearchTooltips.push(nodeObject); + } + + if (nodeObject.tagName == "button" && (labelResult || valueResult || keywordsResult)) { + nodeObject.setAttribute("highlightable", "true"); + } + + matchesFound = matchesFound || complexTextNodesResult || labelResult || valueResult || keywordsResult; } for (let i = 0; i < nodeObject.childNodes.length; i++) { diff --git a/browser/components/preferences/in-content/main.xul b/browser/components/preferences/in-content/main.xul index 720a884d34da..1b844f04234f 100644 --- a/browser/components/preferences/in-content/main.xul +++ b/browser/components/preferences/in-content/main.xul @@ -315,7 +315,8 @@ class="content-cell-item" label="&chooseBookmark.label;" accesskey="&chooseBookmark.accesskey;" - preference="pref.browser.homepage.disable_button.bookmark_page"/> + preference="pref.browser.homepage.disable_button.bookmark_page" + searchkeywords="&selectBookmark.title; &selectBookmark.label;"/>