diff --git a/accessible/android/AccessibleWrap.cpp b/accessible/android/AccessibleWrap.cpp index 4d43c0958d6d..f729154b2cc3 100644 --- a/accessible/android/AccessibleWrap.cpp +++ b/accessible/android/AccessibleWrap.cpp @@ -187,6 +187,21 @@ void AccessibleWrap::Shutdown() { Accessible::Shutdown(); } +bool AccessibleWrap::DoAction(uint8_t aIndex) const { + if (ActionCount()) { + return Accessible::DoAction(aIndex); + } + + if (mContent) { + // We still simulate a click on an accessible even if there is no + // known actions. For the sake of bad markup. + DoCommand(); + return true; + } + + return false; +} + int32_t AccessibleWrap::AcquireID() { return sIDSet.GetID(); } void AccessibleWrap::ReleaseID(int32_t aID) { sIDSet.ReleaseID(aID); } @@ -214,7 +229,8 @@ bool AccessibleWrap::GetSelectionBounds(int32_t* aStartOffset, return false; } -uint32_t AccessibleWrap::GetFlags(role aRole, uint64_t aState) { +uint32_t AccessibleWrap::GetFlags(role aRole, uint64_t aState, + uint8_t aActionCount) { uint32_t flags = 0; if (aState & states::CHECKABLE) { flags |= java::SessionAccessibility::FLAG_CHECKABLE; @@ -232,7 +248,7 @@ uint32_t AccessibleWrap::GetFlags(role aRole, uint64_t aState) { flags |= java::SessionAccessibility::FLAG_EDITABLE; } - if (aState & states::SENSITIVE) { + if (aActionCount && aRole != roles::TEXT_LEAF) { flags |= java::SessionAccessibility::FLAG_CLICKABLE; } @@ -396,15 +412,16 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle() { nsCOMPtr attributes = Attributes(); - return ToBundle(State(), Bounds(), name, textValue, nodeID, curValue, - minValue, maxValue, step, attributes); + return ToBundle(State(), Bounds(), ActionCount(), name, textValue, nodeID, + curValue, minValue, maxValue, step, attributes); } mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle( - const uint64_t aState, const nsIntRect& aBounds, const nsString& aName, - const nsString& aTextValue, const nsString& aDOMNodeID, - const double& aCurVal, const double& aMinVal, const double& aMaxVal, - const double& aStep, nsIPersistentProperties* aAttributes) { + const uint64_t aState, const nsIntRect& aBounds, const uint8_t aActionCount, + const nsString& aName, const nsString& aTextValue, + const nsString& aDOMNodeID, const double& aCurVal, const double& aMinVal, + const double& aMaxVal, const double& aStep, + nsIPersistentProperties* aAttributes) { if (!IsProxy() && IsDefunct()) { return nullptr; } @@ -418,7 +435,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle( java::sdk::Integer::ValueOf(parent ? parent->VirtualViewID() : 0)); role role = WrapperRole(); - uint32_t flags = GetFlags(role, aState); + uint32_t flags = GetFlags(role, aState, aActionCount); GECKOBUNDLE_PUT(nodeInfo, "flags", java::sdk::Integer::ValueOf(flags)); GECKOBUNDLE_PUT(nodeInfo, "className", java::sdk::Integer::ValueOf(AndroidClass())); @@ -556,11 +573,12 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle( } mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToSmallBundle() { - return ToSmallBundle(State(), Bounds()); + return ToSmallBundle(State(), Bounds(), ActionCount()); } mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToSmallBundle( - const uint64_t aState, const nsIntRect& aBounds) { + const uint64_t aState, const nsIntRect& aBounds, + const uint8_t aActionCount) { GECKOBUNDLE_START(nodeInfo); GECKOBUNDLE_PUT(nodeInfo, "id", java::sdk::Integer::ValueOf(VirtualViewID())); @@ -569,7 +587,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToSmallBundle( nodeInfo, "parentId", java::sdk::Integer::ValueOf(parent ? parent->VirtualViewID() : 0)); - uint32_t flags = GetFlags(WrapperRole(), aState); + uint32_t flags = GetFlags(WrapperRole(), aState, aActionCount); GECKOBUNDLE_PUT(nodeInfo, "flags", java::sdk::Integer::ValueOf(flags)); GECKOBUNDLE_PUT(nodeInfo, "className", java::sdk::Integer::ValueOf(AndroidClass())); diff --git a/accessible/android/AccessibleWrap.h b/accessible/android/AccessibleWrap.h index 3c0658b28638..32a9c88cb147 100644 --- a/accessible/android/AccessibleWrap.h +++ b/accessible/android/AccessibleWrap.h @@ -20,8 +20,11 @@ class AccessibleWrap : public Accessible { virtual ~AccessibleWrap(); virtual nsresult HandleAccEvent(AccEvent* aEvent) override; + virtual void Shutdown() override; + virtual bool DoAction(uint8_t aIndex) const override; + int32_t VirtualViewID() const { return mID; } virtual void SetTextContents(const nsAString& aText); @@ -33,13 +36,15 @@ class AccessibleWrap : public Accessible { mozilla::java::GeckoBundle::LocalRef ToBundle(); mozilla::java::GeckoBundle::LocalRef ToBundle( - const uint64_t aState, const nsIntRect& aBounds, const nsString& aName, + const uint64_t aState, const nsIntRect& aBounds, + const uint8_t aActionCount, const nsString& aName, const nsString& aTextValue, const nsString& aDOMNodeID, const double& aCurVal, const double& aMinVal, const double& aMaxVal, const double& aStep, nsIPersistentProperties* aAttributes); - mozilla::java::GeckoBundle::LocalRef ToSmallBundle(const uint64_t aState, - const nsIntRect& aBounds); + mozilla::java::GeckoBundle::LocalRef ToSmallBundle( + const uint64_t aState, const nsIntRect& aBounds, + const uint8_t aActionCount); mozilla::java::GeckoBundle::LocalRef ToSmallBundle(); @@ -78,7 +83,7 @@ class AccessibleWrap : public Accessible { static void GetRoleDescription(role aRole, nsAString& aGeckoRole, nsAString& aRoleDescription); - static uint32_t GetFlags(role aRole, uint64_t aState); + static uint32_t GetFlags(role aRole, uint64_t aState, uint8_t aActionCount); }; static inline AccessibleWrap* WrapperFor(const ProxyAccessible* aProxy) { diff --git a/accessible/android/DocAccessibleWrap.cpp b/accessible/android/DocAccessibleWrap.cpp index 80ac0ed8cf81..466e51a23384 100644 --- a/accessible/android/DocAccessibleWrap.cpp +++ b/accessible/android/DocAccessibleWrap.cpp @@ -134,10 +134,10 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer, : reinterpret_cast(accessible->UniqueID()); cacheData.AppendElement( BatchData(accessible->Document()->IPCDoc(), uid, accessible->State(), - accessible->Bounds(), nsString(), nsString(), nsString(), + accessible->Bounds(), accessible->ActionCount(), nsString(), + nsString(), nsString(), UnspecifiedNaN(), UnspecifiedNaN(), UnspecifiedNaN(), - UnspecifiedNaN(), UnspecifiedNaN(), - nsTArray())); + UnspecifiedNaN(), nsTArray())); } ipcDoc->SendBatch(eBatch_Viewport, cacheData); @@ -199,10 +199,10 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) { nsCOMPtr props = acc->Attributes(); nsTArray attributes; nsAccUtils::PersistentPropertiesToArray(props, &attributes); - cacheData.AppendElement( - BatchData(acc->Document()->IPCDoc(), uid, acc->State(), acc->Bounds(), - name, textValue, nodeID, acc->CurValue(), acc->MinValue(), - acc->MaxValue(), acc->Step(), attributes)); + cacheData.AppendElement(BatchData( + acc->Document()->IPCDoc(), uid, acc->State(), acc->Bounds(), + acc->ActionCount(), name, textValue, nodeID, acc->CurValue(), + acc->MinValue(), acc->MaxValue(), acc->Step(), attributes)); mFocusPath.Put(acc->UniqueID(), acc); } @@ -233,7 +233,7 @@ void DocAccessibleWrap::UpdateFocusPathBounds() { ? 0 : reinterpret_cast(accessible->UniqueID()); boundsData.AppendElement(BatchData( - accessible->Document()->IPCDoc(), uid, 0, accessible->Bounds(), + accessible->Document()->IPCDoc(), uid, 0, accessible->Bounds(), 0, nsString(), nsString(), nsString(), UnspecifiedNaN(), UnspecifiedNaN(), UnspecifiedNaN(), UnspecifiedNaN(), nsTArray())); diff --git a/accessible/android/ProxyAccessibleWrap.cpp b/accessible/android/ProxyAccessibleWrap.cpp index d8ff602d42aa..c19e4a3febbd 100644 --- a/accessible/android/ProxyAccessibleWrap.cpp +++ b/accessible/android/ProxyAccessibleWrap.cpp @@ -80,6 +80,18 @@ void ProxyAccessibleWrap::ScrollTo(uint32_t aHow) const { Proxy()->ScrollTo(aHow); } +uint8_t +ProxyAccessibleWrap::ActionCount() const +{ + return Proxy()->ActionCount(); +} + +bool +ProxyAccessibleWrap::DoAction(uint8_t aIndex) const +{ + return Proxy()->DoAction(aIndex); +} + // Other void ProxyAccessibleWrap::SetTextContents(const nsAString& aText) { diff --git a/accessible/android/ProxyAccessibleWrap.h b/accessible/android/ProxyAccessibleWrap.h index ee2d6f4b348f..3eff3860b8f0 100644 --- a/accessible/android/ProxyAccessibleWrap.h +++ b/accessible/android/ProxyAccessibleWrap.h @@ -45,6 +45,10 @@ class ProxyAccessibleWrap : public AccessibleWrap { virtual void ScrollTo(uint32_t aHow) const override; + virtual uint8_t ActionCount() const override; + + virtual bool DoAction(uint8_t aIndex) const override; + // AccessibleWrap virtual void SetTextContents(const nsAString& aText) override; diff --git a/accessible/android/SessionAccessibility.cpp b/accessible/android/SessionAccessibility.cpp index de1f43d84ae5..75f580a8150f 100644 --- a/accessible/android/SessionAccessibility.cpp +++ b/accessible/android/SessionAccessibility.cpp @@ -106,6 +106,17 @@ void SessionAccessibility::SetText(int32_t aID, jni::String::Param aText) { } } +void SessionAccessibility::Click(int32_t aID) { + if (RootAccessibleWrap* rootAcc = GetRoot()) { + AccessibleWrap* acc = rootAcc->FindAccessibleById(aID); + if (!acc) { + return; + } + + acc->DoAction(0); + } +} + SessionAccessibility* SessionAccessibility::GetInstanceFor( ProxyAccessible* aAccessible) { auto tab = static_cast(aAccessible->Document()->Manager()); @@ -321,7 +332,7 @@ void SessionAccessibility::ReplaceViewportCache( AccessibleWrap* acc = aAccessibles.ElementAt(i); if (aData.Length() == aAccessibles.Length()) { const BatchData& data = aData.ElementAt(i); - auto bundle = acc->ToSmallBundle(data.State(), data.Bounds()); + auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount()); infos->SetElement(i, bundle); } else { infos->SetElement(i, acc->ToSmallBundle()); @@ -341,10 +352,10 @@ void SessionAccessibility::ReplaceFocusPathCache( const BatchData& data = aData.ElementAt(i); nsCOMPtr props = AccessibleWrap::AttributeArrayToProperties(data.Attributes()); - auto bundle = - acc->ToBundle(data.State(), data.Bounds(), data.Name(), - data.TextValue(), data.DOMNodeID(), data.CurValue(), - data.MinValue(), data.MaxValue(), data.Step(), props); + auto bundle = acc->ToBundle( + data.State(), data.Bounds(), data.ActionCount(), data.Name(), + data.TextValue(), data.DOMNodeID(), data.CurValue(), data.MinValue(), + data.MaxValue(), data.Step(), props); infos->SetElement(i, bundle); } else { infos->SetElement(i, acc->ToBundle()); @@ -362,7 +373,7 @@ void SessionAccessibility::UpdateCachedBounds( AccessibleWrap* acc = aAccessibles.ElementAt(i); if (aData.Length() == aAccessibles.Length()) { const BatchData& data = aData.ElementAt(i); - auto bundle = acc->ToSmallBundle(data.State(), data.Bounds()); + auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount()); infos->SetElement(i, bundle); } else { infos->SetElement(i, acc->ToSmallBundle()); diff --git a/accessible/android/SessionAccessibility.h b/accessible/android/SessionAccessibility.h index 7be515ff3016..fe6494c24225 100644 --- a/accessible/android/SessionAccessibility.h +++ b/accessible/android/SessionAccessibility.h @@ -75,6 +75,7 @@ class SessionAccessibility final using Base::DisposeNative; jni::Object::LocalRef GetNodeInfo(int32_t aID); void SetText(int32_t aID, jni::String::Param aText); + void Click(int32_t aID); void StartNativeAccessibility(); // Event methods diff --git a/accessible/ipc/other/PDocAccessible.ipdl b/accessible/ipc/other/PDocAccessible.ipdl index b29aa06017ca..adcb103cff02 100644 --- a/accessible/ipc/other/PDocAccessible.ipdl +++ b/accessible/ipc/other/PDocAccessible.ipdl @@ -36,6 +36,7 @@ struct BatchData uint64_t ID; uint64_t State; nsIntRect Bounds; + uint8_t ActionCount; nsString Name; nsString TextValue; nsString DOMNodeID; diff --git a/accessible/jsat/AccessFu.jsm b/accessible/jsat/AccessFu.jsm index 8458eb7f3f60..0e38c2ec2e25 100644 --- a/accessible/jsat/AccessFu.jsm +++ b/accessible/jsat/AccessFu.jsm @@ -26,7 +26,6 @@ const GECKOVIEW_MESSAGE = { PREVIOUS: "GeckoView:AccessibilityPrevious", SCROLL_BACKWARD: "GeckoView:AccessibilityScrollBackward", SCROLL_FORWARD: "GeckoView:AccessibilityScrollForward", - SELECT: "GeckoView:AccessibilitySelect", SET_SELECTION: "GeckoView:AccessibilitySetSelection", VIEW_FOCUSED: "GeckoView:AccessibilityViewFocused", }; @@ -192,9 +191,6 @@ var AccessFu = { case GECKOVIEW_MESSAGE.CLIPBOARD: this.Input.clipboard(data); break; - case GECKOVIEW_MESSAGE.SELECT: - this.Input.selectCurrent(data); - break; } }, @@ -301,11 +297,6 @@ var Input = { mm.sendAsyncMessage("AccessFu:Activate", { offset: 0 }); }, - selectCurrent: function selectCurrent(aData) { - let mm = Utils.getMessageManager(); - mm.sendAsyncMessage("AccessFu:Select", aData); - }, - doScroll: function doScroll(aDetails, aBrowser) { let horizontal = aDetails.horizontal; let page = aDetails.page; diff --git a/accessible/jsat/ContentControl.jsm b/accessible/jsat/ContentControl.jsm index 156a4612f27f..60ace03b6a00 100644 --- a/accessible/jsat/ContentControl.jsm +++ b/accessible/jsat/ContentControl.jsm @@ -39,7 +39,6 @@ this.ContentControl.prototype = { "AccessFu:MoveByGranularity", "AccessFu:MoveCursor", "AccessFu:MoveToPoint", - "AccessFu:Select", "AccessFu:SetSelection"], start: function cc_start() { @@ -176,16 +175,6 @@ this.ContentControl.prototype = { this.autoMove(null, aMessage.json); }, - handleSelect: function cc_handleSelect(aMessage) { - const vc = this.vc; - if (!this.sendToChild(vc, aMessage, null, true)) { - const acc = vc.position; - if (Utils.getState(acc).contains(States.SELECTABLE)) { - this.handleActivate(aMessage); - } - } - }, - handleActivate: function cc_handleActivate(aMessage) { let activateAccessible = (aAccessible) => { Logger.debug(() => { diff --git a/build/debian-packages/valgrind-wheezy.diff b/build/debian-packages/valgrind-wheezy.diff index 60a91d58edde..0227aa710126 100644 --- a/build/debian-packages/valgrind-wheezy.diff +++ b/build/debian-packages/valgrind-wheezy.diff @@ -1,7 +1,14 @@ diff -Nru valgrind-3.14.0/debian/changelog valgrind-3.14.0/debian/changelog --- valgrind-3.14.0/debian/changelog 2018-11-15 09:21:43.000000000 +0900 -+++ valgrind-3.14.0/debian/changelog 2018-11-15 11:45:25.000000000 +0900 -@@ -1,3 +1,14 @@ ++++ valgrind-3.14.0/debian/changelog 2018-11-30 15:20:10.000000000 +0900 +@@ -1,3 +1,21 @@ ++valgrind (1:3.14.0-1.deb7moz2) wheezy; urgency=medium ++ ++ * debian/patches/vg401112: Cherry-pick upstream revision ++ f2c03ce3babe51eecbf03735f726c4028a162857. ++ ++ -- Mike Hommey Fri, 30 Nov 2018 15:20:10 +0900 ++ +valgrind (1:3.14.0-1.deb7moz1) wheezy; urgency=medium + + * Mozilla backport for wheezy. @@ -35,6 +42,165 @@ diff -Nru valgrind-3.14.0/debian/control valgrind-3.14.0/debian/control gdb, gcc-multilib [amd64], libc6-dev-i386 [amd64], +diff -Nru valgrind-3.14.0/debian/patches/series valgrind-3.14.0/debian/patches/series +--- valgrind-3.14.0/debian/patches/series 2018-11-15 09:21:43.000000000 +0900 ++++ valgrind-3.14.0/debian/patches/series 2018-11-30 15:19:14.000000000 +0900 +@@ -5,3 +5,4 @@ + 08_fix-spelling-in-manpage.patch + 09_fix-armhf-detect.patch + 10_mpi-pkg-config.patch ++vg401112 +diff -Nru valgrind-3.14.0/debian/patches/vg401112 valgrind-3.14.0/debian/patches/vg401112 +--- valgrind-3.14.0/debian/patches/vg401112 1970-01-01 09:00:00.000000000 +0900 ++++ valgrind-3.14.0/debian/patches/vg401112 2018-11-30 15:19:46.000000000 +0900 +@@ -0,0 +1,147 @@ ++From f2c03ce3babe51eecbf03735f726c4028a162857 Mon Sep 17 00:00:00 2001 ++From: Julian Seward ++Date: Wed, 28 Nov 2018 14:15:06 +0100 ++Subject: [PATCH] Bug 401112 - LLVM 5.0 generates comparison against partially ++ initialized data. ++ ++This generalises the existing spec rules for W of 32 bits: ++ ++ W Iex.Const.con->Ico.U64 == n; ++ } ++ ++-/* Returns N if E is an immediate of the form 1 << N for N in 1 to 31, +++/* Returns N if W64 is a value of the form 1 << N for N in 1 to 31, ++ and zero in any other case. */ ++-static Int isU64_1_shl_N ( IRExpr* e ) +++static Int isU64_1_shl_N_literal ( ULong w64 ) ++ { ++- if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64) ++- return 0; ++- ULong w64 = e->Iex.Const.con->Ico.U64; ++ if (w64 < (1ULL << 1) || w64 > (1ULL << 31)) ++ return 0; ++ if ((w64 & (w64 - 1)) != 0) ++@@ -1036,6 +1033,30 @@ static Int isU64_1_shl_N ( IRExpr* e ) ++ return 0; ++ } ++ +++/* Returns N if E is an immediate of the form 1 << N for N in 1 to 31, +++ and zero in any other case. */ +++static Int isU64_1_shl_N ( IRExpr* e ) +++{ +++ if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64) +++ return 0; +++ ULong w64 = e->Iex.Const.con->Ico.U64; +++ return isU64_1_shl_N_literal(w64); +++} +++ +++/* Returns N if E is an immediate of the form (1 << N) - 1 for N in 1 to 31, +++ and zero in any other case. */ +++static Int isU64_1_shl_N_minus_1 ( IRExpr* e ) +++{ +++ if (e->tag != Iex_Const || e->Iex.Const.con->tag != Ico_U64) +++ return 0; +++ ULong w64 = e->Iex.Const.con->Ico.U64; +++ // This isn't actually necessary since isU64_1_shl_N_literal will return +++ // zero given a zero argument, but still .. +++ if (w64 == 0xFFFFFFFFFFFFFFFFULL) +++ return 0; +++ return isU64_1_shl_N_literal(w64 + 1); +++} +++ ++ IRExpr* guest_amd64_spechelper ( const HChar* function_name, ++ IRExpr** args, ++ IRStmt** precedingStmts, ++@@ -1258,32 +1279,51 @@ IRExpr* guest_amd64_spechelper ( const HChar* function_name, ++ /* It appears that LLVM 5.0 and later have a new way to find out ++ whether the top N bits of a word W are all zero, by computing ++ ++- W 0) { ++- /* long sub/cmp, then B (unsigned less than), ++- where dep2 is a power of 2: ++- -> CmpLT32(dep1, 1 << N) ++- -> CmpEQ32(dep1 >>u N, 0) ++- and ++- long sub/cmp, then NB (unsigned greater than or equal), ++- where dep2 is a power of 2: ++- -> CmpGE32(dep1, 1 << N) ++- -> CmpNE32(dep1 >>u N, 0) ++- This avoids CmpLT32U/CmpGE32U being applied to potentially ++- uninitialised bits in the area being shifted out. */ +++ Bool is_NB_or_NBE = False; +++ if (isU64(cc_op, AMD64G_CC_OP_SUBL)) { +++ if (isU64(cond, AMD64CondB) || isU64(cond, AMD64CondNB)) { +++ /* long sub/cmp, then B (unsigned less than), +++ where dep2 is a power of 2: +++ -> CmpLT32U(dep1, 1 << N) +++ -> CmpEQ32(dep1 >>u N, 0) +++ and +++ long sub/cmp, then NB (unsigned greater than or equal), +++ where dep2 is a power of 2: +++ -> CmpGE32U(dep1, 1 << N) +++ -> CmpNE32(dep1 >>u N, 0) +++ This avoids CmpLT32U/CmpGE32U being applied to potentially +++ uninitialised bits in the area being shifted out. */ +++ n = isU64_1_shl_N(cc_dep2); +++ is_NB_or_NBE = isU64(cond, AMD64CondNB); +++ } else if (isU64(cond, AMD64CondBE) || isU64(cond, AMD64CondNBE)) { +++ /* long sub/cmp, then BE (unsigned less than or equal), +++ where dep2 is a power of 2 minus 1: +++ -> CmpLE32U(dep1, (1 << N) - 1) +++ -> CmpEQ32(dep1 >>u N, 0) +++ and +++ long sub/cmp, then NBE (unsigned greater than), +++ where dep2 is a power of 2 minus 1: +++ -> CmpGT32U(dep1, (1 << N) - 1) +++ -> CmpNE32(dep1 >>u N, 0) +++ This avoids CmpLE32U/CmpGT32U being applied to potentially +++ uninitialised bits in the area being shifted out. */ +++ n = isU64_1_shl_N_minus_1(cc_dep2); +++ is_NB_or_NBE = isU64(cond, AMD64CondNBE); +++ } +++ } +++ if (n > 0) { ++ vassert(n >= 1 && n <= 31); ++- Bool isNB = isU64(cond, AMD64CondNB); ++ return unop(Iop_1Uto64, ++- binop(isNB ? Iop_CmpNE32 : Iop_CmpEQ32, +++ binop(is_NB_or_NBE ? Iop_CmpNE32 : Iop_CmpEQ32, ++ binop(Iop_Shr32, unop(Iop_64to32, cc_dep1), ++ mkU8(n)), ++ mkU32(0))); ++-- ++2.9.3 ++ diff -Nru valgrind-3.14.0/debian/rules valgrind-3.14.0/debian/rules --- valgrind-3.14.0/debian/rules 2018-11-15 09:21:43.000000000 +0900 +++ valgrind-3.14.0/debian/rules 2018-11-15 11:45:25.000000000 +0900 diff --git a/dom/locales/en-US/chrome/plugins.properties b/dom/locales/en-US/chrome/plugins.properties index 63ce2914ad6f..62e37cbb4cb8 100644 --- a/dom/locales/en-US/chrome/plugins.properties +++ b/dom/locales/en-US/chrome/plugins.properties @@ -2,28 +2,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -# LOCALIZATION NOTE: -# Those strings are inserted into an HTML page, so all HTML characters -# have to be escaped in a way that they show up correctly in HTML! - -title_label=About Plugins -installedplugins_label=Installed plugins -nopluginsareinstalled_label=No installed plugins found -findpluginupdates_label=Find updates for installed plugins at -file_label=File: -path_label=Path: -version_label=Version: -state_label=State: -state_enabled=Enabled -state_disabled=Disabled -mimetype_label=MIME Type -description_label=Description -suffixes_label=Suffixes -learn_more_label=Learn More - -deprecation_description=Missing something? Some plugins are no longer supported. -deprecation_learn_more=Learn More. - # GMP Plugins gmp_license_info=License information gmp_privacy_info=Privacy Information diff --git a/dom/media/mp4/DecoderData.cpp b/dom/media/mp4/DecoderData.cpp index f46f0987e4bb..377c201652d8 100644 --- a/dom/media/mp4/DecoderData.cpp +++ b/dom/media/mp4/DecoderData.cpp @@ -87,13 +87,12 @@ void MP4AudioInfo::Update(const Mp4parseTrackInfo* track, mRate = audio->sample_rate; mChannels = audio->channels; mBitDepth = audio->bit_depth; - mExtendedProfile = audio->profile; + mExtendedProfile = audio->extended_profile; mDuration = TimeUnit::FromMicroseconds(track->duration); mMediaTime = TimeUnit::FromMicroseconds(track->media_time); mTrackId = track->track_id; // In stagefright, mProfile is kKeyAACProfile, mExtendedProfile is kKeyAACAOT. - // Both are from audioObjectType in AudioSpecificConfig. if (audio->profile <= 4) { mProfile = audio->profile; } diff --git a/dom/push/test/test_has_permissions.html b/dom/push/test/test_has_permissions.html index 5d2d2425bfca..467678878a10 100644 --- a/dom/push/test/test_has_permissions.html +++ b/dom/push/test/test_has_permissions.html @@ -10,6 +10,7 @@ http://creativecommons.org/licenses/publicdomain/ Test for Bug 1038811 + @@ -28,56 +29,24 @@ http://creativecommons.org/licenses/publicdomain/ // console.log(str + "\n"); } - function start() { - return navigator.serviceWorker.register("worker.js" + "?" + (Math.random()), {scope: "."}) - .then((swr) => { - registration = swr; - return waitForActive(registration); - }); - } + add_task(async function start() { + await setupPrefsAndMockSocket(new MockWebSocket()); - function unregister() { - return registration.unregister().then(function(result) { - ok(result, "Unregister should return true."); - }, function(e) { - dump("Unregistering the SW failed with " + e + "\n"); - }); - } + var url = "worker.js" + "?" + Math.random(); + registration = await navigator.serviceWorker.register(url, {scope: "."}); + await waitForActive(registration); + }); - function hasPermission(swr) { - var p = new Promise(function(res, rej) { - swr.pushManager.permissionState().then( - function(state) { - debug("state: " + state); - ok(["granted", "denied", "prompt"].includes(state), "permissionState() returned a valid state."); - res(swr); - }, function(error) { - ok(false, "permissionState() failed."); - res(swr); - } - ); - }); - return p; - } + add_task(async function hasPermission() { + var state = await registration.pushManager.permissionState(); + debug("state: " + state); + ok(["granted", "denied", "prompt"].includes(state), "permissionState() returned a valid state."); + }); - function runTest() { - start() - .then(hasPermission) - .then(unregister) - .catch(function(e) { - ok(false, "Some test failed with error " + e); - }).then(SimpleTest.finish); - } - - SpecialPowers.addPermission("desktop-notification", false, document); - SpecialPowers.pushPrefEnv({"set": [ - ["dom.push.enabled", true], - ["dom.push.connection.enabled", true], - ["dom.serviceWorkers.exemptFromPerDomainMax", true], - ["dom.serviceWorkers.enabled", true], - ["dom.serviceWorkers.testing.enabled", true] - ]}, runTest); - SimpleTest.waitForExplicitFinish(); + add_task(async function unregister() { + var result = await registration.unregister(); + ok(result, "Unregister should return true."); + }); diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp index 54a9db1cc19f..61316c980440 100644 --- a/layout/base/MobileViewportManager.cpp +++ b/layout/base/MobileViewportManager.cpp @@ -280,10 +280,9 @@ void MobileViewportManager::UpdateResolution( // (a) The meta-viewport tag information changes, and so the CSS viewport // might change as a result. If this happens after the content has // been painted, we want to adjust the zoom to compensate. OR - // (b) The display size changed from a nonzero value to another nonzero - // value. - // This covers the case where e.g. the device was rotated, and again - // we want to adjust the zoom to compensate. + // (b) The display size changed from a nonzero value to another + // nonzero value. This covers the case where e.g. the device was + // rotated, and again we want to adjust the zoom to compensate. // Note in particular that aDisplayWidthChangeRatio will be None if all // that happened was a change in the full-zoom. In this case, we still // want to compute a new CSS viewport, but we don't want to update the @@ -292,14 +291,11 @@ void MobileViewportManager::UpdateResolution( // Given the above, the algorithm below accounts for all types of changes // I can conceive of: // 1. screen size changes, CSS viewport does not (pages with no meta - // viewport - // or a fixed size viewport) + // viewport or a fixed size viewport) // 2. screen size changes, CSS viewport also does (pages with a - // device-width - // viewport) + // device-width viewport) // 3. screen size remains constant, but CSS viewport changes (meta - // viewport - // tag is added or removed) + // viewport tag is added or removed) // 4. neither screen size nor CSS viewport changes if (aDisplayWidthChangeRatio) { newZoom = Some( diff --git a/layout/base/MobileViewportManager.h b/layout/base/MobileViewportManager.h index 32bd668fa390..b7a32e197277 100644 --- a/layout/base/MobileViewportManager.h +++ b/layout/base/MobileViewportManager.h @@ -136,8 +136,8 @@ class MobileViewportManager final : public nsIDOMEventListener, const mozilla::ScreenIntSize& aDisplaySize); nsCOMPtr mDocument; - nsIPresShell* MOZ_NON_OWNING_REF - mPresShell; // raw ref since the presShell owns this + // raw ref since the presShell owns this + nsIPresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; bool mIsFirstPaint; bool mPainted; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index ecae24a413ac..db6986eb9b1d 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -364,11 +364,11 @@ class ReflowCountMgr { FILE* GetOutFile() { return mFD; } void SetPresContext(nsPresContext* aPresContext) { - mPresContext = aPresContext; - } // weak reference + mPresContext = aPresContext; // weak reference + } void SetPresShell(nsIPresShell* aPresShell) { - mPresShell = aPresShell; - } // weak reference + mPresShell = aPresShell; // weak reference + } void SetDumpFrameCounts(bool aVal) { mDumpFrameCounts = aVal; } void SetDumpFrameByFrameCounts(bool aVal) { mDumpFrameByFrameCounts = aVal; } @@ -706,16 +706,13 @@ static uint32_t sNextPresShellId; nsIPresShell::nsIPresShell() : mViewManager(nullptr), - mFrameManager(nullptr) + mFrameManager(nullptr), #ifdef ACCESSIBILITY - , - mDocAccessible(nullptr) + mDocAccessible(nullptr), #endif #ifdef DEBUG - , - mDrawEventTargetFrame(nullptr) + mDrawEventTargetFrame(nullptr), #endif - , mPaintCount(0), mAutoWeakFrames(nullptr), mCanvasBackgroundColor(NS_RGBA(0, 0, 0, 0)), @@ -754,17 +751,14 @@ nsIPresShell::nsIPresShell() } PresShell::PresShell() - : mCaretEnabled(false) + : mCaretEnabled(false), #ifdef DEBUG - , mInVerifyReflow(false), - mCurrentReflowRoot(nullptr) + mCurrentReflowRoot(nullptr), #endif #ifdef MOZ_REFLOW_PERF - , - mReflowCountMgr(nullptr) + mReflowCountMgr(nullptr), #endif - , mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE), mFirstCallbackEventRequest(nullptr), mLastCallbackEventRequest(nullptr), @@ -3917,12 +3911,22 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) { MOZ_ASSERT(NeedFlush(flushType), "Why did we get called?"); #ifdef MOZ_GECKO_PROFILER + // clang-format off static const EnumeratedArray - flushTypeNames = {"", "Event", "Content", "ContentAndNotify", - // As far as the profiler is concerned, - // EnsurePresShellInitAndFrames and Frames are the same - "Style", "Style", "InterruptibleLayout", "Layout", - "Display"}; + flushTypeNames = { + "", + "Event", + "Content", + "ContentAndNotify", + // As far as the profiler is concerned, EnsurePresShellInitAndFrames and + // Frames are the same + "Style", + "Style", + "InterruptibleLayout", + "Layout", + "Display" + }; + // clang-format on AUTO_PROFILER_LABEL_DYNAMIC_CSTR("PresShell::DoFlushPendingNotifications", LAYOUT, flushTypeNames[flushType]); #endif @@ -9857,8 +9861,7 @@ void PresShell::UpdateViewportOverridden(bool aAfterInitialization) { } MOZ_ASSERT(mMobileViewportManager, - "Shouldn't reach this without a " - "MobileViewportManager."); + "Shouldn't reach this without a MobileViewportManager."); mMobileViewportManager->Destroy(); mMobileViewportManager = nullptr; diff --git a/layout/base/StaticPresData.cpp b/layout/base/StaticPresData.cpp index 96d33ac412a8..05609bafe246 100644 --- a/layout/base/StaticPresData.cpp +++ b/layout/base/StaticPresData.cpp @@ -37,9 +37,17 @@ StaticPresData::StaticPresData() { _pref.Assign(_s0); \ _pref.Append(_s1); +// clang-format off static const char* const kGenericFont[] = { - ".variable.", ".fixed.", ".serif.", ".sans-serif.", - ".monospace.", ".cursive.", ".fantasy."}; + ".variable.", + ".fixed.", + ".serif.", + ".sans-serif.", + ".monospace.", + ".cursive.", + ".fantasy." +}; +// clang-format on // These are private, use the list in nsFont.h if you want a public list. enum { @@ -61,12 +69,24 @@ void LangGroupFontPrefs::Initialize(nsAtom* aLangGroupAtom) { for the GFX font sub-system... -- attributes for generic fonts -------------------------------------- - font.default.[langGroup] = serif | sans-serif - fallback generic font - font.name.[generic].[langGroup] = current user' selected font on the pref - dialog font.name-list.[generic].[langGroup] = fontname1, fontname2, ... - [factory pre-built list] font.size.[generic].[langGroup] = integer - settable - by the user font.size-adjust.[generic].[langGroup] = "float" - settable by the - user font.minimum-size.[langGroup] = integer - settable by the user + + font.default.[langGroup] = serif | sans-serif + fallback generic font + + font.name.[generic].[langGroup] + current user' selected font on the pref dialog + + font.name-list.[generic].[langGroup] = fontname1, fontname2, ... + [factory pre-built list] + + font.size.[generic].[langGroup] = integer + settable by the user + + font.size-adjust.[generic].[langGroup] = "float" + settable by the user + + font.minimum-size.[langGroup] = integer + settable by the user */ nsAutoCString langGroup; @@ -84,10 +104,17 @@ void LangGroupFontPrefs::Initialize(nsAtom* aLangGroupAtom) { int32_t size = Preferences::GetInt(pref.get()); mMinimumFontSize = nsPresContext::CSSPixelsToAppUnits(size); - nsFont* fontTypes[] = {&mDefaultVariableFont, &mDefaultFixedFont, - &mDefaultSerifFont, &mDefaultSansSerifFont, - &mDefaultMonospaceFont, &mDefaultCursiveFont, - &mDefaultFantasyFont}; + // clang-format off + nsFont* fontTypes[] = { + &mDefaultVariableFont, + &mDefaultFixedFont, + &mDefaultSerifFont, + &mDefaultSansSerifFont, + &mDefaultMonospaceFont, + &mDefaultCursiveFont, + &mDefaultFantasyFont + }; + // clang-format on static_assert(MOZ_ARRAY_LENGTH(fontTypes) == eDefaultFont_COUNT, "FontTypes array count is not correct"); diff --git a/layout/base/ZoomConstraintsClient.h b/layout/base/ZoomConstraintsClient.h index e77ad2d58518..4ef68872527a 100644 --- a/layout/base/ZoomConstraintsClient.h +++ b/layout/base/ZoomConstraintsClient.h @@ -43,8 +43,8 @@ class ZoomConstraintsClient final : public nsIDOMEventListener, void RefreshZoomConstraints(); nsCOMPtr mDocument; - nsIPresShell* MOZ_NON_OWNING_REF - mPresShell; // raw ref since the presShell owns this + // raw ref since the presShell owns this + nsIPresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; mozilla::Maybe mGuid; }; diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index e5e3e9fb9ee5..ec9db2e19ece 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -51,8 +51,8 @@ static const char16_t kLRI = 0x2066; static const char16_t kRLI = 0x2067; static const char16_t kFSI = 0x2068; static const char16_t kPDI = 0x2069; +// All characters with Bidi type Segment Separator or Block Separator static const char16_t kSeparators[] = { - // All characters with Bidi type Segment Separator or Block Separator char16_t('\t'), char16_t('\r'), char16_t('\n'), char16_t(0xb), char16_t(0x1c), char16_t(0x1d), char16_t(0x1e), char16_t(0x1f), char16_t(0x85), char16_t(0x2029), char16_t(0)}; diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h index 846fd5b84df7..e9cf09fd6669 100644 --- a/layout/base/nsBidiPresUtils.h +++ b/layout/base/nsBidiPresUtils.h @@ -427,7 +427,7 @@ class nsBidiPresUtils { * direction, it's the distance to the end, * otherwise, it's the distance to the start. * @param aContinuationStates A map from nsIFrame* to - * nsFrameContinuationState + * nsFrameContinuationState * @return The isize aFrame takes, including margins. */ static nscoord RepositionFrame( @@ -443,7 +443,7 @@ class nsBidiPresUtils { * @param aFrame The frame which itself and its descendants will * be initialized * @param aContinuationStates A map from nsIFrame* to - * nsFrameContinuationState + * nsFrameContinuationState */ static void InitContinuationStates(nsIFrame* aFrame, nsContinuationStates* aContinuationStates); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 296516485cd8..8bf0c01731e9 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -320,9 +320,7 @@ static void AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild, } } #else -#define AssertAnonymousFlexOrGridItemParent(x, y) \ - do { /* nothing */ \ - } while (0) +#define AssertAnonymousFlexOrGridItemParent(x, y) PR_BEGIN_MACRO PR_END_MACRO #endif static inline nsContainerFrame* GetFieldSetBlockFrame( @@ -2576,9 +2574,8 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock( the root element. mDocElementContainingBlock is the parent of mRootElementFrame (i.e. nsCanvasFrame or nsRootBoxFrame) - mPageSequenceFrame is the nsSimplePageSequenceFrame, or null if there isn't - one + one */ // --------- CREATE ROOT FRAME ------- @@ -2589,8 +2586,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock( // The root frame serves two purposes: // - reserves space for any margins needed for the document element's frame // - renders the document element's background. This ensures the background - // covers - // the entire canvas as specified by the CSS2 spec + // covers the entire canvas as specified by the CSS2 spec nsPresContext* presContext = mPresShell->GetPresContext(); bool isPaginated = presContext->IsRootPaginatedDocument(); @@ -4185,7 +4181,7 @@ void nsCSSFrameConstructor::FinishBuildingScrollFrame( /** * Called to wrap a gfx scrollframe around a frame. The hierarchy will look like - *this + * this * * ------- for gfx scrollbars ------ * @@ -4196,27 +4192,29 @@ void nsCSSFrameConstructor::FinishBuildingScrollFrame( * Frame (scrolled frame you passed in) * * - *----------------------------------- + * ----------------------------------- * LEGEND: * * ScrollFrame: This is a frame that manages gfx cross platform frame based - *scrollbars. + * scrollbars. * * @param aContent the content node of the child to wrap. + * @param aScrolledFrame The frame of the content to wrap. This should not be - * Initialized. This method will initialize it with a - *scrolled pseudo and no nsIContent. The content will be attached to the - *scrollframe returned. + * Initialized. This method will initialize it with a scrolled pseudo and no + * nsIContent. The content will be attached to the scrollframe returned. + * @param aContentStyle the style that has already been resolved for the content - * being passed in. + * being passed in. * * @param aParentFrame The parent to attach the scroll frame to * * @param aNewFrame The new scrollframe or gfx scrollframe that we create. It - *will contain the scrolled frame you passed in. (returned) If this is not null, - *we'll just use it + * will contain the scrolled frame you passed in. (returned) If this is not + * null, we'll just use it + * * @param aScrolledContentStyle the style that was resolved for the scrolled - *frame. (returned) + * frame. (returned) */ void nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState, nsIContent* aContent, @@ -8692,29 +8690,29 @@ void nsCSSFrameConstructor::ShouldHaveSpecialBlockStyle( /* static */ const nsCSSFrameConstructor::PseudoParentData nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { - {// Cell - FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | + // Cell + {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow), &nsCSSFrameConstructor::ConstructTableCell), nsCSSAnonBoxes::tableCell()}, - {// Row - FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | + // Row + {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), nsCSSAnonBoxes::tableRow()}, - {// Row group - FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | + // Row group + {FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), nsCSSAnonBoxes::tableRowGroup()}, - {// Column group - FCDATA_DECL( + // Column group + {FCDATA_DECL( FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS | FCDATA_SKIP_ABSPOS_PUSH | @@ -8723,41 +8721,41 @@ const nsCSSFrameConstructor::PseudoParentData FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), NS_NewTableColGroupFrame), nsCSSAnonBoxes::tableColGroup()}, - {// Table - FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | + // Table + {FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX, &nsCSSFrameConstructor::ConstructTable), nsCSSAnonBoxes::table()}, - {// Ruby - FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_USE_CHILD_ITEMS | + // Ruby + {FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_SKIP_FRAMESET, NS_NewRubyFrame), nsCSSAnonBoxes::ruby()}, - {// Ruby Base - FCDATA_DECL( + // Ruby Base + {FCDATA_DECL( FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyBaseContainer) | FCDATA_SKIP_FRAMESET, NS_NewRubyBaseFrame), nsCSSAnonBoxes::rubyBase()}, - {// Ruby Base Container - FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT | + // Ruby Base Container + {FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) | FCDATA_SKIP_FRAMESET, NS_NewRubyBaseContainerFrame), nsCSSAnonBoxes::rubyBaseContainer()}, - {// Ruby Text - FCDATA_DECL( + // Ruby Text + {FCDATA_DECL( FCDATA_USE_CHILD_ITEMS | FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyTextContainer) | FCDATA_SKIP_FRAMESET, NS_NewRubyTextFrame), nsCSSAnonBoxes::rubyText()}, - {// Ruby Text Container - FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | + // Ruby Text Container + {FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) | FCDATA_SKIP_FRAMESET, NS_NewRubyTextContainerFrame), @@ -10923,10 +10921,9 @@ nsIFrame* nsCSSFrameConstructor::ConstructInline( // Initialize the frame InitAndRestoreFrame(aState, content, aParentFrame, newFrame); - nsFrameConstructorSaveState - absoluteSaveState; // definition cannot be inside next block - // because the object's destructor is significant - // this is part of the fix for bug 42372 + // definition cannot be inside next block because the object's destructor is + // significant. this is part of the fix for bug 42372 + nsFrameConstructorSaveState absoluteSaveState; bool isAbsPosCB = newFrame->IsAbsPosContainingBlock(); newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN); diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 71f1583c3f1e..0be70e97070e 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -1206,8 +1206,7 @@ class nsCSSFrameConstructor final : public nsFrameManager { void operator delete(void*) = delete; #endif void operator delete[](void*) = delete; - FrameConstructionItem(const FrameConstructionItem& aOther) = - delete; /* not implemented */ + FrameConstructionItem(const FrameConstructionItem& aOther) = delete; // Not allocated from the stack! ~FrameConstructionItem() { MOZ_COUNT_DTOR(FrameConstructionItem); @@ -1982,7 +1981,6 @@ class nsCSSFrameConstructor final : public nsFrameManager { void RecoverLetterFrames(nsContainerFrame* aBlockFrame); - // void RemoveLetterFrames(nsIPresShell* aPresShell, nsContainerFrame* aBlockFrame); diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index d7ee45f8598e..4d0e6674b5ce 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -669,15 +669,14 @@ nsresult nsCaret::GetCaretFrameForNodeOffset( std::min(levelBefore, levelAfter)); // rule c3 aBidiLevel = std::min(aBidiLevel, std::max(levelBefore, levelAfter)); // rule c4 - if (aBidiLevel == levelBefore // rule c1 - || (aBidiLevel > levelBefore && aBidiLevel < levelAfter && - IS_SAME_DIRECTION(aBidiLevel, levelBefore)) // rule c5 - || (aBidiLevel < levelBefore && aBidiLevel > levelAfter && - IS_SAME_DIRECTION(aBidiLevel, levelBefore))) // rule c9 + if (aBidiLevel == levelBefore || // rule c1 + (aBidiLevel > levelBefore && aBidiLevel < levelAfter && + IS_SAME_DIRECTION(aBidiLevel, levelBefore)) || // rule c5 + (aBidiLevel < levelBefore && aBidiLevel > levelAfter && + IS_SAME_DIRECTION(aBidiLevel, levelBefore))) // rule c9 { if (theFrame != frameBefore) { - if (frameBefore) // if there is a frameBefore, move into it - { + if (frameBefore) { // if there is a frameBefore, move into it theFrame = frameBefore; theFrame->GetOffsets(start, end); theFrameOffset = end; @@ -699,10 +698,9 @@ nsresult nsCaret::GetCaretFrameForNodeOffset( } } } - } else if (aBidiLevel == levelAfter // rule c2 - || (aBidiLevel > levelBefore && aBidiLevel < levelAfter && - IS_SAME_DIRECTION(aBidiLevel, levelAfter)) // rule c6 - || + } else if (aBidiLevel == levelAfter || // rule c2 + (aBidiLevel > levelBefore && aBidiLevel < levelAfter && + IS_SAME_DIRECTION(aBidiLevel, levelAfter)) || // rule c6 (aBidiLevel < levelBefore && aBidiLevel > levelAfter && IS_SAME_DIRECTION(aBidiLevel, levelAfter))) // rule c10 { @@ -732,15 +730,11 @@ nsresult nsCaret::GetCaretFrameForNodeOffset( } } } else if (aBidiLevel > levelBefore && - aBidiLevel < levelAfter // rule c7/8 - && - IS_SAME_DIRECTION( - levelBefore, - levelAfter) // before and after have the same parity - && - !IS_SAME_DIRECTION( - aBidiLevel, levelAfter)) // caret has different parity - { + aBidiLevel < levelAfter && // rule c7/8 + // before and after have the same parity + IS_SAME_DIRECTION(levelBefore, levelAfter) && + // caret has different parity + !IS_SAME_DIRECTION(aBidiLevel, levelAfter)) { if (NS_SUCCEEDED(aFrameSelection->GetFrameFromLevel( frameAfter, eDirNext, aBidiLevel, &theFrame))) { theFrame->GetOffsets(start, end); @@ -752,15 +746,11 @@ nsresult nsCaret::GetCaretFrameForNodeOffset( theFrameOffset = IS_LEVEL_RTL(levelAfter) ? end : start; } } else if (aBidiLevel < levelBefore && - aBidiLevel > levelAfter // rule c11/12 - && - IS_SAME_DIRECTION( - levelBefore, - levelAfter) // before and after have the same parity - && - !IS_SAME_DIRECTION( - aBidiLevel, levelAfter)) // caret has different parity - { + aBidiLevel > levelAfter && // rule c11/12 + // before and after have the same parity + IS_SAME_DIRECTION(levelBefore, levelAfter) && + // caret has different parity + !IS_SAME_DIRECTION(aBidiLevel, levelAfter)) { if (NS_SUCCEEDED(aFrameSelection->GetFrameFromLevel( frameBefore, eDirPrevious, aBidiLevel, &theFrame))) { theFrame->GetOffsets(start, end); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 5f2ea060d533..8f14dc3d1f08 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2138,8 +2138,8 @@ nsDocumentViewer::Show(void) { if (base_win) { base_win->GetParentWidget(&mParentWidget); if (mParentWidget) { - mParentWidget - ->Release(); // GetParentWidget AddRefs, but mParentWidget is weak + // GetParentWidget AddRefs, but mParentWidget is weak + mParentWidget->Release(); } } @@ -2558,9 +2558,9 @@ mozilla::dom::Selection* nsDocumentViewer::GetDocumentSelection() { return mPresShell->GetCurrentSelection(SelectionType::eNormal); } -/* ======================================================================================== +/* ============================================================================ * nsIContentViewerEdit - * ======================================================================================== + * ============================================================================ */ NS_IMETHODIMP nsDocumentViewer::ClearSelection() { diff --git a/layout/base/nsFrameTraversal.h b/layout/base/nsFrameTraversal.h index 8bbc312a2007..7223fef605df 100644 --- a/layout/base/nsFrameTraversal.h +++ b/layout/base/nsFrameTraversal.h @@ -3,6 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #ifndef NSFRAMETRAVERSAL_H #define NSFRAMETRAVERSAL_H diff --git a/layout/base/nsIDocumentViewerPrint.h b/layout/base/nsIDocumentViewerPrint.h index dd3ad4a37f80..e15368d027d2 100644 --- a/layout/base/nsIDocumentViewerPrint.h +++ b/layout/base/nsIDocumentViewerPrint.h @@ -3,6 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #ifndef nsIDocumentViewerPrint_h___ #define nsIDocumentViewerPrint_h___ diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 02695a1a6819..054616ff6b1b 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -698,38 +698,37 @@ class nsIPresShell : public nsStubDocumentObserver { WhenToScroll mWhenToScroll : 8; bool mOnlyIfPerceivedScrollableDirection : 1; /** - * @param aWhere: Either a percentage or a special value. - * nsIPresShell defines: - * * (Default) SCROLL_MINIMUM = -1: The visible area is - * scrolled the minimum amount to show as much as possible of the frame. - * This won't hide any initially visible part of the frame. - * * SCROLL_TOP = 0: The frame's upper edge is aligned with - * the top edge of the visible area. - * * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned - * with the bottom edge of the visible area. - * * SCROLL_LEFT = 0: The frame's left edge is aligned with - * the left edge of the visible area. - * * SCROLL_RIGHT = 100: The frame's right edge is aligned - * with the right edge of the visible area. - * * SCROLL_CENTER = 50: The frame is centered along the axis - * the ScrollAxis is used for. + * aWhere: + * Either a percentage or a special value. nsIPresShell defines: + * * (Default) SCROLL_MINIMUM = -1: The visible area is scrolled the + * minimum amount to show as much as possible of the frame. This won't + * hide any initially visible part of the frame. + * * SCROLL_TOP = 0: The frame's upper edge is aligned with the top edge + * of the visible area. + * * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned with the + * bottom edge of the visible area. + * * SCROLL_LEFT = 0: The frame's left edge is aligned with the left edge + * of the visible area. + * * SCROLL_RIGHT = 100: The frame's right edge is aligned* with the right + * edge of the visible area. + * * SCROLL_CENTER = 50: The frame is centered along the axis the + * ScrollAxis is used for. * - * Other values are treated as a percentage, and the point - * "percent" down the frame is placed at the point "percent" - * down the visible area. - * @param aWhen: - * * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame - * only if it is not fully visible (including if it's not visible at all). - * Note that in this case if the frame is too large to fit in view, it will - * only be scrolled if more of it can fit than is already in view. - * * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it - * is visible. - * * SCROLL_ALWAYS: Move the frame regardless of its current - * visibility. - * @param aOnlyIfPerceivedScrollableDirection: - * If the direction is not a perceived scrollable direction - * (i.e. no scrollbar showing and less than one device pixel of scrollable - * distance), don't scroll. Defaults to false. + * Other values are treated as a percentage, and the point*"percent" + * down the frame is placed at the point "percent" down the visible area. + * + * aWhen: + * * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame only if it is + * not fully visible (including if it's not visible at all). Note that + * in this case if the frame is too large to fit in view, it will only + * be scrolled if more of it can fit than is already in view. + * * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it is visible. + * * SCROLL_ALWAYS: Move the frame regardless of its current visibility. + * + * aOnlyIfPerceivedScrollableDirection: + * If the direction is not a perceived scrollable direction (i.e. no + * scrollbar showing and less than one device pixel of scrollable + * distance), don't scroll. Defaults to false. */ explicit ScrollAxis(int16_t aWhere = SCROLL_MINIMUM, WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE, @@ -1214,15 +1213,19 @@ class nsIPresShell : public nsStubDocumentObserver { * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped). * aBackstopColor is composed behind the background color of the canvas, it is * transparent by default. + * * We attempt to make the background color part of the scrolled canvas (to * reduce transparent layers), and if async scrolling is enabled (and the * background is opaque) then we add a second, unscrolled item to handle the - * checkerboarding case. ADD_FOR_SUBDOC shoud be specified when calling this - * for a subdocument, and LayoutUseContainersForRootFrame might cause the - * whole list to be scrolled. In that case the second unscrolled item will be - * elided. APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so - * that we can add it manually after LayoutUseContainersForRootFrame has built - * the scrolling ContainerLayer. + * checkerboarding case. + * + * ADD_FOR_SUBDOC should be specified when calling this for a subdocument, and + * LayoutUseContainersForRootFrame might cause the whole list to be scrolled. + * In that case the second unscrolled item will be elided. + * + * APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so that + * we can add it manually after LayoutUseContainersForRootFrame has built the + * scrolling ContainerLayer. */ enum { FORCE_DRAW = 0x01, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 380ae06471b1..efdb409bb2a2 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2206,17 +2206,16 @@ static void ConstrainToCoordValues(gfxFloat& aStart, gfxFloat& aSize) { } nsRect nsLayoutUtils::RoundGfxRectToAppRect(const Rect& aRect, float aFactor) { - /* Get a new Rect whose units are app units by scaling by the specified - * factor. */ + // Get a new Rect whose units are app units by scaling by the specified + // factor. Rect scaledRect = aRect; scaledRect.ScaleRoundOut(aFactor); - /* We now need to constrain our results to the max and min values for coords. - */ + // We now need to constrain our results to the max and min values for coords. ConstrainToCoordValues(scaledRect.x, scaledRect.width); ConstrainToCoordValues(scaledRect.y, scaledRect.height); - /* Now typecast everything back. This is guaranteed to be safe. */ + // Now typecast everything back. This is guaranteed to be safe. if (aRect.IsEmpty()) { return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()), 0, 0); } else { @@ -2227,17 +2226,16 @@ nsRect nsLayoutUtils::RoundGfxRectToAppRect(const Rect& aRect, float aFactor) { nsRect nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect& aRect, float aFactor) { - /* Get a new gfxRect whose units are app units by scaling by the specified - * factor. */ + // Get a new gfxRect whose units are app units by scaling by the specified + // factor. gfxRect scaledRect = aRect; scaledRect.ScaleRoundOut(aFactor); - /* We now need to constrain our results to the max and min values for coords. - */ + // We now need to constrain our results to the max and min values for coords. ConstrainToCoordValues(scaledRect.x, scaledRect.width); ConstrainToCoordValues(scaledRect.y, scaledRect.height); - /* Now typecast everything back. This is guaranteed to be safe. */ + // Now typecast everything back. This is guaranteed to be safe. if (aRect.IsEmpty()) { return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()), 0, 0); } else { @@ -6665,10 +6663,10 @@ static ImgDrawResult DrawImageInternal( } /* static */ void nsLayoutUtils::ComputeSizeForDrawing( - imgIContainer* aImage, CSSIntSize& aImageSize, /*outparam*/ - nsSize& aIntrinsicRatio, /*outparam*/ - bool& aGotWidth, /*outparam*/ - bool& aGotHeight /*outparam*/) { + imgIContainer* aImage, /* outparam */ CSSIntSize& aImageSize, + /* outparam */ nsSize& aIntrinsicRatio, + /* outparam */ bool& aGotWidth, + /* outparam */ bool& aGotHeight) { aGotWidth = NS_SUCCEEDED(aImage->GetWidth(&aImageSize.width)); aGotHeight = NS_SUCCEEDED(aImage->GetHeight(&aImageSize.height)); bool gotRatio = NS_SUCCEEDED(aImage->GetIntrinsicRatio(&aIntrinsicRatio)); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 1ad97ab98a40..d323f71695ac 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -853,13 +853,17 @@ class nsLayoutUtils { * * |aMatrixCache| allows for optimizations in recomputing the same matrix over * and over. The argument can be one of the following values: + * * nullptr (the default) - No optimization; the transform matrix is computed - * on every call to this function. non-null pointer to an empty - * Maybe - Upon return, the Maybe is filled with the transform - * matrix that was computed. This can then be passed in to subsequent calls - * with the same source and destination frames to avoid recomputing the - * matrix. non-null pointer to a non-empty Matrix4x4 - The provided matrix - * will be used as the transform matrix and applied to the rect. + * on every call to this function. + * + * non-null pointer to an empty Maybe - Upon return, the Maybe is + * filled with the transform matrix that was computed. This can then be passed + * in to subsequent calls with the same source and destination frames to avoid + * recomputing the matrix. + * + * non-null pointer to a non-empty Matrix4x4 - The provided matrix will be + * used as the transform matrix and applied to the rect. */ static nsRect TransformFrameRectToAncestor( const nsIFrame* aFrame, const nsRect& aRect, const nsIFrame* aAncestor, @@ -1743,30 +1747,35 @@ class nsLayoutUtils { * Draw a background image. The image's dimensions are as specified in aDest; * the image itself is not consulted to determine a size. * See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering - * @param aContext The context to draw to, already set up with an - * appropriate scale and transform for drawing in - * app units. - * @param aForFrame The nsIFrame that we're drawing this image for. - * @param aImage The image. - * @param aImageSize The unscaled size of the image being drawn. - * (This might be the image's size if no scaling - * occurs, or it might be the image's size if - * the image is a vector image being rendered at - * that size.) - * @param aDest The position and scaled area where one copy of - * the image should be drawn. This area represents - * the image itself in its correct position as - * defined with the background-position css property. - * @param aFill The area to be filled with copies of the image. - * @param aRepeatSize The distance between the positions of two - * subsequent repeats of the image. Sizes larger than aDest.Size() create gaps - * between the images. - * @param aAnchor A point in aFill which we will ensure is - * pixel-aligned in the output. - * @param aDirty Pixels outside this area may be skipped. - * @param aImageFlags Image flags of the imgIContainer::FLAG_* - * variety. - * @param aExtendMode How to extend the image over the dest rect. + * + * @param aContext + * The context to draw to, already set up with an appropriate scale and + * transform for drawing in app units. + * @param aForFrame + * The nsIFrame that we're drawing this image for. + * @param aImage + * The image. + * @param aImageSize + * The unscaled size of the image being drawn. (This might be the image's + * size if no scaling occurs, or it might be the image's size if the image is + * a vector image being rendered at that size.) + * @param aDest + * The position and scaled area where one copy of the image should be drawn. + * This area represents the image itself in its correct position as defined + * with the background-position css property. + * @param aFill + * The area to be filled with copies of the image. + * @param aRepeatSize + * The distance between the positions of two subsequent repeats of the image. + * Sizes larger than aDest.Size() create gaps between the images. + * @param aAnchor + * A point in aFill which we will ensure is pixel-aligned in the output. + * @param aDirty + * Pixels outside this area may be skipped. + * @param aImageFlags + * Image flags of the imgIContainer::FLAG_* variety. + * @param aExtendMode + * How to extend the image over the dest rect. */ static ImgDrawResult DrawBackgroundImage( gfxContext& aContext, nsIFrame* aForFrame, nsPresContext* aPresContext, @@ -2912,13 +2921,15 @@ class nsLayoutUtils { * If not, returns the first frame on the next line if such a next line * exists. * - * @return true if the node is an invisible break. - * aNextLineFrame is returned null in this case. - * false if the node causes a visible break or if the node is no - * break. + * @return + * true if the node is an invisible break. aNextLineFrame is returned null + * in this case. * - * @param aNextLineFrame assigned to first frame on the next line if such a - * next line exists, null otherwise. + * false if the node causes a visible break or if the node is no break. + * + * @param aNextLineFrame + * assigned to first frame on the next line if such a next line exists, null + * otherwise. */ static bool IsInvisibleBreak(nsINode* aNode, nsIFrame** aNextLineFrame = nullptr); diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 00d9cc7e5785..bea4b4adce3f 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -102,10 +102,11 @@ enum nsPresContext_CachedIntPrefType { // IDs for the default variable and fixed fonts (not to be changed, see // nsFont.h) To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are // also supported. -const uint8_t kPresContext_DefaultVariableFont_ID = - 0x00; // kGenericFont_moz_variable -const uint8_t kPresContext_DefaultFixedFont_ID = - 0x01; // kGenericFont_moz_fixed +// +// kGenericFont_moz_variable +const uint8_t kPresContext_DefaultVariableFont_ID = 0x00; +// kGenericFont_moz_fixed +const uint8_t kPresContext_DefaultFixedFont_ID = 0x01; #ifdef DEBUG struct nsAutoLayoutPhase; diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 2844007032ee..e9f61ec433d7 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -27,6 +27,7 @@ #include "mozilla/dom/Attr.h" #include "mozilla/EventListenerManager.h" #include "nsFrame.h" +#include "nsFrameState.h" #include "nsGlobalWindow.h" #include "nsGkAtoms.h" #include "nsImageFrame.h" @@ -142,6 +143,7 @@ nsresult nsLayoutStatics::Initialize() { #ifdef DEBUG nsCSSPseudoElements::AssertAtoms(); nsCSSAnonBoxes::AssertAtoms(); + DebugVerifyFrameStateBits(); #endif StartupJSEnvironment(); diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 40a4c984b83d..5d9e433e1fe5 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -39,8 +39,7 @@ using namespace mozilla; using namespace mozilla::dom; // Constants -const uint32_t kMaxDropDownRows = - 20; // This matches the setting for 4.x browsers +const uint32_t kMaxDropDownRows = 20; // matches the setting for 4.x browsers const int32_t kNothingSelected = -1; // Static members diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index f7a98d59f011..ae533ba9fc2f 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -761,8 +761,7 @@ void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint) { nsresult nsTextControlFrame::SetFormProperty(nsAtom* aName, const nsAString& aValue) { - if (!mIsProcessing) // some kind of lock. - { + if (!mIsProcessing) { // some kind of lock. mIsProcessing = true; if (nsGkAtoms::select == aName) { // Select all the text. diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp index 582c8fbf2f3e..f57aab452755 100644 --- a/layout/generic/ReflowInput.cpp +++ b/layout/generic/ReflowInput.cpp @@ -59,9 +59,8 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext, nsIFrame* aFrame, gfxContext* aRenderingContext, const LogicalSize& aAvailableSpace, uint32_t aFlags) : SizeComputationInput(aFrame, aRenderingContext), - mCBReflowInput( - nullptr) // will be setup properly later in InitCBReflowInput - , + // will be setup properly later in InitCBReflowInput + mCBReflowInput(nullptr), mBlockDelta(0), mOrthogonalLimit(NS_UNCONSTRAINEDSIZE), mAvailableWidth(0), @@ -176,9 +175,8 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext, const LogicalSize* aContainingBlockSize, uint32_t aFlags) : SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext), - mCBReflowInput( - nullptr) // will be setup properly later in InitCBReflowInput - , + // will be setup properly later in InitCBReflowInput + mCBReflowInput(nullptr), mBlockDelta(0), mOrthogonalLimit(NS_UNCONSTRAINEDSIZE), mAvailableWidth(0), diff --git a/layout/generic/ReflowInput.h b/layout/generic/ReflowInput.h index d02741e34325..bb6ec793d4d7 100644 --- a/layout/generic/ReflowInput.h +++ b/layout/generic/ReflowInput.h @@ -185,55 +185,74 @@ struct SizeComputationInput { struct ReflowInputFlags { ReflowInputFlags() { memset(this, 0, sizeof(*this)); } - bool mSpecialBSizeReflow : 1; // used by tables to communicate special - // reflow (in process) to handle percent - // bsize frames inside cells which may not - // have computed bsizes - bool mNextInFlowUntouched : 1; // nothing in the frame's next-in-flow (or - // its descendants) is changing - bool mIsTopOfPage : 1; // Is the current context at the top of a - // page? When true, we force something - // that's too tall for a page/column to - // fit anyway to avoid infinite loops. - bool mAssumingHScrollbar : 1; // parent frame is an nsIScrollableFrame and - // it is assuming a horizontal scrollbar - bool mAssumingVScrollbar : 1; // parent frame is an nsIScrollableFrame and - // it is assuming a vertical scrollbar - bool mIsIResize : 1; // Is frame (a) not dirty and (b) a - // different inline-size than before? + // used by tables to communicate special reflow (in process) to handle + // percent bsize frames inside cells which may not have computed bsizes + bool mSpecialBSizeReflow : 1; - bool mIsBResize : 1; // Is frame (a) not dirty and (b) a - // different block-size than before or - // (potentially) in a context where - // percent block-sizes have a different - // basis? - bool mTableIsSplittable : 1; // tables are splittable, this should happen - // only inside a page and never insider a - // column frame - bool mHeightDependsOnAncestorCell : 1; // Does frame height depend on - // an ancestor table-cell? - bool mIsColumnBalancing : 1; // nsColumnSetFrame is balancing columns - bool mIsFlexContainerMeasuringBSize : 1; // nsFlexContainerFrame is - // reflowing this child to - // measure its intrinsic BSize. - bool mDummyParentReflowInput : 1; // a "fake" reflow state made - // in order to be the parent - // of a real one - bool mMustReflowPlaceholders : 1; // Should this frame reflow its place- - // holder children? If the available - // height of this frame didn't change, - // but its in a paginated environment - // (e.g. columns), it should always - // reflow its placeholder children. - bool mShrinkWrap : 1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag - bool mUseAutoBSize : 1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag - bool mStaticPosIsCBOrigin : 1; // the STATIC_POS_IS_CB_ORIGIN ctor flag - bool mIClampMarginBoxMinSize : 1; // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor - // flag - bool mBClampMarginBoxMinSize : 1; // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor - // flag - bool mApplyAutoMinSize : 1; // the I_APPLY_AUTO_MIN_SIZE ctor flag + // nothing in the frame's next-in-flow (or its descendants) is changing + bool mNextInFlowUntouched : 1; + + // Is the current context at the top of a page? When true, we force + // something that's too tall for a page/column to fit anyway to avoid + // infinite loops. + bool mIsTopOfPage : 1; + + // parent frame is an nsIScrollableFrame and it is assuming a horizontal + // scrollbar + bool mAssumingHScrollbar : 1; + + // parent frame is an nsIScrollableFrame and it is assuming a vertical + // scrollbar + bool mAssumingVScrollbar : 1; + + // Is frame (a) not dirty and (b) a different inline-size than before? + bool mIsIResize : 1; + + // Is frame (a) not dirty and (b) a different block-size than before or + // (potentially) in a context where percent block-sizes have a different + // basis? + bool mIsBResize : 1; + + // tables are splittable, this should happen only inside a page and never + // insider a column frame + bool mTableIsSplittable : 1; + + // Does frame height depend on an ancestor table-cell? + bool mHeightDependsOnAncestorCell : 1; + + // nsColumnSetFrame is balancing columns + bool mIsColumnBalancing : 1; + + // nsFlexContainerFrame is reflowing this child to measure its intrinsic + // BSize. + bool mIsFlexContainerMeasuringBSize : 1; + + // a "fake" reflow state made in order to be the parent of a real one + bool mDummyParentReflowInput : 1; + + // Should this frame reflow its place-holder children? If the available + // height of this frame didn't change, but its in a paginated environment + // (e.g. columns), it should always reflow its placeholder children. + bool mMustReflowPlaceholders : 1; + + // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag + bool mShrinkWrap : 1; + + // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag + bool mUseAutoBSize : 1; + + // the STATIC_POS_IS_CB_ORIGIN ctor flag + bool mStaticPosIsCBOrigin : 1; + + // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag + bool mIClampMarginBoxMinSize : 1; + + // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag + bool mBClampMarginBoxMinSize : 1; + + // the I_APPLY_AUTO_MIN_SIZE ctor flag + bool mApplyAutoMinSize : 1; // If set, the following two flags indicate that: // (1) this frame is absolutely-positioned (or fixed-positioned). @@ -838,7 +857,7 @@ struct ReflowInput : public SizeComputationInput { * size computed so far. * * @param aBSize The block-size that we've computed an to which we want to - * apply min/max constraints. + * apply min/max constraints. * @param aConsumed The amount of the computed block-size that was consumed by * our prev-in-flows. */ diff --git a/layout/generic/ScrollSnap.cpp b/layout/generic/ScrollSnap.cpp index c866dcaf4193..f244e6b7f855 100644 --- a/layout/generic/ScrollSnap.cpp +++ b/layout/generic/ScrollSnap.cpp @@ -57,8 +57,8 @@ class CalcSnapPoints : public SnappingEdgeCallback { protected: nsIScrollableFrame::ScrollUnit mUnit; - nsPoint - mDestination; // gives the position after scrolling but before snapping + nsPoint mDestination; // gives the position after scrolling but before + // snapping nsPoint mStartPos; // gives the position before scrolling nsIntPoint mScrollingDirection; // always -1, 0, or 1 nsPoint mBestEdge; // keeps track of the position of the current best edge diff --git a/layout/generic/ViewportFrame.cpp b/layout/generic/ViewportFrame.cpp index e129725daf75..e659345ad1be 100644 --- a/layout/generic/ViewportFrame.cpp +++ b/layout/generic/ViewportFrame.cpp @@ -151,8 +151,8 @@ void ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder, // be handled as top layer element here. if (!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { MOZ_ASSERT(!elem->GetParent()->IsHTMLElement(), - "HTML element " - "should always be out-of-flow if in the top layer"); + "HTML element should always be out-of-flow if in the top " + "layer"); continue; } if (nsIFrame* backdropPh = diff --git a/layout/generic/WritingModes.h b/layout/generic/WritingModes.h index 223f202bdbd2..a77b4d474489 100644 --- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -376,47 +376,49 @@ class WritingMode { * (This is the inverse of the PhysicalSide() method above.) */ LogicalSide LogicalSideForPhysicalSide(mozilla::Side aSide) const { + // clang-format off // indexes are four-bit values: // bit 0 = the eOrientationMask value // bit 1 = the eInlineFlowMask value // bit 2 = the eBlockFlowMask value // bit 3 = the eLineOrientMask value static const LogicalSide kPhysicalToLogicalSides[][4] = { - // top right - // bottom left - {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd, - eLogicalSideIStart}, // horizontal-tb ltr - {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd, - eLogicalSideBEnd}, // vertical-rl ltr - {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd, - eLogicalSideIEnd}, // horizontal-tb rtl - {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart, - eLogicalSideBEnd}, // vertical-rl rtl - {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart, - eLogicalSideIEnd}, // (horizontal-bt) (inv) ltr - {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd, - eLogicalSideBStart}, // vertical-lr sw-left rtl - {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart, - eLogicalSideIStart}, // (horizontal-bt) (inv) rtl - {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart, - eLogicalSideBStart}, // vertical-lr sw-left ltr - {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd, - eLogicalSideIStart}, // horizontal-tb (inv) rtl - {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd, - eLogicalSideBEnd}, // vertical-rl sw-left rtl - {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd, - eLogicalSideIEnd}, // horizontal-tb (inv) ltr - {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart, - eLogicalSideBEnd}, // vertical-rl sw-left ltr - {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart, - eLogicalSideIStart}, // (horizontal-bt) ltr - {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd, - eLogicalSideBStart}, // vertical-lr ltr - {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart, - eLogicalSideIEnd}, // (horizontal-bt) rtl - {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart, - eLogicalSideBStart}, // vertical-lr rtl + // top right + // bottom left + { eLogicalSideBStart, eLogicalSideIEnd, + eLogicalSideBEnd, eLogicalSideIStart }, // horizontal-tb ltr + { eLogicalSideIStart, eLogicalSideBStart, + eLogicalSideIEnd, eLogicalSideBEnd }, // vertical-rl ltr + { eLogicalSideBStart, eLogicalSideIStart, + eLogicalSideBEnd, eLogicalSideIEnd }, // horizontal-tb rtl + { eLogicalSideIEnd, eLogicalSideBStart, + eLogicalSideIStart, eLogicalSideBEnd }, // vertical-rl rtl + { eLogicalSideBEnd, eLogicalSideIStart, + eLogicalSideBStart, eLogicalSideIEnd }, // (horizontal-bt) (inv) ltr + { eLogicalSideIStart, eLogicalSideBEnd, + eLogicalSideIEnd, eLogicalSideBStart }, // vertical-lr sw-left rtl + { eLogicalSideBEnd, eLogicalSideIEnd, + eLogicalSideBStart, eLogicalSideIStart }, // (horizontal-bt) (inv) rtl + { eLogicalSideIEnd, eLogicalSideBEnd, + eLogicalSideIStart, eLogicalSideBStart }, // vertical-lr sw-left ltr + { eLogicalSideBStart, eLogicalSideIEnd, + eLogicalSideBEnd, eLogicalSideIStart }, // horizontal-tb (inv) rtl + { eLogicalSideIStart, eLogicalSideBStart, + eLogicalSideIEnd, eLogicalSideBEnd }, // vertical-rl sw-left rtl + { eLogicalSideBStart, eLogicalSideIStart, + eLogicalSideBEnd, eLogicalSideIEnd }, // horizontal-tb (inv) ltr + { eLogicalSideIEnd, eLogicalSideBStart, + eLogicalSideIStart, eLogicalSideBEnd }, // vertical-rl sw-left ltr + { eLogicalSideBEnd, eLogicalSideIEnd, + eLogicalSideBStart, eLogicalSideIStart }, // (horizontal-bt) ltr + { eLogicalSideIStart, eLogicalSideBEnd, + eLogicalSideIEnd, eLogicalSideBStart }, // vertical-lr ltr + { eLogicalSideBEnd, eLogicalSideIStart, + eLogicalSideBStart, eLogicalSideIEnd }, // (horizontal-bt) rtl + { eLogicalSideIEnd, eLogicalSideBEnd, + eLogicalSideIStart, eLogicalSideBStart }, // vertical-lr rtl }; + // clang-format on static_assert(eOrientationMask == 0x01 && eInlineFlowMask == 0x02 && eBlockFlowMask == 0x04 && eLineOrientMask == 0x08, @@ -614,12 +616,13 @@ class WritingMode { enum Masks { // Masks for our bits; true chosen as opposite of commonest case eOrientationMask = 0x01, // true means vertical text - eInlineFlowMask = - 0x02, // true means absolute RTL/BTT (against physical coords) - eBlockFlowMask = - 0x04, // true means vertical-LR (or horizontal-BT if added) - eLineOrientMask = 0x08, // true means over != block-start - eBidiMask = 0x10, // true means line-relative RTL (bidi RTL) + eInlineFlowMask = 0x02, // true means absolute RTL/BTT (against physical + // coords) + eBlockFlowMask = 0x04, // true means vertical-LR (or horizontal-BT if + // added) + eLineOrientMask = 0x08, // true means over != block-start + eBidiMask = 0x10, // true means line-relative RTL (bidi RTL) + // Note: We have one excess bit of info; WritingMode can pack into 4 bits. // But since we have space, we're caching interesting things for fast // access. diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index e6886c3606ce..2f7ba4fb1794 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -683,13 +683,13 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame( bool constrainBSize = (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) && - (aFlags & AbsPosReflowFlags::eConstrainHeight) + (aFlags & AbsPosReflowFlags::eConstrainHeight) && // Don't split if told not to (e.g. for fixed frames) - && !aDelegatingFrame->IsInlineFrame() + !aDelegatingFrame->IsInlineFrame() && // XXX we don't handle splitting frames for inline absolute containing // blocks yet - && (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <= - aReflowInput.AvailableBSize()); + (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <= + aReflowInput.AvailableBSize()); // Don't split things below the fold. (Ideally we shouldn't *have* // anything totally below the fold, but we can't position frames // across next-in-flow breaks yet. diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 2f3f90843659..6c73eddc111e 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -529,10 +529,12 @@ class nsBlockFrame : public nsContainerFrame { virtual void UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override; - /** Load all of aFrame's floats into the float manager iff aFrame is not a - * block formatting context. Handles all necessary float manager - * translations; assumes float manager is in aFrame's parent's coord system. - * Safe to call on non-blocks (does nothing). + /** + * Load all of aFrame's floats into the float manager iff aFrame is not a + * block formatting context. Handles all necessary float manager translations; + * assumes float manager is in aFrame's parent's coord system. + * + * Safe to call on non-blocks (does nothing). */ static void RecoverFloatsFor(nsIFrame* aFrame, nsFloatManager& aFloatManager, mozilla::WritingMode aWM, @@ -673,11 +675,14 @@ class nsBlockFrame : public nsContainerFrame { // Methods for line reflow /** * Reflow a line. - * @param aState the current reflow state - * @param aLine the line to reflow. can contain a single block - * frame or contain 1 or more inline frames. - * @param aKeepReflowGoing [OUT] indicates whether the caller should continue - * to reflow more lines + * + * @param aState + * the current reflow state + * @param aLine + * the line to reflow. can contain a single block frame or contain 1 or + * more inline frames. + * @param aKeepReflowGoing [OUT] + * indicates whether the caller should continue to reflow more lines */ void ReflowLine(BlockReflowInput& aState, LineIterator aLine, bool* aKeepReflowGoing); diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 63e8b6a85e25..b7e45447a2bf 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1737,8 +1737,8 @@ bool nsContainerFrame::RenumberList() { // add in a sanity check for absurdly deep frame trees. See bug 42138 // can't just use IsFrameTreeTooDeep() because that method has side effects we // don't want -#define MAX_DEPTH_FOR_LIST_RENUMBERING \ - 200 // 200 open displayable tags is pretty unrealistic +// 200 open displayable tags is pretty unrealistic +#define MAX_DEPTH_FOR_LIST_RENUMBERING 200 bool nsContainerFrame::RenumberFrameAndDescendants(int32_t* aOrdinal, int32_t aDepth, diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index d2522ea66c72..6d8e7a7220a8 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -2001,8 +2001,7 @@ FlexItem::FlexItem(nsIFrame* aChildFrame, nscoord aCrossSize, mHadMeasuringReflow(false), mIsStretched(false), mIsStrut(true), // (this is the constructor for making struts, after all) - mIsInlineAxisMainAxis( - true), // (doesn't matter b/c we're not doing layout) + mIsInlineAxisMainAxis(true), // (doesn't matter, we're not doing layout) mNeedsMinSizeAutoResolution(false), mHasAnyAutoMargin(false), mAlignSelf(NS_STYLE_ALIGN_FLEX_START) { @@ -2867,8 +2866,8 @@ MainAxisPositionTracker::MainAxisPositionTracker( uint8_t aJustifyContent, nscoord aContentBoxMainSize) : PositionTracker(aAxisTracker.GetMainAxis(), aAxisTracker.IsMainAxisReversed()), - mPackingSpaceRemaining( - aContentBoxMainSize), // we chip away at this below + // we chip away at this below + mPackingSpaceRemaining(aContentBoxMainSize), mNumAutoMarginsInMainAxis(0), mNumPackingSpacesRemaining(0), mJustifyContent(aJustifyContent) { @@ -3849,8 +3848,8 @@ void nsFlexContainerFrame::GenerateFlexLines( // Check if we need to wrap |item| to a new line // (i.e. check if its outer hypothetical main size pushes our line over // the threshold) - if (wrapThreshold != - NS_UNCONSTRAINEDSIZE && // Don't wrap if unconstrained. + if (wrapThreshold != NS_UNCONSTRAINEDSIZE && // Don't wrap if + // unconstrained. !curLine->IsEmpty()) { // Don't wrap if this will be line's first item. // If the line will be longer than wrapThreshold after adding this item, // then wrap to a new line before inserting this item. diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index 1e80495c250d..5b1fec97e11e 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -880,14 +880,13 @@ nsFloatManager::EllipseShapeInfo::EllipseShapeInfo(const nsPoint& aCenter, "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - df[index - 1] + 5, - std::min( - df[index - iSize] + 5, - std::min( - df[index - iSize - 1] + 7, + // clang-format off + df[index] = std::min(df[index - 1] + 5, + std::min(df[index - iSize] + 5, + std::min(df[index - iSize - 1] + 7, std::min(df[index - iSize - 2] + 11, - df[index - (iSize * 2) - 1] + 11)))); + df[index - (iSize * 2) - 1] + 11)))); + // clang-format on // Check the df value and see if it's less than or equal to the // usedMargin5X value. @@ -1426,22 +1425,17 @@ nsFloatManager::PolygonShapeInfo::PolygonShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - MAX_MARGIN_5X, - std::min( - df[index - (iSize * 2) - 1] + 11, - std::min( - df[index - (iSize * 2) + 1] + 11, - std::min( - df[index - iSize - 2] + 11, - std::min( - df[index - iSize - 1] + 7, - std::min( - df[index - iSize] + 5, - std::min( - df[index - iSize + 1] + 7, - std::min(df[index - iSize + 2] + 11, - df[index - 1] + 5)))))))); + // clang-format off + df[index] = std::min(MAX_MARGIN_5X, + std::min(df[index - (iSize * 2) - 1] + 11, + std::min(df[index - (iSize * 2) + 1] + 11, + std::min(df[index - iSize - 2] + 11, + std::min(df[index - iSize - 1] + 7, + std::min(df[index - iSize] + 5, + std::min(df[index - iSize + 1] + 7, + std::min(df[index - iSize + 2] + 11, + df[index - 1] + 5)))))))); + // clang-format on } } } @@ -1499,22 +1493,17 @@ nsFloatManager::PolygonShapeInfo::PolygonShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - df[index], - std::min( - df[index + (iSize * 2) + 1] + 11, - std::min( - df[index + (iSize * 2) - 1] + 11, - std::min( - df[index + iSize + 2] + 11, - std::min( - df[index + iSize + 1] + 7, - std::min( - df[index + iSize] + 5, - std::min( - df[index + iSize - 1] + 7, - std::min(df[index + iSize - 2] + 11, - df[index + 1] + 5)))))))); + // clang-format off + df[index] = std::min(df[index], + std::min(df[index + (iSize * 2) + 1] + 11, + std::min(df[index + (iSize * 2) - 1] + 11, + std::min(df[index + iSize + 2] + 11, + std::min(df[index + iSize + 1] + 7, + std::min(df[index + iSize] + 5, + std::min(df[index + iSize - 1] + 7, + std::min(df[index + iSize - 2] + 11, + df[index + 1] + 5)))))))); + // clang-format on } // Finally, we can check the df value and see if it's less than @@ -1981,23 +1970,17 @@ nsFloatManager::ImageShapeInfo::ImageShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - MAX_MARGIN_5X, - std::min( - df[index - wEx - 2] + 11, - std::min( - df[index + wEx - 2] + 11, - std::min( - df[index - (wEx * 2) - 1] + 11, - std::min( - df[index - wEx - 1] + 7, - std::min( - df[index - 1] + 5, - std::min( - df[index + wEx - 1] + 7, - std::min( - df[index + (wEx * 2) - 1] + 11, - df[index - wEx] + 5)))))))); + // clang-format off + df[index] = std::min(MAX_MARGIN_5X, + std::min(df[index - wEx - 2] + 11, + std::min(df[index + wEx - 2] + 11, + std::min(df[index - (wEx * 2) - 1] + 11, + std::min(df[index - wEx - 1] + 7, + std::min(df[index - 1] + 5, + std::min(df[index + wEx - 1] + 7, + std::min(df[index + (wEx * 2) - 1] + 11, + df[index - wEx] + 5)))))))); + // clang-format on } else { // Row-by-row, starting at the top, each row left-to-right. // Backward-looking neighborhood distance from target pixel X @@ -2019,23 +2002,17 @@ nsFloatManager::ImageShapeInfo::ImageShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - MAX_MARGIN_5X, - std::min( - df[index - (wEx * 2) - 1] + 11, - std::min( - df[index - (wEx * 2) + 1] + 11, - std::min( - df[index - wEx - 2] + 11, - std::min( - df[index - wEx - 1] + 7, - std::min( - df[index - wEx] + 5, - std::min( - df[index - wEx + 1] + 7, - std::min( - df[index - wEx + 2] + 11, - df[index - 1] + 5)))))))); + // clang-format off + df[index] = std::min(MAX_MARGIN_5X, + std::min(df[index - (wEx * 2) - 1] + 11, + std::min(df[index - (wEx * 2) + 1] + 11, + std::min(df[index - wEx - 2] + 11, + std::min(df[index - wEx - 1] + 7, + std::min(df[index - wEx] + 5, + std::min(df[index - wEx + 1] + 7, + std::min(df[index - wEx + 2] + 11, + df[index - 1] + 5)))))))); + // clang-format on } } } @@ -2108,23 +2085,17 @@ nsFloatManager::ImageShapeInfo::ImageShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - df[index], - std::min( - df[index + wEx + 2] + 11, - std::min( - df[index - wEx + 2] + 11, - std::min( - df[index + (wEx * 2) + 1] + 11, - std::min( - df[index + wEx + 1] + 7, - std::min( - df[index + 1] + 5, - std::min( - df[index - wEx + 1] + 7, - std::min( - df[index - (wEx * 2) + 1] + 11, - df[index + wEx] + 5)))))))); + // clang-format off + df[index] = std::min(df[index], + std::min(df[index + wEx + 2] + 11, + std::min(df[index - wEx + 2] + 11, + std::min(df[index + (wEx * 2) + 1] + 11, + std::min(df[index + wEx + 1] + 7, + std::min(df[index + 1] + 5, + std::min(df[index - wEx + 1] + 7, + std::min(df[index - (wEx * 2) + 1] + 11, + df[index + wEx] + 5)))))))); + // clang-format on } else { // Row-by-row, starting at the bottom, each row right-to-left. // Forward-looking neighborhood distance from target pixel X @@ -2146,23 +2117,17 @@ nsFloatManager::ImageShapeInfo::ImageShapeInfo( "Our distance field most extreme indices should be " "in-bounds."); - df[index] = std::min( - df[index], - std::min( - df[index + (wEx * 2) + 1] + 11, - std::min( - df[index + (wEx * 2) - 1] + 11, - std::min( - df[index + wEx + 2] + 11, - std::min( - df[index + wEx + 1] + 7, - std::min( - df[index + wEx] + 5, - std::min( - df[index + wEx - 1] + 7, - std::min( - df[index + wEx - 2] + 11, - df[index + 1] + 5)))))))); + // clang-format off + df[index] = std::min(df[index], + std::min(df[index + (wEx * 2) + 1] + 11, + std::min(df[index + (wEx * 2) - 1] + 11, + std::min(df[index + wEx + 2] + 11, + std::min(df[index + wEx + 1] + 7, + std::min(df[index + wEx] + 5, + std::min(df[index + wEx - 1] + 7, + std::min(df[index + wEx - 2] + 11, + df[index + 1] + 5)))))))); + // clang-format on } } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 6c0e4873f258..80b4871c96ba 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -7539,8 +7539,8 @@ nsresult nsFrame::GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext, nsIFrame* resultFrame = nullptr; nsIFrame* farStoppingFrame = nullptr; // we keep searching until we find a // "this" frame then we go to next line - nsIFrame* nearStoppingFrame = - nullptr; // if we are backing up from edge, stop here + nsIFrame* nearStoppingFrame = nullptr; // if we are backing up from edge, + // stop here nsIFrame* firstFrame; nsIFrame* lastFrame; nsRect rect; @@ -9543,21 +9543,18 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) { // Ok we need to compute our minimum, preferred, and maximum sizes. // 1) Maximum size. This is easy. Its infinite unless it is overloaded by CSS. - // 2) Preferred size. This is a little harder. This is the size the block - // would be - // if it were laid out on an infinite canvas. So we can get this by - // reflowing the block with and INTRINSIC width and height. We can also - // do a nice optimization for incremental reflow. If the reflow is - // incremental then we can pass a flag to have the block compute the - // preferred width for us! Preferred height can just be the minimum - // height; + // 2) Preferred size. This is a little harder. This is the size the + // block would be if it were laid out on an infinite canvas. So we can + // get this by reflowing the block with and INTRINSIC width and height. We + // can also do a nice optimization for incremental reflow. If the reflow is + // incremental then we can pass a flag to have the block compute the + // preferred width for us! Preferred height can just be the minimum height; // 3) Minimum size. This is a toughy. We can pass the block a flag asking for - // the max element - // size. That would give us the width. Unfortunately you can only ask for a - // maxElementSize during an incremental reflow. So on other reflows we will - // just have to use 0. The min height on the other hand is fairly easy we - // need to get the largest line height. This can be done with the line - // iterator. + // the max element size. That would give us the width. Unfortunately you + // can only ask for a maxElementSize during an incremental reflow. So on + // other reflows we will just have to use 0. The min height on the other + // hand is fairly easy we need to get the largest line height. This can be + // done with the line iterator. // if we do have a rendering context gfxContext* rendContext = aState.GetRenderingContext(); diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 27321cf97132..7064bd586547 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -637,9 +637,8 @@ nsresult nsFrameSelection::MoveCaret(nsDirection aDirection, nsPresContext* context = mShell->GetPresContext(); if (!context) return NS_ERROR_FAILURE; - nsPoint desiredPos( - 0, - 0); // we must keep this around and revalidate it when its just UP/DOWN + // we must keep this around and revalidate it when its just UP/DOWN + nsPoint desiredPos(0, 0); int8_t index = GetIndexFromSelectionType(SelectionType::eNormal); RefPtr sel = mDomSelections[index]; @@ -965,16 +964,17 @@ nsresult nsFrameSelection::MaintainSelection(nsSelectionAmount aAmount) { return NS_OK; } -/** After moving the caret, its Bidi level is set according to the following +/** + * After moving the caret, its Bidi level is set according to the following * rules: * - * After moving over a character with left/right arrow, set to the Bidi level + * After moving over a character with left/right arrow, set to the Bidi level * of the last moved over character. After Home and End, set to the paragraph * embedding level. After up/down arrow, PageUp/Down, set to the lower level of * the 2 surrounding characters. After mouse click, set to the level of the * current frame. * - * The following two methods use GetPrevNextBidiLevels to determine the new + * The following two methods use GetPrevNextBidiLevels to determine the new * Bidi level. BidiLevelFromMove is called when the caret is moved in response * to a keyboard event * @@ -1245,8 +1245,8 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* aNewFocus, mBatching = batching; mChangesDuringBatching = changes; } else { - bool oldDesiredPosSet = - mDesiredPosSet; // need to keep old desired position if it was set. + bool oldDesiredPosSet = mDesiredPosSet; // need to keep old desired + // position if it was set. mDomSelections[index]->Collapse(aNewFocus, aContentOffset); mDesiredPosSet = oldDesiredPosSet; // now reset desired pos back. mBatching = batching; diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h index 2da5266d2c9d..f95a8ead2956 100644 --- a/layout/generic/nsFrameSelection.h +++ b/layout/generic/nsFrameSelection.h @@ -81,81 +81,85 @@ struct MOZ_STACK_CLASS nsPeekOffsetStruct { /*** Input arguments ***/ // Note: The value of some of the input arguments may be changed upon exit. - // mAmount: The type of movement requested (by character, word, line, etc.) + // The type of movement requested (by character, word, line, etc.) nsSelectionAmount mAmount; - // mDirection: eDirPrevious or eDirNext. - // * Note for visual bidi movement: - // eDirPrevious means 'left-then-up' if the containing block is - // LTR, 'right-then-up' if it is RTL. eDirNext means - // 'right-then-down' if the containing block is LTR, - // 'left-then-down' if it is RTL. - // Between paragraphs, eDirPrevious means "go to the visual end of - // the previous paragraph", and eDirNext means "go to the visual - // beginning of the next paragraph". Used with: eSelectCharacter, - // eSelectWord, eSelectLine, eSelectParagraph. + // eDirPrevious or eDirNext. + // + // Note for visual bidi movement: + // * eDirPrevious means 'left-then-up' if the containing block is LTR, + // 'right-then-up' if it is RTL. + // * eDirNext means 'right-then-down' if the containing block is LTR, + // 'left-then-down' if it is RTL. + // * Between paragraphs, eDirPrevious means "go to the visual end of + // the previous paragraph", and eDirNext means "go to the visual + // beginning of the next paragraph". + // + // Used with: eSelectCharacter, eSelectWord, eSelectLine, eSelectParagraph. nsDirection mDirection; - // mStartOffset: Offset into the content of the current frame where the peek - // starts. - // Used with: eSelectCharacter, eSelectWord + // Offset into the content of the current frame where the peek starts. + // + // Used with: eSelectCharacter, eSelectWord int32_t mStartOffset; - // mDesiredPos: The desired inline coordinate for the caret - // (one of .x or .y will be used, depending on line's writing - // mode) Used with: eSelectLine. + // The desired inline coordinate for the caret (one of .x or .y will be used, + // depending on line's writing mode) + // + // Used with: eSelectLine. nsPoint mDesiredPos; - // mWordMovementType: An enum that determines whether to prefer the start or - // end of a word - // or to use the default beahvior, which is a combination - // of direction and the platform-based pref - // "layout.word_select.eat_space_to_next_word" + // An enum that determines whether to prefer the start or end of a word or to + // use the default beahvior, which is a combination of direction and the + // platform-based pref "layout.word_select.eat_space_to_next_word" mozilla::EWordMovementType mWordMovementType; - // mJumpLines: Whether to allow jumping across line boundaries. - // Used with: eSelectCharacter, eSelectWord. + // Whether to allow jumping across line boundaries. + // + // Used with: eSelectCharacter, eSelectWord. bool mJumpLines; - // mScrollViewStop: Whether to stop when reaching a scroll view boundary. - // Used with: eSelectCharacter, eSelectWord, eSelectLine. + // Whether to stop when reaching a scroll view boundary. + // + // Used with: eSelectCharacter, eSelectWord, eSelectLine. bool mScrollViewStop; - // mIsKeyboardSelect: Whether the peeking is done in response to a keyboard - // action. - // Used with: eSelectWord. + // Whether the peeking is done in response to a keyboard action. + // + // Used with: eSelectWord. bool mIsKeyboardSelect; - // mVisual: Whether bidi caret behavior is visual (true) or logical (false). - // Used with: eSelectCharacter, eSelectWord, eSelectBeginLine, - // eSelectEndLine. + // Whether bidi caret behavior is visual (true) or logical (false). + // + // Used with: eSelectCharacter, eSelectWord, eSelectBeginLine, eSelectEndLine. bool mVisual; - // mExtend: Whether the selection is being extended or moved. + // Whether the selection is being extended or moved. bool mExtend; - // mForceEditableRegion: If true, the offset has to end up in an editable - // node, otherwise we'll keep searching. + // If true, the offset has to end up in an editable node, otherwise we'll keep + // searching. const bool mForceEditableRegion; /*** Output arguments ***/ - // mResultContent: Content reached as a result of the peek. + // Content reached as a result of the peek. nsCOMPtr mResultContent; - // mResultFrame: Frame reached as a result of the peek. - // Used with: eSelectCharacter, eSelectWord. + // Frame reached as a result of the peek. + // + // Used with: eSelectCharacter, eSelectWord. nsIFrame* mResultFrame; - // mContentOffset: Offset into content reached as a result of the peek. + // Offset into content reached as a result of the peek. int32_t mContentOffset; - // mAttachForward: When the result position is between two frames, - // indicates which of the two frames the caret should be - // painted in. false means "the end of the frame logically - // before the caret", true means "the beginning of the frame - // logically after the caret". Used with: eSelectLine, - // eSelectBeginLine, eSelectEndLine. + // When the result position is between two frames, indicates which of the two + // frames the caret should be painted in. false means "the end of the frame + // logically before the caret", true means "the beginning of the frame + // logically after the caret". + // + // Used with: eSelectLine, eSelectBeginLine, eSelectEndLine. mozilla::CaretAssociationHint mAttach; }; @@ -209,31 +213,42 @@ class nsFrameSelection final { NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsFrameSelection) NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsFrameSelection) - /** Init will initialize the frame selector with the necessary pres shell to - * be used by most of the methods - * @param aShell is the parameter to be used for most of the other calls for + /** + * Init will initialize the frame selector with the necessary pres shell to + * be used by most of the methods + * + * @param aShell is the parameter to be used for most of the other calls for * callbacks etc - * @param aLimiter limits the selection to nodes with aLimiter parents - * @param aAccessibleCaretEnabled true if we should enable the accessible + * + * @param aLimiter limits the selection to nodes with aLimiter parents + * + * @param aAccessibleCaretEnabled true if we should enable the accessible * caret. */ void Init(nsIPresShell* aShell, nsIContent* aLimiter, bool aAccessibleCaretEnabled); - /** HandleClick will take the focus to the new frame at the new offset and - * will either extend the selection from the old anchor, or replace the old + /** + * HandleClick will take the focus to the new frame at the new offset and + * will either extend the selection from the old anchor, or replace the old * anchor. the old anchor and focus position may also be used to deselect * things - * @param aNewfocus is the content that wants the focus - * @param aContentOffset is the content offset of the parent aNewFocus - * @param aContentOffsetEnd is the content offset of the parent aNewFocus and + * + * @param aNewfocus is the content that wants the focus + * + * @param aContentOffset is the content offset of the parent aNewFocus + * + * @param aContentOffsetEnd is the content offset of the parent aNewFocus and * is specified different when you need to select to and include both start * and end points - * @param aContinueSelection is the flag that tells the selection to keep the + * + * @param aContinueSelection is the flag that tells the selection to keep the * old anchor point or not. - * @param aMultipleSelection will tell the frame selector to replace /or not + * + * @param aMultipleSelection will tell the frame selector to replace /or not * the old selection. cannot coexist with aContinueSelection - * @param aHint will tell the selection which direction geometrically to + * + * @param aHint will tell the selection which direction geometrically to * actually show the caret on. 1 = end of this line 0 = beginning of this line */ MOZ_CAN_RUN_SCRIPT_BOUNDARY @@ -241,29 +256,42 @@ class nsFrameSelection final { uint32_t aContentEndOffset, bool aContinueSelection, bool aMultipleSelection, CaretAssociateHint aHint); - /** HandleDrag extends the selection to contain the frame closest to aPoint. - * @param aPresContext is the context to use when figuring out what frame + /** + * HandleDrag extends the selection to contain the frame closest to aPoint. + * + * @param aPresContext is the context to use when figuring out what frame * contains the point. - * @param aFrame is the parent of all frames to use when searching for the + * + * @param aFrame is the parent of all frames to use when searching for the * closest frame to the point. - * @param aPoint is relative to aFrame + * + * @param aPoint is relative to aFrame */ /*unsafe*/ void HandleDrag(nsIFrame* aFrame, const nsPoint& aPoint); - /** HandleTableSelection will set selection to a table, cell, etc - * depending on information contained in aFlags - * @param aParentContent is the paretent of either a table or cell that user + /** + * HandleTableSelection will set selection to a table, cell, etc + * depending on information contained in aFlags + * + * @param aParentContent is the paretent of either a table or cell that user * clicked or dragged the mouse in - * @param aContentOffset is the offset of the table or cell - * @param aTarget indicates what to select - * TableSelection::Cell We should select a cell (content points to the - * cell) TableSelection::Row We should select a row (content points to - * any cell in row) TableSelection::Column We should select a row (content - * points to any cell in column) TableSelection::Table We should select a - * table (content points to the table) TableSelection::AllCells We should - * select all cells (content points to any cell in table) - * @param aMouseEvent passed in so we can get where event occurred + * + * @param aContentOffset is the offset of the table or cell + * + * @param aTarget indicates what to select + * * TableSelection::Cell + * We should select a cell (content points to the cell) + * * TableSelection::Row + * We should select a row (content points to any cell in row) + * * TableSelection::Column + * We should select a row (content points to any cell in column) + * * TableSelection::Table + * We should select a table (content points to the table) + * * TableSelection::AllCells + * We should select all cells (content points to any cell in table) + * + * @param aMouseEvent passed in so we can get where event occurred * and what keys are pressed */ /*unsafe*/ @@ -319,27 +347,33 @@ class nsFrameSelection final { int32_t aEndRowIndex, int32_t aEndColumnIndex); - /** StartAutoScrollTimer is responsible for scrolling frames so that - * aPoint is always visible, and for selecting any frame that contains - * aPoint. The timer will also reset itself to fire again if we have - * not scrolled to the end of the document. - * @param aFrame is the outermost frame to use when searching for - * the closest frame for the point, i.e. the frame that is capturing - * the mouse - * @param aPoint is relative to aFrame. - * @param aDelay is the timer's interval. + /** + * StartAutoScrollTimer is responsible for scrolling frames so that + * aPoint is always visible, and for selecting any frame that contains + * aPoint. The timer will also reset itself to fire again if we have + * not scrolled to the end of the document. + * + * @param aFrame is the outermost frame to use when searching for + * the closest frame for the point, i.e. the frame that is capturing + * the mouse + * + * @param aPoint is relative to aFrame. + * + * @param aDelay is the timer's interval. */ /*unsafe*/ nsresult StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint, uint32_t aDelay); - /** StopAutoScrollTimer stops any active auto scroll timer. + /** + * Stops any active auto scroll timer. */ void StopAutoScrollTimer(); - /** Lookup Selection - * returns in frame coordinates the selection beginning and ending with the + /** + * Returns in frame coordinates the selection beginning and ending with the * type of selection given + * * @param aContent is the content asking * @param aContentOffset is the starting content boundary * @param aContentLength is the length of the content piece asking @@ -350,21 +384,23 @@ class nsFrameSelection final { int32_t aContentLength, bool aSlowCheck) const; - /** SetDragState(bool); - * sets the drag state to aState for resons of drag state. + /** + * Sets the drag state to aState for resons of drag state. + * * @param aState is the new state of drag */ MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetDragState(bool aState); - /** GetDragState(bool *); - * gets the drag state to aState for resons of drag state. + /** + * Gets the drag state to aState for resons of drag state. + * * @param aState will hold the state of drag */ bool GetDragState() const { return mDragState; } /** - if we are in table cell selection mode. aka ctrl click in table cell + * If we are in table cell selection mode. aka ctrl click in table cell */ bool GetTableCellSelection() const { return mSelectingTableCellMode != mozilla::TableSelection::None; @@ -373,8 +409,9 @@ class nsFrameSelection final { mSelectingTableCellMode = mozilla::TableSelection::None; } - /** GetSelection - * no query interface for selection. must use this method now. + /** + * No query interface for selection. must use this method now. + * * @param aSelectionType The selection type what you want. */ mozilla::dom::Selection* GetSelection( @@ -385,28 +422,33 @@ class nsFrameSelection final { * so that it is visible in the scrolled view. * * @param aSelectionType the selection to scroll into view. - * @param aRegion the region inside the selection to scroll into view. - * @param aFlags the scroll flags. Valid bits include: - * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view - * before returning. If not set, posts a request which is processed - * at some point after the method returns. - * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be - * scrolled into view. * + * @param aRegion the region inside the selection to scroll into view. + * + * @param aFlags the scroll flags. Valid bits include: + * * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view + * before returning. If not set, posts a request which is processed + * at some point after the method returns. + * * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be + * scrolled into view. */ /*unsafe*/ nsresult ScrollSelectionIntoView(mozilla::SelectionType aSelectionType, SelectionRegion aRegion, int16_t aFlags) const; - /** RepaintSelection repaints the selected frames that are inside the + /** + * RepaintSelection repaints the selected frames that are inside the * selection specified by aSelectionType. + * * @param aSelectionType The selection type what you want to repaint. */ nsresult RepaintSelection(mozilla::SelectionType aSelectionType); - /** GetFrameForNodeOffset given a node and its child offset, return the - * nsIFrame and the offset into that frame. + /** + * Given a node and its child offset, return the nsIFrame and the offset into + * that frame. + * * @param aNode input parameter for the node to look at * @param aOffset offset into above node. * @param aReturnOffset will contain offset into frame. @@ -459,7 +501,8 @@ class nsFrameSelection final { */ void UndefineCaretBidiLevel(); - /** PhysicalMove will generally be called from the nsiselectioncontroller + /** + * PhysicalMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one unit * 'aAmount' in the given aDirection. * @param aDirection the direction to move the selection @@ -469,7 +512,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult PhysicalMove(int16_t aDirection, int16_t aAmount, bool aExtend); - /** CharacterMove will generally be called from the nsiselectioncontroller + /** + * CharacterMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one character * left or right. * @param aForward move forward in document. @@ -478,19 +522,22 @@ class nsFrameSelection final { /*unsafe*/ nsresult CharacterMove(bool aForward, bool aExtend); - /** CharacterExtendForDelete extends the selection forward (logically) to + /** + * CharacterExtendForDelete extends the selection forward (logically) to * the next character cell, so that the selected cell can be deleted. */ /*unsafe*/ nsresult CharacterExtendForDelete(); - /** CharacterExtendForBackspace extends the selection backward (logically) to + /** + * CharacterExtendForBackspace extends the selection backward (logically) to * the previous character cell, so that the selected cell can be deleted. */ /*unsafe*/ nsresult CharacterExtendForBackspace(); - /** WordMove will generally be called from the nsiselectioncontroller + /** + * WordMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one word left or * right. * @param aForward move forward in document. @@ -499,14 +546,16 @@ class nsFrameSelection final { /*unsafe*/ nsresult WordMove(bool aForward, bool aExtend); - /** WordExtendForDelete extends the selection backward or forward (logically) + /** + * WordExtendForDelete extends the selection backward or forward (logically) * to the next word boundary, so that the selected word can be deleted. * @param aForward select forward in document. */ /*unsafe*/ nsresult WordExtendForDelete(bool aForward); - /** LineMove will generally be called from the nsiselectioncontroller + /** + * LineMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one line up or * down. * @param aForward move forward in document. @@ -515,7 +564,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult LineMove(bool aForward, bool aExtend); - /** IntraLineMove will generally be called from the nsiselectioncontroller + /** + * IntraLineMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move to beginning or * end of line * @param aForward move forward in document. @@ -524,7 +574,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult IntraLineMove(bool aForward, bool aExtend); - /** Select All will generally be called from the nsiselectioncontroller + /** + * Select All will generally be called from the nsiselectioncontroller * implementations. it will select the whole doc */ MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult SelectAll(); @@ -534,19 +585,23 @@ class nsFrameSelection final { void SetDisplaySelection(int16_t aState) { mDisplaySelection = aState; } int16_t GetDisplaySelection() const { return mDisplaySelection; } - /** This method can be used to store the data received during a MouseDown - * event so that we can place the caret during the MouseUp event. - * @aMouseEvent the event received by the selection MouseDown - * handling method. A nullptr value can be use to tell this method - * that any data is storing is no longer valid. + /** + * This method can be used to store the data received during a MouseDown + * event so that we can place the caret during the MouseUp event. + * + * @param aMouseEvent the event received by the selection MouseDown + * handling method. A nullptr value can be use to tell this method + * that any data is storing is no longer valid. */ void SetDelayedCaretData(mozilla::WidgetMouseEvent* aMouseEvent); - /** Get the delayed MouseDown event data necessary to place the - * caret during MouseUp processing. + /** + * Get the delayed MouseDown event data necessary to place the + * caret during MouseUp processing. + * * @return a pointer to the event received - * by the selection during MouseDown processing. It can be nullptr - * if the data is no longer valid. + * by the selection during MouseDown processing. It can be nullptr + * if the data is no longer valid. */ bool HasDelayedCaretData() { return mDelayedMouseEventValid; } bool IsShiftDownInDelayedCaretData() { @@ -563,58 +618,66 @@ class nsFrameSelection final { GetClickCountInDelayedCaretData() < 2; } - /** Get the content node that limits the selection - * When searching up a nodes for parents, as in a text edit field - * in an browser page, we must stop at this node else we reach into the - * parent page, which is very bad! + /** + * Get the content node that limits the selection + * + * When searching up a nodes for parents, as in a text edit field + * in an browser page, we must stop at this node else we reach into the + * parent page, which is very bad! */ nsIContent* GetLimiter() const { return mLimiter; } nsIContent* GetAncestorLimiter() const { return mAncestorLimiter; } MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetAncestorLimiter(nsIContent* aLimiter); - /** This will tell the frame selection that a double click has been pressed - * so it can track abort future drags if inside the same selection - * @aDoubleDown has the double click down happened + /** + * This will tell the frame selection that a double click has been pressed + * so it can track abort future drags if inside the same selection + * @param aDoubleDown has the double click down happened */ void SetMouseDoubleDown(bool aDoubleDown) { mMouseDoubleDownState = aDoubleDown; } - /** This will return whether the double down flag was set. - * @return whether the double down flag was set + /** + * This will return whether the double down flag was set. + * @return whether the double down flag was set */ bool GetMouseDoubleDown() const { return mMouseDoubleDownState; } /** * GetPrevNextBidiLevels will return the frames and associated Bidi levels of * the characters logically before and after a (collapsed) selection. - * @param aNode is the node containing the selection - * @param aContentOffset is the offset of the selection in the node - * @param aJumpLines If true, look across line boundaries. - * If false, behave as if there were base-level frames at - * line edges. * - * @return A struct holding the before/after frame and the before/after + * @param aNode is the node containing the selection + * @param aContentOffset is the offset of the selection in the node + * @param aJumpLines + * If true, look across line boundaries. + * If false, behave as if there were base-level frames at line edges. + * + * @return A struct holding the before/after frame and the before/after * level. * - * At the beginning and end of each line there is assumed to be a frame with - * Bidi level equal to the paragraph embedding level. - * In these cases the before frame and after frame respectively will be - * nullptr. + * At the beginning and end of each line there is assumed to be a frame with + * Bidi level equal to the paragraph embedding level. + * + * In these cases the before frame and after frame respectively will be + * nullptr. */ nsPrevNextBidiLevels GetPrevNextBidiLevels(nsIContent* aNode, uint32_t aContentOffset, bool aJumpLines) const; - /** GetFrameFromLevel will scan in a given direction - * until it finds a frame with a Bidi level less than or equal to a given + /** + * GetFrameFromLevel will scan in a given direction + * until it finds a frame with a Bidi level less than or equal to a given * level. It will return the last frame before this. - * @param aPresContext is the context to use - * @param aFrameIn is the frame to start from - * @param aDirection is the direction to scan - * @param aBidiLevel is the level to search for - * @param aFrameOut will hold the frame returned + * + * @param aPresContext is the context to use + * @param aFrameIn is the frame to start from + * @param aDirection is the direction to scan + * @param aBidiLevel is the level to search for + * @param aFrameOut will hold the frame returned */ nsresult GetFrameFromLevel(nsIFrame* aFrameIn, nsDirection aDirection, nsBidiLevel aBidiLevel, @@ -625,6 +688,7 @@ class nsFrameSelection final { * Dragging or extending selection will never allow for a subset * (or the whole) of the maintained selection to become unselected. * Primary use: double click selecting then dragging on second click + * * @param aAmount the initial amount of text selected (word, line or * paragraph). For "line", use eSelectBeginLine. */ diff --git a/layout/generic/nsFrameSetFrame.h b/layout/generic/nsFrameSetFrame.h index 5951088f895b..e4bf2e0fff20 100644 --- a/layout/generic/nsFrameSetFrame.h +++ b/layout/generic/nsFrameSetFrame.h @@ -45,8 +45,8 @@ enum nsFrameborder { }; struct nsFramesetDrag { - nsHTMLFramesetFrame* - mSource; // frameset whose border was dragged to cause the resize + nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause + // the resize int32_t mIndex; // index of left col or top row of effected area int32_t mChange; // pos for left to right or top to bottom, neg otherwise bool mVertical; // vertical if true, otherwise horizontal diff --git a/layout/generic/nsFrameState.cpp b/layout/generic/nsFrameState.cpp index 8c027f8f10b1..8f91c324f7ee 100644 --- a/layout/generic/nsFrameState.cpp +++ b/layout/generic/nsFrameState.cpp @@ -41,7 +41,7 @@ nsCString GetFrameState(nsIFrame* aFrame) { return result; } -#define FRAME_STATE_GROUP(name_, class_) \ +#define FRAME_STATE_GROUP_CLASS(name_, class_) \ { \ class_* frame = do_QueryFrame(aFrame); \ if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) { \ @@ -57,7 +57,7 @@ nsCString GetFrameState(nsIFrame* aFrame) { state = state & ~NS_FRAME_STATE_BIT(value_); \ } #include "nsFrameStateBits.h" -#undef FRAME_STATE_GROUP +#undef FRAME_STATE_GROUP_CLASS #undef FRAME_STATE_BIT if (state) { @@ -70,6 +70,40 @@ nsCString GetFrameState(nsIFrame* aFrame) { void PrintFrameState(nsIFrame* aFrame) { printf("%s\n", GetFrameState(aFrame).get()); } + +enum class FrameStateGroupId { +#define FRAME_STATE_GROUP_NAME(name_) name_, +#include "nsFrameStateBits.h" +#undef FRAME_STATE_GROUP_NAME + + LENGTH +}; + +void DebugVerifyFrameStateBits() { + // Build an array of all of the bits used by each group. While + // building this we assert that a bit isn't used multiple times within + // the same group. + nsFrameState bitsUsedPerGroup[size_t(FrameStateGroupId::LENGTH)] = { + nsFrameState(0)}; + +#define FRAME_STATE_BIT(group_, value_, name_) \ + { \ + auto bit = NS_FRAME_STATE_BIT(value_); \ + size_t group = size_t(FrameStateGroupId::group_); \ + MOZ_ASSERT(!(bitsUsedPerGroup[group] & bit), #name_ \ + " must not use a bit already declared within its group"); \ + bitsUsedPerGroup[group] |= bit; \ + } + +#include "nsFrameStateBits.h" +#undef FRAME_STATE_BIT + + // FIXME: Can we somehow check across the groups as well??? In other + // words, find the pairs of groups that could be used on the same + // frame (Generic paired with everything else, and a few other pairs), + // and check that we don't have bits in common between those pairs. +} + #endif } // namespace mozilla diff --git a/layout/generic/nsFrameState.h b/layout/generic/nsFrameState.h index 33c773361720..1edaa663da09 100644 --- a/layout/generic/nsFrameState.h +++ b/layout/generic/nsFrameState.h @@ -67,6 +67,7 @@ namespace mozilla { #ifdef DEBUG nsCString GetFrameState(nsIFrame* aFrame); void PrintFrameState(nsIFrame* aFrame); +void DebugVerifyFrameStateBits(); #endif } // namespace mozilla diff --git a/layout/generic/nsFrameStateBits.h b/layout/generic/nsFrameStateBits.h index 8aa8061f7a4d..8d10d6557073 100644 --- a/layout/generic/nsFrameStateBits.h +++ b/layout/generic/nsFrameStateBits.h @@ -12,19 +12,21 @@ in nsIFrame::mState -- and groups of frame state bits and which classes they apply to. - There are two macros that can be defined before #including this + There are three macros that can be defined before #including this file: - FRAME_STATE_GROUP(name_, class_) + FRAME_STATE_GROUP_NAME(name_) This denotes the existence of a named group of frame state bits. - name_ is the name of the group and class_ is the name of a frame - class that uses the frame state bits that are a part of the group. The main group of frame state bits is named "Generic" and is defined to apply to nsIFrame, i.e. all frames. All of the global frame state bits -- bits 0..19 and 32..59 -- are in this group. + FRAME_STATE_GROUP_CLASS(group_, class_) + class_ is the name of a frame class that uses the frame state bits + that are a part of the group. + FRAME_STATE_BIT(group_, value_, name_) This denotes the existence of a frame state bit. group_ indicates @@ -38,9 +40,14 @@ ******/ -#ifndef FRAME_STATE_GROUP -#define FRAME_STATE_GROUP(name_, class_) /* nothing */ -#define DEFINED_FRAME_STATE_GROUP +#ifndef FRAME_STATE_GROUP_NAME +#define FRAME_STATE_GROUP_NAME(name_) /* nothing */ +#define DEFINED_FRAME_STATE_GROUP_NAME +#endif + +#ifndef FRAME_STATE_GROUP_CLASS +#define FRAME_STATE_GROUP_CLASS(name_, class_) /* nothing */ +#define DEFINED_FRAME_STATE_GROUP_CLASS #endif #ifndef FRAME_STATE_BIT @@ -48,6 +55,11 @@ #define DEFINED_FRAME_STATE_BIT #endif +// Helper macro for the common case of a single class +#define FRAME_STATE_GROUP(name_, class_) \ + FRAME_STATE_GROUP_NAME(name_) \ + FRAME_STATE_GROUP_CLASS(name_, class_) + // == Frame state bits that apply to all frames =============================== FRAME_STATE_GROUP(Generic, nsIFrame) @@ -374,8 +386,9 @@ FRAME_STATE_BIT(GridContainer, 28, NS_STATE_GRID_HAS_CHILD_NIFS) // == Frame state bits that apply to SVG frames =============================== -FRAME_STATE_GROUP(SVG, nsSVGDisplayableFrame) -FRAME_STATE_GROUP(SVG, nsSVGContainerFrame) +FRAME_STATE_GROUP_NAME(SVG) +FRAME_STATE_GROUP_CLASS(SVG, nsSVGDisplayableFrame) +FRAME_STATE_GROUP_CLASS(SVG, nsSVGContainerFrame) FRAME_STATE_BIT(SVG, 20, NS_STATE_IS_OUTER_SVG) @@ -578,8 +591,8 @@ FRAME_STATE_BIT(Block, 63, NS_BLOCK_HAS_FIRST_LETTER_CHILD) FRAME_STATE_GROUP(Bullet, nsBulletFrame) -FRAME_STATE_BIT(Block, 62, BULLET_FRAME_HAS_FONT_INFLATION) -FRAME_STATE_BIT(Block, 63, BULLET_FRAME_IMAGE_LOADING) +FRAME_STATE_BIT(Bullet, 62, BULLET_FRAME_HAS_FONT_INFLATION) +FRAME_STATE_BIT(Bullet, 63, BULLET_FRAME_IMAGE_LOADING) // == Frame state bits that apply to image frames ============================= @@ -660,8 +673,9 @@ FRAME_STATE_BIT(TableCell, 31, NS_TABLE_CELL_CONTENT_EMPTY) // == Frame state bits that apply to table rows and table row group frames ==== -FRAME_STATE_GROUP(TableRowAndRowGroup, nsTableRowFrame) -FRAME_STATE_GROUP(TableRowAndRowGroup, nsTableRowGroupFrame) +FRAME_STATE_GROUP_NAME(TableRowAndRowGroup) +FRAME_STATE_GROUP_CLASS(TableRowAndRowGroup, nsTableRowFrame) +FRAME_STATE_GROUP_CLASS(TableRowAndRowGroup, nsTableRowGroupFrame) // see nsTableRowGroupFrame::InitRepeatedFrame FRAME_STATE_BIT(TableRowAndRowGroup, 28, NS_REPEATED_ROW_OR_ROWGROUP) @@ -690,9 +704,16 @@ FRAME_STATE_GROUP(Table, nsTableFrame) FRAME_STATE_BIT(Table, 28, NS_TABLE_PART_HAS_FIXED_BACKGROUND) -#ifdef DEFINED_FRAME_STATE_GROUP -#undef DEFINED_FRAME_STATE_GROUP #undef FRAME_STATE_GROUP + +#ifdef DEFINED_FRAME_STATE_GROUP_NAME +#undef DEFINED_FRAME_STATE_GROUP_NAME +#undef FRAME_STATE_GROUP_NAME +#endif + +#ifdef DEFINED_FRAME_STATE_GROUP_CLASS +#undef DEFINED_FRAME_STATE_GROUP_CLASS +#undef FRAME_STATE_GROUP_CLASS #endif #ifdef DEFINED_FRAME_STATE_BIT diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index e7e43bfe8a32..058a1c7f01c6 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -226,10 +226,9 @@ struct MOZ_STACK_CLASS ScrollReflowInput { bool mShowVScrollbar; ScrollReflowInput(nsIScrollableFrame* aFrame, const ReflowInput& aReflowInput) - : mReflowInput(aReflowInput) + : mReflowInput(aReflowInput), // mBoxState is just used for scrollbars so we don't need to // worry about the reflow depth here - , mBoxState(aReflowInput.mFrame->PresContext(), aReflowInput.mRenderingContext) { ScrollStyles styles = aFrame->GetScrollStyles(); @@ -1867,10 +1866,11 @@ ComputeBezierAnimationSettingsForOrigin(nsAtom* aOrigin) { } // Keep the animation duration longer than the average event intervals - // (to "connect" consecutive scroll animations before the scroll comes to a - // stop). - static const double kDefaultDurationToIntervalRatio = - 2; // Duplicated at all.js + // (to "connect" consecutive scroll animations before the scroll comes to a + // stop). + // + // Default value is duplicated in all.js. + static const double kDefaultDurationToIntervalRatio = 2; intervalRatio = Preferences::GetInt("general.smoothScroll.durationToIntervalRatio", kDefaultDurationToIntervalRatio * 100) / diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index a3e73b2b3326..497a761764e4 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -338,16 +338,15 @@ std::ostream& operator<<(std::ostream& aStream, const nsReflowStatus& aStatus); * If all four deltas are zero, this means that no overflow rect has * actually been set (this is the initial state of newly-created frames). */ -#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe // max delta we can store -#define NS_FRAME_OVERFLOW_NONE \ - 0x00000000 // there are no overflow rects; - // code relies on this being - // the all-zero value +// max delta we can store +#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe -#define NS_FRAME_OVERFLOW_LARGE \ - 0x000000ff // overflow is stored as a - // separate rect property +// there are no overflow rects; code relies on this being the all-zero value +#define NS_FRAME_OVERFLOW_NONE 0x00000000 + +// overflow is stored as a separate rect property +#define NS_FRAME_OVERFLOW_LARGE 0x000000ff /** * nsBidiLevel is the type of the level values in our Unicode Bidi @@ -381,14 +380,16 @@ std::ostream& operator<<(std::ostream& aStream, const nsReflowStatus& aStatus); */ typedef uint8_t nsBidiLevel; -/** Paragraph level setting. - * If there is no strong character, then set the paragraph level to 0 +/** + * Paragraph level setting. + * If there is no strong character, then set the paragraph level to 0 * (left-to-right). */ #define NSBIDI_DEFAULT_LTR 0xfe -/** Paragraph level setting. - * If there is no strong character, then set the paragraph level to 1 +/** + * Paragraph level setting. + * If there is no strong character, then set the paragraph level to 1 * (right-to-left). */ #define NSBIDI_DEFAULT_RTL 0xff @@ -397,7 +398,6 @@ typedef uint8_t nsBidiLevel; * Maximum explicit embedding level. * (The maximum resolved level can be up to * NSBIDI_MAX_EXPLICIT_LEVEL+1). - * */ #define NSBIDI_MAX_EXPLICIT_LEVEL 125 @@ -617,7 +617,8 @@ class nsIFrame : public nsQueryFrame { // Note that |this| is deleted at this point. } - /** Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return + /** + * Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return * values. */ enum FrameSearchResult { @@ -1147,13 +1148,13 @@ class nsIFrame : public nsQueryFrame { #define NS_DECLARE_FRAME_PROPERTY_RELEASABLE(prop, type) \ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, ReleaseValue) -#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \ - static void AssertOnDestroyingProperty##prop(type*) { \ - MOZ_ASSERT_UNREACHABLE("Frame property " #prop \ - " should never " \ - "be destroyed by the FrameProperties class"); \ - } \ - NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, \ +#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \ + static void AssertOnDestroyingProperty##prop(type*) { \ + MOZ_ASSERT_UNREACHABLE( \ + "Frame property " #prop \ + " should never be destroyed by the FrameProperties class"); \ + } \ + NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, \ AssertOnDestroyingProperty##prop) #define NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(prop, type) \ @@ -1833,11 +1834,11 @@ class nsIFrame : public nsQueryFrame { /** * Event handling of GUI events. * - * @param aEvent event structure describing the type of event and rge widget - * where the event originated - * The |point| member of this is in the coordinate system of the - * view returned by GetOffsetFromView. - * @param aEventStatus a return value indicating whether the event was + * @param aEvent event structure describing the type of event and rge widget + * where the event originated. The |point| member of this is in the coordinate + * system of the view returned by GetOffsetFromView. + * + * @param aEventStatus a return value indicating whether the event was * handled and whether default processing should be done * * XXX From a frame's perspective it's unclear what the effect of the event @@ -2324,8 +2325,8 @@ class nsIFrame : public nsQueryFrame { * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-align-3/#valdef-justify-self-stretch */ - eIApplyAutoMinSize = - 1 << 4, // only has an effect when eShrinkWrap is false + eIApplyAutoMinSize = 1 << 4, // only has an effect when eShrinkWrap is + // false }; /** @@ -3184,27 +3185,28 @@ class nsIFrame : public nsQueryFrame { } /** - * called to discover where this frame, or a parent frame has user-select + * Called to discover where this frame, or a parent frame has user-select * style applied, which affects that way that it is selected. * - * @param aSelectStyle out param. Returns the type of selection style found - * (using values defined in nsStyleConsts.h). + * @param aSelectStyle out param. Returns the type of selection style found + * (using values defined in nsStyleConsts.h). * - * @return Whether the frame can be selected (i.e. is not affected by - * user-select: none) + * @return Whether the frame can be selected (i.e. is not affected by + * user-select: none) */ bool IsSelectable(mozilla::StyleUserSelect* aSelectStyle) const; /** - * Called to retrieve the SelectionController associated with the frame. - * @param aSelCon will contain the selection controller associated with - * the frame. + * Called to retrieve the SelectionController associated with the frame. + * + * @param aSelCon will contain the selection controller associated with + * the frame. */ virtual nsresult GetSelectionController(nsPresContext* aPresContext, nsISelectionController** aSelCon) = 0; /** - * Call to get nsFrameSelection for this frame. + * Call to get nsFrameSelection for this frame. */ already_AddRefed GetFrameSelection(); @@ -3215,28 +3217,36 @@ class nsIFrame : public nsQueryFrame { const nsFrameSelection* GetConstFrameSelection() const; /** - * called to find the previous/next character, word, or line returns the - * actual nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE - * uses frame's begin selection state to start. if no selection on this frame - * will return NS_ERROR_FAILURE - * @param aPOS is defined in nsFrameSelection + * called to find the previous/next character, word, or line. Returns the + * actual nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE. + * Uses frame's begin selection state to start. If no selection on this frame + * will return NS_ERROR_FAILURE. + * + * @param aPOS is defined in nsFrameSelection */ virtual nsresult PeekOffset(nsPeekOffsetStruct* aPos); /** - * called to find the previous/next non-anonymous selectable leaf frame. - * @param aDirection [in] the direction to move in (eDirPrevious or eDirNext) - * @param aVisual [in] whether bidi caret behavior is visual (true) or + * Called to find the previous/next non-anonymous selectable leaf frame. + * + * @param aDirection [in] the direction to move in (eDirPrevious or eDirNext) + * + * @param aVisual [in] whether bidi caret behavior is visual (true) or * logical (false) - * @param aJumpLines [in] whether to allow jumping across line boundaries - * @param aScrollViewStop [in] whether to stop when reaching a scroll frame + * + * @param aJumpLines [in] whether to allow jumping across line boundaries + * @param aScrollViewStop [in] whether to stop when reaching a scroll frame * boundary - * @param aOutFrame [out] the previous/next selectable leaf frame - * @param aOutOffset [out] 0 indicates that we arrived at the beginning of + * + * @param aOutFrame [out] the previous/next selectable leaf frame + * + * @param aOutOffset [out] 0 indicates that we arrived at the beginning of * the output frame; -1 indicates that we arrived at its end. - * @param aOutJumpedLine [out] whether this frame and the returned frame are + * + * @param aOutJumpedLine [out] whether this frame and the returned frame are * on different lines - * @param aOutMovedOverNonSelectableText [out] whether we jumped over a + * + * @param aOutMovedOverNonSelectableText [out] whether we jumped over a * non-selectable frame during the search */ nsresult GetFrameFromDirection(nsDirection aDirection, bool aVisual, @@ -3247,17 +3257,22 @@ class nsIFrame : public nsQueryFrame { bool* aOutMovedOverNonSelectableText); /** - * called to see if the children of the frame are visible from indexstart to - * index end. this does not change any state. returns true only if the indexes - * are valid and any of the children are visible. for textframes this index - * is the character index. if aStart = aEnd result will be false - * @param aStart start index of first child from 0-N (number of children) - * @param aEnd end index of last child from 0-N - * @param aRecurse should this frame talk to siblings to get to the contents + * Called to see if the children of the frame are visible from indexstart to + * index end. This does not change any state. Returns true only if the indexes + * are valid and any of the children are visible. For textframes this index + * is the character index. If aStart = aEnd result will be false. + * + * @param aStart start index of first child from 0-N (number of children) + * + * @param aEnd end index of last child from 0-N + * + * @param aRecurse should this frame talk to siblings to get to the contents * other children? - * @param aFinished did this frame have the aEndIndex? or is there more work + * + * @param aFinished did this frame have the aEndIndex? or is there more work * to do - * @param _retval return value true or false. false = range is not rendered. + * + * @param _retval return value true or false. false = range is not rendered. */ virtual nsresult CheckVisibility(nsPresContext* aContext, int32_t aStartIndex, int32_t aEndIndex, bool aRecurse, @@ -4283,30 +4298,38 @@ class nsIFrame : public nsQueryFrame { // Helpers /** * Can we stop inside this frame when we're skipping non-rendered whitespace? - * @param aForward [in] Are we moving forward (or backward) in content order. - * @param aOffset [in/out] At what offset into the frame to start looking. - * on output - what offset was reached (whether or not we found a - * place to stop). - * @return STOP: An appropriate offset was found within this frame, - * and is given by aOffset. - * CONTINUE: Not found within this frame, need to try the next frame. - * see enum FrameSearchResult for more details. + * + * @param aForward [in] Are we moving forward (or backward) in content order. + * + * @param aOffset [in/out] At what offset into the frame to start looking. + * at offset was reached (whether or not we found a place to stop). + * + * @return + * * STOP: An appropriate offset was found within this frame, + * and is given by aOffset. + * * CONTINUE: Not found within this frame, need to try the next frame. + * See enum FrameSearchResult for more details. */ virtual FrameSearchResult PeekOffsetNoAmount(bool aForward, int32_t* aOffset) = 0; /** * Search the frame for the next character - * @param aForward [in] Are we moving forward (or backward) in content order. - * @param aOffset [in/out] At what offset into the frame to start looking. - * on output - what offset was reached (whether or not we found a - * place to stop). - * @param aOptions [in] Options, see the comment in - * PeekOffsetCharacterOptions for the detail. - * @return STOP: An appropriate offset was found within this frame, - * and is given by aOffset. - * CONTINUE: Not found within this frame, need to try the next frame. - * see enum FrameSearchResult for more details. + * + * @param aForward [in] Are we moving forward (or backward) in content order. + * + * @param aOffset [in/out] At what offset into the frame to start looking. + * on output - what offset was reached (whether or not we found a place to + * stop). + * + * @param aOptions [in] Options, see the comment in PeekOffsetCharacterOptions + * for the detail. + * + * @return + * * STOP: An appropriate offset was found within this frame, and is given + * by aOffset. + * * CONTINUE: Not found within this frame, need to try the next frame. See + * enum FrameSearchResult for more details. */ virtual FrameSearchResult PeekOffsetCharacter( bool aForward, int32_t* aOffset, diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index 94579d3458a1..2a985d2e48a8 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -36,9 +36,8 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock) : mFirstChild(aFrame), mWritingMode(), mContainerSize(-1, -1), - mBounds(WritingMode()) // mBounds will be initialized with the correct - // writing mode when it is set - , + mBounds(WritingMode()), // mBounds will be initialized with the correct + // writing mode when it is set mFrames(), mAscent(), mAllFlags(0), diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index 7401b0e96630..1a5872e7aa7c 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -1181,8 +1181,7 @@ void nsPluginFrame::PrintPlugin(gfxContext& aRenderingContext, * meta surface. */ - /* we'll already be translated into the right spot by gfxWindowsNativeDrawing - */ + // we'll already be translated into the right spot by gfxWindowsNativeDrawing nsSize contentSize = GetContentRectRelativeToSelf().Size(); window.x = 0; window.y = 0; @@ -1191,8 +1190,7 @@ void nsPluginFrame::PrintPlugin(gfxContext& aRenderingContext, aRenderingContext.Save(); - /* Make sure plugins don't do any damage outside of where they're supposed to - */ + // Make sure plugins don't do any damage outside of where they're supposed to aRenderingContext.NewPath(); gfxRect r(window.x, window.y, window.width, window.height); aRenderingContext.Rectangle(r); diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 86fbe3daffc8..e1d2367d8c73 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -2933,42 +2933,40 @@ static bool IsJustifiableCharacter(const nsStyleText* aTextStyle, return false; } if (aLangIsCJ) { - if ((0x2150u <= ch && - ch <= 0x22ffu) || // Number Forms, Arrows, Mathematical Operators - (0x2460u <= ch && ch <= 0x24ffu) || // Enclosed Alphanumerics - (0x2580u <= ch && - ch <= 0x27bfu) || // Block Elements, Geometric Shapes, Miscellaneous - // Symbols, Dingbats - (0x27f0u <= ch && - ch <= 0x2bffu) || // Supplemental Arrows-A, Braille Patterns, - // Supplemental Arrows-B, Miscellaneous Mathematical - // Symbols-B, Supplemental Mathematical Operators, - // Miscellaneous Symbols and Arrows - (0x2e80u <= ch && - ch <= 0x312fu) || // CJK Radicals Supplement, CJK Radicals Supplement, - // Ideographic Description Characters, CJK Symbols - // and Punctuation, Hiragana, Katakana, Bopomofo - (0x3190u <= ch && - ch <= 0xabffu) || // Kanbun, Bopomofo Extended, Katakana Phonetic - // Extensions, Enclosed CJK Letters and Months, CJK - // Compatibility, CJK Unified Ideographs Extension - // A, Yijing Hexagram Symbols, CJK Unified - // Ideographs, Yi Syllables, Yi Radicals - (0xf900u <= ch && ch <= 0xfaffu) || // CJK Compatibility Ideographs - (0xff5eu <= ch && - ch <= 0xff9fu) // Halfwidth and Fullwidth Forms(a part) - ) { + if ( // Number Forms, Arrows, Mathematical Operators + (0x2150u <= ch && ch <= 0x22ffu) || + // Enclosed Alphanumerics + (0x2460u <= ch && ch <= 0x24ffu) || + // Block Elements, Geometric Shapes, Miscellaneous Symbols, Dingbats + (0x2580u <= ch && ch <= 0x27bfu) || + // Supplemental Arrows-A, Braille Patterns, Supplemental Arrows-B, + // Miscellaneous Mathematical Symbols-B, + // Supplemental Mathematical Operators, Miscellaneous Symbols and Arrows + (0x27f0u <= ch && ch <= 0x2bffu) || + // CJK Radicals Supplement, CJK Radicals Supplement, Ideographic + // Description Characters, CJK Symbols and Punctuation, Hiragana, + // Katakana, Bopomofo + (0x2e80u <= ch && ch <= 0x312fu) || + // Kanbun, Bopomofo Extended, Katakana Phonetic Extensions, + // Enclosed CJK Letters and Months, CJK Compatibility, + // CJK Unified Ideographs Extension A, Yijing Hexagram Symbols, + // CJK Unified Ideographs, Yi Syllables, Yi Radicals + (0x3190u <= ch && ch <= 0xabffu) || + // CJK Compatibility Ideographs + (0xf900u <= ch && ch <= 0xfaffu) || + // Halfwidth and Fullwidth Forms (a part) + (0xff5eu <= ch && ch <= 0xff9fu)) { return true; } char16_t ch2; if (NS_IS_HIGH_SURROGATE(ch) && aFrag->GetLength() > uint32_t(aPos) + 1 && NS_IS_LOW_SURROGATE(ch2 = aFrag->CharAt(aPos + 1))) { uint32_t u = SURROGATE_TO_UCS4(ch, ch2); - if (0x20000u <= u && - u <= 0x2ffffu) { // CJK Unified Ideographs Extension B, - // CJK Unified Ideographs Extension C, - // CJK Unified Ideographs Extension D, - // CJK Compatibility Ideographs Supplement + // CJK Unified Ideographs Extension B, + // CJK Unified Ideographs Extension C, + // CJK Unified Ideographs Extension D, + // CJK Compatibility Ideographs Supplement + if (0x20000u <= u && u <= 0x2ffffu) { return true; } } @@ -3550,10 +3548,11 @@ gfxFloat PropertyProvider::GetHyphenWidth() const { } static inline bool IS_HYPHEN(char16_t u) { - return (u == char16_t('-') || u == 0x058A || // ARMENIAN HYPHEN - u == 0x2010 || // HYPHEN - u == 0x2012 || // FIGURE DASH - u == 0x2013); // EN DASH + return u == char16_t('-') || // HYPHEN-MINUS + u == 0x058A || // ARMENIAN HYPHEN + u == 0x2010 || // HYPHEN + u == 0x2012 || // FIGURE DASH + u == 0x2013; // EN DASH } void PropertyProvider::GetHyphenationBreaks(Range aRange, diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 76b2cf6a04c9..bcf893db9052 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -579,46 +579,38 @@ bool nsCaseTransformTextRunFactory::TransformString( break; case NS_STYLE_TEXT_TRANSFORM_FULL_SIZE_KANA: { + // clang-format off static const uint16_t kSmallKanas[] = { // ぁ ぃ ぅ ぇ ぉ っ ゃ ゅ ょ - 0x3041, 0x3043, 0x3045, 0x3047, 0x3049, 0x3063, 0x3083, 0x3085, - 0x3087, + 0x3041, 0x3043, 0x3045, 0x3047, 0x3049, 0x3063, 0x3083, 0x3085, 0x3087, // ゎ ゕ ゖ 0x308E, 0x3095, 0x3096, // ァ ィ ゥ ェ ォ ッ ャ ュ ョ - 0x30A1, 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30C3, 0x30E3, 0x30E5, - 0x30E7, + 0x30A1, 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30C3, 0x30E3, 0x30E5, 0x30E7, // ヮ ヵ ヶ ㇰ ㇱ ㇲ ㇳ ㇴ ㇵ - 0x30EE, 0x30F5, 0x30F6, 0x31F0, 0x31F1, 0x31F2, 0x31F3, 0x31F4, - 0x31F5, + 0x30EE, 0x30F5, 0x30F6, 0x31F0, 0x31F1, 0x31F2, 0x31F3, 0x31F4, 0x31F5, // ㇶ ㇷ ㇸ ㇹ ㇺ ㇻ ㇼ ㇽ ㇾ - 0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB, 0x31FC, 0x31FD, - 0x31FE, + 0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB, 0x31FC, 0x31FD, 0x31FE, // ㇿ 0x31FF, // ァ ィ ゥ ェ ォ ャ ュ ョ ッ - 0xFF67, 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, - 0xFF6F}; + 0xFF67, 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F}; static const uint16_t kFullSizeKanas[] = { // あ い う え お つ や ゆ よ - 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3064, 0x3084, 0x3086, - 0x3088, + 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3064, 0x3084, 0x3086, 0x3088, // わ か け 0x308F, 0x304B, 0x3051, // ア イ ウ エ オ ツ ヤ ユ ヨ - 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30C4, 0x30E4, 0x30E6, - 0x30E8, + 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30C4, 0x30E4, 0x30E6, 0x30E8, // ワ カ ケ ク シ ス ト ヌ ハ - 0x30EF, 0x30AB, 0x30B1, 0x30AF, 0x30B7, 0x30B9, 0x30C8, 0x30CC, - 0x30CF, + 0x30EF, 0x30AB, 0x30B1, 0x30AF, 0x30B7, 0x30B9, 0x30C8, 0x30CC, 0x30CF, // ヒ フ ヘ ホ ム ラ リ ル レ - 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30E0, 0x30E9, 0x30EA, 0x30EB, - 0x30EC, + 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30E0, 0x30E9, 0x30EA, 0x30EB, 0x30EC, // ロ 0x30ED, // ア イ ウ エ オ ヤ ユ ヨ ツ - 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF94, 0xFF95, 0xFF96, - 0xFF82}; + 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF94, 0xFF95, 0xFF96, 0xFF82}; + // clang-format on size_t index; const uint16_t len = MOZ_ARRAY_LENGTH(kSmallKanas); diff --git a/layout/mathml/nsIMathMLFrame.h b/layout/mathml/nsIMathMLFrame.h index 8d2689915a54..837bd5a7b373 100644 --- a/layout/mathml/nsIMathMLFrame.h +++ b/layout/mathml/nsIMathMLFrame.h @@ -127,19 +127,19 @@ class nsIMathMLFrame { * to have already reached in their own InheritAutomaticData(). * - set properties that your descendants assume that you would have set in * your InheritAutomaticData() -- this way, they can safely query them - * and the process will feed upon itself. + * and the process will feed upon itself. * * 2. Use TransmitAutomaticData() to set properties related to your * descendants: * - set properties that depend on the state that you expect your - * descendants to have reached upon processing their own - * TransmitAutomaticData(). + * descendants to have reached upon processing their own + * TransmitAutomaticData(). * - transmit properties that your descendants expect that you will - * transmit to them in your TransmitAutomaticData() -- this way, they remain - * up-to-date. + * transmit to them in your TransmitAutomaticData() -- this way, they + * remain up-to-date. * - set properties that your ancestors expect that you would set in your * TransmitAutomaticData() -- this way, they can safely query them and - * the process will feed upon itself. + * the process will feed upon itself. */ NS_IMETHOD diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index fe49a02b5206..ce7007bcb853 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -1003,12 +1003,12 @@ static int32_t // spacing is not to be used for scriptlevel > 0 /* Ord OpOrd OpInv OpUsr Inner Italic Upright */ - /*Ord */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00}, - /*OpOrd*/ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - /*OpInv*/ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - /*OpUsr*/ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01}, - /*Inner*/ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01}, - /*Italic*/ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01}, + /*Ord */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00}, + /*OpOrd */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + /*OpInv */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + /*OpUsr */ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01}, + /*Inner */ {0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01}, + /*Italic */ {0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01}, /*Upright*/ {0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}}; #define GET_INTERSPACE(scriptlevel_, frametype1_, frametype2_, space_) \ diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h index 28409530a15c..784e4937d112 100644 --- a/layout/mathml/nsMathMLContainerFrame.h +++ b/layout/mathml/nsMathMLContainerFrame.h @@ -124,8 +124,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame { // we just re-layout them using ReLayoutChildren(this); // (e.g., this happens with ). // 2b. If the automatic data to update affects us in some way, we ask our - // parent - // to re-layout its children using ReLayoutChildren(mParent); + // parent to re-layout its children using ReLayoutChildren(mParent); // Therefore, there is an overhead here in that our siblings are // re-laid too (e.g., this happens with , , // ). diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index 01e251384c46..7999b70c4c3e 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -48,16 +48,17 @@ nsMathMLmpaddedFrame::InheritAutomaticData(nsIFrame* aParent) { } void nsMathMLmpaddedFrame::ProcessAttributes() { + // clang-format off /* parse the attributes - width = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | - namedspace) height = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | - v-unit | namedspace) depth = [+|-] unsigned-number (% [pseudo-unit] | - pseudo-unit | v-unit | namedspace) lspace = [+|-] unsigned-number (% - [pseudo-unit] | pseudo-unit | h-unit | namedspace) voffset= [+|-] - unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace) + width = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace) + height = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace) + depth = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace) + lspace = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace) + voffset= [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace) */ + // clang-format on nsAutoString value; diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index 81d7f45f2597..6b5ece53bf7e 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -636,8 +636,8 @@ static void ListMathMLTree(nsIFrame* atLeast) { for (; f; f = f->GetParent()) { nsIContent* c = f->GetContent(); if (!c || c->IsMathMLElement(nsGkAtoms::math) || - c->NodeInfo()->NameAtom( - nsGkAtoms::body)) // XXXbaku which kind of body tag? + // XXXbaku which kind of body tag? + c->NodeInfo()->NameAtom(nsGkAtoms::body)) break; } if (!f) f = atLeast; diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index 054f8b4aae13..cfde0849c259 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -387,12 +387,10 @@ DisplayItemData* DisplayItemData::AssertDisplayItemData( class LayerManagerData : public LayerUserData { public: explicit LayerManagerData(LayerManager* aManager) - : mLayerManager(aManager) + : mLayerManager(aManager), #ifdef DEBUG_DISPLAY_ITEM_DATA - , - mParent(nullptr) + mParent(nullptr), #endif - , mInvalidateAllLayers(false) { MOZ_COUNT_CTOR(LayerManagerData); } diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index 100af2f83901..e8b2a5802440 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -61,8 +61,8 @@ class nsPrintData { nsCOMArray mPrintProgressListeners; nsCOMPtr mPrintProgressParams; - nsCOMPtr - mCurrentFocusWin; // cache a pointer to the currently focused window + nsCOMPtr mCurrentFocusWin; // cache a pointer to the + // currently focused window // Array of non-owning pointers to all the nsPrintObjects owned by this // nsPrintData. This includes this->mPrintObject, as well as all of its diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index dcc83f392d57..18c8c9aaf20f 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -203,81 +203,72 @@ struct CJKIdeographicData { bool informal; }; static const CJKIdeographicData gDataJapaneseInformal = { - {// digit - 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x5341, 0x767e, 0x5343}, // unit {0x4e07, 0x5104}, // unit10K JAPANESE, // lang true // informal }; static const CJKIdeographicData gDataJapaneseFormal = { - {// digit - 0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, 0x4f0d, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, 0x4f0d, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x62fe, 0x767e, 0x9621}, // unit {0x842c, 0x5104}, // unit10K JAPANESE, // lang false // informal }; static const CJKIdeographicData gDataKoreanHangulFormal = { - {// digit - 0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, 0xc624, 0xc721, 0xce60, 0xd314, - 0xad6c}, + {0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, 0xc624, 0xc721, 0xce60, 0xd314, + 0xad6c}, // digit {0xc2ed, 0xbc31, 0xcc9c}, // unit {0xb9cc, 0xc5b5}, // unit10K KOREAN, // lang false // informal }; static const CJKIdeographicData gDataKoreanHanjaInformal = { - {// digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x5341, 0x767e, 0x5343}, // unit {0x842c, 0x5104}, // unit10K KOREAN, // lang true // informal }; static const CJKIdeographicData gDataKoreanHanjaFormal = { - {// digit - 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x62fe, 0x767e, 0x4edf}, // unit {0x842c, 0x5104}, // unit10K KOREAN, // lang false // informal }; static const CJKIdeographicData gDataSimpChineseInformal = { - {// digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x5341, 0x767e, 0x5343}, // unit {0x4e07, 0x4ebf}, // unit10K CHINESE, // lang true // informal }; static const CJKIdeographicData gDataSimpChineseFormal = { - {// digit - 0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, 0x4f0d, 0x9646, 0x67d2, 0x634c, - 0x7396}, + {0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, 0x4f0d, 0x9646, 0x67d2, 0x634c, + 0x7396}, // digit {0x62fe, 0x4f70, 0x4edf}, // unit {0x4e07, 0x4ebf}, // unit10K CHINESE, // lang false // informal }; static const CJKIdeographicData gDataTradChineseInformal = { - {// digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, - 0x4e5d}, + {0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, + 0x4e5d}, // digit {0x5341, 0x767e, 0x5343}, // unit {0x842c, 0x5104}, // unit10K CHINESE, // lang true // informal }; static const CJKIdeographicData gDataTradChineseFormal = { - {// digit - 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2, 0x634c, - 0x7396}, + {0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2, 0x634c, + 0x7396}, // digit {0x62fe, 0x4f70, 0x4edf}, // unit {0x842c, 0x5104}, // unit10K CHINESE, // lang diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 524d0af5d414..fb4f6d4898f5 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -640,9 +640,8 @@ nsresult FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry, if (NS_SUCCEEDED(rv)) { mLoaders.PutEntry(fontLoader); fontLoader->StartedLoading(streamLoader); - aUserFontEntry->SetLoader( - fontLoader); // let the font entry remember the - // loader, in case we need to cancel it + // let the font entry remember the loader, in case we need to cancel it + aUserFontEntry->SetLoader(fontLoader); } return rv; diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index 0dfd5bcfa121..fe5ed137ae7e 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -53,14 +53,12 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy, StyleSheet* aParentToUse, mOwningNode(aOwningNodeToUse), mOwnerRule(aOwnerRuleToUse), mParsingMode(aCopy.mParsingMode), - mState(aCopy.mState) + mState(aCopy.mState), // We only use this constructor during cloning. It's the cloner's // responsibility to notify us if we end up being owned by a document. - , mAssociationMode(NotOwnedByDocumentOrShadowRoot), - mInner( - aCopy.mInner) // Shallow copy, but concrete subclasses will fix up. -{ + // Shallow copy, but concrete subclasses will fix up. + mInner(aCopy.mInner) { MOZ_ASSERT(mInner, "Should only copy StyleSheets with an mInner."); mInner->AddSheet(this); @@ -857,9 +855,10 @@ already_AddRefed StyleSheet::CreateEmptyChildSheet( // // (1) The pref is off. // (2) The browser is recording CSS errors (which parallel parsing can't -// handle). (3) The stylesheet is a chrome stylesheet, since those can use -// -moz-bool-pref, -// which needs to access the pref service, which is not threadsafe. +// handle). +// (3) The stylesheet is a chrome stylesheet, since those can use +// -moz-bool-pref, which needs to access the pref service, which is not +// threadsafe. static bool AllowParallelParse(css::Loader* aLoader, nsIURI* aSheetURI) { // Check the pref. if (!StaticPrefs::layout_css_parsing_parallel()) { diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index 684a5a1e366a..930864c78cce 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -458,9 +458,9 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache { StyleSheet* mParent; // weak ref nsString mTitle; - dom::DocumentOrShadowRoot* - mDocumentOrShadowRoot; // weak ref; parents maintain this for their - // children + + // weak ref; parents maintain this for their children + dom::DocumentOrShadowRoot* mDocumentOrShadowRoot; nsINode* mOwningNode; // weak ref dom::CSSImportRule* mOwnerRule; // weak ref diff --git a/layout/style/URLExtraData.h b/layout/style/URLExtraData.h index a27f975a1e1b..c41eb94b35f4 100644 --- a/layout/style/URLExtraData.h +++ b/layout/style/URLExtraData.h @@ -28,10 +28,9 @@ struct URLExtraData { : mBaseURI(std::move(aBaseURI)), mReferrer(std::move(aReferrer)), mReferrerPolicy(aReferrerPolicy), - mPrincipal(std::move(aPrincipal)) + mPrincipal(std::move(aPrincipal)), // When we hold the URI data of a style sheet, mReferrer is always // equal to the sheet URI. - , mIsChrome(mReferrer ? dom::IsChromeURI(mReferrer) : false) { MOZ_ASSERT(mBaseURI); MOZ_ASSERT(mPrincipal); diff --git a/layout/style/nsCSSAnonBoxes.h b/layout/style/nsCSSAnonBoxes.h index f9674fc9f096..adada70f28fc 100644 --- a/layout/style/nsCSSAnonBoxes.h +++ b/layout/style/nsCSSAnonBoxes.h @@ -71,7 +71,10 @@ class nsCSSAnonBoxes { static bool IsWrapperAnonBox(nsAtom* aPseudo) { // We commonly get null passed here, and want to quickly return false for // it. - return aPseudo && ( + if (!aPseudo) { + return false; + } + return #define CSS_ANON_BOX(_name, _value) /* nothing */ #define CSS_WRAPPER_ANON_BOX(_name, _value) \ nsGkAtoms::AnonBox_##_name == aPseudo || @@ -80,7 +83,7 @@ class nsCSSAnonBoxes { #undef CSS_NON_INHERITING_ANON_BOX #undef CSS_WRAPPER_ANON_BOX #undef CSS_ANON_BOX - false); + false; } // Get the NonInheriting type for a given pseudo tag. The pseudo tag must diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 260dceaed560..8377f283f08a 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -293,27 +293,24 @@ class nsCSSProps { // Not const because we modify its entries when various // "layout.css.*.enabled" prefs changes: static KTableEntry kDisplayKTable[]; - // -- tables for parsing the {align,justify}-{content,items,self} properties - // -- + // clang-format off + // -- tables for parsing the {align,justify}-{content,items,self} properties -- static const KTableEntry kAlignAllKeywords[]; static const KTableEntry kAlignOverflowPosition[]; // static const KTableEntry kAlignSelfPosition[]; // static const KTableEntry kAlignLegacy[]; // 'legacy' static const KTableEntry kAlignLegacyPosition[]; // 'left/right/center' - static const KTableEntry - kAlignAutoNormalStretchBaseline[]; // 'auto/normal/stretch/baseline' - static const KTableEntry - kAlignNormalStretchBaseline[]; // 'normal/stretch/baseline' + static const KTableEntry kAlignAutoNormalStretchBaseline[]; // 'auto/normal/stretch/baseline' + static const KTableEntry kAlignNormalStretchBaseline[]; // 'normal/stretch/baseline' static const KTableEntry kAlignNormalBaseline[]; // 'normal/baseline' - static const KTableEntry - kAlignContentDistribution[]; // + static const KTableEntry kAlignContentDistribution[]; // static const KTableEntry kAlignContentPosition[]; // - // -- tables for auto-completion of the {align,justify}-{content,items,self} - // properties -- + // -- tables for auto-completion of the {align,justify}-{content,items,self} properties -- static const KTableEntry kAutoCompletionAlignJustifySelf[]; static const KTableEntry kAutoCompletionAlignItems[]; static const KTableEntry kAutoCompletionAlignJustifyContent[]; // ------------------------------------------------------------------ + // clang-format on static const KTableEntry kFontSmoothingKTable[]; static const KTableEntry kGridAutoFlowKTable[]; static const KTableEntry kGridTrackBreadthKTable[]; diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index 132d061d73b0..9feb7f93d3b2 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -250,8 +250,8 @@ enum nsCSSUnit { eCSSUnit_Unset = 4, // (n/a) value equivalent to 'initial' if on a reset // property, 'inherit' otherwise eCSSUnit_None = 5, // (n/a) value is none - eCSSUnit_Normal = - 6, // (n/a) value is normal (algorithmic, different than auto) + eCSSUnit_Normal = 6, // (n/a) value is normal (algorithmic, different than + // auto) eCSSUnit_System_Font = 7, // (n/a) value is -moz-use-system-font eCSSUnit_All = 8, // (n/a) value is all eCSSUnit_Dummy = 9, // (n/a) a fake but specified value, used @@ -264,32 +264,28 @@ enum nsCSSUnit { eCSSUnit_Attr = 14, // (char16_t*) a attr(string) value eCSSUnit_Element = 15, // (char16_t*) an element id - eCSSUnit_Array = 20, // (nsCSSValue::Array*) a list of values - eCSSUnit_Counter = - 21, // (nsCSSValue::Array*) a counter(string,[string]) value - eCSSUnit_Counters = - 22, // (nsCSSValue::Array*) a counters(string,string[,string]) value - eCSSUnit_Cubic_Bezier = 23, // (nsCSSValue::Array*) a list of float values - eCSSUnit_Steps = 24, // (nsCSSValue::Array*) a list of (integer, enumerated) - eCSSUnit_Symbols = - 25, // (nsCSSValue::Array*) a symbols(enumerated, symbols) value - eCSSUnit_Function = 26, // (nsCSSValue::Array*) a function with - // parameters. First elem of array is name, - // an nsCSSKeyword as eCSSUnit_Enumerated, - // the rest of the values are arguments. + // nsCSSValue::Array* values + eCSSUnit_Array = 20, // (Array*) a list of values + eCSSUnit_Counter = 21, // (Array*) a counter(string,[string]) value + eCSSUnit_Counters = 22, // (Array*) a counters(string,string[,string]) value + eCSSUnit_Cubic_Bezier = 23, // (Array*) a list of float values + eCSSUnit_Steps = 24, // (Array*) a list of (integer, enumerated) + eCSSUnit_Symbols = 25, // (Array*) a symbols(enumerated, symbols) value + eCSSUnit_Function = 26, // (Array*) a function with parameters. First elem of + // array is name, an nsCSSKeyword as + // eCSSUnit_Enumerated, the rest of the values are + // arguments. // The top level of a calc() expression is eCSSUnit_Calc. All // remaining eCSSUnit_Calc_* units only occur inside these toplevel // calc values. - // eCSSUnit_Calc has an array with exactly 1 element. eCSSUnit_Calc - // exists so we can distinguish calc(2em) from 2em as specified values - // (but we drop this distinction for nsStyleCoord when we store + // eCSSUnit_Calc exists so we can distinguish calc(2em) from 2em as specified + // values (but we drop this distinction for nsStyleCoord when we store // computed values). - eCSSUnit_Calc = 30, // (nsCSSValue::Array*) calc() value - // Plus, Minus, Times_* and Divided have arrays with exactly 2 - // elements. a + b + c + d is grouped as ((a + b) + c) + d - eCSSUnit_Calc_Plus = 31, // (nsCSSValue::Array*) + node within calc() + eCSSUnit_Calc = 30, // (Array*) calc() value -- exactly 1 elt. + eCSSUnit_Calc_Plus = 31, // (Array*) + node within calc(); exactly 2 elts. + // a + b + c + d is grouped as ((a + b) + c) + d eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values eCSSUnit_List = 53, // (nsCSSValueList*) list of values @@ -303,29 +299,28 @@ enum nsCSSUnit { eCSSUnit_Integer = 70, // (int) simple value eCSSUnit_Enumerated = 71, // (int) value has enumerated meaning - eCSSUnit_Percent = - 100, // (float) 1.0 == 100%) value is percentage of something - eCSSUnit_Number = 101, // (float) value is numeric (usually multiplier, - // different behavior than percent) + eCSSUnit_Percent = 100, // (float) (1.0 == 100%) value is percentage of + // something + eCSSUnit_Number = 101, // (float) value is numeric (usually multiplier, + // different behavior than percent) // Length units - relative // Viewport relative measure - eCSSUnit_ViewportWidth = - 700, // (float) 1% of the width of the initial containing block - eCSSUnit_ViewportHeight = - 701, // (float) 1% of the height of the initial containing block - eCSSUnit_ViewportMin = - 702, // (float) smaller of ViewportWidth and ViewportHeight - eCSSUnit_ViewportMax = - 703, // (float) larger of ViewportWidth and ViewportHeight + eCSSUnit_ViewportWidth = 700, // (float) 1% of the width of the initial + // containing block (ICB) + eCSSUnit_ViewportHeight = 701, // (float) 1% of the height of the ICB + eCSSUnit_ViewportMin = 702, // (float) smaller of ViewportWidth and + // ViewportHeight + eCSSUnit_ViewportMax = 703, // (float) larger of ViewportWidth and + // ViewportHeight // Font relative measure - eCSSUnit_EM = 800, // (float) == current font size - eCSSUnit_XHeight = - 801, // (float) distance from top of lower case x to baseline - eCSSUnit_Char = - 802, // (float) number of characters, used for width with monospace font - eCSSUnit_RootEM = 803, // (float) == root element font size + eCSSUnit_EM = 800, // (float) == current font size + eCSSUnit_XHeight = 801, // (float) distance from top of lower case x to + // baseline + eCSSUnit_Char = 802, // (float) number of characters, used for width with + // monospace font + eCSSUnit_RootEM = 803, // (float) == root element font size // Screen relative measure eCSSUnit_Point = 900, // (float) 4/3 of a CSS pixel diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index a921d0e3cf84..d212ad4756bb 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -753,8 +753,7 @@ enum class StyleWhiteSpace : uint8_t { // ruby-position, see nsStyleText #define NS_STYLE_RUBY_POSITION_OVER 0 #define NS_STYLE_RUBY_POSITION_UNDER 1 -#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER \ - 2 /* placeholder, not yet parsed */ +#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER 2 // placeholder, not yet parsed // See nsStyleText #define NS_STYLE_TEXT_SIZE_ADJUST_NONE 0 diff --git a/layout/style/nsStyleCoord.h b/layout/style/nsStyleCoord.h index e91b185d83ac..71d1a598932f 100644 --- a/layout/style/nsStyleCoord.h +++ b/layout/style/nsStyleCoord.h @@ -183,8 +183,8 @@ class nsStyleCoord { static nscoord ToLength(nsStyleUnit aUnit, nsStyleUnion aValue) { MOZ_ASSERT(ConvertsToLength(aUnit, aValue)); if (IsCalcUnit(aUnit)) { - return AsCalcValue(aValue) - ->ToLength(); // Note: This asserts !mHasPercent + // Note: ToLength asserts !mHasPercent + return AsCalcValue(aValue)->ToLength(); } MOZ_ASSERT(aUnit == eStyleUnit_Coord); return aValue.mInt; diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index ee674a9a6f8c..e901f633d35c 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -121,8 +121,7 @@ nsStyleFont::nsStyleFont(const nsPresContext* aContext) mScriptLevel(0), mMathVariant(NS_MATHML_MATHVARIANT_NONE), mMathDisplay(NS_MATHML_DISPLAYSTYLE_INLINE), - mMinFontSizeRatio(100) // 100% - , + mMinFontSizeRatio(100), // 100% mExplicitLanguage(false), mAllowZoom(true), mScriptUnconstrainedSize(mSize), @@ -653,8 +652,7 @@ nsChangeHint nsStyleColumn::CalcDifference( // nsStyleSVG // nsStyleSVG::nsStyleSVG(const nsPresContext* aContext) - : mFill(eStyleSVGPaintType_Color) // Will be initialized to NS_RGB(0, 0, 0) - , + : mFill(eStyleSVGPaintType_Color), // Will be initialized to NS_RGB(0,0,0) mStroke(eStyleSVGPaintType_None), mStrokeDashoffset(0, nsStyleCoord::CoordConstructor), mStrokeWidth(nsPresContext::CSSPixelsToAppUnits(1), diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 0de5bbf82221..87677aead5b5 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -606,30 +606,27 @@ struct nsStyleImageLayers { Size mSize; StyleGeometryBox mClip; MOZ_INIT_OUTSIDE_CTOR StyleGeometryBox mOrigin; - StyleImageLayerAttachment mAttachment; - // background-only property - // This property is used for background layer - // only. For a mask layer, it should always - // be the initial value, which is + + // This property is used for background layer only. + // For a mask layer, it should always be the initial value, which is // StyleImageLayerAttachment::Scroll. + StyleImageLayerAttachment mAttachment; + + // This property is used for background layer only. + // For a mask layer, it should always be the initial value, which is + // NS_STYLE_BLEND_NORMAL. uint8_t mBlendMode; // NS_STYLE_BLEND_* - // background-only property - // This property is used for background layer - // only. For a mask layer, it should always - // be the initial value, which is - // NS_STYLE_BLEND_NORMAL. + + // This property is used for mask layer only. + // For a background layer, it should always be the initial value, which is + // NS_STYLE_COMPOSITE_MODE_ADD. uint8_t mComposite; // NS_STYLE_MASK_COMPOSITE_* - // mask-only property - // This property is used for mask layer only. - // For a background layer, it should always - // be the initial value, which is - // NS_STYLE_COMPOSITE_MODE_ADD. - uint8_t mMaskMode; // NS_STYLE_MASK_MODE_* - // mask-only property - // This property is used for mask layer only. - // For a background layer, it should always - // be the initial value, which is - // NS_STYLE_MASK_MODE_MATCH_SOURCE. + + // mask-only property. This property is used for mask layer only. For a + // background layer, it should always be the initial value, which is + // NS_STYLE_MASK_MODE_MATCH_SOURCE. + uint8_t mMaskMode; // NS_STYLE_MASK_MODE_* + Repeat mRepeat; // This constructor does not initialize mRepeat or mOrigin and Initialize() @@ -662,9 +659,17 @@ struct nsStyleImageLayers { // The (positive) number of computed values of each property, since // the lengths of the lists are independent. - uint32_t mAttachmentCount, mClipCount, mOriginCount, mRepeatCount, - mPositionXCount, mPositionYCount, mImageCount, mSizeCount, mMaskModeCount, - mBlendModeCount, mCompositeCount; + uint32_t mAttachmentCount; + uint32_t mClipCount; + uint32_t mOriginCount; + uint32_t mRepeatCount; + uint32_t mPositionXCount; + uint32_t mPositionYCount; + uint32_t mImageCount; + uint32_t mSizeCount; + uint32_t mMaskModeCount; + uint32_t mBlendModeCount; + uint32_t mCompositeCount; // Layers are stored in an array, matching the top-to-bottom order in // which they are specified in CSS. The number of layers to be used @@ -1945,15 +1950,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { nsStyleCoord mChildPerspective; // none, coord nsStyleCoord mPerspectiveOrigin[2]; // percent, coord, calc - nsStyleCoord - mVerticalAlign; // coord, percent, calc, enum (NS_STYLE_VERTICAL_ALIGN_*) + nsStyleCoord mVerticalAlign; // coord, percent, calc, enum + // (NS_STYLE_VERTICAL_ALIGN_*) nsStyleAutoArray mTransitions; // The number of elements in mTransitions that are not from repeating // a list due to another property being longer. - uint32_t mTransitionTimingFunctionCount, mTransitionDurationCount, - mTransitionDelayCount, mTransitionPropertyCount; + uint32_t mTransitionTimingFunctionCount; + uint32_t mTransitionDurationCount; + uint32_t mTransitionDelayCount; + uint32_t mTransitionPropertyCount; nsCSSPropertyID GetTransitionProperty(uint32_t aIndex) const { return mTransitions[aIndex % mTransitionPropertyCount].GetProperty(); @@ -1980,10 +1987,14 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { // The number of elements in mAnimations that are not from repeating // a list due to another property being longer. - uint32_t mAnimationTimingFunctionCount, mAnimationDurationCount, - mAnimationDelayCount, mAnimationNameCount, mAnimationDirectionCount, - mAnimationFillModeCount, mAnimationPlayStateCount, - mAnimationIterationCountCount; + uint32_t mAnimationTimingFunctionCount; + uint32_t mAnimationDurationCount; + uint32_t mAnimationDelayCount; + uint32_t mAnimationNameCount; + uint32_t mAnimationDirectionCount; + uint32_t mAnimationFillModeCount; + uint32_t mAnimationPlayStateCount; + uint32_t mAnimationIterationCountCount; nsAtom* GetAnimationName(uint32_t aIndex) const { return mAnimations[aIndex % mAnimationNameCount].GetName(); diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 89edcaf4d233..4727d6938362 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -484,8 +484,11 @@ struct TextRenderedRun { * transform. * * - * Assume that we have abcdef. This would result in four text rendered runs: + * Assume that we have: + * + * abcdef. + * + * This would result in four text rendered runs: * * - one for "ab" * - one for "c" diff --git a/layout/svg/nsSVGDisplayableFrame.h b/layout/svg/nsSVGDisplayableFrame.h index 9142a02421bf..e0c0dc0308fc 100644 --- a/layout/svg/nsSVGDisplayableFrame.h +++ b/layout/svg/nsSVGDisplayableFrame.h @@ -104,15 +104,16 @@ class nsSVGDisplayableFrame : public nsQueryFrame { // Flags to pass to NotifySVGChange: // - // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when - // updating the descendant frames of a clipPath, - // mask, pattern or marker frame (or other similar - // NS_FRAME_IS_NONDISPLAY frame) immediately - // prior to painting that frame's descendants. - // TRANSFORM_CHANGED - the current transform matrix for this frame has - // changed COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate - // context has - // changed (percentage lengths must be reevaluated) + // DO_NOT_NOTIFY_RENDERING_OBSERVERS: + // this should only be used when updating the descendant frames of a + // clipPath, mask, pattern or marker frame (or other similar + // NS_FRAME_IS_NONDISPLAY frame) immediately prior to painting that frame's + // descendants. + // TRANSFORM_CHANGED: + // the current transform matrix for this frame has changed + // COORD_CONTEXT_CHANGED: + // the dimensions of this frame's coordinate context has changed (percentage + // lengths must be reevaluated) enum SVGChangedFlags { TRANSFORM_CHANGED = 0x01, COORD_CONTEXT_CHANGED = 0x02, diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index 0769eb98472a..3aed414523be 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -176,7 +176,7 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame, // A hash-set containing our nsSVGForeignObjectFrame descendants. Note we use // a hash-set to avoid the O(N^2) behavior we'd get tearing down an SVG frame // subtree if we were to use a list (see bug 381285 comment 20). - nsAutoPtr > > + nsAutoPtr>> mForeignObjectHash; nsRegion mInvalidRegion; diff --git a/layout/tables/celldata.h b/layout/tables/celldata.h index 7bba7c5d310a..461d0153a098 100644 --- a/layout/tables/celldata.h +++ b/layout/tables/celldata.h @@ -110,13 +110,13 @@ class CellData { friend class nsCellMap; friend class BCCellData; - /** constructor. + /** + * Implemented in nsCellMap.cpp + * * @param aOrigCell the table cell frame which will be stored in mOrigCell. */ - explicit CellData( - nsTableCellFrame* aOrigCell); // implemented in nsCellMap.cpp + explicit CellData(nsTableCellFrame* aOrigCell); - /** destructor */ ~CellData(); // implemented in nsCellMap.cpp protected: diff --git a/layout/tables/nsTableColFrame.h b/layout/tables/nsTableColFrame.h index a59e3e593832..8d6a45b06ada 100644 --- a/layout/tables/nsTableColFrame.h +++ b/layout/tables/nsTableColFrame.h @@ -20,14 +20,16 @@ class nsTableColFrame final : public nsSplittableFrame { enum { eWIDTH_SOURCE_NONE = 0, // no cell has contributed to the width style eWIDTH_SOURCE_CELL = 1, // a cell specified a width - eWIDTH_SOURCE_CELL_WITH_SPAN = - 2 // a cell implicitly specified a width via colspan + eWIDTH_SOURCE_CELL_WITH_SPAN = 2 // a cell implicitly specified a width via + // colspan }; nsTableColType GetColType() const; void SetColType(nsTableColType aType); - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index 718cb03ef2b2..c4178708e107 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -21,7 +21,9 @@ class nsTableColGroupFrame final : public nsContainerFrame { public: NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame) - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 50d241426072..f00307eebf49 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1829,62 +1829,66 @@ void nsTableFrame::RequestSpecialBSizeReflow(const ReflowInput& aReflowInput) { * After the intrinsic isize calculation, the table determines the * column widths using BalanceColumnISizes() and * then reflows each child again with a constrained avail isize. This reflow is - *referred to as the pass 2 reflow. + * referred to as the pass 2 reflow. * * A special bsize reflow (pass 3 reflow) can occur during an initial or resize - *reflow if (a) a row group, row, cell, or a frame inside a cell has a percent - *bsize but no computed bsize or (b) in paginated mode, a table has a bsize. (a) - *supports percent nested tables contained inside cells whose bsizes aren't - *known until after the pass 2 reflow. (b) is necessary because the table cannot - *split until after the pass 2 reflow. The mechanics of the special bsize reflow - *(variety a) are as follows: + * reflow if (a) a row group, row, cell, or a frame inside a cell has a percent + * bsize but no computed bsize or (b) in paginated mode, a table has a bsize. + * (a) supports percent nested tables contained inside cells whose bsizes aren't + * known until after the pass 2 reflow. (b) is necessary because the table + * cannot split until after the pass 2 reflow. The mechanics of the special + * bsize reflow (variety a) are as follows: * * 1) Each table related frame (table, row group, row, cell) implements - *NeedsSpecialReflow() to indicate that it should get the reflow. It does this - *when it has a percent bsize but no computed bsize by calling - *CheckRequestSpecialBSizeReflow(). This method calls + * NeedsSpecialReflow() to indicate that it should get the reflow. It does + * this when it has a percent bsize but no computed bsize by calling + * CheckRequestSpecialBSizeReflow(). This method calls * RequestSpecialBSizeReflow() which calls SetNeedSpecialReflow() on its - *ancestors until it reaches the containing table and calls - *SetNeedToInitiateSpecialReflow() on it. For percent bsize frames inside cells, - *during DidReflow(), the cell's NotifyPercentBSize() is called (the cell is the - *reflow state's mPercentBSizeObserver in this case). NotifyPercentBSize() calls - *RequestSpecialBSizeReflow(). + * ancestors until it reaches the containing table and calls + * SetNeedToInitiateSpecialReflow() on it. For percent bsize frames inside + * cells, during DidReflow(), the cell's NotifyPercentBSize() is called + * (the cell is the reflow state's mPercentBSizeObserver in this case). + * NotifyPercentBSize() calls RequestSpecialBSizeReflow(). * * XXX (jfkthame) This comment appears to be out of date; it refers to - *methods/flags that are no longer present in the code. 2) After the pass 2 - *reflow, if the table's NeedToInitiateSpecialReflow(true) was called, it will - *do the special bsize reflow, setting the reflow state's - *mFlags.mSpecialBSizeReflow to true and mSpecialHeightInitiator to itself. It - *won't do this if IsPrematureSpecialHeightReflow() returns true because in that - *case another special bsize reflow will be coming along with the containing - *table as the mSpecialHeightInitiator. It is only relevant to do the reflow - *when the mSpecialHeightInitiator is the containing table, because if it is a - *remote ancestor, then appropriate bsizes will not be known. + * methods/flags that are no longer present in the code. + * + * 2) After the pass 2 reflow, if the table's NeedToInitiateSpecialReflow(true) + * was called, it will do the special bsize reflow, setting the reflow + * state's mFlags.mSpecialBSizeReflow to true and mSpecialHeightInitiator to + * itself. It won't do this if IsPrematureSpecialHeightReflow() returns true + * because in that case another special bsize reflow will be coming along + * with the containing table as the mSpecialHeightInitiator. It is only + * relevant to do the reflow when the mSpecialHeightInitiator is the + * containing table, because if it is a remote ancestor, then appropriate + * bsizes will not be known. * * 3) Since the bsizes of the table, row groups, rows, and cells was determined - *during the pass 2 reflow, they return their last desired sizes during the - *special bsize reflow. The reflow only permits percent bsize frames inside the - *cells to resize based on the cells bsize and that bsize was determined during - *the pass 2 reflow. + * during the pass 2 reflow, they return their last desired sizes during the + * special bsize reflow. The reflow only permits percent bsize frames inside + * the cells to resize based on the cells bsize and that bsize was + * determined during the pass 2 reflow. * * So, in the case of deeply nested tables, all of the tables that were told to - *initiate a special reflow will do so, but if a table is already in a special - *reflow, it won't inititate the reflow until the current initiator is its - *containing table. Since these reflows are only received by frames that need - *them and they don't cause any rebalancing of tables, the extra overhead is - *minimal. + * initiate a special reflow will do so, but if a table is already in a special + * reflow, it won't inititate the reflow until the current initiator is its + * containing table. Since these reflows are only received by frames that need + * them and they don't cause any rebalancing of tables, the extra overhead is + * minimal. * * The type of special reflow that occurs during printing (variety b) follows - *the same mechanism except that all frames will receive the reflow even if they - *don't really need them. + * the same mechanism except that all frames will receive the reflow even if + * they don't really need them. * * Open issues with the special bsize reflow: * * 1) At some point there should be 2 kinds of special bsize reflows because (a) - *and (b) above are really quite different. This would avoid unnecessary reflows - *during printing. 2) When a cell contains frames whose percent bsizes > 100%, - *there is data loss (see bug 115245). However, this can also occur if a cell - *has a fixed bsize and there is no special bsize reflow. + * and (b) above are really quite different. This would avoid unnecessary + * reflows during printing. + * + * 2) When a cell contains frames whose percent bsizes > 100%, there is data + * loss (see bug 115245). However, this can also occur if a cell has a fixed + * bsize and there is no special bsize reflow. * * XXXldb Special bsize reflow should really be its own method, not * part of nsIFrame::Reflow. It should then call nsIFrame::Reflow on @@ -4060,8 +4064,8 @@ bool nsTableFrame::ColumnHasCellSpacingBefore(int32_t aColIndex) const { * 3) the border styles are ranked in this order, highest to lowest precedence: * double, solid, dashed, dotted, ridge, outset, groove, inset * 4) borders that are of equal width and style (differ only in color) have - *this precedence: cell, row, rowgroup, col, colgroup, table 5) if all border - *styles are NONE, then that's the computed border style. + * this precedence: cell, row, rowgroup, col, colgroup, table + * 5) if all border styles are NONE, then that's the computed border style. *******************************************************************************/ #ifdef DEBUG @@ -5549,11 +5553,15 @@ BCCellBorder BCMapCellInfo::GetBStartInternalBorder() { n=rowspan left and right border edges per cell. 1) On the top edge of the table, store the top edge. Never store the top edge - otherwise, since a bottom edge from a cell above will take care of it. 2) On - the left edge of the table, store the left edge. Never store the left edge - othewise, since a right edge from a cell to the left will take care of it. 3) - Store the right edge (or edges if a row span) 4) Store the bottom edge (or - edges if a col span) + otherwise, since a bottom edge from a cell above will take care of it. + + 2) On the left edge of the table, store the left edge. Never store the left + edge othewise, since a right edge from a cell to the left will take care + of it. + + 3) Store the right edge (or edges if a row span) + + 4) Store the bottom edge (or edges if a col span) Since corners are computed with only an array of BCCornerInfo indexed by the number-of-cols, corner calculations are somewhat complicated. Using an array @@ -5567,20 +5575,25 @@ BCCellBorder BCMapCellInfo::GetBStartInternalBorder() { edges per cell and n=rowspan left and right border edges per cell. 1) On the top edge of the table, store the top-left corner, unless on the - left edge of the table. Never store the top-right corner, since it will get - stored as a right-top corner. 2) On the left edge of the table, store the - left-top corner. Never store the left-bottom corner, since it will get stored - as a bottom-left corner. 3) Store the right-top corner if (a) it is the top - right corner of the table or (b) it is not on the top edge of the table. - Never store the right-bottom corner since it will get stored as a - bottom-right corner. + left edge of the table. Never store the top-right corner, since it will + get stored as a right-top corner. + + 2) On the left edge of the table, store the left-top corner. Never store the + left-bottom corner, since it will get stored as a bottom-left corner. + + 3) Store the right-top corner if (a) it is the top right corner of the table + or (b) it is not on the top edge of the table. Never store the + right-bottom corner since it will get stored as a bottom-right corner. + 4) Store the bottom-right corner, if it is the bottom right corner of the - table. Never store it otherwise, since it will get stored as either a - right-top corner by a cell below or a bottom-left corner from a cell to the - right. 5) Store the bottom-left corner, if (a) on the bottom edge of the - table or (b) if the left edge hits the top side of a colspan in its interior. - Never store the corner otherwise, since it will get stored as a right-top - corner by a cell from below. + table. Never store it otherwise, since it will get stored as either a + right-top corner by a cell below or a bottom-left corner from a cell to + the right. + + 5) Store the bottom-left corner, if (a) on the bottom edge of the table or + (b) if the left edge hits the top side of a colspan in its interior. + Never store the corner otherwise, since it will get stored as a right-top + corner by a cell from below. XXX the BC-RTL hack - The correct fix would be a rewrite as described in bug 203686. In order to draw borders in rtl conditions somehow correct, the diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index fef45295838a..4530dcfe4cf0 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -98,8 +98,7 @@ class nsAutoPushCurrentTableItem { #endif }; -/* ============================================================================ - */ +/* ========================================================================== */ enum nsTableColType { eColContent = 0, // there is real col content associated @@ -131,7 +130,9 @@ class nsTableFrame : public nsContainerFrame { /** nsTableWrapperFrame has intimate knowledge of the inner table frame */ friend class nsTableWrapperFrame; - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created @@ -322,16 +323,23 @@ class nsTableFrame : public nsContainerFrame { nscoord aWidthInCB); // XXXldb REWRITE THIS COMMENT! - /** inner tables are reflowed in two steps. + // clang-format off + /** + * Inner tables are reflowed in two steps. *
-   * if mFirstPassValid is false, this is our first time through since content
-   * was last changed set pass to 1 do pass 1 get min/max info for all cells in
-   * an infinite space do column balancing set mFirstPassValid to true do pass 2
+   * if mFirstPassValid is false, this is our first time through since content was last changed
+   *   set pass to 1
+   *   do pass 1
+   *     get min/max info for all cells in an infinite space
+   *   do column balancing
+   *   set mFirstPassValid to true
+   *   do pass 2
    *     use column widths to Reflow cells
    * 
* * @see nsIFrame::Reflow */ + // clang-format on virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, const ReflowInput& aReflowInput, nsReflowStatus& aStatus) override; @@ -839,8 +847,8 @@ class nsTableFrame : public nsContainerFrame { uint32_t mHasPctCol : 1; // does any cell or col have a pct width uint32_t mCellSpansPctCol : 1; // does any cell span a col with a pct width // (or containing a cell with a pct width) - uint32_t - mIsBorderCollapse : 1; // border collapsing model vs. separate model + uint32_t mIsBorderCollapse : 1; // border collapsing model vs. separate + // model uint32_t mRowInserted : 1; uint32_t mNeedToCalcBCBorders : 1; uint32_t mGeometryDirty : 1; @@ -854,11 +862,11 @@ class nsTableFrame : public nsContainerFrame { std::map mDeletedRowIndexRanges; // maintains ranges of row // indices of deleted rows - nsTableCellMap* - mCellMap; // maintains the relationships between rows, cols, and cells - nsITableLayoutStrategy* - mTableLayoutStrategy; // the layout strategy for this frame - nsFrameList mColGroups; // the list of colgroup frames + nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, + // and cells + nsITableLayoutStrategy* mTableLayoutStrategy; // the layout strategy for this + // frame + nsFrameList mColGroups; // the list of colgroup frames }; inline bool nsTableFrame::IsRowGroup(mozilla::StyleDisplay aDisplayType) const { diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 4b482ddc19cc..e17916a0e412 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -80,8 +80,12 @@ class nsTableRowFrame : public nsContainerFrame { inline nsTableCellFrame* GetFirstCell() const; /** calls Reflow for all of its child cells. + * * Cells with rowspan=1 are all set to the same height and stacked - * horizontally.

Cells are not split unless absolutely necessary.

+ * horizontally. + * + * Cells are not split unless absolutely necessary. + * * Cells are resized in nsTableFrame::BalanceColumnWidths and * nsTableFrame::ShrinkWrapChildren * diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 25faa5b510e9..2a0e79bfc425 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -75,9 +75,12 @@ class nsTableRowGroupFrame final : public nsContainerFrame, virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) override; - /** calls Reflow for all of its child rows. + /** + * Calls Reflow for all of its child rows. + * * Rows are all set to the same isize and stacked in the block direction. - *

rows are not split unless absolutely necessary. + * + * Rows are not split unless absolutely necessary. * * @param aDesiredSize isize set to isize of rows, bsize set to * sum of bsize of rows that fit in AvailableBSize. @@ -223,11 +226,10 @@ class nsTableRowGroupFrame final : public nsContainerFrame, /** Find the orginating cell frame on a row that is the nearest to the * inline-dir coordinate of aPos. - * @param aLineNumber - the index of the row relative to the row - * group - * @param aPos - coordinate in twips relative to the - * origin of the row group - * @param aFrameFound - pointer to the cellframe + * @param aLineNumber - the index of the row relative to the row group + * @param aPos - coordinate in twips relative to the + * origin of the row group + * @param aFrameFound - pointer to the cellframe * @param aPosIsBeforeFirstFrame - the point is before the first originating * cellframe * @param aPosIsAfterLastFrame - the point is after the last originating diff --git a/layout/xul/BoxObject.h b/layout/xul/BoxObject.h index 38918f8131d3..9e2c9c33448b 100644 --- a/layout/xul/BoxObject.h +++ b/layout/xul/BoxObject.h @@ -82,8 +82,7 @@ class BoxObject : public nsPIBoxObject, public nsWrapperCache { protected: virtual ~BoxObject(); - nsAutoPtr > - mPropertyTable; //[OWNER] + nsAutoPtr> mPropertyTable; Element* mContent; // [WEAK] }; diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index 999120ac37f5..d81cadac302a 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -14,12 +14,17 @@ // How boxes layout // ---------------- // Boxes layout a bit differently than html. html does a bottom up layout. Where -// boxes do a top down. 1) First thing a box does it goes out and askes each -// child for its min, max, and preferred sizes. 2) It then adds them up to -// determine its size. 3) If the box was asked to layout it self intrinically it -// will layout its children at their preferred size -// otherwise it will layout the child at the size it was told to. It will -// squeeze or stretch its children if Necessary. +// boxes do a top down. +// +// 1) First thing a box does it goes out and askes each child for its min, max, +// and preferred sizes. +// +// 2) It then adds them up to determine its size. +// +// 3) If the box was asked to layout it self intrinically it will layout its +// children at their preferred size otherwise it will layout the child at +// the size it was told to. It will squeeze or stretch its children if +// Necessary. // // However there is a catch. Some html components like block frames can not // determine their preferred size. this is their size if they were laid out diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index c5f686a24efc..e12f047e21a0 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -169,10 +169,10 @@ void nsImageBoxFrame::DestroyFrom(nsIFrame* aDestructRoot, mImageRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); } - if (mListener) - reinterpret_cast(mListener.get()) - ->ClearFrame(); // set the frame to null so we don't send messages to a - // dead object. + if (mListener) { + // set the frame to null so we don't send messages to a dead object. + reinterpret_cast(mListener.get())->ClearFrame(); + } nsLeafBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData); } diff --git a/layout/xul/nsMenuBarFrame.h b/layout/xul/nsMenuBarFrame.h index 5b050e7acf21..c7771322e363 100644 --- a/layout/xul/nsMenuBarFrame.h +++ b/layout/xul/nsMenuBarFrame.h @@ -51,8 +51,9 @@ class nsMenuBarFrame final : public nsBoxFrame, public nsMenuParent { virtual bool IsActive() override { return mIsActive; } virtual bool IsMenu() override { return false; } virtual bool IsOpen() override { + // menubars are considered always open return true; - } // menubars are considered always open + } bool IsMenuOpen() { return mCurrentMenu && mCurrentMenu->IsOpen(); } diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index 671f56231e8b..d2e1f9787a20 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -879,8 +879,7 @@ void nsMenuFrame::UpdateMenuSpecialState() { /* uncheck the old item */ sib->GetContent()->AsElement()->UnsetAttr(kNameSpaceID_None, nsGkAtoms::checked, true); - /* XXX in DEBUG, check to make sure that there aren't two checked items - */ + // XXX in DEBUG, check to make sure that there aren't two checked items return; } } diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index 450c58a66f4f..746c353dcd8f 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -188,8 +188,9 @@ class nsMenuPopupFrame final : public nsBoxFrame, void SetPopupState(nsPopupState aPopupState) { mPopupState = aPopupState; } NS_IMETHOD SetActive(bool aActiveFlag) override { + // We don't care. return NS_OK; - } // We don't care. + } virtual bool IsActive() override { return false; } virtual bool IsMenuBar() override { return false; } diff --git a/layout/xul/nsScrollbarFrame.cpp b/layout/xul/nsScrollbarFrame.cpp index e82d0500f78e..c30c35747ebe 100644 --- a/layout/xul/nsScrollbarFrame.cpp +++ b/layout/xul/nsScrollbarFrame.cpp @@ -283,19 +283,18 @@ int32_t nsScrollbarFrame::MoveToNewPosition() { nsresult nsScrollbarFrame::CreateAnonymousContent( nsTArray& aElements) { - // - // + // + // + // // - // + // + // + + // clang-format on nsNodeInfoManager* nodeInfoManager = mContent->NodeInfo()->NodeInfoManager(); diff --git a/layout/xul/nsXULPopupManager.h b/layout/xul/nsXULPopupManager.h index 0a32863cae3d..2d7e5790c280 100644 --- a/layout/xul/nsXULPopupManager.h +++ b/layout/xul/nsXULPopupManager.h @@ -477,8 +477,8 @@ class nsXULPopupManager final : public nsIDOMEventListener, * aHideChain - true if the entire chain of menus should be closed. If false, * only this popup is closed. * aDeselectMenu - true if the parent

of the popup should be - * deselected. This will be false when the menu is closed by pressing the - * Escape key. + * deselected. This will be false when the menu is closed by + * pressing the Escape key. * aAsynchronous - true if the first popuphiding event should be sent * asynchrously. This should be true if HidePopup is called * from a frame. diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index ced65af4d215..f5ff8f1636e5 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -473,7 +473,7 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame, * @param aEndRow the end index of invalidated rows, -1 means that columns * have been invalidated only * @param aStartCol the start invalidated column, nullptr means that only - * rows have been invalidated + * rows have been invalidated * @param aEndCol the end invalidated column, nullptr means that rows have * been invalidated only */ diff --git a/media/libcubeb/moz.yaml b/media/libcubeb/moz.yaml index d0c404c0aacd..fe0a442b2bae 100644 --- a/media/libcubeb/moz.yaml +++ b/media/libcubeb/moz.yaml @@ -19,5 +19,5 @@ origin: license: "ISC" # update.sh will update this value - release: "9a7a55153e7f9b9e0036ab023909c7bc4a41688b (2018-10-30 09:05:26 +1300)" + release: "e5c3a1d8a68c412177f768908b1d54550cf9d510-dirty (2018-11-29 18:20:54 +0100)" diff --git a/media/libcubeb/src/cubeb_mixer.cpp b/media/libcubeb/src/cubeb_mixer.cpp index c95fef657b53..2ab7f673af0d 100644 --- a/media/libcubeb/src/cubeb_mixer.cpp +++ b/media/libcubeb/src/cubeb_mixer.cpp @@ -236,13 +236,8 @@ int MixerContext::auto_matrix() matrix[SIDE_LEFT][BACK_CENTER] += M_SQRT1_2; matrix[SIDE_RIGHT][BACK_CENTER] += M_SQRT1_2; } else if (out_ch_layout & CHANNEL_FRONT_LEFT) { - if (unaccounted & (CHANNEL_BACK_LEFT | CHANNEL_SIDE_LEFT)) { - matrix[FRONT_LEFT][BACK_CENTER] -= _surround_mix_level * M_SQRT1_2; - matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2; - } else { - matrix[FRONT_LEFT][BACK_CENTER] -= _surround_mix_level; - matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level; - } + matrix[FRONT_LEFT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2; + matrix[FRONT_RIGHT][BACK_CENTER] += _surround_mix_level * M_SQRT1_2; } else if (out_ch_layout & CHANNEL_FRONT_CENTER) { matrix[FRONT_CENTER][BACK_CENTER] += _surround_mix_level * M_SQRT1_2; @@ -261,10 +256,8 @@ int MixerContext::auto_matrix() matrix[SIDE_RIGHT][BACK_RIGHT] += 1.0; } } else if (out_ch_layout & CHANNEL_FRONT_LEFT) { - matrix[FRONT_LEFT][BACK_LEFT] -= _surround_mix_level * M_SQRT1_2; - matrix[FRONT_LEFT][BACK_RIGHT] -= _surround_mix_level * M_SQRT1_2; - matrix[FRONT_RIGHT][BACK_LEFT] += _surround_mix_level * M_SQRT1_2; - matrix[FRONT_RIGHT][BACK_RIGHT] += _surround_mix_level * M_SQRT1_2; + matrix[FRONT_LEFT][BACK_LEFT] += _surround_mix_level; + matrix[FRONT_RIGHT][BACK_RIGHT] += _surround_mix_level; } else if (out_ch_layout & CHANNEL_FRONT_CENTER) { matrix[FRONT_CENTER][BACK_LEFT] += _surround_mix_level * M_SQRT1_2; matrix[FRONT_CENTER][BACK_RIGHT] += _surround_mix_level * M_SQRT1_2; @@ -286,10 +279,8 @@ int MixerContext::auto_matrix() matrix[BACK_CENTER][SIDE_LEFT] += M_SQRT1_2; matrix[BACK_CENTER][SIDE_RIGHT] += M_SQRT1_2; } else if (out_ch_layout & CHANNEL_FRONT_LEFT) { - matrix[FRONT_LEFT][SIDE_LEFT] -= _surround_mix_level * M_SQRT1_2; - matrix[FRONT_LEFT][SIDE_RIGHT] -= _surround_mix_level * M_SQRT1_2; - matrix[FRONT_RIGHT][SIDE_LEFT] += _surround_mix_level * M_SQRT1_2; - matrix[FRONT_RIGHT][SIDE_RIGHT] += _surround_mix_level * M_SQRT1_2; + matrix[FRONT_LEFT][SIDE_LEFT] += _surround_mix_level; + matrix[FRONT_RIGHT][SIDE_RIGHT] += _surround_mix_level; } else if (out_ch_layout & CHANNEL_FRONT_CENTER) { matrix[FRONT_CENTER][SIDE_LEFT] += _surround_mix_level * M_SQRT1_2; matrix[FRONT_CENTER][SIDE_RIGHT] += _surround_mix_level * M_SQRT1_2; diff --git a/media/mp4parse-rust/mp4parse.h b/media/mp4parse-rust/mp4parse.h index 6696b64b2f78..339c9b8a7972 100644 --- a/media/mp4parse-rust/mp4parse.h +++ b/media/mp4parse-rust/mp4parse.h @@ -83,6 +83,7 @@ typedef struct { uint16_t bit_depth; uint32_t sample_rate; uint16_t profile; + uint16_t extended_profile; Mp4parseByteData codec_specific_config; Mp4parseByteData extra_data; Mp4parseSinfInfo protected_data; diff --git a/media/mp4parse-rust/mp4parse/src/lib.rs b/media/mp4parse-rust/mp4parse/src/lib.rs index 05a091bb6e86..532c09813fa9 100644 --- a/media/mp4parse-rust/mp4parse/src/lib.rs +++ b/media/mp4parse-rust/mp4parse/src/lib.rs @@ -293,6 +293,7 @@ pub enum SampleEntry { pub struct ES_Descriptor { pub audio_codec: CodecType, pub audio_object_type: Option, + pub extended_audio_object_type: Option, pub audio_sample_rate: Option, pub audio_channel_count: Option, pub codec_esds: Vec, @@ -1506,6 +1507,17 @@ fn find_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> { Ok(()) } +fn get_audio_object_type(bit_reader: &mut BitReader) -> Result { + let mut audio_object_type: u16 = ReadInto::read(bit_reader, 5)?; + + // Extend audio object type, for example, HE-AAC. + if audio_object_type == 31 { + let audio_object_type_ext: u16 = ReadInto::read(bit_reader, 6)?; + audio_object_type = 32 + audio_object_type_ext; + } + Ok(audio_object_type) +} + fn read_ds_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> { let frequency_table = vec![(0x0, 96000), (0x1, 88200), (0x2, 64000), (0x3, 48000), @@ -1515,13 +1527,7 @@ fn read_ds_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> { let bit_reader = &mut BitReader::new(data); - let mut audio_object_type: u16 = ReadInto::read(bit_reader, 5)?; - - // Extend audio object type, for example, HE-AAC. - if audio_object_type == 31 { - let audio_object_type_ext: u16 = ReadInto::read(bit_reader, 6)?; - audio_object_type = 32 + audio_object_type_ext; - } + let mut audio_object_type = get_audio_object_type(bit_reader)?; let sample_index: u32 = ReadInto::read(bit_reader, 4)?; @@ -1536,60 +1542,124 @@ fn read_ds_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> { }, }; - let mut channel_counts: u16 = ReadInto::read(bit_reader, 4)?; + let channel_configuration: u16 = ReadInto::read(bit_reader, 4)?; - // parsing GASpecificConfig - bit_reader.skip(1)?; // frameLengthFlag - let depend_on_core_order: u8 = ReadInto::read(bit_reader, 1)?; - if depend_on_core_order > 0 { - bit_reader.skip(14)?; // codeCoderDelay + let extended_audio_object_type = match audio_object_type { + 5 | 29 => Some(5), + _ => None, + }; + + if audio_object_type == 5 || audio_object_type == 29 { + // We have an explicit signaling for BSAC extension, should the decoder + // decode the BSAC extension (all Gecko's AAC decoders do), then this is + // what the stream will actually look like once decoded. + let _extended_sample_index = ReadInto::read(bit_reader, 4)?; + let _extended_sample_frequency: Option = match _extended_sample_index { + 0x0F => Some(ReadInto::read(bit_reader, 24)?), + _ => frequency_table.iter().find(|item| item.0 == sample_index).map(|x| x.1) + }; + audio_object_type = get_audio_object_type(bit_reader)?; + let _extended_channel_configuration = match audio_object_type { + 22 => ReadInto::read(bit_reader, 4)?, + _ => channel_configuration + }; + }; + + match audio_object_type { + 1 ... 4 | 6 | 7 | 17 | 19 ... 23 => { + if sample_frequency.is_none() { + return Err(Error::Unsupported("unknown frequency")); + } + + // parsing GASpecificConfig + + // If the sampling rate is not one of the rates listed in the right + // column in Table 4.82, the sampling frequency dependent tables + // (code tables, scale factor band tables etc.) must be deduced in + // order for the bitstream payload to be parsed. Since a given + // sampling frequency is associated with only one sampling frequency + // table, and since maximum flexibility is desired in the range of + // possible sampling frequencies, the following table shall be used + // to associate an implied sampling frequency with the desired + // sampling frequency dependent tables. + let sample_frequency_value = match sample_frequency.unwrap() { + 0 ... 9390 => 8000, + 9391 ... 11501 => 11025, + 11502 ... 13855 => 12000, + 13856 ... 18782 => 16000, + 18783 ... 23003 => 22050, + 23004 ... 27712 => 24000, + 27713 ... 37565 => 32000, + 37566 ... 46008 => 44100, + 46009 ... 55425 => 48000, + 55426 ... 75131 => 64000, + 75132 ... 92016 => 88200, + _ => 96000 + }; + + bit_reader.skip(1)?; // frameLengthFlag + let depend_on_core_order: u8 = ReadInto::read(bit_reader, 1)?; + if depend_on_core_order > 0 { + bit_reader.skip(14)?; // codeCoderDelay + } + bit_reader.skip(1)?; // extensionFlag + + let channel_counts = match channel_configuration { + 0 => { + debug!("Parsing program_config_element for channel counts"); + + bit_reader.skip(4)?; // element_instance_tag + bit_reader.skip(2)?; // object_type + bit_reader.skip(4)?; // sampling_frequency_index + let num_front_channel: u8 = ReadInto::read(bit_reader, 4)?; + let num_side_channel: u8 = ReadInto::read(bit_reader, 4)?; + let num_back_channel:u8 = ReadInto::read(bit_reader, 4)?; + let num_lfe_channel: u8 = ReadInto::read(bit_reader, 2)?; + bit_reader.skip(3)?; // num_assoc_data + bit_reader.skip(4)?; // num_valid_cc + + let mono_mixdown_present: bool = ReadInto::read(bit_reader, 1)?; + if mono_mixdown_present { + bit_reader.skip(4)?; // mono_mixdown_element_number + } + + let stereo_mixdown_present: bool = ReadInto::read(bit_reader, 1)?; + if stereo_mixdown_present { + bit_reader.skip(4)?; // stereo_mixdown_element_number + } + + let matrix_mixdown_idx_present: bool = ReadInto::read(bit_reader, 1)?; + if matrix_mixdown_idx_present { + bit_reader.skip(2)?; // matrix_mixdown_idx + bit_reader.skip(1)?; // pseudo_surround_enable + } + let mut _channel_counts = 0; + _channel_counts += read_surround_channel_count(bit_reader, num_front_channel)?; + _channel_counts += read_surround_channel_count(bit_reader, num_side_channel)?; + _channel_counts += read_surround_channel_count(bit_reader, num_back_channel)?; + _channel_counts += read_surround_channel_count(bit_reader, num_lfe_channel)?; + _channel_counts + }, + 1 ... 7 => channel_configuration, + // Amendment 4 of the AAC standard in 2013 below + 11 => 7, // 6.1 Amendment 4 of the AAC standard in 2013 + 12 | 14 => 8, // 7.1 (a/d) of ITU BS.2159 + _ => { + return Err(Error::Unsupported("invalid channel configuration")); + } + }; + + esds.audio_object_type = Some(audio_object_type); + esds.extended_audio_object_type = extended_audio_object_type; + esds.audio_sample_rate = Some(sample_frequency_value); + esds.audio_channel_count = Some(channel_counts); + assert!(esds.decoder_specific_data.is_empty()); + esds.decoder_specific_data.extend_from_slice(data); + + Ok(()) + }, + _ => Err(Error::Unsupported("unknown aac audio object type")) } - bit_reader.skip(1)?; // extensionFlag - - // When channel_counts is 0, we need to parse the program_config_element - // to calculate the channel counts. - if channel_counts == 0 { - debug!("Parsing program_config_element for channel counts"); - - bit_reader.skip(4)?; // element_instance_tag - bit_reader.skip(2)?; // object_type - bit_reader.skip(4)?; // sampling_frequency_index - let num_front_channel: u8 = ReadInto::read(bit_reader, 4)?; - let num_side_channel: u8 = ReadInto::read(bit_reader, 4)?; - let num_back_channel:u8 = ReadInto::read(bit_reader, 4)?; - let num_lfe_channel: u8 = ReadInto::read(bit_reader, 2)?; - bit_reader.skip(3)?; // num_assoc_data - bit_reader.skip(4)?; // num_valid_cc - - let mono_mixdown_present: bool = ReadInto::read(bit_reader, 1)?; - if mono_mixdown_present { - bit_reader.skip(4)?; // mono_mixdown_element_number - } - - let stereo_mixdown_present: bool = ReadInto::read(bit_reader, 1)?; - if stereo_mixdown_present { - bit_reader.skip(4)?; // stereo_mixdown_element_number - } - - let matrix_mixdown_idx_present: bool = ReadInto::read(bit_reader, 1)?; - if matrix_mixdown_idx_present { - bit_reader.skip(2)?; // matrix_mixdown_idx - bit_reader.skip(1)?; // pseudo_surround_enable - } - - channel_counts += read_surround_channel_count(bit_reader, num_front_channel)?; - channel_counts += read_surround_channel_count(bit_reader, num_side_channel)?; - channel_counts += read_surround_channel_count(bit_reader, num_back_channel)?; - channel_counts += read_surround_channel_count(bit_reader, num_lfe_channel)?; - } - - esds.audio_object_type = Some(audio_object_type); - esds.audio_sample_rate = sample_frequency; - esds.audio_channel_count = Some(channel_counts); - assert!(esds.decoder_specific_data.is_empty()); - esds.decoder_specific_data.extend_from_slice(data); - - Ok(()) } fn read_surround_channel_count(bit_reader: &mut BitReader, channels: u8) -> Result { diff --git a/media/mp4parse-rust/mp4parse_capi/src/lib.rs b/media/mp4parse-rust/mp4parse_capi/src/lib.rs index 10583eb5c6e4..7b6be9c5efda 100644 --- a/media/mp4parse-rust/mp4parse_capi/src/lib.rs +++ b/media/mp4parse-rust/mp4parse_capi/src/lib.rs @@ -181,6 +181,7 @@ pub struct Mp4parseTrackAudioInfo { pub bit_depth: u16, pub sample_rate: u32, pub profile: u16, + pub extended_profile: u16, pub codec_specific_config: Mp4parseByteData, pub extra_data: Mp4parseByteData, pub protected_data: Mp4parseSinfInfo, @@ -538,6 +539,10 @@ pub unsafe extern fn mp4parse_get_track_audio_info(parser: *mut Mp4parseParser, if let Some(profile) = v.audio_object_type { (*info).profile = profile; } + (*info).extended_profile = match v.extended_audio_object_type { + Some(extended_profile) => extended_profile, + _ => (*info).profile + }; } AudioCodecSpecific::FLACSpecificBox(ref flac) => { // Return the STREAMINFO metadata block in the codec_specific. diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc b/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc index 4f4a4e1dd5a2..16330b616f41 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc +++ b/media/webrtc/trunk/webrtc/modules/video_capture/test/video_capture_unittest.cc @@ -398,8 +398,7 @@ TEST_F(VideoCaptureExternalTest, TestExternalCapture) { EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_)); } -// Disabled, see Bug 1368816 -TEST_F(VideoCaptureExternalTest, DISABLED_Rotation) { +TEST_F(VideoCaptureExternalTest, Rotation) { EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0)); size_t length = webrtc::CalcBufferSize( webrtc::VideoType::kI420, test_frame_->width(), test_frame_->height()); diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index b0013970873f..ab0822aee1e9 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -3228,10 +3228,6 @@ void arena_t::DallocSmall(arena_chunk_t* aChunk, void* aPtr, size = bin->mSizeClass; MOZ_DIAGNOSTIC_ASSERT(uintptr_t(aPtr) >= uintptr_t(run) + bin->mRunFirstRegionOffset); - MOZ_DIAGNOSTIC_ASSERT( - (uintptr_t(aPtr) - (uintptr_t(run) + bin->mRunFirstRegionOffset)) % - size == - 0); memset(aPtr, kAllocPoison, size); diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt index a0ac6d4887b4..f1f6cc8c10e2 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt @@ -191,6 +191,7 @@ class AccessibilityTest : BaseSessionTest() { assertThat("Label accessibility focused", node.className.toString(), equalTo("android.view.View")) assertThat("Text node should not be focusable", node.isFocusable, equalTo(false)) + assertThat("Text node should not be clickable", node.isClickable, equalTo(false)) } }) @@ -205,6 +206,7 @@ class AccessibilityTest : BaseSessionTest() { assertThat("Editbox accessibility focused", node.className.toString(), equalTo("android.widget.EditText")) assertThat("Entry node should be focusable", node.isFocusable, equalTo(true)) + assertThat("Entry node should be clickable", node.isClickable, equalTo(true)) } }) } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java index 8b2be7eb31e0..1cafcf0fce6a 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java @@ -155,7 +155,7 @@ public class SessionAccessibility { } return true; case AccessibilityNodeInfo.ACTION_CLICK: - mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityActivate", null); + nativeProvider.click(virtualViewId); GeckoBundle nodeInfo = nativeProvider.getNodeInfo(virtualViewId); final int flags = nodeInfo != null ? nodeInfo.getInt("flags") : 0; if ((flags & (FLAG_SELECTABLE | FLAG_CHECKABLE)) == 0) { @@ -173,7 +173,7 @@ public class SessionAccessibility { mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityScrollBackward", null); return true; case AccessibilityNodeInfo.ACTION_SELECT: - mSession.getEventDispatcher().dispatch("GeckoView:AccessibilitySelect", null); + nativeProvider.click(virtualViewId); return true; case AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT: case AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT: @@ -748,6 +748,9 @@ public class SessionAccessibility { @WrapForJNI(dispatchTo = "gecko") public native void setText(int id, String text); + @WrapForJNI(dispatchTo = "gecko") + public native void click(int id); + @WrapForJNI(calledFrom = "gecko", stubName = "SendEvent") private void sendEventNative(final int eventType, final int sourceId, final int className, final GeckoBundle eventData) { ThreadUtils.postToUiThread(new Runnable() { diff --git a/mobile/android/locales/filter.py b/mobile/android/locales/filter.py index f80a3c81b8f1..a3cbbf10cd6c 100644 --- a/mobile/android/locales/filter.py +++ b/mobile/android/locales/filter.py @@ -40,6 +40,9 @@ def test(mod, path, entity=None): if re.match(r"toolkit/about/[^/]*About.ftl", path): # error on toolkit/about/*About.ftl return "error" + if re.match(r"toolkit/about/[^/]*Plugins.ftl", path): + # error on toolkit/about/*Plugins.ftl + return "error" return "ignore" if mod == "dom": diff --git a/mobile/android/locales/l10n.toml b/mobile/android/locales/l10n.toml index c66d9e1df963..d2da110b24bf 100644 --- a/mobile/android/locales/l10n.toml +++ b/mobile/android/locales/l10n.toml @@ -153,6 +153,10 @@ exclude-multi-locale = [ reference = "dom/locales/en-US/chrome/dom/dom.properties" l10n = "{l}dom/chrome/dom/dom.properties" +[[paths]] + reference = "toolkit/locales/en-US/toolkit/about/*Plugins.ftl" + l10n = "{l}toolkit/toolkit/about/*Plugins.ftl" + [[paths]] reference = "dom/locales/en-US/chrome/plugins.properties" l10n = "{l}dom/chrome/plugins.properties" diff --git a/mobile/locales/filter.py b/mobile/locales/filter.py index 1c3f0f1e5fc4..4ba28a262fbe 100644 --- a/mobile/locales/filter.py +++ b/mobile/locales/filter.py @@ -41,6 +41,9 @@ def test(mod, path, entity=None): if re.match(r"toolkit/about/[^/]*About.ftl", path): # error on toolkit/about/*About.ftl return "error" + if re.match(r"toolkit/about/[^/]*Plugins.ftl", path): + # error on toolkit/about/*Plugins.ftl + return "error" return "ignore" if mod == "dom": diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 8b5c56f4a580..aa7300f743c0 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -175,6 +175,8 @@ HttpChannelChild::HttpChannelChild() mDivertingToParent(false), mFlushedForDiversion(false), mIsFromCache(false), + mCacheNeedToReportBytesReadInitialized(false), + mNeedToReportBytesRead(true), mCacheEntryAvailable(false), mAltDataCacheEntryAvailable(false), mSendResumeAt(false), @@ -186,9 +188,7 @@ HttpChannelChild::HttpChannelChild() mPostRedirectChannelShouldIntercept(false), mPostRedirectChannelShouldUpgrade(false), mShouldParentIntercept(false), - mSuspendParentAfterSynthesizeResponse(false), - mCacheNeedToReportBytesReadInitialized(false), - mNeedToReportBytesRead(true) { + mSuspendParentAfterSynthesizeResponse(false) { LOG(("Creating HttpChannelChild @%p\n", this)); mChannelCreationTime = PR_Now(); @@ -1910,6 +1910,7 @@ void HttpChannelChild::ProcessDivertMessages() { // channel. bool HttpChannelChild::Redirect3Complete(OverrideRunnable* aRunnable) { LOG(("HttpChannelChild::Redirect3Complete [this=%p]\n", this)); + MOZ_ASSERT(NS_IsMainThread()); nsresult rv = NS_OK; nsCOMPtr chan = do_QueryInterface(mRedirectChannelChild); @@ -1978,6 +1979,7 @@ NS_IMETHODIMP HttpChannelChild::ConnectParent(uint32_t registrarId) { LOG(("HttpChannelChild::ConnectParent [this=%p, id=%" PRIu32 "]\n", this, registrarId)); + MOZ_ASSERT(NS_IsMainThread()); mozilla::dom::TabChild* tabChild = nullptr; nsCOMPtr iTabChild; GetCallback(iTabChild); @@ -2052,6 +2054,7 @@ NS_IMETHODIMP HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* listener, nsISupports* aContext) { LOG(("HttpChannelChild::FinishRedirectSetup [this=%p]\n", this)); + MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS); NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED); @@ -2111,6 +2114,7 @@ HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* listener, NS_IMETHODIMP HttpChannelChild::OnRedirectVerifyCallback(nsresult result) { LOG(("HttpChannelChild::OnRedirectVerifyCallback [this=%p]\n", this)); + MOZ_ASSERT(NS_IsMainThread()); OptionalURIParams redirectURI; nsresult rv; @@ -2286,6 +2290,7 @@ HttpChannelChild::Suspend() { LOG(("HttpChannelChild::Suspend [this=%p, mSuspendCount=%" PRIu32 ", " "mDivertingToParent=%d]\n", this, mSuspendCount + 1, static_cast(mDivertingToParent))); + MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(RemoteChannelExists() || mInterceptListener, NS_ERROR_NOT_AVAILABLE); @@ -2311,6 +2316,7 @@ HttpChannelChild::Resume() { LOG(("HttpChannelChild::Resume [this=%p, mSuspendCount=%" PRIu32 ", " "mDivertingToParent=%d]\n", this, mSuspendCount - 1, static_cast(mDivertingToParent))); + MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(RemoteChannelExists() || mInterceptListener, NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); @@ -2868,6 +2874,7 @@ HttpChannelChild::SetupFallbackChannel(const char* aFallbackKey) { NS_IMETHODIMP HttpChannelChild::GetCacheTokenFetchCount(int32_t* _retval) { NS_ENSURE_ARG_POINTER(_retval); + MOZ_ASSERT(NS_IsMainThread()); if (mSynthesizedCacheInfo) { return mSynthesizedCacheInfo->GetCacheTokenFetchCount(_retval); @@ -2884,6 +2891,7 @@ HttpChannelChild::GetCacheTokenFetchCount(int32_t* _retval) { NS_IMETHODIMP HttpChannelChild::GetCacheTokenExpirationTime(uint32_t* _retval) { NS_ENSURE_ARG_POINTER(_retval); + MOZ_ASSERT(NS_IsMainThread()); if (mSynthesizedCacheInfo) { return mSynthesizedCacheInfo->GetCacheTokenExpirationTime(_retval); @@ -2897,6 +2905,7 @@ HttpChannelChild::GetCacheTokenExpirationTime(uint32_t* _retval) { NS_IMETHODIMP HttpChannelChild::GetCacheTokenCachedCharset(nsACString& _retval) { + MOZ_ASSERT(NS_IsMainThread()); if (mSynthesizedCacheInfo) { return mSynthesizedCacheInfo->GetCacheTokenCachedCharset(_retval); } @@ -2952,6 +2961,7 @@ HttpChannelChild::GetCacheEntryId(uint64_t* aCacheEntryId) { NS_IMETHODIMP HttpChannelChild::GetCacheKey(uint32_t* cacheKey) { + MOZ_ASSERT(NS_IsMainThread()); if (mSynthesizedCacheInfo) { return mSynthesizedCacheInfo->GetCacheKey(cacheKey); } @@ -3298,6 +3308,7 @@ HttpChannelChild::DivertToParent(ChannelDiverterChild** aChild) { MOZ_RELEASE_ASSERT(aChild); MOZ_RELEASE_ASSERT(gNeckoChild); MOZ_RELEASE_ASSERT(!mDivertingToParent); + MOZ_ASSERT(NS_IsMainThread()); nsresult rv = NS_OK; @@ -3558,6 +3569,7 @@ void HttpChannelChild::OverrideWithSynthesizedResponse( nsIInterceptedBodyCallback* aSynthesizedCallback, InterceptStreamListener* aStreamListener, nsICacheInfoChannel* aCacheInfoChannel) { + MOZ_ASSERT(NS_IsMainThread()); nsresult rv = NS_OK; auto autoCleanup = MakeScopeExit([&] { // Auto-cancel on failure. Do this first to get mStatus set, if necessary. @@ -3659,6 +3671,7 @@ void HttpChannelChild::OverrideWithSynthesizedResponse( NS_IMETHODIMP HttpChannelChild::ForceIntercepted(bool aPostRedirectChannelShouldIntercept, bool aPostRedirectChannelShouldUpgrade) { + MOZ_ASSERT(NS_IsMainThread()); mShouldParentIntercept = true; mPostRedirectChannelShouldIntercept = aPostRedirectChannelShouldIntercept; mPostRedirectChannelShouldUpgrade = aPostRedirectChannelShouldUpgrade; @@ -3669,6 +3682,7 @@ void HttpChannelChild::ForceIntercepted( nsIInputStream* aSynthesizedInput, nsIInterceptedBodyCallback* aSynthesizedCallback, nsICacheInfoChannel* aCacheInfo) { + MOZ_ASSERT(NS_IsMainThread()); mSynthesizedInput = aSynthesizedInput; mSynthesizedCallback = aSynthesizedCallback; mSynthesizedCacheInfo = aCacheInfo; diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index 8c3abd90c22b..985eb30bea04 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -387,7 +387,12 @@ class HttpChannelChild final : public PHttpChannelChild, // parent channel, nor dequeued from the ChannelEventQueue. Atomic mFlushedForDiversion; - uint8_t mIsFromCache : 1; + Atomic mIsFromCache; + // Set if we get the result and cache |mNeedToReportBytesRead| + Atomic mCacheNeedToReportBytesReadInitialized; + // True if we need to tell the parent the size of unreported received data + Atomic mNeedToReportBytesRead; + uint8_t mCacheEntryAvailable : 1; uint8_t mAltDataCacheEntryAvailable : 1; @@ -428,12 +433,6 @@ class HttpChannelChild final : public PHttpChannelChild, // is synthesized. uint8_t mSuspendParentAfterSynthesizeResponse : 1; - // Set if we get the result and cache |mNeedToReportBytesRead| - uint8_t mCacheNeedToReportBytesReadInitialized : 1; - - // True if we need to tell the parent the size of unreported received data - uint8_t mNeedToReportBytesRead : 1; - void FinishInterceptedRedirect(); void CleanupRedirectingChannel(nsresult rv); diff --git a/python/l10n/fluent_migrations/bug_1511454_aboutPlugins.py b/python/l10n/fluent_migrations/bug_1511454_aboutPlugins.py new file mode 100644 index 000000000000..0f2c6d89c1f2 --- /dev/null +++ b/python/l10n/fluent_migrations/bug_1511454_aboutPlugins.py @@ -0,0 +1,153 @@ +# coding=utf8 + +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +from __future__ import absolute_import +import fluent.syntax.ast as FTL +from fluent.migrate.helpers import transforms_from +from fluent.migrate import COPY +from fluent.migrate import CONCAT + +def migrate(ctx): + """Bug 1511454 - Migrate about:plugins to use Fluent for localization, part {index}.""" + + ctx.add_transforms( + "toolkit/toolkit/about/aboutPlugins.ftl", + "toolkit/toolkit/about/aboutPlugins.ftl", + transforms_from( +""" +title-label = { COPY("dom/chrome/plugins.properties", "title_label") } +installed-plugins-label = { COPY("dom/chrome/plugins.properties", "installedplugins_label") } +no-plugins-are-installed-label = { COPY("dom/chrome/plugins.properties", "nopluginsareinstalled_label") } + +mime-type-label = { COPY("dom/chrome/plugins.properties", "mimetype_label") } +description-label = { COPY("dom/chrome/plugins.properties", "description_label") } +suffixes-label = { COPY("dom/chrome/plugins.properties", "suffixes_label") } +""") +) + + ctx.add_transforms( + "toolkit/toolkit/about/aboutPlugins.ftl", + "toolkit/toolkit/about/aboutPlugins.ftl", + [ + FTL.Message( + id=FTL.Identifier("deprecation-description"), + value=CONCAT( + COPY( + "dom/chrome/plugins.properties", + "deprecation_description" + ), + FTL.TextElement(' '), + COPY( + "dom/chrome/plugins.properties", + "deprecation_learn_more" + ), + FTL.TextElement('') + ) + ), + + FTL.Message( + id=FTL.Identifier("file-dd"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "file_label" + ), + FTL.TextElement(' { $pluginLibraries }'), + ) + ), + + FTL.Message( + id=FTL.Identifier("path-dd"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "path_label" + ), + FTL.TextElement(' { $pluginFullPath }'), + ) + ), + + FTL.Message( + id=FTL.Identifier("version-dd"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "version_label" + ), + FTL.TextElement(' { $version }'), + ) + ), + + FTL.Message( + id=FTL.Identifier("state-dd-enabled"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "state_label" + ), + FTL.TextElement(' '), + COPY( + "dom/chrome/plugins.properties", + "state_enabled" + ), + ) + ), + + FTL.Message( + id=FTL.Identifier("state-dd-enabled-block-list-state"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "state_label" + ), + FTL.TextElement(' '), + COPY( + "dom/chrome/plugins.properties", + "state_enabled" + ), + FTL.TextElement(' ({ $blockListState })'), + ) + ), + + FTL.Message( + id=FTL.Identifier("state-dd-Disabled"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "state_label" + ), + FTL.TextElement(' '), + COPY( + "dom/chrome/plugins.properties", + "state_disabled" + ), + ) + ), + + FTL.Message( + id=FTL.Identifier("state-dd-Disabled-block-list-state"), + value=CONCAT( + FTL.TextElement(''), + COPY( + "dom/chrome/plugins.properties", + "state_label" + ), + FTL.TextElement(' '), + COPY( + "dom/chrome/plugins.properties", + "state_disabled" + ), + FTL.TextElement(' ({ $blockListState })'), + ) + ), + + ] + ) diff --git a/taskcluster/docker/funsize-update-generator/Dockerfile b/taskcluster/docker/funsize-update-generator/Dockerfile index eea129f0ea3f..8c8eacb3fb4c 100644 --- a/taskcluster/docker/funsize-update-generator/Dockerfile +++ b/taskcluster/docker/funsize-update-generator/Dockerfile @@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -q && \ apt-get install -yyq --no-install-recommends \ python3.6 python3-setuptools python3-cryptography libgetopt-simple-perl \ - bzip2 clamav clamav-freshclam python3-requests python3-sh curl \ + bzip2 python3-requests python3-sh curl \ python3-dev gcc liblzma-dev xz-utils jq libdpkg-perl locales && \ apt-get clean RUN useradd -d /home/worker -s /bin/bash -m worker @@ -20,9 +20,6 @@ ENV LANGUAGE en_CA.UTF-8 ENV LANG_ALL en_CA.UTF-8 ENV LC_ALL en_CA.UTF-8 -# Freshclam may be flaky, retry if it fails -RUN for i in 1 2 3 4 5; do freshclam --verbose && break || sleep 15; done - # python-pip installs a lot of dependencies increasing the size of an image # drastically. Install it like this saves us almost 200M. RUN bash -c "curl -L https://bootstrap.pypa.io/get-pip.py | python3" diff --git a/taskcluster/docker/funsize-update-generator/scripts/funsize.py b/taskcluster/docker/funsize-update-generator/scripts/funsize.py index a57f47251a2f..fba16b11de19 100755 --- a/taskcluster/docker/funsize-update-generator/scripts/funsize.py +++ b/taskcluster/docker/funsize-update-generator/scripts/funsize.py @@ -320,12 +320,6 @@ async def manage_partial(partial_def, work_env, filename_template, artifacts_dir use_old_format = True log.info("Forcing BZ2 compression for %s", f) - log.info("AV-scanning %s ...", unpack_dir) - metric_tags = [ - "platform:{}".format(partial_def['platform']), - ] - with ddstats.timer('mar.clamscan.time', tags=metric_tags): - await run_command("clamscan -r {}".format(unpack_dir), label='clamscan') log.info("Done.") to_path = os.path.join(work_env.workdir, "to") @@ -455,8 +449,6 @@ def main(): help="Allow files from staging buckets.") parser.add_argument("--filename-template", default=DEFAULT_FILENAME_TEMPLATE) - parser.add_argument("--no-freshclam", action="store_true", default=False, - help="Do not refresh ClamAV DB") parser.add_argument("-q", "--quiet", dest="log_level", action="store_const", const=logging.WARNING, default=logging.DEBUG) @@ -491,17 +483,6 @@ def main(): else: log.info("No metric collection") - if args.no_freshclam: - log.info("Skipping freshclam") - else: - log.info("Refreshing clamav db...") - try: - redo.retry(lambda: sh.freshclam("--stdout", "--verbose", - _timeout=300, _err_to_out=True)) - log.info("Done.") - except sh.ErrorReturnCode: - log.warning("Freshclam failed, skipping DB update") - loop = asyncio.get_event_loop() manifest = loop.run_until_complete(async_main(args, signing_certs)) loop.close() diff --git a/taskcluster/scripts/run-task b/taskcluster/scripts/run-task index 6df32735597e..ddb090f9d8b7 100755 --- a/taskcluster/scripts/run-task +++ b/taskcluster/scripts/run-task @@ -266,7 +266,7 @@ def configure_cache_posix(cache, user, group, if not os.listdir(cache): print_line(b'cache', b'cache %s is empty; writing requirements: ' b'%s\n' % ( - cache.encode('utf-8'), b' '.join(sorted(our_requirements)))) + cache.encode('utf-8'), b' '.join(sorted(our_requirements)))) # We write a requirements file so future invocations know what the # requirements are. @@ -427,7 +427,7 @@ def vcs_checkout(source_repo, dest, store_path, res = urllib.request.urlopen(FINGERPRINT_URL, timeout=10) secret = res.read() try: - secret = json.loads(secret, encoding='utf-8') + secret = json.loads(secret.decode('utf-8')) except ValueError: print_line(b'vcs', b'invalid JSON in hg fingerprint secret') sys.exit(1) @@ -699,6 +699,7 @@ def main(args): os.environ['GECKO_HEAD_REPOSITORY'], args.vcs_checkout, os.environ['HG_STORE_PATH'], + fetch_hgfingerprint=args.fetch_hgfingerprint, base_repo=base_repo, revision=os.environ.get('GECKO_HEAD_REV'), branch=os.environ.get('GECKO_HEAD_REF'), @@ -713,6 +714,7 @@ def main(args): vcs_checkout('https://hg.mozilla.org/build/tools', args.tools_checkout, os.environ['HG_STORE_PATH'], + fetch_hgfingerprint=args.fetch_hgfingerprint, # Always check out the latest commit on default branch. # This is non-deterministic! branch='default') @@ -728,6 +730,7 @@ def main(args): os.environ['COMM_HEAD_REPOSITORY'], args.comm_checkout, os.environ['HG_STORE_PATH'], + fetch_hgfingerprint=args.fetch_hgfingerprint, base_repo=base_repo, revision=os.environ.get('COMM_HEAD_REV'), branch=os.environ.get('COMM_HEAD_REF')) diff --git a/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py b/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py index 31102b650ca2..1d1648a07930 100644 --- a/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py +++ b/toolkit/components/telemetry/tests/marionette/tests/client/test_main_tab_scalars.py @@ -28,10 +28,11 @@ class TestMainTabScalars(TelemetryTestCase): ping = self.wait_for_ping(self.restart_browser, MAIN_SHUTDOWN_PING) - assert ping["type"] == "main" - assert ping["clientId"] == self.client_id + self.assertEqual(ping["type"], "main") + self.assertEqual(ping["clientId"], self.client_id) scalars = ping["payload"]["processes"]["parent"]["scalars"] - assert scalars["browser.engagement.max_concurrent_tab_count"] == 3 - assert scalars["browser.engagement.tab_open_event_count"] == 2 - assert scalars["browser.engagement.max_concurrent_window_count"] == 1 + + self.assertEqual(scalars["browser.engagement.max_concurrent_tab_count"], 3) + self.assertEqual(scalars["browser.engagement.tab_open_event_count"], 2) + self.assertEqual(scalars["browser.engagement.max_concurrent_window_count"], 1) diff --git a/toolkit/content/plugins.html b/toolkit/content/plugins.html index f7dd39730ca9..b15e9f22a2b2 100644 --- a/toolkit/content/plugins.html +++ b/toolkit/content/plugins.html @@ -6,22 +6,14 @@ + +
@@ -69,23 +61,24 @@ var id, label; if (aPlugins.length > 0) { id = "plugs"; - label = "installedplugins_label"; + label = "installed-plugins-label"; } else { id = "noplugs"; - label = "nopluginsareinstalled_label"; + label = "no-plugins-are-installed-label"; } var enabledplugins = document.createElement("h1"); enabledplugins.setAttribute("id", id); - enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label))); + document.l10n.setAttributes(enabledplugins, label); fragment.appendChild(enabledplugins); var deprecation = document.createElement("p"); - deprecation.setAttribute("class", "notice"); - deprecation.textContent = pluginsbundle.GetStringFromName("deprecation_description") + " \u00A0 "; var deprecationLink = document.createElement("a"); - deprecationLink.textContent = pluginsbundle.GetStringFromName("deprecation_learn_more"); - deprecationLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi"; + let deprecationLink_href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi"; + deprecationLink.setAttribute("data-l10n-name", "deprecation-link"); + deprecationLink.setAttribute("href", deprecationLink_href); deprecation.appendChild(deprecationLink); + deprecation.setAttribute("class", "notice"); + document.l10n.setAttributes(deprecation, "deprecation-description"); fragment.appendChild(deprecation); var stateNames = {}; @@ -112,41 +105,47 @@ // "File: Flash Player.plugin" var fileDd = document.createElement("dd"); var file = document.createElement("span"); + file.setAttribute("data-l10n-name", "file"); file.setAttribute("class", "label"); - file.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("file_label") + " ")); fileDd.appendChild(file); - fileDd.appendChild(document.createTextNode(plugin.pluginLibraries)); + document.l10n.setAttributes(fileDd, "file-dd", { pluginLibraries: plugin.pluginLibraries[0] }); dl.appendChild(fileDd); // "Path: /usr/lib/mozilla/plugins/libtotem-cone-plugin.so" var pathDd = document.createElement("dd"); var path = document.createElement("span"); + path.setAttribute("data-l10n-name", "path"); path.setAttribute("class", "label"); - path.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("path_label") + " ")); pathDd.appendChild(path); - pathDd.appendChild(document.createTextNode(plugin.pluginFullpath)); + document.l10n.setAttributes(pathDd, "path-dd", { pluginFullPath: plugin.pluginFullpath[0] }); dl.appendChild(pathDd); // "Version: " var versionDd = document.createElement("dd"); var version = document.createElement("span"); + version.setAttribute("data-l10n-name", "version"); version.setAttribute("class", "label"); - version.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("version_label") + " ")); versionDd.appendChild(version); - versionDd.appendChild(document.createTextNode(plugin.version)); + document.l10n.setAttributes(versionDd, "version-dd", { version: plugin.version }); dl.appendChild(versionDd); // "State: " var stateDd = document.createElement("dd"); var state = document.createElement("span"); + state.setAttribute("data-l10n-name", "state"); state.setAttribute("label", "state"); - state.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("state_label") + " ")); stateDd.appendChild(state); - var status = plugin.isActive ? pluginsbundle.GetStringFromName("state_enabled") : pluginsbundle.GetStringFromName("state_disabled"); - if (plugin.blocklistState in stateNames) { - status += " (" + stateNames[plugin.blocklistState] + ")"; + if (plugin.isActive) { + if (plugin.blocklistState in stateNames) { + document.l10n.setAttributes(stateDd, "state-dd-enabled-block-list-state", { blockListState: stateNames[plugin.blocklistState] }); + } else { + document.l10n.setAttributes(stateDd, "state-dd-enabled"); + } + } else if (plugin.blocklistState in stateNames) { + document.l10n.setAttributes(stateDd, "state-dd-disabled-block-list-state", { blockListState: stateNames[plugin.blocklistState] }); + } else { + document.l10n.setAttributes(stateDd, "state-dd-disabled"); } - stateDd.appendChild(document.createTextNode(status)); dl.appendChild(stateDd); // Plugin Description @@ -168,19 +167,19 @@ // "MIME Type" column header var typeTh = document.createElement("th"); typeTh.setAttribute("class", "type"); - typeTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("mimetype_label"))); + document.l10n.setAttributes(typeTh, "mime-type-label"); tr.appendChild(typeTh); // "Description" column header var descTh = document.createElement("th"); descTh.setAttribute("class", "desc"); - descTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("description_label"))); + document.l10n.setAttributes(descTh, "description-label"); tr.appendChild(descTh); // "Suffixes" column header var suffixesTh = document.createElement("th"); suffixesTh.setAttribute("class", "suff"); - suffixesTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("suffixes_label"))); + document.l10n.setAttributes(suffixesTh, "suffixes-label"); tr.appendChild(suffixesTh); var tbody = document.createElement("tbody"); diff --git a/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl b/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl new file mode 100644 index 000000000000..b9860737a523 --- /dev/null +++ b/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl @@ -0,0 +1,33 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +title-label = About Plugins + +installed-plugins-label = Installed plugins +no-plugins-are-installed-label = No installed plugins found + +deprecation-description = Missing something? Some plugins are no longer supported. Learn More. + +## The information of plugins +## +## Variables: +## $pluginLibraries: the plugin library +## $pluginFullPath: path of the plugin +## $version: version of the plugin +file-dd = File: { $pluginLibraries } +path-dd = Path: { $pluginFullPath } +version-dd = Version: { $version } + +## These strings describe the state of plugins +## +## Variables: +## $blockListState: show some special state of the plugin, such as blocked, outdated +state-dd-enabled = State: Enabled +state-dd-enabled-block-list-state = State: Enabled ({ $blockListState }) +state-dd-Disabled = State: Disabled +state-dd-Disabled-block-list-state = State: Disabled ({ $blockListState }) + +mime-type-label = MIME Type +description-label = Description +suffixes-label = Suffixes