Files
palemoon27/gfx/layers/LayersLogging.cpp
T
roytam1 6e2582b2b6 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1117087 Don't reset IM context when nsGtkIMContext receives selection change during dispatching compositionstart r=m_kato (0bbca7a4c)
- Bug 1155494 - Add a 'compressall' message flag. f=handyman r=billm (parts of this patch were written by handyman with r=billm) (5bb9ccd32)
- Bug 1167882 - Move a couple of static helpers functions higher up in TabChild.cpp. r=kats (75a880959)
- Bug 1167882 - Add utility functions MaxScaleRatio() and MinScaleRatio() to Units.h. r=kats (3604aa9e2)
- Bug 1167882 - Use the display size (includes scrollbar areas) rather than the root composition bounds (excludes scrollbar areas) to calculate the intrinsic scale. r=kats (8b6f2917c)
- Fix a potential null-deref in TabChild::HandlePossibleViewportChange. (bug 1156156, r=kats) (55e5e79f4)
- Bug 1164406 - Exclude the scrollbars from the composition bounds in TabChild::HandleCalculateViewportChange() when appropriate. r=kats (28a7efaad)
- Bug 1089090, e10s, support custom cursors, r=jmathies (6f005a600)
- Bug 1125325 - Make TabParent/TabChild UpdateDimensions messages aware of the display scale. r=kats (07ac774b2)
- Bug 1157248 - TabChild should initialize ServiceWorkerManager before starting the first loading, r=nsm (0eb50c148)
- Bug 1060643 - Give content the opportunity to block chrome keyhandlers. r=smaug (93cdd9608)
- Bug 1137555 - Add implementation of PuppetWidget::GetMaxTouchPoints(). r=smaug, r=jimm (d859fd19a)
- Bug 1164763 - Avoid one extra IPC round-trip when compositor-lru-size == 0. r=mattwoodrow,billm (19cfdf029)
- bug 1167295 - manage PDocAccessible with PBrowser instead of PContent r=smaug (5787cd60c)
- Bug 1161592 - If we don't get a target frame from the touch point try using the root scrollable frame. r=botond (c0d49d85f)
- Bug 1162648. When updating layout with the latest async values from the APZC do the scrolling last because it can flush layout. r=botond,kats (f8a354aab)
- Bug 1163572 - Modify UpdateRootFrame to automatically compute the nsIContent* and nsIPresShell* from the metrics. r=botond (9d7fda5c8)
- Bug 1163572 - Have ChromeProcessController also handle root-frame repaint requests. r=botond (67786ad9f)
- Bug 1163572 - Modify UpdateSubFrame to automatically figure out the nsIContent from the scrollId. r=botond (136aff8a1)
- Bug 1175383 TabChild should store PuppetWidget as is rather than as nsIWidget r=smaug (3e2bfd3ad)
- Bug 1158424 - Expose IsRootContent() in AsyncPanZoomController. r=kats (632ba6051)
- Bug 1158424 - Clean up uses of HasNoParentWithSameLayersId() related to zoom constraints. r=kats (c94b5f517)
- Bug 1166942 - Add logging code for gfx::Matrix. r=nical (5dc405fa6)
- Bug 1055557 - Move storage of ZoomConstraints from RemoteContentController to APZCTreeManager. r=botond (8e1056b71)
- Bug 1055557 - Add a ZoomConstraintsClient class to manage pushing zoom constraints updates to the APZ code. r=botond (69f1ae857)
- Bug 1055557 - Constify some methods. r=botond (b81ec32f9)
- Bug 1055557 - Ensure the right presShell resolution is used in ApplyCallbackTransform for fennec-apz scenarios. r=botond (6df0c30e7)
- Bug 1175217 - Fix non-unified (and some unified) builds for nsDisplayListInvalidation.cpp. r=mstange (cd0662dfa)
- Bug 1160421 - Replace nsThreadPool with a custom thread pool implementation in DecodePool. r=tn (66ae4fac2)
- Bug 1130935 part.1 Add a method to check if current IME supports vertical writing mode r=emk (056232715)
- Bug 1130935 part.2 Set proper composition font when writing mode is changed r=emk (e5cc07c43)
- Bug 1130935 part.3 Add hack for Japanist because its candidate window is broken with @System font r=emk (4e7587585)
- Bug 1130935 part.4 nsIMM32Handler::GetCharacterRectOfSelectedTextAt() should return wrting mode if it's necessary r=emk+smaug (92e76951a)
- Bug 1130935 part.5 nsIMM32Handler should compute candidate window position with writing mode r=emk (676e1c274)
- Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug (a0e37af25)
2021-02-06 08:28:03 +08:00

