зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1096093 - Send ThemeRefresh message from parent down to content process. r=smaug.
--HG-- extra : rebase_source : 2103f47a75612dc4f1b719f5913d6cc14be5fbf7
This commit is contained in:
Родитель
b81c35afce
Коммит
e21dde0949
|
@ -58,6 +58,7 @@ using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/laye
|
||||||
using mozilla::WritingMode from "mozilla/WritingModes.h";
|
using mozilla::WritingMode from "mozilla/WritingModes.h";
|
||||||
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
||||||
using nsIWidget::TouchPointerState from "nsIWidget.h";
|
using nsIWidget::TouchPointerState from "nsIWidget.h";
|
||||||
|
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
@ -673,6 +674,12 @@ child:
|
||||||
*/
|
*/
|
||||||
UIResolutionChanged();
|
UIResolutionChanged();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell the child that the system theme has changed, and that a repaint
|
||||||
|
* is necessary.
|
||||||
|
*/
|
||||||
|
ThemeChanged(LookAndFeelInt[] lookAndFeelIntCache);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the child of an app's offline status
|
* Tell the child of an app's offline status
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3140,8 +3140,27 @@ TabChild::RecvUIResolutionChanged()
|
||||||
static_cast<PuppetWidget*>(mWidget.get())->ClearBackingScaleCache();
|
static_cast<PuppetWidget*>(mWidget.get())->ClearBackingScaleCache();
|
||||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||||
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
if (presShell) {
|
||||||
presContext->UIResolutionChanged();
|
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||||
|
if (presContext) {
|
||||||
|
presContext->UIResolutionChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TabChild::RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache)
|
||||||
|
{
|
||||||
|
LookAndFeel::SetIntCache(aLookAndFeelIntCache);
|
||||||
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||||
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||||
|
if (presShell) {
|
||||||
|
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||||
|
if (presContext) {
|
||||||
|
presContext->ThemeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -480,6 +480,8 @@ public:
|
||||||
|
|
||||||
virtual bool RecvUIResolutionChanged() override;
|
virtual bool RecvUIResolutionChanged() override;
|
||||||
|
|
||||||
|
virtual bool RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native widget remoting protocol for use with windowed plugins with e10s.
|
* Native widget remoting protocol for use with windowed plugins with e10s.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mozilla/layers/CompositorParent.h"
|
#include "mozilla/layers/CompositorParent.h"
|
||||||
#include "mozilla/layers/InputAPZContext.h"
|
#include "mozilla/layers/InputAPZContext.h"
|
||||||
#include "mozilla/layout/RenderFrameParent.h"
|
#include "mozilla/layout/RenderFrameParent.h"
|
||||||
|
#include "mozilla/LookAndFeel.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/net/NeckoChild.h"
|
#include "mozilla/net/NeckoChild.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
@ -992,6 +993,19 @@ TabParent::UIResolutionChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TabParent::ThemeChanged()
|
||||||
|
{
|
||||||
|
if (!mIsDestroyed) {
|
||||||
|
// The theme has changed, and any cached values we had sent down
|
||||||
|
// to the child have been invalidated. When this method is called,
|
||||||
|
// LookAndFeel should have the up-to-date values, which we now
|
||||||
|
// send down to the child. We do this for every remote tab for now,
|
||||||
|
// but bug 1156934 has been filed to do it once per content process.
|
||||||
|
unused << SendThemeChanged(LookAndFeel::GetIntCache());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabParent::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
TabParent::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
||||||
const mozilla::CSSPoint& aDestination)
|
const mozilla::CSSPoint& aDestination)
|
||||||
|
|
|
@ -246,6 +246,7 @@ public:
|
||||||
void UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size);
|
void UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size);
|
||||||
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
||||||
void UIResolutionChanged();
|
void UIResolutionChanged();
|
||||||
|
void ThemeChanged();
|
||||||
void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
||||||
const mozilla::CSSPoint& aDestination);
|
const mozilla::CSSPoint& aDestination);
|
||||||
void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
||||||
|
|
|
@ -1702,6 +1702,12 @@ nsPresContext::ThemeChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
NotifyThemeChanged(TabParent* aTabParent, void* aArg)
|
||||||
|
{
|
||||||
|
aTabParent->ThemeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsPresContext::ThemeChangedInternal()
|
nsPresContext::ThemeChangedInternal()
|
||||||
{
|
{
|
||||||
|
@ -1735,6 +1741,11 @@ nsPresContext::ThemeChangedInternal()
|
||||||
// changes are not), and -moz-appearance (whose changes likewise are
|
// changes are not), and -moz-appearance (whose changes likewise are
|
||||||
// not), so we need to reflow.
|
// not), so we need to reflow.
|
||||||
MediaFeatureValuesChanged(eRestyle_Subtree, NS_STYLE_HINT_REFLOW);
|
MediaFeatureValuesChanged(eRestyle_Subtree, NS_STYLE_HINT_REFLOW);
|
||||||
|
|
||||||
|
// Recursively notify all remote leaf descendants that the
|
||||||
|
// system theme has changed.
|
||||||
|
nsContentUtils::CallOnAllRemoteChildren(mDocument->GetWindow(),
|
||||||
|
NotifyThemeChanged, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Загрузка…
Ссылка в новой задаче