mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
a661b33faa
@ -251,8 +251,6 @@ GetAccService()
|
|||||||
inline bool
|
inline bool
|
||||||
IPCAccessibilityActive()
|
IPCAccessibilityActive()
|
||||||
{
|
{
|
||||||
// XXX temporarily disable ipc accessibility because of crashes.
|
|
||||||
return false;
|
|
||||||
#ifdef MOZ_B2G
|
#ifdef MOZ_B2G
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
@ -23,7 +23,8 @@ public:
|
|||||||
|
|
||||||
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
|
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
|
||||||
DocAccessibleParent* aDoc, role aRole) :
|
DocAccessibleParent* aDoc, role aRole) :
|
||||||
mParent(aParent), mDoc(aDoc), mID(aID), mRole(aRole), mOuterDoc(false)
|
mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
|
||||||
|
mOuterDoc(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ProxyAccessible);
|
MOZ_COUNT_CTOR(ProxyAccessible);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
|
|||||||
dnl Set the version number of the libs included with mozilla
|
dnl Set the version number of the libs included with mozilla
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
MOZJPEG=62
|
MOZJPEG=62
|
||||||
MOZPNG=10614
|
MOZPNG=10616
|
||||||
NSPR_VERSION=4
|
NSPR_VERSION=4
|
||||||
NSPR_MINVER=4.10.3
|
NSPR_MINVER=4.10.3
|
||||||
NSS_VERSION=3
|
NSS_VERSION=3
|
||||||
@ -2674,11 +2674,7 @@ AC_SUBST(VISIBILITY_FLAGS)
|
|||||||
|
|
||||||
MOZ_GCC_PR49911
|
MOZ_GCC_PR49911
|
||||||
MOZ_GCC_PR39608
|
MOZ_GCC_PR39608
|
||||||
if test "$OS_TARGET" != WINNT; then
|
MOZ_LLVM_PR8927
|
||||||
# Only run this test with clang on non-Windows platforms, because clang
|
|
||||||
# cannot do enough code gen for now to make this test work correctly.
|
|
||||||
MOZ_LLVM_PR8927
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1024926
|
|||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=946529">Mozilla Bug 1024926</a>
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024926">Mozilla Bug 1024926</a>
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none">
|
<div id="content" style="display: none">
|
||||||
<svg width="100%" height="1" id="svg">
|
<svg width="100%" height="1" id="svg">
|
||||||
|
@ -9677,6 +9677,10 @@
|
|||||||
> cysteine/M
|
> cysteine/M
|
||||||
19536a25296
|
19536a25296
|
||||||
> decertify/DSGNX
|
> decertify/DSGNX
|
||||||
|
19759c25519
|
||||||
|
< deliverable/U
|
||||||
|
---
|
||||||
|
> deliverable/US
|
||||||
19935a25696
|
19935a25696
|
||||||
> dequeue/DSG
|
> dequeue/DSG
|
||||||
19999a25761
|
19999a25761
|
||||||
@ -10430,6 +10434,10 @@
|
|||||||
< member/EAS
|
< member/EAS
|
||||||
---
|
---
|
||||||
> member/EASM
|
> member/EASM
|
||||||
|
32386c38086
|
||||||
|
< men
|
||||||
|
---
|
||||||
|
> men/M
|
||||||
32708a38409
|
32708a38409
|
||||||
> might've
|
> might've
|
||||||
32717a38419
|
32717a38419
|
||||||
@ -10461,6 +10469,10 @@
|
|||||||
< mister's
|
< mister's
|
||||||
---
|
---
|
||||||
> mister/M
|
> mister/M
|
||||||
|
33083c38784
|
||||||
|
< mitigation/M
|
||||||
|
---
|
||||||
|
> mitigation/MS
|
||||||
33107,33108c38808
|
33107,33108c38808
|
||||||
< mob's
|
< mob's
|
||||||
< mob/CS
|
< mob/CS
|
||||||
|
@ -25788,7 +25788,7 @@ delirious/PY
|
|||||||
deliriousness/M
|
deliriousness/M
|
||||||
delirium/SM
|
delirium/SM
|
||||||
deliver/ADGS
|
deliver/ADGS
|
||||||
deliverable/U
|
deliverable/US
|
||||||
deliverance/M
|
deliverance/M
|
||||||
delivered/U
|
delivered/U
|
||||||
deliverer/SM
|
deliverer/SM
|
||||||
@ -38384,7 +38384,7 @@ memorize/DSG
|
|||||||
memorized/U
|
memorized/U
|
||||||
memory/SM
|
memory/SM
|
||||||
memsahib/S
|
memsahib/S
|
||||||
men
|
men/M
|
||||||
menace/MGDS
|
menace/MGDS
|
||||||
menacing/Y
|
menacing/Y
|
||||||
menage/MS
|
menage/MS
|
||||||
@ -39086,7 +39086,7 @@ mite/MZRS
|
|||||||
miter/MDG
|
miter/MDG
|
||||||
mitigate/DSGN
|
mitigate/DSGN
|
||||||
mitigated/U
|
mitigated/U
|
||||||
mitigation/M
|
mitigation/MS
|
||||||
mitigatory
|
mitigatory
|
||||||
mitochondria
|
mitochondria
|
||||||
mitochondrial
|
mitochondrial
|
||||||
|
@ -277,7 +277,6 @@ struct SK_API SkIRect {
|
|||||||
rectangle. If either rectangle is empty, do nothing and return false.
|
rectangle. If either rectangle is empty, do nothing and return false.
|
||||||
*/
|
*/
|
||||||
bool intersect(const SkIRect& a, const SkIRect& b) {
|
bool intersect(const SkIRect& a, const SkIRect& b) {
|
||||||
SkASSERT(&a && &b);
|
|
||||||
|
|
||||||
if (!a.isEmpty() && !b.isEmpty() &&
|
if (!a.isEmpty() && !b.isEmpty() &&
|
||||||
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||||
@ -298,7 +297,6 @@ struct SK_API SkIRect {
|
|||||||
we assert that both rectangles are non-empty.
|
we assert that both rectangles are non-empty.
|
||||||
*/
|
*/
|
||||||
bool intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b) {
|
bool intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b) {
|
||||||
SkASSERT(&a && &b);
|
|
||||||
SkASSERT(!a.isEmpty() && !b.isEmpty());
|
SkASSERT(!a.isEmpty() && !b.isEmpty());
|
||||||
|
|
||||||
if (a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
if (a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||||
|
@ -129,7 +129,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int appendAction(const char label[], SkEventSinkID target);
|
int appendAction(const char label[], SkEventSinkID target);
|
||||||
int appendList(const char label[], const char slotName[],
|
int appendList(const char label[], const char slotName[],
|
||||||
SkEventSinkID target, int defaultIndex, const char[] ...);
|
SkEventSinkID target, int defaultIndex, const char* ...);
|
||||||
int appendSlider(const char label[], const char slotName[],
|
int appendSlider(const char label[], const char slotName[],
|
||||||
SkEventSinkID target, SkScalar min, SkScalar max,
|
SkEventSinkID target, SkScalar min, SkScalar max,
|
||||||
SkScalar defaultValue);
|
SkScalar defaultValue);
|
||||||
|
@ -1067,7 +1067,7 @@ void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkMatrix::mapRect(SkRect* dst, const SkRect& src) const {
|
bool SkMatrix::mapRect(SkRect* dst, const SkRect& src) const {
|
||||||
SkASSERT(dst && &src);
|
SkASSERT(dst);
|
||||||
|
|
||||||
if (this->rectStaysRect()) {
|
if (this->rectStaysRect()) {
|
||||||
this->mapPoints((SkPoint*)dst, (const SkPoint*)&src, 2);
|
this->mapPoints((SkPoint*)dst, (const SkPoint*)&src, 2);
|
||||||
|
@ -114,12 +114,10 @@ bool SkRect::intersect(SkScalar left, SkScalar top, SkScalar right,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkRect::intersect(const SkRect& r) {
|
bool SkRect::intersect(const SkRect& r) {
|
||||||
SkASSERT(&r);
|
|
||||||
return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom);
|
return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkRect::intersect2(const SkRect& r) {
|
bool SkRect::intersect2(const SkRect& r) {
|
||||||
SkASSERT(&r);
|
|
||||||
SkScalar L = SkMaxScalar(fLeft, r.fLeft);
|
SkScalar L = SkMaxScalar(fLeft, r.fLeft);
|
||||||
SkScalar R = SkMinScalar(fRight, r.fRight);
|
SkScalar R = SkMinScalar(fRight, r.fRight);
|
||||||
if (L >= R) {
|
if (L >= R) {
|
||||||
@ -135,7 +133,6 @@ bool SkRect::intersect2(const SkRect& r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkRect::intersect(const SkRect& a, const SkRect& b) {
|
bool SkRect::intersect(const SkRect& a, const SkRect& b) {
|
||||||
SkASSERT(&a && &b);
|
|
||||||
|
|
||||||
if (!a.isEmpty() && !b.isEmpty() &&
|
if (!a.isEmpty() && !b.isEmpty() &&
|
||||||
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||||
|
@ -432,7 +432,7 @@ static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last) {
|
|||||||
void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitter,
|
void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitter,
|
||||||
int start_y, int stop_y, int shiftEdgesUp,
|
int start_y, int stop_y, int shiftEdgesUp,
|
||||||
const SkRegion& clipRgn) {
|
const SkRegion& clipRgn) {
|
||||||
SkASSERT(&path && blitter);
|
SkASSERT(blitter);
|
||||||
|
|
||||||
SkEdgeBuilder builder;
|
SkEdgeBuilder builder;
|
||||||
|
|
||||||
|
@ -1337,7 +1337,7 @@ void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph,
|
|||||||
SkPath* path) {
|
SkPath* path) {
|
||||||
SkAutoMutexAcquire ac(gFTMutex);
|
SkAutoMutexAcquire ac(gFTMutex);
|
||||||
|
|
||||||
SkASSERT(&glyph && path);
|
SkASSERT(path);
|
||||||
|
|
||||||
if (this->setupSize()) {
|
if (this->setupSize()) {
|
||||||
path->reset();
|
path->reset();
|
||||||
|
@ -167,7 +167,7 @@ void SkTextBox::setSpacing(SkScalar mul, SkScalar add)
|
|||||||
|
|
||||||
void SkTextBox::draw(SkCanvas* canvas, const char text[], size_t len, const SkPaint& paint)
|
void SkTextBox::draw(SkCanvas* canvas, const char text[], size_t len, const SkPaint& paint)
|
||||||
{
|
{
|
||||||
SkASSERT(canvas && &paint && (text || len == 0));
|
SkASSERT(canvas && (text || len == 0));
|
||||||
|
|
||||||
SkScalar marginWidth = fBox.width();
|
SkScalar marginWidth = fBox.width();
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ void SkView::Artist::draw(SkView* view, SkCanvas* canvas)
|
|||||||
|
|
||||||
void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
||||||
{
|
{
|
||||||
SkASSERT(&dom && node);
|
SkASSERT(node);
|
||||||
this->onInflate(dom, node);
|
this->onInflate(dom, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ void SkView::Layout::layoutChildren(SkView* parent)
|
|||||||
|
|
||||||
void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
||||||
{
|
{
|
||||||
SkASSERT(&dom && node);
|
SkASSERT(node);
|
||||||
this->onInflate(dom, node);
|
this->onInflate(dom, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2244,11 +2244,7 @@ AC_SUBST(VISIBILITY_FLAGS)
|
|||||||
|
|
||||||
MOZ_GCC_PR49911
|
MOZ_GCC_PR49911
|
||||||
MOZ_GCC_PR39608
|
MOZ_GCC_PR39608
|
||||||
if test "$OS_TARGET" != WINNT; then
|
MOZ_LLVM_PR8927
|
||||||
# Only run this test with clang on non-Windows platforms, because clang
|
|
||||||
# cannot do enough code gen for now to make this test work correctly.
|
|
||||||
MOZ_LLVM_PR8927
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
@ -96,10 +96,16 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.focus();
|
||||||
// Run the test in a separate window so we get a clean browser window.
|
// Run the test in a separate window so we get a clean browser window.
|
||||||
win = window.open("data:text/html,<html style='overflow:scroll'>",
|
win = window.open("data:text/html,<html style='overflow:scroll'>",
|
||||||
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
|
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
|
||||||
|
setTimeout(setupWindow, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupWindow() {
|
||||||
win.addEventListener("load", doTest, false);
|
win.addEventListener("load", doTest, false);
|
||||||
|
win.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTest();
|
nextTest();
|
||||||
|
24
layout/generic/RubyReflowState.cpp
Normal file
24
layout/generic/RubyReflowState.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
/* states and methods used while laying out a ruby segment */
|
||||||
|
|
||||||
|
#include "RubyReflowState.h"
|
||||||
|
|
||||||
|
using namespace mozilla;
|
||||||
|
|
||||||
|
RubyReflowState::RubyReflowState(
|
||||||
|
WritingMode aLineWM,
|
||||||
|
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||||
|
: mCurrentContainerIndex(kBaseContainerIndex)
|
||||||
|
{
|
||||||
|
uint32_t rtcCount = aTextContainers.Length();
|
||||||
|
mTextContainers.SetCapacity(rtcCount);
|
||||||
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
|
mTextContainers.AppendElement(
|
||||||
|
TextContainerInfo(aLineWM, aTextContainers[i]));
|
||||||
|
}
|
||||||
|
}
|
68
layout/generic/RubyReflowState.h
Normal file
68
layout/generic/RubyReflowState.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
/* states and methods used while laying out a ruby segment */
|
||||||
|
|
||||||
|
#ifndef mozilla_RubyReflowState_h_
|
||||||
|
#define mozilla_RubyReflowState_h_
|
||||||
|
|
||||||
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "WritingModes.h"
|
||||||
|
#include "nsTArray.h"
|
||||||
|
|
||||||
|
#define RTC_ARRAY_SIZE 1
|
||||||
|
|
||||||
|
class nsRubyTextContainerFrame;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
class MOZ_STACK_CLASS RubyReflowState MOZ_FINAL
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit RubyReflowState(
|
||||||
|
WritingMode aLineWM,
|
||||||
|
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers);
|
||||||
|
|
||||||
|
struct TextContainerInfo
|
||||||
|
{
|
||||||
|
nsRubyTextContainerFrame* mFrame;
|
||||||
|
LogicalSize mLineSize;
|
||||||
|
|
||||||
|
TextContainerInfo(WritingMode aLineWM, nsRubyTextContainerFrame* aFrame)
|
||||||
|
: mFrame(aFrame)
|
||||||
|
, mLineSize(aLineWM) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
void AdvanceCurrentContainerIndex() { mCurrentContainerIndex++; }
|
||||||
|
|
||||||
|
void SetTextContainerInfo(int32_t aIndex,
|
||||||
|
nsRubyTextContainerFrame* aContainer,
|
||||||
|
const LogicalSize& aLineSize)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mTextContainers[aIndex].mFrame == aContainer);
|
||||||
|
mTextContainers[aIndex].mLineSize = aLineSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TextContainerInfo&
|
||||||
|
GetCurrentTextContainerInfo(nsRubyTextContainerFrame* aFrame) const
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mTextContainers[mCurrentContainerIndex].mFrame == aFrame);
|
||||||
|
return mTextContainers[mCurrentContainerIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static MOZ_CONSTEXPR_VAR int32_t kBaseContainerIndex = -1;
|
||||||
|
// The index of the current reflowing container. When it equals to
|
||||||
|
// kBaseContainerIndex, we are reflowing ruby base. Otherwise, it
|
||||||
|
// stands for the index of text containers in the ruby segment.
|
||||||
|
int32_t mCurrentContainerIndex;
|
||||||
|
|
||||||
|
nsAutoTArray<TextContainerInfo, RTC_ARRAY_SIZE> mTextContainers;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // mozilla_RubyReflowState_h_
|
@ -5,7 +5,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "RubyUtils.h"
|
#include "RubyUtils.h"
|
||||||
#include "nsIFrame.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
@ -42,3 +41,20 @@ RubyUtils::GetReservedISize(nsIFrame* aFrame)
|
|||||||
value.mPointer = aFrame->Properties().Get(ReservedISize());
|
value.mPointer = aFrame->Properties().Get(ReservedISize());
|
||||||
return value.mCoord;
|
return value.mCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RubyTextContainerIterator::RubyTextContainerIterator(
|
||||||
|
nsRubyBaseContainerFrame* aBaseContainer)
|
||||||
|
{
|
||||||
|
mFrame = aBaseContainer;
|
||||||
|
Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RubyTextContainerIterator::Next()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mFrame, "Should have checked AtEnd()");
|
||||||
|
mFrame = mFrame->GetNextSibling();
|
||||||
|
if (mFrame && mFrame->GetType() != nsGkAtoms::rubyTextContainerFrame) {
|
||||||
|
mFrame = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
#define mozilla_RubyUtils_h_
|
#define mozilla_RubyUtils_h_
|
||||||
|
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsRubyBaseContainerFrame.h"
|
||||||
|
#include "nsRubyTextContainerFrame.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
@ -58,6 +59,26 @@ public:
|
|||||||
static nscoord GetReservedISize(nsIFrame* aFrame);
|
static nscoord GetReservedISize(nsIFrame* aFrame);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class iterates all ruby text containers paired with
|
||||||
|
* the given ruby base container.
|
||||||
|
*/
|
||||||
|
class MOZ_STACK_CLASS RubyTextContainerIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit RubyTextContainerIterator(nsRubyBaseContainerFrame* aBaseContainer);
|
||||||
|
|
||||||
|
void Next();
|
||||||
|
bool AtEnd() const { return !mFrame; }
|
||||||
|
nsRubyTextContainerFrame* GetTextContainer() const
|
||||||
|
{
|
||||||
|
return static_cast<nsRubyTextContainerFrame*>(mFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsIFrame* mFrame;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !defined(mozilla_RubyUtils_h_) */
|
#endif /* !defined(mozilla_RubyUtils_h_) */
|
||||||
|
@ -94,6 +94,7 @@ UNIFIED_SOURCES += [
|
|||||||
'nsTextRunTransformations.cpp',
|
'nsTextRunTransformations.cpp',
|
||||||
'nsVideoFrame.cpp',
|
'nsVideoFrame.cpp',
|
||||||
'nsViewportFrame.cpp',
|
'nsViewportFrame.cpp',
|
||||||
|
'RubyReflowState.cpp',
|
||||||
'RubyUtils.cpp',
|
'RubyUtils.cpp',
|
||||||
'ScrollbarActivity.cpp',
|
'ScrollbarActivity.cpp',
|
||||||
'StickyScrollContainer.cpp',
|
'StickyScrollContainer.cpp',
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "nsInlineFrame.h"
|
#include "nsInlineFrame.h"
|
||||||
#include "nsPlaceholderFrame.h"
|
#include "nsPlaceholderFrame.h"
|
||||||
#include "nsRubyTextFrame.h"
|
#include "nsRubyTextFrame.h"
|
||||||
|
#include "nsRubyTextContainerFrame.h"
|
||||||
#include "nsSVGContainerFrame.h"
|
#include "nsSVGContainerFrame.h"
|
||||||
#include "nsTableCellFrame.h"
|
#include "nsTableCellFrame.h"
|
||||||
#include "nsTableRowFrame.h"
|
#include "nsTableRowFrame.h"
|
||||||
|
@ -523,6 +523,13 @@ FRAME_STATE_GROUP(RubyText, nsRubyTextFrame)
|
|||||||
FRAME_STATE_BIT(RubyText, 24, NS_RUBY_TEXT_FRAME_AUTOHIDE)
|
FRAME_STATE_BIT(RubyText, 24, NS_RUBY_TEXT_FRAME_AUTOHIDE)
|
||||||
|
|
||||||
|
|
||||||
|
// == Frame state bits that apply to ruby text container frames ===============
|
||||||
|
|
||||||
|
FRAME_STATE_GROUP(RubyTextContainer, nsRubyTextContainerFrame)
|
||||||
|
|
||||||
|
FRAME_STATE_BIT(RubyTextContainer, 20, NS_RUBY_TEXT_CONTAINER_IS_SPAN)
|
||||||
|
|
||||||
|
|
||||||
// == Frame state bits that apply to placeholder frames =======================
|
// == Frame state bits that apply to placeholder frames =======================
|
||||||
|
|
||||||
FRAME_STATE_GROUP(Placeholder, nsPlaceholderFrame)
|
FRAME_STATE_GROUP(Placeholder, nsPlaceholderFrame)
|
||||||
|
@ -72,6 +72,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
|||||||
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
||||||
mFloatManager = nullptr;
|
mFloatManager = nullptr;
|
||||||
mLineLayout = nullptr;
|
mLineLayout = nullptr;
|
||||||
|
mRubyReflowState = nullptr;
|
||||||
memset(&mFlags, 0, sizeof(mFlags));
|
memset(&mFlags, 0, sizeof(mFlags));
|
||||||
mDiscoveredClearance = nullptr;
|
mDiscoveredClearance = nullptr;
|
||||||
mPercentHeightObserver = nullptr;
|
mPercentHeightObserver = nullptr;
|
||||||
@ -207,6 +208,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
|||||||
mLineLayout = aParentReflowState.mLineLayout;
|
mLineLayout = aParentReflowState.mLineLayout;
|
||||||
else
|
else
|
||||||
mLineLayout = nullptr;
|
mLineLayout = nullptr;
|
||||||
|
mRubyReflowState = nullptr;
|
||||||
|
|
||||||
// Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
|
// Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
|
||||||
// this constructor's init list, so the only flags that we need to explicitly
|
// this constructor's init list, so the only flags that we need to explicitly
|
||||||
|
@ -21,6 +21,10 @@ class nsLineLayout;
|
|||||||
class nsIPercentHeightObserver;
|
class nsIPercentHeightObserver;
|
||||||
struct nsHypotheticalBox;
|
struct nsHypotheticalBox;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
class RubyReflowState;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return aValue clamped to [aMinValue, aMaxValue].
|
* @return aValue clamped to [aMinValue, aMaxValue].
|
||||||
*
|
*
|
||||||
@ -258,6 +262,9 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
|
|||||||
// LineLayout object (only for inline reflow; set to nullptr otherwise)
|
// LineLayout object (only for inline reflow; set to nullptr otherwise)
|
||||||
nsLineLayout* mLineLayout;
|
nsLineLayout* mLineLayout;
|
||||||
|
|
||||||
|
// RubyReflowState object (only for ruby reflow; set to nullptr otherwise)
|
||||||
|
mozilla::RubyReflowState* mRubyReflowState;
|
||||||
|
|
||||||
// The appropriate reflow state for the containing block (for
|
// The appropriate reflow state for the containing block (for
|
||||||
// percentage widths, etc.) of this reflow state's frame.
|
// percentage widths, etc.) of this reflow state's frame.
|
||||||
const nsHTMLReflowState *mCBReflowState;
|
const nsHTMLReflowState *mCBReflowState;
|
||||||
|
@ -66,6 +66,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
|||||||
mForceBreakFrameOffset(-1),
|
mForceBreakFrameOffset(-1),
|
||||||
mMinLineBSize(0),
|
mMinLineBSize(0),
|
||||||
mTextIndent(0),
|
mTextIndent(0),
|
||||||
|
mRubyReflowState(nullptr),
|
||||||
mFirstLetterStyleOK(false),
|
mFirstLetterStyleOK(false),
|
||||||
mIsTopOfPage(false),
|
mIsTopOfPage(false),
|
||||||
mImpactedByFloats(false),
|
mImpactedByFloats(false),
|
||||||
@ -868,6 +869,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||||||
aFrame, availSize);
|
aFrame, availSize);
|
||||||
nsHTMLReflowState& reflowState = *reflowStateHolder;
|
nsHTMLReflowState& reflowState = *reflowStateHolder;
|
||||||
reflowState.mLineLayout = this;
|
reflowState.mLineLayout = this;
|
||||||
|
if (mRubyReflowState) {
|
||||||
|
reflowState.mRubyReflowState = mRubyReflowState;
|
||||||
|
mRubyReflowState = nullptr;
|
||||||
|
}
|
||||||
reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
|
reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
|
||||||
if (reflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
|
if (reflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
|
||||||
reflowState.AvailableISize() = availableSpaceOnLine;
|
reflowState.AvailableISize() = availableSpaceOnLine;
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
class nsFloatManager;
|
class nsFloatManager;
|
||||||
struct nsStyleText;
|
struct nsStyleText;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
class RubyReflowState;
|
||||||
|
}
|
||||||
|
|
||||||
class nsLineLayout {
|
class nsLineLayout {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -98,6 +102,13 @@ public:
|
|||||||
|
|
||||||
bool IsZeroBSize();
|
bool IsZeroBSize();
|
||||||
|
|
||||||
|
// The ruby layout will be passed to the next frame to be reflowed
|
||||||
|
// via the HTML reflow state.
|
||||||
|
void SetRubyReflowState(mozilla::RubyReflowState* aRubyReflowState)
|
||||||
|
{
|
||||||
|
mRubyReflowState = aRubyReflowState;
|
||||||
|
}
|
||||||
|
|
||||||
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
||||||
// if the frame is pushed to the next line because it doesn't fit.
|
// if the frame is pushed to the next line because it doesn't fit.
|
||||||
void ReflowFrame(nsIFrame* aFrame,
|
void ReflowFrame(nsIFrame* aFrame,
|
||||||
@ -558,6 +569,10 @@ protected:
|
|||||||
int32_t mLineNumber;
|
int32_t mLineNumber;
|
||||||
mozilla::JustificationInfo mJustificationInfo;
|
mozilla::JustificationInfo mJustificationInfo;
|
||||||
|
|
||||||
|
// The ruby layout for the next frame to be reflowed.
|
||||||
|
// It is reset every time it is used.
|
||||||
|
mozilla::RubyReflowState* mRubyReflowState;
|
||||||
|
|
||||||
int32_t mTotalPlacedFrames;
|
int32_t mTotalPlacedFrames;
|
||||||
|
|
||||||
nscoord mBStartEdge;
|
nscoord mBStartEdge;
|
||||||
|
@ -55,11 +55,23 @@ nsRubyBaseContainerFrame::GetFrameName(nsAString& aResult) const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MOZ_STACK_CLASS PairEnumerator
|
/**
|
||||||
|
* Ruby column is a unit consists of one ruby base and all ruby
|
||||||
|
* annotations paired with it.
|
||||||
|
* See http://dev.w3.org/csswg/css-ruby/#ruby-pairing
|
||||||
|
*/
|
||||||
|
struct MOZ_STACK_CLASS mozilla::RubyColumn
|
||||||
|
{
|
||||||
|
nsIFrame* mBaseFrame;
|
||||||
|
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE> mTextFrames;
|
||||||
|
RubyColumn() : mBaseFrame(nullptr) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class MOZ_STACK_CLASS RubyColumnEnumerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PairEnumerator(nsRubyBaseContainerFrame* aRBCFrame,
|
RubyColumnEnumerator(nsRubyBaseContainerFrame* aRBCFrame,
|
||||||
const nsTArray<nsRubyTextContainerFrame*>& aRTCFrames);
|
const nsTArray<nsRubyTextContainerFrame*>& aRTCFrames);
|
||||||
|
|
||||||
void Next();
|
void Next();
|
||||||
bool AtEnd() const;
|
bool AtEnd() const;
|
||||||
@ -68,27 +80,31 @@ public:
|
|||||||
nsIFrame* GetFrame(uint32_t aIndex) const { return mFrames[aIndex]; }
|
nsIFrame* GetFrame(uint32_t aIndex) const { return mFrames[aIndex]; }
|
||||||
nsIFrame* GetBaseFrame() const { return GetFrame(0); }
|
nsIFrame* GetBaseFrame() const { return GetFrame(0); }
|
||||||
nsIFrame* GetTextFrame(uint32_t aIndex) const { return GetFrame(aIndex + 1); }
|
nsIFrame* GetTextFrame(uint32_t aIndex) const { return GetFrame(aIndex + 1); }
|
||||||
void GetFrames(nsIFrame*& aBaseFrame, nsTArray<nsIFrame*>& aTextFrames) const;
|
void GetColumn(RubyColumn& aColumn) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE + 1> mFrames;
|
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE + 1> mFrames;
|
||||||
};
|
};
|
||||||
|
|
||||||
PairEnumerator::PairEnumerator(
|
RubyColumnEnumerator::RubyColumnEnumerator(
|
||||||
nsRubyBaseContainerFrame* aBaseContainer,
|
nsRubyBaseContainerFrame* aBaseContainer,
|
||||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||||
{
|
{
|
||||||
const uint32_t rtcCount = aTextContainers.Length();
|
const uint32_t rtcCount = aTextContainers.Length();
|
||||||
mFrames.SetCapacity(rtcCount + 1);
|
mFrames.SetCapacity(rtcCount + 1);
|
||||||
mFrames.AppendElement(aBaseContainer->GetFirstPrincipalChild());
|
mFrames.AppendElement(aBaseContainer->GetFirstPrincipalChild());
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsIFrame* rtFrame = aTextContainers[i]->GetFirstPrincipalChild();
|
nsRubyTextContainerFrame* container = aTextContainers[i];
|
||||||
|
// If the container is for span, leave a nullptr here.
|
||||||
|
// Spans do not take part in pairing.
|
||||||
|
nsIFrame* rtFrame = !container->IsSpanContainer() ?
|
||||||
|
aTextContainers[i]->GetFirstPrincipalChild() : nullptr;
|
||||||
mFrames.AppendElement(rtFrame);
|
mFrames.AppendElement(rtFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PairEnumerator::Next()
|
RubyColumnEnumerator::Next()
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
||||||
if (mFrames[i]) {
|
if (mFrames[i]) {
|
||||||
@ -98,7 +114,7 @@ PairEnumerator::Next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PairEnumerator::AtEnd() const
|
RubyColumnEnumerator::AtEnd() const
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
||||||
if (mFrames[i]) {
|
if (mFrames[i]) {
|
||||||
@ -109,33 +125,18 @@ PairEnumerator::AtEnd() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PairEnumerator::GetFrames(nsIFrame*& aBaseFrame,
|
RubyColumnEnumerator::GetColumn(RubyColumn& aColumn) const
|
||||||
nsTArray<nsIFrame*>& aTextFrames) const
|
|
||||||
{
|
{
|
||||||
aBaseFrame = mFrames[0];
|
aColumn.mBaseFrame = mFrames[0];
|
||||||
aTextFrames.ClearAndRetainStorage();
|
aColumn.mTextFrames.ClearAndRetainStorage();
|
||||||
for (uint32_t i = 1, iend = mFrames.Length(); i < iend; i++) {
|
for (uint32_t i = 1, iend = mFrames.Length(); i < iend; i++) {
|
||||||
aTextFrames.AppendElement(mFrames[i]);
|
aColumn.mTextFrames.AppendElement(mFrames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
|
||||||
nsRubyBaseContainerFrame::CalculateMaxSpanISize(
|
|
||||||
nsRenderingContext* aRenderingContext)
|
|
||||||
{
|
|
||||||
nscoord max = 0;
|
|
||||||
uint32_t spanCount = mSpanContainers.Length();
|
|
||||||
for (uint32_t i = 0; i < spanCount; i++) {
|
|
||||||
nsIFrame* frame = mSpanContainers[i]->GetFirstPrincipalChild();
|
|
||||||
nscoord isize = frame->GetPrefISize(aRenderingContext);
|
|
||||||
max = std::max(max, isize);
|
|
||||||
}
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nscoord
|
static nscoord
|
||||||
CalculatePairPrefISize(nsRenderingContext* aRenderingContext,
|
CalculateColumnPrefISize(nsRenderingContext* aRenderingContext,
|
||||||
const PairEnumerator& aEnumerator)
|
const RubyColumnEnumerator& aEnumerator)
|
||||||
{
|
{
|
||||||
nscoord max = 0;
|
nscoord max = 0;
|
||||||
uint32_t levelCount = aEnumerator.GetLevelCount();
|
uint32_t levelCount = aEnumerator.GetLevelCount();
|
||||||
@ -152,19 +153,25 @@ CalculatePairPrefISize(nsRenderingContext* aRenderingContext,
|
|||||||
nsRubyBaseContainerFrame::AddInlineMinISize(
|
nsRubyBaseContainerFrame::AddInlineMinISize(
|
||||||
nsRenderingContext *aRenderingContext, nsIFrame::InlineMinISizeData *aData)
|
nsRenderingContext *aRenderingContext, nsIFrame::InlineMinISizeData *aData)
|
||||||
{
|
{
|
||||||
if (!mSpanContainers.IsEmpty()) {
|
AutoTextContainerArray textContainers;
|
||||||
// Since spans are not breakable internally, use our pref isize
|
GetTextContainers(textContainers);
|
||||||
// directly if there is any span.
|
|
||||||
aData->currentLine += GetPrefISize(aRenderingContext);
|
for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
|
||||||
return;
|
if (textContainers[i]->IsSpanContainer()) {
|
||||||
|
// Since spans are not breakable internally, use our pref isize
|
||||||
|
// directly if there is any span.
|
||||||
|
aData->currentLine += GetPrefISize(aRenderingContext);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord max = 0;
|
nscoord max = 0;
|
||||||
PairEnumerator enumerator(this, mTextContainers);
|
RubyColumnEnumerator enumerator(this, textContainers);
|
||||||
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
||||||
// We use *pref* isize for computing the min isize of pairs
|
// We use *pref* isize for computing the min isize of columns
|
||||||
// because ruby bases and texts are unbreakable internally.
|
// because ruby bases and texts are unbreakable internally.
|
||||||
max = std::max(max, CalculatePairPrefISize(aRenderingContext, enumerator));
|
max = std::max(max, CalculateColumnPrefISize(aRenderingContext,
|
||||||
|
enumerator));
|
||||||
}
|
}
|
||||||
aData->currentLine += max;
|
aData->currentLine += max;
|
||||||
}
|
}
|
||||||
@ -173,12 +180,20 @@ nsRubyBaseContainerFrame::AddInlineMinISize(
|
|||||||
nsRubyBaseContainerFrame::AddInlinePrefISize(
|
nsRubyBaseContainerFrame::AddInlinePrefISize(
|
||||||
nsRenderingContext *aRenderingContext, nsIFrame::InlinePrefISizeData *aData)
|
nsRenderingContext *aRenderingContext, nsIFrame::InlinePrefISizeData *aData)
|
||||||
{
|
{
|
||||||
|
AutoTextContainerArray textContainers;
|
||||||
|
GetTextContainers(textContainers);
|
||||||
|
|
||||||
nscoord sum = 0;
|
nscoord sum = 0;
|
||||||
PairEnumerator enumerator(this, mTextContainers);
|
RubyColumnEnumerator enumerator(this, textContainers);
|
||||||
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
||||||
sum += CalculatePairPrefISize(aRenderingContext, enumerator);
|
sum += CalculateColumnPrefISize(aRenderingContext, enumerator);
|
||||||
|
}
|
||||||
|
for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
|
||||||
|
if (textContainers[i]->IsSpanContainer()) {
|
||||||
|
nsIFrame* frame = textContainers[i]->GetFirstPrincipalChild();
|
||||||
|
sum = std::max(sum, frame->GetPrefISize(aRenderingContext));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sum = std::max(sum, CalculateMaxSpanISize(aRenderingContext));
|
|
||||||
aData->currentLine += sum;
|
aData->currentLine += sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,26 +204,13 @@ nsRubyBaseContainerFrame::IsFrameOfType(uint32_t aFlags) const
|
|||||||
~(nsIFrame::eLineParticipant));
|
~(nsIFrame::eLineParticipant));
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsRubyBaseContainerFrame::AppendTextContainer(nsIFrame* aFrame)
|
void
|
||||||
|
nsRubyBaseContainerFrame::GetTextContainers(TextContainerArray& aTextContainers)
|
||||||
{
|
{
|
||||||
nsRubyTextContainerFrame* rtcFrame = do_QueryFrame(aFrame);
|
MOZ_ASSERT(aTextContainers.IsEmpty());
|
||||||
MOZ_ASSERT(rtcFrame, "Must provide a ruby text container.");
|
for (RubyTextContainerIterator iter(this); !iter.AtEnd(); iter.Next()) {
|
||||||
|
aTextContainers.AppendElement(iter.GetTextContainer());
|
||||||
nsTArray<nsRubyTextContainerFrame*>* containers = &mTextContainers;
|
|
||||||
if (!GetPrevContinuation() && !GetNextContinuation()) {
|
|
||||||
nsIFrame* onlyChild = rtcFrame->PrincipalChildList().OnlyChild();
|
|
||||||
if (onlyChild && onlyChild->IsPseudoFrame(rtcFrame->GetContent())) {
|
|
||||||
// Per CSS Ruby spec, if the only child of an rtc frame is
|
|
||||||
// a pseudo rt frame, it spans all bases in the segment.
|
|
||||||
containers = &mSpanContainers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
containers->AppendElement(rtcFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsRubyBaseContainerFrame::ClearTextContainers() {
|
|
||||||
mSpanContainers.Clear();
|
|
||||||
mTextContainers.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ bool
|
/* virtual */ bool
|
||||||
@ -238,6 +240,14 @@ nsRubyBaseContainerFrame::GetLogicalBaseline(WritingMode aWritingMode) const
|
|||||||
return mBaseline;
|
return mBaseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct nsRubyBaseContainerFrame::ReflowState
|
||||||
|
{
|
||||||
|
bool mAllowLineBreak;
|
||||||
|
const TextContainerArray& mTextContainers;
|
||||||
|
const nsHTMLReflowState& mBaseReflowState;
|
||||||
|
const nsTArray<UniquePtr<nsHTMLReflowState>>& mTextReflowStates;
|
||||||
|
};
|
||||||
|
|
||||||
// Check whether the given extra isize can fit in the line in base level.
|
// Check whether the given extra isize can fit in the line in base level.
|
||||||
static bool
|
static bool
|
||||||
ShouldBreakBefore(const nsHTMLReflowState& aReflowState, nscoord aExtraISize)
|
ShouldBreakBefore(const nsHTMLReflowState& aReflowState, nscoord aExtraISize)
|
||||||
@ -266,20 +276,22 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
"No line layout provided to RubyBaseContainerFrame reflow method.");
|
"No line layout provided to RubyBaseContainerFrame reflow method.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||||
|
|
||||||
|
AutoTextContainerArray textContainers;
|
||||||
|
GetTextContainers(textContainers);
|
||||||
|
|
||||||
MoveOverflowToChildList();
|
MoveOverflowToChildList();
|
||||||
// Ask text containers to drain overflows
|
// Ask text containers to drain overflows
|
||||||
const uint32_t rtcCount = mTextContainers.Length();
|
const uint32_t rtcCount = textContainers.Length();
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
mTextContainers[i]->MoveOverflowToChildList();
|
textContainers[i]->MoveOverflowToChildList();
|
||||||
}
|
}
|
||||||
|
|
||||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||||
LogicalSize availSize(lineWM, aReflowState.AvailableWidth(),
|
LogicalSize availSize(lineWM, aReflowState.AvailableWidth(),
|
||||||
aReflowState.AvailableHeight());
|
aReflowState.AvailableHeight());
|
||||||
|
|
||||||
const uint32_t spanCount = mSpanContainers.Length();
|
|
||||||
const uint32_t totalCount = rtcCount + spanCount;
|
|
||||||
// We have a reflow state and a line layout for each RTC.
|
// We have a reflow state and a line layout for each RTC.
|
||||||
// They are conceptually the state of the RTCs, but we don't actually
|
// They are conceptually the state of the RTCs, but we don't actually
|
||||||
// reflow those RTCs in this code. These two arrays are holders of
|
// reflow those RTCs in this code. These two arrays are holders of
|
||||||
@ -289,29 +301,20 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
// reason, they are wrapped in UniquePtr here.
|
// reason, they are wrapped in UniquePtr here.
|
||||||
nsAutoTArray<UniquePtr<nsHTMLReflowState>, RTC_ARRAY_SIZE> reflowStates;
|
nsAutoTArray<UniquePtr<nsHTMLReflowState>, RTC_ARRAY_SIZE> reflowStates;
|
||||||
nsAutoTArray<UniquePtr<nsLineLayout>, RTC_ARRAY_SIZE> lineLayouts;
|
nsAutoTArray<UniquePtr<nsLineLayout>, RTC_ARRAY_SIZE> lineLayouts;
|
||||||
reflowStates.SetCapacity(totalCount);
|
reflowStates.SetCapacity(rtcCount);
|
||||||
lineLayouts.SetCapacity(totalCount);
|
lineLayouts.SetCapacity(rtcCount);
|
||||||
|
|
||||||
nsAutoTArray<nsHTMLReflowState*, RTC_ARRAY_SIZE> rtcReflowStates;
|
|
||||||
nsAutoTArray<nsHTMLReflowState*, RTC_ARRAY_SIZE> spanReflowStates;
|
|
||||||
rtcReflowStates.SetCapacity(rtcCount);
|
|
||||||
spanReflowStates.SetCapacity(spanCount);
|
|
||||||
|
|
||||||
// Begin the line layout for each ruby text container in advance.
|
// Begin the line layout for each ruby text container in advance.
|
||||||
for (uint32_t i = 0; i < totalCount; i++) {
|
bool hasSpan = false;
|
||||||
nsIFrame* textContainer;
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsTArray<nsHTMLReflowState*>* reflowStateArray;
|
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||||
if (i < rtcCount) {
|
if (textContainer->IsSpanContainer()) {
|
||||||
textContainer = mTextContainers[i];
|
hasSpan = true;
|
||||||
reflowStateArray = &rtcReflowStates;
|
|
||||||
} else {
|
|
||||||
textContainer = mSpanContainers[i - rtcCount];
|
|
||||||
reflowStateArray = &spanReflowStates;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLReflowState* reflowState = new nsHTMLReflowState(
|
nsHTMLReflowState* reflowState = new nsHTMLReflowState(
|
||||||
aPresContext, *aReflowState.parentReflowState, textContainer, availSize);
|
aPresContext, *aReflowState.parentReflowState, textContainer, availSize);
|
||||||
reflowStates.AppendElement(reflowState);
|
reflowStates.AppendElement(reflowState);
|
||||||
reflowStateArray->AppendElement(reflowState);
|
|
||||||
nsLineLayout* lineLayout = new nsLineLayout(aPresContext,
|
nsLineLayout* lineLayout = new nsLineLayout(aPresContext,
|
||||||
reflowState->mFloatManager,
|
reflowState->mFloatManager,
|
||||||
reflowState, nullptr,
|
reflowState, nullptr,
|
||||||
@ -362,21 +365,24 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
nscoord isize = 0;
|
nscoord isize = 0;
|
||||||
if (aStatus == NS_FRAME_COMPLETE) {
|
if (aStatus == NS_FRAME_COMPLETE) {
|
||||||
// Reflow pairs excluding any span
|
// Reflow columns excluding any span
|
||||||
bool allowInternalLineBreak = allowLineBreak && mSpanContainers.IsEmpty();
|
ReflowState reflowState = {
|
||||||
isize = ReflowPairs(aPresContext, allowInternalLineBreak,
|
allowLineBreak && !hasSpan, textContainers, aReflowState, reflowStates
|
||||||
aReflowState, rtcReflowStates, aStatus);
|
};
|
||||||
|
isize = ReflowColumns(reflowState, aStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there exists any span, the pairs must either be completely
|
// If there exists any span, the columns must either be completely
|
||||||
// reflowed, or be not reflowed at all.
|
// reflowed, or be not reflowed at all.
|
||||||
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
||||||
NS_FRAME_IS_COMPLETE(aStatus) || mSpanContainers.IsEmpty());
|
NS_FRAME_IS_COMPLETE(aStatus) || !hasSpan);
|
||||||
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
|
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
|
||||||
NS_FRAME_IS_COMPLETE(aStatus) && !mSpanContainers.IsEmpty()) {
|
NS_FRAME_IS_COMPLETE(aStatus) && hasSpan) {
|
||||||
// Reflow spans
|
// Reflow spans
|
||||||
nscoord spanISize = ReflowSpans(aPresContext, aReflowState,
|
ReflowState reflowState = {
|
||||||
spanReflowStates);
|
false, textContainers, aReflowState, reflowStates
|
||||||
|
};
|
||||||
|
nscoord spanISize = ReflowSpans(reflowState);
|
||||||
nscoord deltaISize = spanISize - isize;
|
nscoord deltaISize = spanISize - isize;
|
||||||
if (deltaISize <= 0) {
|
if (deltaISize <= 0) {
|
||||||
RubyUtils::ClearReservedISize(this);
|
RubyUtils::ClearReservedISize(this);
|
||||||
@ -387,8 +393,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
||||||
isize = spanISize;
|
isize = spanISize;
|
||||||
}
|
}
|
||||||
}
|
// When there are spans, ReflowColumns and ReflowOneColumn won't
|
||||||
// When there are spans, ReflowPairs and ReflowOnePair won't
|
|
||||||
// record any optional break position. We have to record one
|
// record any optional break position. We have to record one
|
||||||
// at the end of this segment.
|
// at the end of this segment.
|
||||||
if (!NS_INLINE_IS_BREAK(aStatus) && allowLineBreak &&
|
if (!NS_INLINE_IS_BREAK(aStatus) && allowLineBreak &&
|
||||||
@ -397,6 +402,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
gfxBreakPriority::eNormalBreak)) {
|
gfxBreakPriority::eNormalBreak)) {
|
||||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DebugOnly<nscoord> lineSpanSize = aReflowState.mLineLayout->EndSpan(this);
|
DebugOnly<nscoord> lineSpanSize = aReflowState.mLineLayout->EndSpan(this);
|
||||||
// When there are no frames inside the ruby base container, EndSpan
|
// When there are no frames inside the ruby base container, EndSpan
|
||||||
@ -404,11 +410,10 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
// container could be non-zero because of non-empty ruby annotations.
|
// container could be non-zero because of non-empty ruby annotations.
|
||||||
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
||||||
isize == lineSpanSize || mFrames.IsEmpty());
|
isize == lineSpanSize || mFrames.IsEmpty());
|
||||||
for (uint32_t i = 0; i < totalCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
// It happens before the ruby text container is reflowed, and that
|
// It happens before the ruby text container is reflowed, and that
|
||||||
// when it is reflowed, it will just use this size.
|
// when it is reflowed, it will just use this size.
|
||||||
nsRubyTextContainerFrame* textContainer = i < rtcCount ?
|
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||||
mTextContainers[i] : mSpanContainers[i - rtcCount];
|
|
||||||
nsLineLayout* lineLayout = lineLayouts[i].get();
|
nsLineLayout* lineLayout = lineLayouts[i].get();
|
||||||
|
|
||||||
RubyUtils::ClearReservedISize(textContainer);
|
RubyUtils::ClearReservedISize(textContainer);
|
||||||
@ -417,7 +422,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
// need reserving isize. For normal ruby text containers, their
|
// need reserving isize. For normal ruby text containers, their
|
||||||
// children will be expanded properly. We only need to expand their
|
// children will be expanded properly. We only need to expand their
|
||||||
// own size.
|
// own size.
|
||||||
if (i < rtcCount) {
|
if (!textContainer->IsSpanContainer()) {
|
||||||
rtcISize = isize;
|
rtcISize = isize;
|
||||||
} else if (isize > rtcISize) {
|
} else if (isize > rtcISize) {
|
||||||
RubyUtils::SetReservedISize(textContainer, isize - rtcISize);
|
RubyUtils::SetReservedISize(textContainer, isize - rtcISize);
|
||||||
@ -425,7 +430,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
lineLayout->VerticalAlignLine();
|
lineLayout->VerticalAlignLine();
|
||||||
LogicalSize lineSize(lineWM, isize, lineLayout->GetFinalLineBSize());
|
LogicalSize lineSize(lineWM, isize, lineLayout->GetFinalLineBSize());
|
||||||
textContainer->SetLineSize(lineSize);
|
aReflowState.mRubyReflowState->SetTextContainerInfo(i, textContainer, lineSize);
|
||||||
lineLayout->EndLineReflow();
|
lineLayout->EndLineReflow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,34 +448,33 @@ struct MOZ_STACK_CLASS nsRubyBaseContainerFrame::PullFrameState
|
|||||||
{
|
{
|
||||||
ContinuationTraversingState mBase;
|
ContinuationTraversingState mBase;
|
||||||
nsAutoTArray<ContinuationTraversingState, RTC_ARRAY_SIZE> mTexts;
|
nsAutoTArray<ContinuationTraversingState, RTC_ARRAY_SIZE> mTexts;
|
||||||
|
const TextContainerArray& mTextContainers;
|
||||||
|
|
||||||
explicit PullFrameState(nsRubyBaseContainerFrame* aFrame);
|
PullFrameState(nsRubyBaseContainerFrame* aBaseContainer,
|
||||||
|
const TextContainerArray& aTextContainers);
|
||||||
};
|
};
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
nsRubyBaseContainerFrame::ReflowColumns(const ReflowState& aReflowState,
|
||||||
bool aAllowLineBreak,
|
nsReflowStatus& aStatus)
|
||||||
const nsHTMLReflowState& aReflowState,
|
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
|
||||||
nsReflowStatus& aStatus)
|
|
||||||
{
|
{
|
||||||
nsLineLayout* lineLayout = aReflowState.mLineLayout;
|
nsLineLayout* lineLayout = aReflowState.mBaseReflowState.mLineLayout;
|
||||||
const uint32_t rtcCount = mTextContainers.Length();
|
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
|
||||||
nscoord istart = lineLayout->GetCurrentICoord();
|
nscoord istart = lineLayout->GetCurrentICoord();
|
||||||
nscoord icoord = istart;
|
nscoord icoord = istart;
|
||||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
mPairCount = 0;
|
uint32_t columnIndex = 0;
|
||||||
nsIFrame* baseFrame = nullptr;
|
RubyColumn column;
|
||||||
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE> textFrames;
|
column.mTextFrames.SetCapacity(rtcCount);
|
||||||
textFrames.SetCapacity(rtcCount);
|
RubyColumnEnumerator e(this, aReflowState.mTextContainers);
|
||||||
PairEnumerator e(this, mTextContainers);
|
|
||||||
for (; !e.AtEnd(); e.Next()) {
|
for (; !e.AtEnd(); e.Next()) {
|
||||||
e.GetFrames(baseFrame, textFrames);
|
e.GetColumn(column);
|
||||||
icoord += ReflowOnePair(aPresContext, aAllowLineBreak,
|
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
|
||||||
aReflowState, aReflowStates,
|
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||||
baseFrame, textFrames, reflowStatus);
|
columnIndex++;
|
||||||
|
}
|
||||||
if (NS_INLINE_IS_BREAK(reflowStatus)) {
|
if (NS_INLINE_IS_BREAK(reflowStatus)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -479,28 +483,29 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isComplete = false;
|
bool isComplete = false;
|
||||||
PullFrameState pullFrameState(this);
|
PullFrameState pullFrameState(this, aReflowState.mTextContainers);
|
||||||
while (!NS_INLINE_IS_BREAK(reflowStatus)) {
|
while (!NS_INLINE_IS_BREAK(reflowStatus)) {
|
||||||
// We are not handling overflow here.
|
// We are not handling overflow here.
|
||||||
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
|
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
|
||||||
|
|
||||||
// Try pull some frames from next continuations. This call replaces
|
// Try pull some frames from next continuations. This call replaces
|
||||||
// |baseFrame| and |textFrames| with the frame pulled in each level.
|
// frames in |column| with the frame pulled in each level.
|
||||||
PullOnePair(lineLayout, pullFrameState, baseFrame, textFrames, isComplete);
|
PullOneColumn(lineLayout, pullFrameState, column, isComplete);
|
||||||
if (isComplete) {
|
if (isComplete) {
|
||||||
// No more frames can be pulled.
|
// No more frames can be pulled.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
icoord += ReflowOnePair(aPresContext, aAllowLineBreak,
|
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
|
||||||
aReflowState, aReflowStates,
|
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||||
baseFrame, textFrames, reflowStatus);
|
columnIndex++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e.AtEnd() && NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
if (!e.AtEnd() && NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
||||||
// The current pair has been successfully placed.
|
// The current column has been successfully placed.
|
||||||
// Skip to the next pair and mark break before.
|
// Skip to the next column and mark break before.
|
||||||
e.Next();
|
e.Next();
|
||||||
e.GetFrames(baseFrame, textFrames);
|
e.GetColumn(column);
|
||||||
reflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
reflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
||||||
}
|
}
|
||||||
if (!e.AtEnd() || (GetNextInFlow() && !isComplete)) {
|
if (!e.AtEnd() || (GetNextInFlow() && !isComplete)) {
|
||||||
@ -508,28 +513,28 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
if (NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||||
if (!mPairCount || !mSpanContainers.IsEmpty()) {
|
if (!columnIndex || !aReflowState.mAllowLineBreak) {
|
||||||
// If no pair has been placed yet, or we have any span,
|
// If no column has been placed yet, or we have any span,
|
||||||
// the whole container should be in the next line.
|
// the whole container should be in the next line.
|
||||||
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||||
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || mSpanContainers.IsEmpty());
|
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || aReflowState.mAllowLineBreak);
|
||||||
|
|
||||||
if (baseFrame) {
|
if (column.mBaseFrame) {
|
||||||
PushChildren(baseFrame, baseFrame->GetPrevSibling());
|
PushChildren(column.mBaseFrame, column.mBaseFrame->GetPrevSibling());
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsIFrame* textFrame = textFrames[i];
|
nsIFrame* textFrame = column.mTextFrames[i];
|
||||||
if (textFrame) {
|
if (textFrame) {
|
||||||
mTextContainers[i]->PushChildren(textFrame,
|
aReflowState.mTextContainers[i]->PushChildren(
|
||||||
textFrame->GetPrevSibling());
|
textFrame, textFrame->GetPrevSibling());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
} else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
||||||
// |reflowStatus| being break after here may only happen when
|
// |reflowStatus| being break after here may only happen when
|
||||||
// there is a break after the pair just pulled, or the whole
|
// there is a break after the column just pulled, or the whole
|
||||||
// segment has been completely reflowed. In those cases, we do
|
// segment has been completely reflowed. In those cases, we do
|
||||||
// not need to push anything.
|
// not need to push anything.
|
||||||
MOZ_ASSERT(e.AtEnd());
|
MOZ_ASSERT(e.AtEnd());
|
||||||
@ -540,24 +545,24 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
nsRubyBaseContainerFrame::ReflowOneColumn(const ReflowState& aReflowState,
|
||||||
bool aAllowLineBreak,
|
uint32_t aColumnIndex,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const RubyColumn& aColumn,
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
nsReflowStatus& aStatus)
|
||||||
nsIFrame* aBaseFrame,
|
|
||||||
const nsTArray<nsIFrame*>& aTextFrames,
|
|
||||||
nsReflowStatus& aStatus)
|
|
||||||
{
|
{
|
||||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
const nsHTMLReflowState& baseReflowState = aReflowState.mBaseReflowState;
|
||||||
const uint32_t rtcCount = mTextContainers.Length();
|
const auto& textReflowStates = aReflowState.mTextReflowStates;
|
||||||
MOZ_ASSERT(aTextFrames.Length() == rtcCount);
|
|
||||||
MOZ_ASSERT(aReflowStates.Length() == rtcCount);
|
WritingMode lineWM = baseReflowState.mLineLayout->GetWritingMode();
|
||||||
nscoord istart = aReflowState.mLineLayout->GetCurrentICoord();
|
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
|
||||||
nscoord pairISize = 0;
|
MOZ_ASSERT(aColumn.mTextFrames.Length() == rtcCount);
|
||||||
|
MOZ_ASSERT(textReflowStates.Length() == rtcCount);
|
||||||
|
nscoord istart = baseReflowState.mLineLayout->GetCurrentICoord();
|
||||||
|
nscoord columnISize = 0;
|
||||||
|
|
||||||
nsAutoString baseText;
|
nsAutoString baseText;
|
||||||
if (aBaseFrame) {
|
if (aColumn.mBaseFrame) {
|
||||||
if (!nsContentUtils::GetNodeTextContent(aBaseFrame->GetContent(),
|
if (!nsContentUtils::GetNodeTextContent(aColumn.mBaseFrame->GetContent(),
|
||||||
true, baseText)) {
|
true, baseText)) {
|
||||||
NS_RUNTIMEABORT("OOM");
|
NS_RUNTIMEABORT("OOM");
|
||||||
}
|
}
|
||||||
@ -565,7 +570,7 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
// Reflow text frames
|
// Reflow text frames
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsIFrame* textFrame = aTextFrames[i];
|
nsIFrame* textFrame = aColumn.mTextFrames[i];
|
||||||
if (textFrame) {
|
if (textFrame) {
|
||||||
MOZ_ASSERT(textFrame->GetType() == nsGkAtoms::rubyTextFrame);
|
MOZ_ASSERT(textFrame->GetType() == nsGkAtoms::rubyTextFrame);
|
||||||
nsAutoString annotationText;
|
nsAutoString annotationText;
|
||||||
@ -585,18 +590,19 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsReflowStatus reflowStatus;
|
nsReflowStatus reflowStatus;
|
||||||
nsHTMLReflowMetrics metrics(*aReflowStates[i]);
|
nsHTMLReflowMetrics metrics(*textReflowStates[i]);
|
||||||
RubyUtils::ClearReservedISize(textFrame);
|
RubyUtils::ClearReservedISize(textFrame);
|
||||||
|
|
||||||
bool pushedFrame;
|
bool pushedFrame;
|
||||||
aReflowStates[i]->mLineLayout->ReflowFrame(textFrame, reflowStatus,
|
textReflowStates[i]->mLineLayout->ReflowFrame(textFrame, reflowStatus,
|
||||||
&metrics, pushedFrame);
|
&metrics, pushedFrame);
|
||||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||||
"Any line break inside ruby box should has been suppressed");
|
"Any line break inside ruby box should has been suppressed");
|
||||||
pairISize = std::max(pairISize, metrics.ISize(lineWM));
|
columnISize = std::max(columnISize, metrics.ISize(lineWM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aAllowLineBreak && ShouldBreakBefore(aReflowState, pairISize)) {
|
if (aReflowState.mAllowLineBreak &&
|
||||||
|
ShouldBreakBefore(baseReflowState, columnISize)) {
|
||||||
// Since ruby text container uses an independent line layout, it
|
// Since ruby text container uses an independent line layout, it
|
||||||
// may successfully place a frame because the line is empty while
|
// may successfully place a frame because the line is empty while
|
||||||
// the line of base container is not.
|
// the line of base container is not.
|
||||||
@ -605,32 +611,35 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reflow the base frame
|
// Reflow the base frame
|
||||||
if (aBaseFrame) {
|
if (aColumn.mBaseFrame) {
|
||||||
MOZ_ASSERT(aBaseFrame->GetType() == nsGkAtoms::rubyBaseFrame);
|
MOZ_ASSERT(aColumn.mBaseFrame->GetType() == nsGkAtoms::rubyBaseFrame);
|
||||||
nsReflowStatus reflowStatus;
|
nsReflowStatus reflowStatus;
|
||||||
nsHTMLReflowMetrics metrics(aReflowState);
|
nsHTMLReflowMetrics metrics(baseReflowState);
|
||||||
RubyUtils::ClearReservedISize(aBaseFrame);
|
RubyUtils::ClearReservedISize(aColumn.mBaseFrame);
|
||||||
|
|
||||||
bool pushedFrame;
|
bool pushedFrame;
|
||||||
aReflowState.mLineLayout->ReflowFrame(aBaseFrame, reflowStatus,
|
baseReflowState.mLineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
|
||||||
&metrics, pushedFrame);
|
&metrics, pushedFrame);
|
||||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||||
"Any line break inside ruby box should has been suppressed");
|
"Any line break inside ruby box should has been suppressed");
|
||||||
pairISize = std::max(pairISize, metrics.ISize(lineWM));
|
columnISize = std::max(columnISize, metrics.ISize(lineWM));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Align all the line layout to the new coordinate.
|
// Align all the line layout to the new coordinate.
|
||||||
nscoord icoord = istart + pairISize;
|
nscoord icoord = istart + columnISize;
|
||||||
nscoord deltaISize = icoord - aReflowState.mLineLayout->GetCurrentICoord();
|
nscoord deltaISize = icoord - baseReflowState.mLineLayout->GetCurrentICoord();
|
||||||
if (deltaISize > 0) {
|
if (deltaISize > 0) {
|
||||||
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
baseReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
||||||
if (aBaseFrame) {
|
if (aColumn.mBaseFrame) {
|
||||||
RubyUtils::SetReservedISize(aBaseFrame, deltaISize);
|
RubyUtils::SetReservedISize(aColumn.mBaseFrame, deltaISize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsLineLayout* lineLayout = aReflowStates[i]->mLineLayout;
|
if (aReflowState.mTextContainers[i]->IsSpanContainer()) {
|
||||||
nsIFrame* textFrame = aTextFrames[i];
|
continue;
|
||||||
|
}
|
||||||
|
nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
|
||||||
|
nsIFrame* textFrame = aColumn.mTextFrames[i];
|
||||||
nscoord deltaISize = icoord - lineLayout->GetCurrentICoord();
|
nscoord deltaISize = icoord - lineLayout->GetCurrentICoord();
|
||||||
if (deltaISize > 0) {
|
if (deltaISize > 0) {
|
||||||
lineLayout->AdvanceICoord(deltaISize);
|
lineLayout->AdvanceICoord(deltaISize);
|
||||||
@ -638,49 +647,50 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
|||||||
RubyUtils::SetReservedISize(textFrame, deltaISize);
|
RubyUtils::SetReservedISize(textFrame, deltaISize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aBaseFrame && textFrame) {
|
if (aColumn.mBaseFrame && textFrame) {
|
||||||
lineLayout->AttachLastFrameToBaseLineLayout();
|
lineLayout->AttachLastFrameToBaseLineLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mPairCount++;
|
if (aReflowState.mAllowLineBreak &&
|
||||||
if (aAllowLineBreak &&
|
baseReflowState.mLineLayout->NotifyOptionalBreakPosition(
|
||||||
aReflowState.mLineLayout->NotifyOptionalBreakPosition(
|
this, aColumnIndex + 1, icoord <= baseReflowState.AvailableISize(),
|
||||||
this, mPairCount, icoord <= aReflowState.AvailableISize(),
|
|
||||||
gfxBreakPriority::eNormalBreak)) {
|
gfxBreakPriority::eNormalBreak)) {
|
||||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pairISize;
|
return columnISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRubyBaseContainerFrame::PullFrameState::PullFrameState(
|
nsRubyBaseContainerFrame::PullFrameState::PullFrameState(
|
||||||
nsRubyBaseContainerFrame* aFrame)
|
nsRubyBaseContainerFrame* aBaseContainer,
|
||||||
: mBase(aFrame)
|
const TextContainerArray& aTextContainers)
|
||||||
|
: mBase(aBaseContainer)
|
||||||
|
, mTextContainers(aTextContainers)
|
||||||
{
|
{
|
||||||
const uint32_t rtcCount = aFrame->mTextContainers.Length();
|
const uint32_t rtcCount = aTextContainers.Length();
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
mTexts.AppendElement(aFrame->mTextContainers[i]);
|
mTexts.AppendElement(aTextContainers[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsRubyBaseContainerFrame::PullOnePair(nsLineLayout* aLineLayout,
|
nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
||||||
PullFrameState& aPullFrameState,
|
PullFrameState& aPullFrameState,
|
||||||
nsIFrame*& aBaseFrame,
|
RubyColumn& aColumn,
|
||||||
nsTArray<nsIFrame*>& aTextFrames,
|
bool& aIsComplete)
|
||||||
bool& aIsComplete)
|
|
||||||
{
|
{
|
||||||
const uint32_t rtcCount = mTextContainers.Length();
|
const TextContainerArray& textContainers = aPullFrameState.mTextContainers;
|
||||||
|
const uint32_t rtcCount = textContainers.Length();
|
||||||
|
|
||||||
aBaseFrame = PullNextInFlowChild(aPullFrameState.mBase);
|
aColumn.mBaseFrame = PullNextInFlowChild(aPullFrameState.mBase);
|
||||||
aIsComplete = !aBaseFrame;
|
aIsComplete = !aColumn.mBaseFrame;
|
||||||
|
|
||||||
aTextFrames.ClearAndRetainStorage();
|
aColumn.mTextFrames.ClearAndRetainStorage();
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsIFrame* nextText =
|
nsIFrame* nextText =
|
||||||
mTextContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
|
textContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
|
||||||
aTextFrames.AppendElement(nextText);
|
aColumn.mTextFrames.AppendElement(nextText);
|
||||||
// If there exists any frame in continations, we haven't
|
// If there exists any frame in continations, we haven't
|
||||||
// completed the reflow process.
|
// completed the reflow process.
|
||||||
aIsComplete = aIsComplete && !nextText;
|
aIsComplete = aIsComplete && !nextText;
|
||||||
@ -693,22 +703,25 @@ nsRubyBaseContainerFrame::PullOnePair(nsLineLayout* aLineLayout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
nsRubyBaseContainerFrame::ReflowSpans(nsPresContext* aPresContext,
|
nsRubyBaseContainerFrame::ReflowSpans(const ReflowState& aReflowState)
|
||||||
const nsHTMLReflowState& aReflowState,
|
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates)
|
|
||||||
{
|
{
|
||||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
WritingMode lineWM =
|
||||||
const uint32_t spanCount = mSpanContainers.Length();
|
aReflowState.mBaseReflowState.mLineLayout->GetWritingMode();
|
||||||
nscoord spanISize = 0;
|
nscoord spanISize = 0;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < spanCount; i++) {
|
for (uint32_t i = 0, iend = aReflowState.mTextContainers.Length();
|
||||||
nsRubyTextContainerFrame* container = mSpanContainers[i];
|
i < iend; i++) {
|
||||||
|
nsRubyTextContainerFrame* container = aReflowState.mTextContainers[i];
|
||||||
|
if (!container->IsSpanContainer()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame* rtFrame = container->GetFirstPrincipalChild();
|
nsIFrame* rtFrame = container->GetFirstPrincipalChild();
|
||||||
nsReflowStatus reflowStatus;
|
nsReflowStatus reflowStatus;
|
||||||
nsHTMLReflowMetrics metrics(*aReflowStates[i]);
|
nsHTMLReflowMetrics metrics(*aReflowState.mTextReflowStates[i]);
|
||||||
bool pushedFrame;
|
bool pushedFrame;
|
||||||
aReflowStates[i]->mLineLayout->ReflowFrame(rtFrame, reflowStatus,
|
aReflowState.mTextReflowStates[i]->mLineLayout->
|
||||||
&metrics, pushedFrame);
|
ReflowFrame(rtFrame, reflowStatus, &metrics, pushedFrame);
|
||||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||||
"Any line break inside ruby box should has been suppressed");
|
"Any line break inside ruby box should has been suppressed");
|
||||||
spanISize = std::max(spanISize, metrics.ISize(lineWM));
|
spanISize = std::max(spanISize, metrics.ISize(lineWM));
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#include "nsRubyTextContainerFrame.h"
|
#include "nsRubyTextContainerFrame.h"
|
||||||
#include "nsRubyBaseFrame.h"
|
#include "nsRubyBaseFrame.h"
|
||||||
#include "nsRubyTextFrame.h"
|
#include "nsRubyTextFrame.h"
|
||||||
|
#include "RubyReflowState.h"
|
||||||
#define RTC_ARRAY_SIZE 1
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory function.
|
* Factory function.
|
||||||
@ -23,6 +22,10 @@
|
|||||||
nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
||||||
nsStyleContext* aContext);
|
nsStyleContext* aContext);
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
struct RubyColumn;
|
||||||
|
}
|
||||||
|
|
||||||
class nsRubyBaseContainerFrame MOZ_FINAL : public nsContainerFrame
|
class nsRubyBaseContainerFrame MOZ_FINAL : public nsContainerFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -59,67 +62,35 @@ public:
|
|||||||
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
void AssertTextContainersEmpty()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mSpanContainers.IsEmpty());
|
|
||||||
MOZ_ASSERT(mTextContainers.IsEmpty());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void AppendTextContainer(nsIFrame* aFrame);
|
|
||||||
void ClearTextContainers();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend nsContainerFrame*
|
friend nsContainerFrame*
|
||||||
NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
||||||
nsStyleContext* aContext);
|
nsStyleContext* aContext);
|
||||||
explicit nsRubyBaseContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
explicit nsRubyBaseContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
||||||
|
|
||||||
nscoord CalculateMaxSpanISize(nsRenderingContext* aRenderingContext);
|
typedef nsTArray<nsRubyTextContainerFrame*> TextContainerArray;
|
||||||
|
typedef nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> AutoTextContainerArray;
|
||||||
|
void GetTextContainers(TextContainerArray& aTextContainers);
|
||||||
|
|
||||||
nscoord ReflowPairs(nsPresContext* aPresContext,
|
struct ReflowState;
|
||||||
bool aAllowLineBreak,
|
nscoord ReflowColumns(const ReflowState& aReflowState,
|
||||||
const nsHTMLReflowState& aReflowState,
|
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
|
||||||
nsReflowStatus& aStatus);
|
|
||||||
|
|
||||||
nscoord ReflowOnePair(nsPresContext* aPresContext,
|
|
||||||
bool aAllowLineBreak,
|
|
||||||
const nsHTMLReflowState& aReflowState,
|
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
|
||||||
nsIFrame* aBaseFrame,
|
|
||||||
const nsTArray<nsIFrame*>& aTextFrames,
|
|
||||||
nsReflowStatus& aStatus);
|
nsReflowStatus& aStatus);
|
||||||
|
nscoord ReflowOneColumn(const ReflowState& aReflowState,
|
||||||
nscoord ReflowSpans(nsPresContext* aPresContext,
|
uint32_t aColumnIndex,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const mozilla::RubyColumn& aColumn,
|
||||||
nsTArray<nsHTMLReflowState*>& aReflowStates);
|
nsReflowStatus& aStatus);
|
||||||
|
nscoord ReflowSpans(const ReflowState& aReflowState);
|
||||||
|
|
||||||
struct PullFrameState;
|
struct PullFrameState;
|
||||||
|
|
||||||
// Pull ruby base and corresponding ruby text frames from
|
// Pull ruby base and corresponding ruby text frames from
|
||||||
// continuations after them.
|
// continuations after them.
|
||||||
void PullOnePair(nsLineLayout* aLineLayout,
|
void PullOneColumn(nsLineLayout* aLineLayout,
|
||||||
PullFrameState& aPullFrameState,
|
PullFrameState& aPullFrameState,
|
||||||
nsIFrame*& aBaseFrame,
|
mozilla::RubyColumn& aColumn,
|
||||||
nsTArray<nsIFrame*>& aTextFrames,
|
bool& aIsComplete);
|
||||||
bool& aIsComplete);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The arrays of ruby text containers below are filled before the ruby
|
|
||||||
* frame (parent) starts reflowing this ruby segment, and cleared when
|
|
||||||
* the reflow finishes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The text containers that contain a span, which spans all ruby
|
|
||||||
// pairs in the ruby segment.
|
|
||||||
nsTArray<nsRubyTextContainerFrame*> mSpanContainers;
|
|
||||||
// Normal text containers that do not contain spans.
|
|
||||||
nsTArray<nsRubyTextContainerFrame*> mTextContainers;
|
|
||||||
|
|
||||||
nscoord mBaseline;
|
nscoord mBaseline;
|
||||||
uint32_t mPairCount;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsRubyBaseContainerFrame_h___ */
|
#endif /* nsRubyBaseContainerFrame_h___ */
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "WritingModes.h"
|
#include "WritingModes.h"
|
||||||
|
#include "RubyUtils.h"
|
||||||
|
#include "RubyReflowState.h"
|
||||||
#include "nsRubyBaseContainerFrame.h"
|
#include "nsRubyBaseContainerFrame.h"
|
||||||
#include "nsRubyTextContainerFrame.h"
|
#include "nsRubyTextContainerFrame.h"
|
||||||
|
|
||||||
@ -59,71 +61,6 @@ nsRubyFrame::GetFrameName(nsAString& aResult) const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MOZ_STACK_CLASS TextContainerIterator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit TextContainerIterator(nsRubyBaseContainerFrame* aBaseContainer);
|
|
||||||
void Next();
|
|
||||||
bool AtEnd() const { return !mFrame; }
|
|
||||||
nsRubyTextContainerFrame* GetTextContainer() const
|
|
||||||
{
|
|
||||||
return static_cast<nsRubyTextContainerFrame*>(mFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsIFrame* mFrame;
|
|
||||||
};
|
|
||||||
|
|
||||||
TextContainerIterator::TextContainerIterator(
|
|
||||||
nsRubyBaseContainerFrame* aBaseContainer)
|
|
||||||
{
|
|
||||||
mFrame = aBaseContainer;
|
|
||||||
Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TextContainerIterator::Next()
|
|
||||||
{
|
|
||||||
if (mFrame) {
|
|
||||||
mFrame = mFrame->GetNextSibling();
|
|
||||||
if (mFrame && mFrame->GetType() != nsGkAtoms::rubyTextContainerFrame) {
|
|
||||||
mFrame = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is responsible for appending and clearing
|
|
||||||
* text container list of the base container.
|
|
||||||
*/
|
|
||||||
class MOZ_STACK_CLASS AutoSetTextContainers
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit AutoSetTextContainers(nsRubyBaseContainerFrame* aBaseContainer);
|
|
||||||
~AutoSetTextContainers();
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsRubyBaseContainerFrame* mBaseContainer;
|
|
||||||
};
|
|
||||||
|
|
||||||
AutoSetTextContainers::AutoSetTextContainers(
|
|
||||||
nsRubyBaseContainerFrame* aBaseContainer)
|
|
||||||
: mBaseContainer(aBaseContainer)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
aBaseContainer->AssertTextContainersEmpty();
|
|
||||||
#endif
|
|
||||||
for (TextContainerIterator iter(aBaseContainer);
|
|
||||||
!iter.AtEnd(); iter.Next()) {
|
|
||||||
aBaseContainer->AppendTextContainer(iter.GetTextContainer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoSetTextContainers::~AutoSetTextContainers()
|
|
||||||
{
|
|
||||||
mBaseContainer->ClearTextContainers();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This enumerator enumerates each segment.
|
* This enumerator enumerates each segment.
|
||||||
*/
|
*/
|
||||||
@ -169,7 +106,6 @@ nsRubyFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
|
|||||||
{
|
{
|
||||||
nscoord max = 0;
|
nscoord max = 0;
|
||||||
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
||||||
AutoSetTextContainers holder(e.GetBaseContainer());
|
|
||||||
max = std::max(max, e.GetBaseContainer()->GetMinISize(aRenderingContext));
|
max = std::max(max, e.GetBaseContainer()->GetMinISize(aRenderingContext));
|
||||||
}
|
}
|
||||||
aData->currentLine += max;
|
aData->currentLine += max;
|
||||||
@ -181,7 +117,6 @@ nsRubyFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
|||||||
{
|
{
|
||||||
nscoord sum = 0;
|
nscoord sum = 0;
|
||||||
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
||||||
AutoSetTextContainers holder(e.GetBaseContainer());
|
|
||||||
sum += e.GetBaseContainer()->GetPrefISize(aRenderingContext);
|
sum += e.GetBaseContainer()->GetPrefISize(aRenderingContext);
|
||||||
}
|
}
|
||||||
aData->currentLine += sum;
|
aData->currentLine += sum;
|
||||||
@ -294,19 +229,20 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
|||||||
nsRubyBaseContainerFrame* aBaseContainer,
|
nsRubyBaseContainerFrame* aBaseContainer,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
AutoSetTextContainers holder(aBaseContainer);
|
|
||||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||||
LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
|
LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
|
||||||
aReflowState.AvailableBSize());
|
aReflowState.AvailableBSize());
|
||||||
|
|
||||||
nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> textContainers;
|
nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> textContainers;
|
||||||
for (TextContainerIterator iter(aBaseContainer); !iter.AtEnd(); iter.Next()) {
|
for (RubyTextContainerIterator iter(aBaseContainer); !iter.AtEnd(); iter.Next()) {
|
||||||
textContainers.AppendElement(iter.GetTextContainer());
|
textContainers.AppendElement(iter.GetTextContainer());
|
||||||
}
|
}
|
||||||
const uint32_t rtcCount = textContainers.Length();
|
const uint32_t rtcCount = textContainers.Length();
|
||||||
|
RubyReflowState rubyReflowState(lineWM, textContainers);
|
||||||
|
|
||||||
nsHTMLReflowMetrics baseMetrics(aReflowState);
|
nsHTMLReflowMetrics baseMetrics(aReflowState);
|
||||||
bool pushedFrame;
|
bool pushedFrame;
|
||||||
|
aReflowState.mLineLayout->SetRubyReflowState(&rubyReflowState);
|
||||||
aReflowState.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
|
aReflowState.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
|
||||||
&baseMetrics, pushedFrame);
|
&baseMetrics, pushedFrame);
|
||||||
|
|
||||||
@ -385,10 +321,13 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
|||||||
nsRect offsetRect = baseRect;
|
nsRect offsetRect = baseRect;
|
||||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||||
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||||
|
rubyReflowState.AdvanceCurrentContainerIndex();
|
||||||
|
|
||||||
nsReflowStatus textReflowStatus;
|
nsReflowStatus textReflowStatus;
|
||||||
nsHTMLReflowMetrics textMetrics(aReflowState);
|
nsHTMLReflowMetrics textMetrics(aReflowState);
|
||||||
nsHTMLReflowState textReflowState(aPresContext, aReflowState,
|
nsHTMLReflowState textReflowState(aPresContext, aReflowState,
|
||||||
textContainer, availSize);
|
textContainer, availSize);
|
||||||
|
textReflowState.mRubyReflowState = &rubyReflowState;
|
||||||
// FIXME We probably shouldn't be using the same nsLineLayout for
|
// FIXME We probably shouldn't be using the same nsLineLayout for
|
||||||
// the text containers. But it should be fine now as we are
|
// the text containers. But it should be fine now as we are
|
||||||
// not actually using this line layout to reflow something,
|
// not actually using this line layout to reflow something,
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "WritingModes.h"
|
#include "WritingModes.h"
|
||||||
|
#include "RubyReflowState.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
@ -61,6 +62,60 @@ nsRubyTextContainerFrame::IsFrameOfType(uint32_t aFlags) const
|
|||||||
return nsRubyTextContainerFrameSuper::IsFrameOfType(aFlags);
|
return nsRubyTextContainerFrameSuper::IsFrameOfType(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ void
|
||||||
|
nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID,
|
||||||
|
nsFrameList& aChildList)
|
||||||
|
{
|
||||||
|
nsRubyTextContainerFrameSuper::SetInitialChildList(aListID, aChildList);
|
||||||
|
UpdateSpanFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* virtual */ void
|
||||||
|
nsRubyTextContainerFrame::AppendFrames(ChildListID aListID,
|
||||||
|
nsFrameList& aFrameList)
|
||||||
|
{
|
||||||
|
nsRubyTextContainerFrameSuper::AppendFrames(aListID, aFrameList);
|
||||||
|
UpdateSpanFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* virtual */ void
|
||||||
|
nsRubyTextContainerFrame::InsertFrames(ChildListID aListID,
|
||||||
|
nsIFrame* aPrevFrame,
|
||||||
|
nsFrameList& aFrameList)
|
||||||
|
{
|
||||||
|
nsRubyTextContainerFrameSuper::InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||||
|
UpdateSpanFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* virtual */ void
|
||||||
|
nsRubyTextContainerFrame::RemoveFrame(ChildListID aListID,
|
||||||
|
nsIFrame* aOldFrame)
|
||||||
|
{
|
||||||
|
nsRubyTextContainerFrameSuper::RemoveFrame(aListID, aOldFrame);
|
||||||
|
UpdateSpanFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsRubyTextContainerFrame::UpdateSpanFlag()
|
||||||
|
{
|
||||||
|
bool isSpan = false;
|
||||||
|
// The continuation checks are safe here because spans never break.
|
||||||
|
if (!GetPrevContinuation() && !GetNextContinuation()) {
|
||||||
|
nsIFrame* onlyChild = mFrames.OnlyChild();
|
||||||
|
if (onlyChild && onlyChild->IsPseudoFrame(GetContent())) {
|
||||||
|
// Per CSS Ruby spec, if the only child of an rtc frame is
|
||||||
|
// a pseudo rt frame, it spans all bases in the segment.
|
||||||
|
isSpan = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSpan) {
|
||||||
|
AddStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
||||||
|
} else {
|
||||||
|
RemoveStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize,
|
nsHTMLReflowMetrics& aDesiredSize,
|
||||||
@ -70,6 +125,8 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
|
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
|
||||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||||
|
|
||||||
|
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||||
|
|
||||||
// All rt children have already been reflowed. All we need to do is
|
// All rt children have already been reflowed. All we need to do is
|
||||||
// to report complete and return the desired size provided by the
|
// to report complete and return the desired size provided by the
|
||||||
// ruby base container.
|
// ruby base container.
|
||||||
@ -80,5 +137,7 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
// will take care of our continuations.
|
// will take care of our continuations.
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||||
aDesiredSize.SetSize(lineWM, mLineSize);
|
const RubyReflowState::TextContainerInfo& info =
|
||||||
|
aReflowState.mRubyReflowState->GetCurrentTextContainerInfo(this);
|
||||||
|
aDesiredSize.SetSize(lineWM, info.mLineSize);
|
||||||
}
|
}
|
||||||
|
@ -42,21 +42,32 @@ public:
|
|||||||
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// nsContainerFrame overrides
|
||||||
|
virtual void SetInitialChildList(ChildListID aListID,
|
||||||
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
||||||
|
virtual void AppendFrames(ChildListID aListID,
|
||||||
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
||||||
|
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
||||||
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
||||||
|
virtual void RemoveFrame(ChildListID aListID,
|
||||||
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
bool IsSpanContainer() const
|
||||||
|
{
|
||||||
|
return GetStateBits() & NS_RUBY_TEXT_CONTAINER_IS_SPAN;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend nsContainerFrame*
|
friend nsContainerFrame*
|
||||||
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
|
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
|
||||||
nsStyleContext* aContext);
|
nsStyleContext* aContext);
|
||||||
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
|
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
|
||||||
: nsRubyTextContainerFrameSuper(aContext)
|
: nsRubyTextContainerFrameSuper(aContext) {}
|
||||||
, mLineSize(mozilla::WritingMode(aContext)) {}
|
|
||||||
|
|
||||||
|
void UpdateSpanFlag();
|
||||||
|
|
||||||
|
// For MoveOverflowToChildList
|
||||||
friend class nsRubyBaseContainerFrame;
|
friend class nsRubyBaseContainerFrame;
|
||||||
void SetLineSize(const mozilla::LogicalSize& aSize) { mLineSize = aSize; }
|
|
||||||
|
|
||||||
// The intended dimensions of the ruby text container. It is set by
|
|
||||||
// the corresponding ruby base container when the segment is reflowed,
|
|
||||||
// and used when the ruby text container is reflowed by its parent.
|
|
||||||
mozilla::LogicalSize mLineSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsRubyTextContainerFrame_h___ */
|
#endif /* nsRubyTextContainerFrame_h___ */
|
||||||
|
@ -5097,6 +5097,33 @@ Version 1.6.15rc03 [November 16, 2014]
|
|||||||
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
|
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
|
||||||
|
|
||||||
Version 1.6.15 [November 20, 2014]
|
Version 1.6.15 [November 20, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.16beta01 [December 14, 2014]
|
||||||
|
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
|
||||||
|
don't do alignment correctly.
|
||||||
|
Revised Makefile.am and scripts/symbols.dfn to work with MinGW/MSYS
|
||||||
|
(Bob Friesenhahn).
|
||||||
|
|
||||||
|
Version 1.6.16beta02 [December 15, 2014]
|
||||||
|
Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
|
||||||
|
renamed scripts/*.dfn to scripts/*.c (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.16beta03 [December 21, 2014]
|
||||||
|
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.16rc01 [December 21, 2014]
|
||||||
|
Restored a test on width that was removed from png.c at libpng-1.6.9
|
||||||
|
(Bug report by Alex Eubanks).
|
||||||
|
|
||||||
|
Version 1.6.16rc02 [December 21, 2014]
|
||||||
|
Undid the update to pngrutil.c in 1.6.16rc01.
|
||||||
|
|
||||||
|
Version 1.6.16rc03 [December 21, 2014]
|
||||||
|
Fixed an overflow in png_combine_row with very wide interlaced images.
|
||||||
|
|
||||||
|
Version 1.6.16 [December 22, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
@ -10,7 +10,7 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
|
libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||||
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
November 20, 2014
|
December 22, 2014
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
|
|
||||||
Changes made to pristine libpng source by mozilla.org developers.
|
Changes made to pristine libpng source by mozilla.org developers.
|
||||||
|
|
||||||
|
2014/12/22 -- Synced with libpng-1.6.16 (bug #1114360).
|
||||||
|
Added arm.patch file.
|
||||||
|
|
||||||
2014/11/20 -- Synced with libpng-1.6.15 (bug #1102523).
|
2014/11/20 -- Synced with libpng-1.6.15 (bug #1102523).
|
||||||
|
|
||||||
2014/10/23 -- Synced with libpng-1.6.14 (bug #1087841).
|
2014/10/23 -- Synced with libpng-1.6.14 (bug #1087841).
|
||||||
|
|
||||||
2014/08/21 -- Synced with libpng-1.6.13 (bug #1021713).
|
2014/08/21 -- Synced with libpng-1.6.13 (bug #1021713).
|
||||||
Renamed mozpngconf.h to pnglibconf.h.
|
Renamed mozpngconf.h to pnglibconf.h.
|
||||||
|
Revised system arm/filter_neon.S to include the lines
|
||||||
|
#define PNG_READ_SUPPORTED and #define MOZ_PNG_HAVE_ARM_NEON
|
||||||
|
because the moz.build system doesn't yet pass -DDefined
|
||||||
|
macros to the assembler.
|
||||||
|
|
||||||
2014/03/21 -- Synced with libpng-1.6.10 (bug #980488) and disabled
|
2014/03/21 -- Synced with libpng-1.6.10 (bug #980488) and disabled
|
||||||
PNG_WARNINGS and PNG_ERROR_TEXT in non-debug builds.
|
PNG_WARNINGS and PNG_ERROR_TEXT in non-debug builds.
|
||||||
@ -16,10 +23,12 @@ Changes made to pristine libpng source by mozilla.org developers.
|
|||||||
2014/03/04 -- Enabled PNG_WARNINGS and other stuff in mozpngconf.h
|
2014/03/04 -- Enabled PNG_WARNINGS and other stuff in mozpngconf.h
|
||||||
as part of enabling Freetype2 with PNG (bug #969814).
|
as part of enabling Freetype2 with PNG (bug #969814).
|
||||||
|
|
||||||
2014/03/03 -- Fixed hang with empty IDAT (bug #974825).
|
2014/03/03 -- Fixed hang with empty IDAT (bug #974825). This will be
|
||||||
|
fixed in libpng-1.6.10.
|
||||||
|
|
||||||
2014/02/18 -- Exposed png_error(), etc. redefinitions to applications
|
2014/02/18 -- Exposed png_error(), etc. redefinitions to applications
|
||||||
(moved them from pngpriv.h to png.h).
|
(moved them from pngpriv.h to png.h). This will be fixed
|
||||||
|
in libpng-1.6.10.
|
||||||
|
|
||||||
2014/02/18 -- Disabled PNG_FIXED_POINT_SUPPORTED in mozpngconf.h (we
|
2014/02/18 -- Disabled PNG_FIXED_POINT_SUPPORTED in mozpngconf.h (we
|
||||||
don't need both FIXED and FLOATING_POINT support).
|
don't need both FIXED and FLOATING_POINT support).
|
||||||
@ -27,6 +36,7 @@ Changes made to pristine libpng source by mozilla.org developers.
|
|||||||
2014/02/15 -- Synced with libpng-1.6.9 (bug #952505).
|
2014/02/15 -- Synced with libpng-1.6.9 (bug #952505).
|
||||||
|
|
||||||
2014/02/11 -- Fixed crash with empty PLTE, CVE-2013-6954 (bug #945912).
|
2014/02/11 -- Fixed crash with empty PLTE, CVE-2013-6954 (bug #945912).
|
||||||
|
This will be fixed in libpng-1.6.9.
|
||||||
|
|
||||||
2013/12/11 -- Enable ARM support (bug #832390).
|
2013/12/11 -- Enable ARM support (bug #832390).
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
README for libpng version 1.6.15 - November 20, 2014 (shared library 16.0)
|
README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
@ -278,7 +278,7 @@ Index: png.h
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- png.h
|
--- png.h
|
||||||
+++ png.h
|
+++ png.h
|
||||||
@@ -473,6 +473,10 @@
|
@@ -476,6 +476,10 @@
|
||||||
# include "pnglibconf.h"
|
# include "pnglibconf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ Index: png.h
|
|||||||
#ifndef PNG_VERSION_INFO_ONLY
|
#ifndef PNG_VERSION_INFO_ONLY
|
||||||
/* Machine specific configuration. */
|
/* Machine specific configuration. */
|
||||||
# include "pngconf.h"
|
# include "pngconf.h"
|
||||||
@@ -563,6 +567,17 @@
|
@@ -566,6 +570,17 @@
|
||||||
* See pngconf.h for base types that vary by machine/system
|
* See pngconf.h for base types that vary by machine/system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ Index: png.h
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
@@ -883,6 +898,10 @@
|
@@ -886,6 +901,10 @@
|
||||||
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
||||||
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
||||||
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
||||||
@ -318,7 +318,7 @@ Index: png.h
|
|||||||
|
|
||||||
/* This is used for the transformation routines, as some of them
|
/* This is used for the transformation routines, as some of them
|
||||||
* change these values for the row. It also should enable using
|
* change these values for the row. It also should enable using
|
||||||
@@ -920,6 +939,10 @@
|
@@ -923,6 +942,10 @@
|
||||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
|
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
|
||||||
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
|
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
|
||||||
@ -329,7 +329,7 @@ Index: png.h
|
|||||||
|
|
||||||
/* The following callback receives png_uint_32 row_number, int pass for the
|
/* The following callback receives png_uint_32 row_number, int pass for the
|
||||||
* png_bytep data of the row. When transforming an interlaced image the
|
* png_bytep data of the row. When transforming an interlaced image the
|
||||||
@@ -3259,6 +3282,75 @@
|
@@ -3262,6 +3285,75 @@
|
||||||
* END OF HARDWARE AND SOFTWARE OPTIONS
|
* END OF HARDWARE AND SOFTWARE OPTIONS
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ Index: png.h
|
|||||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
||||||
* defs, and in scripts/symbols.def.
|
* defs, and in scripts/symbols.def.
|
||||||
*/
|
*/
|
||||||
@@ -3267,7 +3359,11 @@
|
@@ -3270,7 +3362,11 @@
|
||||||
* one to use is one more than this.)
|
* one to use is one more than this.)
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||||
@ -1023,7 +1023,7 @@ Index: pngrutil.c
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- pngrutil.c
|
--- pngrutil.c
|
||||||
+++ pngrutil.c
|
+++ pngrutil.c
|
||||||
@@ -818,6 +818,11 @@
|
@@ -819,6 +819,11 @@
|
||||||
filter_type = buf[11];
|
filter_type = buf[11];
|
||||||
interlace_type = buf[12];
|
interlace_type = buf[12];
|
||||||
|
|
||||||
|
48
media/libpng/arm.patch
Normal file
48
media/libpng/arm.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
diff --git ../../../libpng-1.6.16/arm/arm_init.c arm/arm_init.c
|
||||||
|
--- ../../../libpng-1.6.16/arm/arm_init.c 2014-12-21 22:08:08.000000000 -0500
|
||||||
|
+++ arm/arm_init.c 2014-12-22 17:33:57.556305506 -0500
|
||||||
|
@@ -29,17 +29,17 @@
|
||||||
|
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
||||||
|
* a fragment of C source code which defines the png_have_neon function. There
|
||||||
|
* are a number of implementations in contrib/arm-neon, but the only one that
|
||||||
|
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||||
|
* implementation which reads /proc/cpufino.
|
||||||
|
*/
|
||||||
|
#ifndef PNG_ARM_NEON_FILE
|
||||||
|
# ifdef __linux__
|
||||||
|
-# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||||
|
+# define PNG_ARM_NEON_FILE "linux.c"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_ARM_NEON_FILE
|
||||||
|
|
||||||
|
#include <signal.h> /* for sig_atomic_t */
|
||||||
|
static int png_have_neon(png_structp png_ptr);
|
||||||
|
#include PNG_ARM_NEON_FILE
|
||||||
|
diff --git ../../../libpng-1.6.16/arm/filter_neon.S arm/filter_neon.S
|
||||||
|
--- ../../../libpng-1.6.16/arm/filter_neon.S 2014-12-21 22:08:08.000000000 -0500
|
||||||
|
+++ arm/filter_neon.S 2014-12-22 17:43:31.588323649 -0500
|
||||||
|
@@ -5,16 +5,22 @@
|
||||||
|
* Written by Mans Rullgard, 2011.
|
||||||
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
+/* These are required because Mozilla's moz.build system doesn't pass
|
||||||
|
+ * -DDefined macros to the assembler.
|
||||||
|
+ */
|
||||||
|
+#define PNG_READ_SUPPORTED
|
||||||
|
+#define MOZ_PNG_HAVE_ARM_NEON
|
||||||
|
+
|
||||||
|
/* This is required to get the symbol renames, which are #defines, and the
|
||||||
|
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||||
|
*/
|
||||||
|
#define PNG_VERSION_INFO_ONLY
|
||||||
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -17,12 +17,13 @@
|
|||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
#if PNG_ARM_NEON_OPT > 0
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||||
/* WARNING: it is strongly recommended that you do not build libpng with
|
/* WARNING: it is strongly recommended that you do not build libpng with
|
||||||
* run-time checks for CPU features if at all possible. In the case of the ARM
|
* run-time checks for CPU features if at all possible. In the case of the ARM
|
||||||
* NEON instructions there is no processor-specific way of detecting the
|
* NEON instructions there is no processor-specific way of detecting the
|
||||||
* presense of the required support, therefore run-time detectioon is extremely
|
* presence of the required support, therefore run-time detection is extremely
|
||||||
* OS specific.
|
* OS specific.
|
||||||
*
|
*
|
||||||
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
||||||
@ -130,4 +131,4 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* READ */
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* filter_neon.S - NEON optimised filter functions
|
/* filter_neon.S - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -16,9 +16,8 @@
|
|||||||
#define PNG_READ_SUPPORTED
|
#define PNG_READ_SUPPORTED
|
||||||
#define MOZ_PNG_HAVE_ARM_NEON
|
#define MOZ_PNG_HAVE_ARM_NEON
|
||||||
|
|
||||||
/* This is required to get the symbol renames, which are #defines, and also
|
/* This is required to get the symbol renames, which are #defines, and the
|
||||||
* includes the definition (or not) of PNG_ARM_NEON_OPT and
|
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||||
* PNG_ARM_NEON_IMPLEMENTATION.
|
|
||||||
*/
|
*/
|
||||||
#define PNG_VERSION_INFO_ONLY
|
#define PNG_VERSION_INFO_ONLY
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
@ -27,6 +26,8 @@
|
|||||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
||||||
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
||||||
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
||||||
@ -34,7 +35,6 @@
|
|||||||
*/
|
*/
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
#if PNG_ARM_NEON_OPT > 0
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
|
|
||||||
#ifdef __ELF__
|
#ifdef __ELF__
|
||||||
@ -55,9 +55,8 @@ ELF .size \name, . - \name
|
|||||||
.text
|
.text
|
||||||
|
|
||||||
/* Explicitly specifying alignment here because some versions of
|
/* Explicitly specifying alignment here because some versions of
|
||||||
gas don't align code correctly. See
|
* GAS don't align code correctly. This is harmless in correctly
|
||||||
http://lists.gnu.org/archive/html/bug-binutils/2011-06/msg00199.html
|
* written versions of GAS.
|
||||||
and https://bugzilla.mozilla.org/show_bug.cgi?id=920992
|
|
||||||
*/
|
*/
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
@ -256,5 +255,5 @@ func png_read_filter_row_paeth3_neon, export=1
|
|||||||
pop {r4,pc}
|
pop {r4,pc}
|
||||||
endfunc
|
endfunc
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||||
|
#endif /* READ */
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
/* This code requires -mfpu=neon on the command line: */
|
/* This code requires -mfpu=neon on the command line: */
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||||
|
|
||||||
@ -35,7 +37,6 @@
|
|||||||
#define png_ldr(type,pointer)\
|
#define png_ldr(type,pointer)\
|
||||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
#if PNG_ARM_NEON_OPT > 0
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -368,5 +369,5 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
||||||
|
#endif /* READ */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by John Bowler, 2014.
|
* Written by John Bowler, 2014.
|
||||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -16,8 +16,8 @@
|
|||||||
* png_have_neon implemented for Linux by reading the widely available
|
* png_have_neon implemented for Linux by reading the widely available
|
||||||
* pseudo-file /proc/cpuinfo.
|
* pseudo-file /proc/cpuinfo.
|
||||||
*
|
*
|
||||||
* This code is strict ANSI-C and is probably moderately portable, it does
|
* This code is strict ANSI-C and is probably moderately portable; it does
|
||||||
* however use <stdio.h> and assumes that /proc/cpuinfo is never localized.
|
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -152,8 +152,10 @@ png_have_neon(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.6.15 - November 20, 2014
|
libpng version 1.6.16 - December 22, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.15 - November 20, 2014
|
libpng versions 0.97, January 1998, through 1.6.16 - December 22, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -648,15 +648,12 @@ User limits
|
|||||||
|
|
||||||
The PNG specification allows the width and height of an image to be as
|
The PNG specification allows the width and height of an image to be as
|
||||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||||
Since very few applications really need to process such large images,
|
|
||||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
|
||||||
Larger images will be rejected immediately with a png_error() call. If
|
Larger images will be rejected immediately with a png_error() call. If
|
||||||
you wish to change this limit, you can use
|
you wish to reduce these limits, you can use
|
||||||
|
|
||||||
png_set_user_limits(png_ptr, width_max, height_max);
|
png_set_user_limits(png_ptr, width_max, height_max);
|
||||||
|
|
||||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
to set your own limits (libpng may reject some very wide images
|
||||||
to allow all valid dimensions (libpng may reject some very large images
|
|
||||||
anyway because of potential buffer overflow conditions).
|
anyway because of potential buffer overflow conditions).
|
||||||
|
|
||||||
You should put this statement after you create the PNG structure and
|
You should put this statement after you create the PNG structure and
|
||||||
@ -5037,8 +5034,8 @@ where "rp" indicates a "restricted pointer".
|
|||||||
Error detection in some chunks has improved; in particular the iCCP chunk
|
Error detection in some chunks has improved; in particular the iCCP chunk
|
||||||
reader now does pretty complete validation of the basic format. Some bad
|
reader now does pretty complete validation of the basic format. Some bad
|
||||||
profiles that were previously accepted are now accepted with a warning or
|
profiles that were previously accepted are now accepted with a warning or
|
||||||
rejected, depending upon the png_set_benign_errors() setting, in particular the
|
rejected, depending upon the png_set_benign_errors() setting, in particular
|
||||||
very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
|
the very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
|
||||||
libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
|
libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
|
||||||
means of
|
means of
|
||||||
|
|
||||||
@ -5048,8 +5045,8 @@ means of
|
|||||||
PNG_OPTION_ON);
|
PNG_OPTION_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
It's not a good idea to do this if you are using the "simplified API",
|
It's not a good idea to do this if you are using the new "simplified API",
|
||||||
which needs to be able to recognize an sRGB profile conveyed via the iCCP
|
which needs to be able to recognize sRGB profiles conveyed via the iCCP
|
||||||
chunk.
|
chunk.
|
||||||
|
|
||||||
The PNG spec requirement that only grayscale profiles may appear in images
|
The PNG spec requirement that only grayscale profiles may appear in images
|
||||||
@ -5277,13 +5274,13 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
XVI. Y2K Compliance in libpng
|
XVI. Y2K Compliance in libpng
|
||||||
|
|
||||||
November 20, 2014
|
December 22, 2014
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.6.15 are Y2K compliant. It is my belief that earlier
|
upward through 1.6.16 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -14,7 +14,7 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_15 Your_png_h_is_not_version_1_6_15;
|
typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
@ -769,13 +769,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.15 - November 20, 2014" PNG_STRING_NEWLINE \
|
"libpng version 1.6.16 - December 22, 2014" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.15 - November 20, 2014\
|
return "libpng version 1.6.16 - December 22, 2014\
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
@ -1075,7 +1075,7 @@ png_colorspace_set_gamma(png_const_structrp png_ptr,
|
|||||||
png_colorspacerp colorspace, png_fixed_point gAMA)
|
png_colorspacerp colorspace, png_fixed_point gAMA)
|
||||||
{
|
{
|
||||||
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
|
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
|
||||||
* occur. Since the fixed point representation is assymetrical it is
|
* occur. Since the fixed point representation is asymetrical it is
|
||||||
* possible for 1/gamma to overflow the limit of 21474 and this means the
|
* possible for 1/gamma to overflow the limit of 21474 and this means the
|
||||||
* gamma value must be at least 5/100000 and hence at most 20000.0. For
|
* gamma value must be at least 5/100000 and hence at most 20000.0. For
|
||||||
* safety the limits here are a little narrower. The values are 0.00016 to
|
* safety the limits here are a little narrower. The values are 0.00016 to
|
||||||
@ -1324,7 +1324,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||||||
* (1/white-y), so we can immediately see that as white-y approaches 0 the
|
* (1/white-y), so we can immediately see that as white-y approaches 0 the
|
||||||
* accuracy inherent in the cHRM chunk drops off substantially.
|
* accuracy inherent in the cHRM chunk drops off substantially.
|
||||||
*
|
*
|
||||||
* libpng arithmetic: a simple invertion of the above equations
|
* libpng arithmetic: a simple inversion of the above equations
|
||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* white_scale = 1/white-y
|
* white_scale = 1/white-y
|
||||||
@ -1817,7 +1817,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
PNG_UNUSED(pos)
|
PNG_UNUSED(pos)
|
||||||
|
|
||||||
/* This is recoverable, but make it unconditionally an app_error on write to
|
/* This is recoverable, but make it unconditionally an app_error on write to
|
||||||
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
|
* avoid writing invalid ICC profiles into PNG files (i.e., we handle them
|
||||||
* on read, with a warning, but on write unless the app turns off
|
* on read, with a warning, but on write unless the app turns off
|
||||||
* application errors the PNG won't be written.)
|
* application errors the PNG won't be written.)
|
||||||
*/
|
*/
|
||||||
@ -1836,7 +1836,7 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
/* sRGB sets known gamma, end points and (from the chunk) intent. */
|
/* sRGB sets known gamma, end points and (from the chunk) intent. */
|
||||||
/* IMPORTANT: these are not necessarily the values found in an ICC profile
|
/* IMPORTANT: these are not necessarily the values found in an ICC profile
|
||||||
* because ICC profiles store values adapted to a D50 environment; it is
|
* because ICC profiles store values adapted to a D50 environment; it is
|
||||||
* expected that the ICC profile mediaWhitePointTag will be D50, see the
|
* expected that the ICC profile mediaWhitePointTag will be D50; see the
|
||||||
* checks and code elsewhere to understand this better.
|
* checks and code elsewhere to understand this better.
|
||||||
*
|
*
|
||||||
* These XYZ values, which are accurate to 5dp, produce rgb to gray
|
* These XYZ values, which are accurate to 5dp, produce rgb to gray
|
||||||
@ -2461,6 +2461,17 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
|
|||||||
|
|
||||||
#endif /* COLORSPACE */
|
#endif /* COLORSPACE */
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
/* This exists solely to work round a warning from GNU C. */
|
||||||
|
static int /* PRIVATE */
|
||||||
|
png_gt(size_t a, size_t b)
|
||||||
|
{
|
||||||
|
return a > b;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define png_gt(a,b) ((a) > (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_check_IHDR(png_const_structrp png_ptr,
|
png_check_IHDR(png_const_structrp png_ptr,
|
||||||
png_uint_32 width, png_uint_32 height, int bit_depth,
|
png_uint_32 width, png_uint_32 height, int bit_depth,
|
||||||
@ -2480,6 +2491,28 @@ png_check_IHDR(png_const_structrp png_ptr,
|
|||||||
png_warning(png_ptr, "Invalid image width in IHDR");
|
png_warning(png_ptr, "Invalid image width in IHDR");
|
||||||
error = 1;
|
error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (png_gt(width,
|
||||||
|
(PNG_SIZE_MAX >> 3) /* 8-byte RGBA pixels */
|
||||||
|
- 48 /* big_row_buf hack */
|
||||||
|
- 1 /* filter byte */
|
||||||
|
- 7*8 /* rounding width to multiple of 8 pix */
|
||||||
|
- 8)) /* extra max_pixel_depth pad */
|
||||||
|
{
|
||||||
|
/* The size of the row must be within the limits of this architecture.
|
||||||
|
* Because the read code can perform arbitrary transformations the
|
||||||
|
* maximum size is checked here. Because the code in png_read_start_row
|
||||||
|
* adds extra space "for safety's sake" in several places a conservative
|
||||||
|
* limit is used here.
|
||||||
|
*
|
||||||
|
* NOTE: it would be far better to check the size that is actually used,
|
||||||
|
* but the effect in the real world is minor and the changes are more
|
||||||
|
* extensive, therefore much more dangerous and much more difficult to
|
||||||
|
* write in a way that avoids compiler warnings.
|
||||||
|
*/
|
||||||
|
png_warning(png_ptr, "Image width is too large for this architecture");
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.15, November 20, 2014
|
* libpng version 1.6.16, December 22, 2014
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.15, November 20, 2014: Glenn
|
* libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
@ -209,6 +209,9 @@
|
|||||||
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||||
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||||
* 1.6.15 16 10615 16.so.16.15[.0]
|
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||||
|
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||||
|
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||||
|
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
@ -240,7 +243,7 @@
|
|||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
|
* libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||||
* Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
* with the following individual added to the list of Contributing Authors:
|
* with the following individual added to the list of Contributing Authors:
|
||||||
@ -352,13 +355,13 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* November 20, 2014
|
* December 22, 2014
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.6.15 are Y2K compliant. It is my belief that
|
* upward through 1.6.16 are Y2K compliant. It is my belief that
|
||||||
* earlier versions were also Y2K compliant.
|
* earlier versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
@ -420,9 +423,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.15"
|
#define PNG_LIBPNG_VER_STRING "1.6.16"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.6.15 - November 20, 2014\n"
|
" libpng version 1.6.16 - December 22, 2014\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
@ -430,7 +433,7 @@
|
|||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 15
|
#define PNG_LIBPNG_VER_RELEASE 16
|
||||||
|
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
@ -461,7 +464,7 @@
|
|||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10615 /* 1.6.15 */
|
#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
@ -581,7 +584,7 @@ extern "C" {
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_15;
|
typedef char* png_libpng_version_1_6_16;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.15,November 20, 2014
|
* libpng version 1.6.16,December 22, 2014
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
@ -788,6 +788,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Read and check the IDHR chunk */
|
/* Read and check the IDHR chunk */
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
@ -857,8 +858,7 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set up other useful info */
|
/* Set up other useful info */
|
||||||
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
|
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
|
||||||
png_ptr->channels);
|
|
||||||
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
|
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
|
||||||
png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
|
png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
|
||||||
png_debug1(3, "channels = %d", png_ptr->channels);
|
png_debug1(3, "channels = %d", png_ptr->channels);
|
||||||
@ -3182,7 +3182,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
{
|
{
|
||||||
unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
|
unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
|
||||||
png_const_bytep sp = png_ptr->row_buf + 1;
|
png_const_bytep sp = png_ptr->row_buf + 1;
|
||||||
png_uint_32 row_width = png_ptr->width;
|
png_alloc_size_t row_width = png_ptr->width;
|
||||||
unsigned int pass = png_ptr->pass;
|
unsigned int pass = png_ptr->pass;
|
||||||
png_bytep end_ptr = 0;
|
png_bytep end_ptr = 0;
|
||||||
png_byte end_byte = 0;
|
png_byte end_byte = 0;
|
||||||
@ -3457,7 +3457,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
|
|
||||||
/* But don't allow this number to exceed the actual row width. */
|
/* But don't allow this number to exceed the actual row width. */
|
||||||
if (bytes_to_copy > row_width)
|
if (bytes_to_copy > row_width)
|
||||||
bytes_to_copy = row_width;
|
bytes_to_copy = (unsigned int)/*SAFE*/row_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* normal row; Adam7 only ever gives us one pixel to copy. */
|
else /* normal row; Adam7 only ever gives us one pixel to copy. */
|
||||||
@ -3637,7 +3637,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
dp += bytes_to_jump;
|
dp += bytes_to_jump;
|
||||||
row_width -= bytes_to_jump;
|
row_width -= bytes_to_jump;
|
||||||
if (bytes_to_copy > row_width)
|
if (bytes_to_copy > row_width)
|
||||||
bytes_to_copy = row_width;
|
bytes_to_copy = (unsigned int)/*SAFE*/row_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4443,7 +4443,7 @@ png_read_start_row(png_structrp png_ptr)
|
|||||||
|
|
||||||
max_pixel_depth = png_ptr->pixel_depth;
|
max_pixel_depth = png_ptr->pixel_depth;
|
||||||
|
|
||||||
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpliar set of
|
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
|
||||||
* calculations to calculate the final pixel depth, then
|
* calculations to calculate the final pixel depth, then
|
||||||
* png_do_read_transforms actually does the transforms. This means that the
|
* png_do_read_transforms actually does the transforms. This means that the
|
||||||
* code which effectively calculates this value is actually repeated in three
|
* code which effectively calculates this value is actually repeated in three
|
||||||
|
Loading…
Reference in New Issue
Block a user