371 lines
11 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* 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/. */
#include "LayersLogging.h"
#include <stdint.h> // for uint8_t
#include "gfxColor.h" // for gfxRGBA
#include "mozilla/gfx/Matrix.h" // for Matrix4x4, Matrix
#include "mozilla/gfx/Point.h" // for IntSize
#include "nsDebug.h" // for NS_ERROR
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for mozilla::gfx::IntRect
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
void
AppendToString(std::stringstream& aStream, const void* p,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString("%p", p).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const GraphicsFilter& f,
const char* pfx, const char* sfx)
{
aStream << pfx;
switch (f) {
case GraphicsFilter::FILTER_FAST: aStream << "fast"; break;
case GraphicsFilter::FILTER_GOOD: aStream << "good"; break;
case GraphicsFilter::FILTER_BEST: aStream << "best"; break;
case GraphicsFilter::FILTER_NEAREST: aStream << "nearest"; break;
case GraphicsFilter::FILTER_BILINEAR: aStream << "bilinear"; break;
case GraphicsFilter::FILTER_GAUSSIAN: aStream << "gaussian"; break;
default:
NS_ERROR("unknown filter type");
aStream << "???";
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, FrameMetrics::ViewID n,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << n;
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const gfxRGBA& c,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"rgba(%d, %d, %d, %g)",
uint8_t(c.r*255.0), uint8_t(c.g*255.0), uint8_t(c.b*255.0), c.a).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsPoint& p,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString("(x=%d, y=%d)", p.x, p.y).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsRect& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsIntPoint& p,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString("(x=%d, y=%d)", p.x, p.y).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const IntRect& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsRegion& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
nsRegionRectIterator it(r);
aStream << "< ";
while (const nsRect* sr = it.Next()) {
AppendToString(aStream, *sr);
aStream << "; ";
}
aStream << ">";
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsIntRegion& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
nsIntRegionRectIterator it(r);
aStream << "< ";
while (const IntRect* sr = it.Next()) {
AppendToString(aStream, *sr);
aStream << "; ";
}
aStream << ">";
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const EventRegions& e,
const char* pfx, const char* sfx)
{
aStream << pfx << "{";
if (!e.mHitRegion.IsEmpty()) {
AppendToString(aStream, e.mHitRegion, " hitregion=", "");
}
if (!e.mDispatchToContentHitRegion.IsEmpty()) {
AppendToString(aStream, e.mDispatchToContentHitRegion, " dispatchtocontentregion=", "");
}
if (!e.mNoActionRegion.IsEmpty()) {
AppendToString(aStream, e.mNoActionRegion, " NoActionRegion=","");
}
if (!e.mHorizontalPanRegion.IsEmpty()) {
AppendToString(aStream, e.mHorizontalPanRegion, " HorizontalPanRegion=", "");
}
if (!e.mVerticalPanRegion.IsEmpty()) {
AppendToString(aStream, e.mVerticalPanRegion, " VerticalPanRegion=", "");
}
aStream << "}" << sfx;
}
void
AppendToString(std::stringstream& aStream, const FrameMetrics& m,
const char* pfx, const char* sfx, bool detailed)
{
aStream << pfx;
AppendToString(aStream, m.GetCompositionBounds(), "{ [cb=");
AppendToString(aStream, m.GetScrollableRect(), "] [sr=");
AppendToString(aStream, m.GetScrollOffset(), "] [s=");
if (m.GetDoSmoothScroll()) {
AppendToString(aStream, m.GetSmoothScrollOffset(), "] [ss=");
}
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
AppendToString(aStream, m.GetCriticalDisplayPort(), "] [cdp=");
AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
if (!detailed) {
AppendToString(aStream, m.GetScrollId(), "] [scrollId=");
if (m.GetScrollParentId() != FrameMetrics::NULL_SCROLL_ID) {
AppendToString(aStream, m.GetScrollParentId(), "] [scrollParent=");
}
if (m.HasClipRect()) {
AppendToString(aStream, m.ClipRect(), "] [clip=");
}
AppendToString(aStream, m.GetZoom(), "] [z=", "] }");
} else {
AppendToString(aStream, m.GetDisplayPortMargins(), " [dpm=");
aStream << nsPrintfCString("] um=%d", m.GetUseDisplayPortMargins()).get();
AppendToString(aStream, m.GetRootCompositionSize(), "] [rcs=");
AppendToString(aStream, m.GetViewport(), "] [v=");
aStream << nsPrintfCString("] [z=(ld=%.3f r=%.3f",
m.GetDevPixelsPerCSSPixel().scale,
m.GetPresShellResolution()).get();
AppendToString(aStream, m.GetCumulativeResolution(), " cr=");
AppendToString(aStream, m.GetZoom(), " z=");
AppendToString(aStream, m.GetExtraResolution(), " er=");
aStream << nsPrintfCString(")] [u=(%d %d %lu)",
m.GetScrollOffsetUpdated(), m.GetDoSmoothScroll(),
m.GetScrollGeneration()).get();
AppendToString(aStream, m.GetScrollParentId(), "] [p=");
aStream << nsPrintfCString("] [i=(%ld %lld)] }",
m.GetPresShellId(), m.GetScrollId()).get();
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const ScrollableLayerGuid& s,
const char* pfx, const char* sfx)
{
aStream << pfx
<< nsPrintfCString("{ l=%" PRIu64 ", p=%u, v=%" PRIu64 " }", s.mLayersId, s.mPresShellId, s.mScrollId).get()
<< sfx;
}
void
AppendToString(std::stringstream& aStream, const ZoomConstraints& z,
const char* pfx, const char* sfx)
{
aStream << pfx
<< nsPrintfCString("{ z=%d dt=%d min=%f max=%f }", z.mAllowZoom, z.mAllowDoubleTapZoom, z.mMinZoom.scale, z.mMaxZoom.scale).get()
<< sfx;
}
void
AppendToString(std::stringstream& aStream, const Matrix& m,
const char* pfx, const char* sfx)
{
aStream << pfx;
if (m.IsIdentity()) {
aStream << "[ I ]";
} else {
aStream << nsPrintfCString(
"[ %g %g; %g %g; %g %g; ]",
m._11, m._12, m._21, m._22, m._31, m._32).get();
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const Matrix4x4& m,
const char* pfx, const char* sfx)
{
if (m.Is2D()) {
Matrix matrix = m.As2D();
AppendToString(aStream, matrix, pfx, sfx);
return;
}
aStream << pfx;
aStream << nsPrintfCString(
"[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; ]",
m._11, m._12, m._13, m._14,
m._21, m._22, m._23, m._24,
m._31, m._32, m._33, m._34,
m._41, m._42, m._43, m._44).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const Matrix5x4& m,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g]",
m._11, m._12, m._13, m._14,
m._21, m._22, m._23, m._24,
m._31, m._32, m._33, m._34,
m._41, m._42, m._43, m._44,
m._51, m._52, m._53, m._54).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const Filter filter,
const char* pfx, const char* sfx)
{
aStream << pfx;
switch (filter) {
case Filter::GOOD: aStream << "Filter::GOOD"; break;
case Filter::LINEAR: aStream << "Filter::LINEAR"; break;
case Filter::POINT: aStream << "Filter::POINT"; break;
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, TextureFlags flags,
const char* pfx, const char* sfx)
{
aStream << pfx;
if (flags == TextureFlags::NO_FLAGS) {
aStream << "NoFlags";
} else {
#define AppendFlag(test) \
{ \
if (!!(flags & test)) { \
if (previous) { \
aStream << "|"; \
} \
aStream << #test; \
previous = true; \
} \
}
bool previous = false;
AppendFlag(TextureFlags::USE_NEAREST_FILTER);
AppendFlag(TextureFlags::ORIGIN_BOTTOM_LEFT);
AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
#undef AppendFlag
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, mozilla::gfx::SurfaceFormat format,
const char* pfx, const char* sfx)
{
aStream << pfx;
switch (format) {
case SurfaceFormat::B8G8R8A8: aStream << "SurfaceFormat::B8G8R8A8"; break;
case SurfaceFormat::B8G8R8X8: aStream << "SurfaceFormat::B8G8R8X8"; break;
case SurfaceFormat::R8G8B8A8: aStream << "SurfaceFormat::R8G8B8A8"; break;
case SurfaceFormat::R8G8B8X8: aStream << "SurfaceFormat::R8G8B8X8"; break;
case SurfaceFormat::R5G6B5: aStream << "SurfaceFormat::R5G6B5"; break;
case SurfaceFormat::A8: aStream << "SurfaceFormat::A8"; break;
case SurfaceFormat::YUV: aStream << "SurfaceFormat::YUV"; break;
case SurfaceFormat::UNKNOWN: aStream << "SurfaceFormat::UNKNOWN"; break;
}
aStream << sfx;
}
} // namespace layers
} // namespace mozilla
void
print_stderr(std::stringstream& aStr)
{
#if defined(ANDROID)
// On Android logcat output is truncated to 1024 chars per line, and
// we usually use std::stringstream to build up giant multi-line gobs
// of output. So to avoid the truncation we find the newlines and
// print the lines individually.
std::string line;
while (std::getline(aStr, line)) {
printf_stderr("%s\n", line.c_str());
}
#else
printf_stderr("%s", aStr.str().c_str());
#endif
}
void
fprint_stderr(FILE* aFile, std::stringstream& aStr)
{
if (aFile == stderr) {
print_stderr(aStr);
} else {
fprintf_stderr(aFile, "%s", aStr.str().c_str());
}
}