summaryrefslogtreecommitdiffstats
path: root/layout
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-03 09:06:25 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-03 09:06:25 +0100
commit1626b5d7041ea9c3db92200f91542da46e49dde6 (patch)
treee99c393052ef818645027da57774672990e29514 /layout
parent314fb761d144b160d3aeb72840c89e31c4f21a4a (diff)
parent1d55939c7ca0e80555a24b240ff68d5bdbb48b4a (diff)
downloadUXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.gz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.lz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.xz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.zip
Merge branch 'master' into Basilisk-releasev2018.11.04
Diffstat (limited to 'layout')
-rw-r--r--layout/base/nsCaret.cpp8
-rw-r--r--layout/base/nsLayoutUtils.cpp1
-rw-r--r--layout/base/nsPresShell.cpp5
-rw-r--r--layout/generic/nsGfxScrollFrame.cpp63
-rw-r--r--layout/generic/nsGfxScrollFrame.h3
-rw-r--r--layout/generic/nsGridContainerFrame.cpp8
-rw-r--r--layout/reftests/css-grid/bug1349571-ref.html90
-rw-r--r--layout/reftests/css-grid/bug1349571.html94
-rw-r--r--layout/reftests/css-grid/bug1356820-ref.html81
-rw-r--r--layout/reftests/css-grid/bug1356820.html81
-rw-r--r--layout/reftests/css-grid/reftest.list2
-rw-r--r--layout/tables/nsTableFrame.cpp79
12 files changed, 443 insertions, 72 deletions
diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp
index 8ad435950..eca22f3ba 100644
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -117,6 +117,12 @@ IsBidiUI()
return Preferences::GetBool("bidi.browser.ui");
}
+static bool
+CjkThickCaret()
+{
+ return Preferences::GetBool("layout.cjkthickcaret");
+}
+
nsCaret::nsCaret()
: mOverrideOffset(0)
, mBlinkCount(-1)
@@ -190,7 +196,7 @@ nsCaret::ComputeMetrics(nsIFrame* aFrame, int32_t aOffset, nscoord aCaretHeight)
nsPresContext::CSSPixelsToAppUnits(
LookAndFeel::GetInt(LookAndFeel::eIntID_CaretWidth, 1));
- if (DrawCJKCaret(aFrame, aOffset)) {
+ if (DrawCJKCaret(aFrame, aOffset) && CjkThickCaret()) {
caretWidth += nsPresContext::CSSPixelsToAppUnits(1);
}
nscoord bidiIndicatorSize = nsPresContext::CSSPixelsToAppUnits(kMinBidiIndicatorPixels);
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index d0f790a0b..c1f4ad372 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3423,7 +3423,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
return NS_OK;
}
- TimeStamp startBuildDisplayList = TimeStamp::Now();
nsDisplayListBuilder builder(aFrame, aBuilderMode,
!(aFlags & PaintFrameFlags::PAINT_HIDE_CARET));
if (aFlags & PaintFrameFlags::PAINT_IN_TRANSFORM) {
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 88539dc4a..340042b46 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1111,10 +1111,6 @@ PresShell::Destroy()
LogTextPerfStats(tp, this, tp->cumulative, 0.0, eLog_totals, nullptr);
}
}
- if (mPresContext) {
- const bool mayFlushUserFontSet = false;
- gfxUserFontSet* fs = mPresContext->GetUserFontSet(mayFlushUserFontSet);
- }
#ifdef MOZ_REFLOW_PERF
DumpReflows();
@@ -9409,7 +9405,6 @@ PresShell::ProcessReflowCommands(bool aInterruptible)
return true;
}
- mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
bool interrupted = false;
if (!mDirtyRoots.IsEmpty()) {
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index ccdc3a0ce..3ed3b0bb3 100644
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1774,6 +1774,18 @@ public:
return true;
}
+ /**
+ * The mCallee holds a strong ref to us since the refresh driver doesn't.
+ * Our dtor and mCallee's Destroy() method both call RemoveObserver() -
+ * whichever comes first removes us from the refresh driver.
+ */
+ void RemoveObserver() {
+ if (mCallee) {
+ RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
+ mCallee = nullptr;
+ }
+ }
+
private:
// Private destructor, to discourage deletion outside of Release():
~AsyncSmoothMSDScroll() {
@@ -1786,17 +1798,6 @@ private:
return aCallee->mOuter->PresContext()->RefreshDriver();
}
- /*
- * The refresh driver doesn't hold a reference to its observers,
- * so releasing this object can (and is) used to remove the observer on DTOR.
- * Currently, this object is released once the scrolling ends.
- */
- void RemoveObserver() {
- if (mCallee) {
- RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
- }
- }
-
mozilla::layers::AxisPhysicsMSDModel mXAxisModel, mYAxisModel;
nsRect mRange;
mozilla::TimeStamp mLastRefreshTime;
@@ -1875,24 +1876,25 @@ public:
ScrollFrameHelper::AsyncScrollCallback(mCallee, aTime);
}
-private:
- ScrollFrameHelper *mCallee;
-
- nsRefreshDriver* RefreshDriver(ScrollFrameHelper* aCallee) {
- return aCallee->mOuter->PresContext()->RefreshDriver();
- }
-
- /*
- * The refresh driver doesn't hold a reference to its observers,
- * so releasing this object can (and is) used to remove the observer on DTOR.
- * Currently, this object is released once the scrolling ends.
+ /**
+ * The mCallee holds a strong ref to us since the refresh driver doesn't.
+ * Our dtor and mCallee's Destroy() method both call RemoveObserver() -
+ * whichever comes first removes us from the refresh driver.
*/
void RemoveObserver() {
if (mCallee) {
RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
APZCCallbackHelper::SuppressDisplayport(false, mCallee->mOuter->PresContext()->PresShell());
+ mCallee = nullptr;
}
}
+
+private:
+ ScrollFrameHelper *mCallee;
+
+ nsRefreshDriver* RefreshDriver(ScrollFrameHelper* aCallee) {
+ return aCallee->mOuter->PresContext()->RefreshDriver();
+ }
};
/*
@@ -2150,8 +2152,7 @@ void
ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin)
{
// Apply desired destination range since this is the last step of scrolling.
- mAsyncSmoothMSDScroll = nullptr;
- mAsyncScroll = nullptr;
+ RemoveObservers();
nsWeakFrame weakFrame(mOuter);
ScrollToImpl(mDestination, aRange, aOrigin);
if (!weakFrame.IsAlive()) {
@@ -4586,6 +4587,20 @@ ScrollFrameHelper::Destroy()
mScrollActivityTimer->Cancel();
mScrollActivityTimer = nullptr;
}
+ RemoveObservers();
+}
+
+void
+ScrollFrameHelper::RemoveObservers()
+{
+ if (mAsyncScroll) {
+ mAsyncScroll->RemoveObserver();
+ mAsyncScroll = nullptr;
+ }
+ if (mAsyncSmoothMSDScroll) {
+ mAsyncSmoothMSDScroll->RemoveObserver();
+ mAsyncSmoothMSDScroll = nullptr;
+ }
}
/**
diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h
index f1ef44ae8..81bbb358f 100644
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -638,6 +638,9 @@ protected:
bool HasBgAttachmentLocal() const;
uint8_t GetScrolledFrameDir() const;
+ // Removes any RefreshDriver observers we might have registered.
+ void RemoveObservers();
+
static void EnsureFrameVisPrefsCached();
static bool sFrameVisPrefsCached;
// The number of scrollports wide/high to expand when tracking frame visibility.
diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp
index 8f117b5ab..fbd61f783 100644
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -3714,8 +3714,11 @@ MeasuringReflow(nsIFrame* aChild,
parent->Properties().Set(
nsContainerFrame::DebugReflowingWithInfiniteISize(), true);
#endif
- uint32_t riFlags = ReflowInput::COMPUTE_SIZE_SHRINK_WRAP |
- ReflowInput::COMPUTE_SIZE_USE_AUTO_BSIZE;
+ auto wm = aChild->GetWritingMode();
+ uint32_t riFlags = ReflowInput::COMPUTE_SIZE_USE_AUTO_BSIZE;
+ if (aAvailableSize.ISize(wm) == INFINITE_ISIZE_COORD) {
+ riFlags |= ReflowInput::COMPUTE_SIZE_SHRINK_WRAP;
+ }
if (aIMinSizeClamp != NS_MAXSIZE) {
riFlags |= ReflowInput::I_CLAMP_MARGIN_BOX_MIN_SIZE;
}
@@ -3730,7 +3733,6 @@ MeasuringReflow(nsIFrame* aChild,
ReflowOutput childSize(childRI);
nsReflowStatus childStatus;
const uint32_t flags = NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_SIZE_VIEW;
- WritingMode wm = childRI.GetWritingMode();
parent->ReflowChild(aChild, pc, childSize, childRI, wm,
LogicalPoint(wm), nsSize(), flags, childStatus);
parent->FinishReflowChild(aChild, pc, childSize, &childRI, wm,
diff --git a/layout/reftests/css-grid/bug1349571-ref.html b/layout/reftests/css-grid/bug1349571-ref.html
new file mode 100644
index 000000000..42efd731a
--- /dev/null
+++ b/layout/reftests/css-grid/bug1349571-ref.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta charset="utf-8">
+ <title>Testcase for bug 1349571</title>
+ <style type="text/css">
+html,body {
+ color:black; background-color:white; font:16px/1 monospace; padding:0; margin:0;
+}
+
+.container {
+ display: grid;
+ grid: 250px / 500px;
+ border: 3px solid;
+ width: 500px;
+}
+
+.responsive-container {
+ background: lightgrey;
+}
+
+ </style>
+<script>try {
+(function() {
+ var target = 'blur';
+ if ( target === '' || target === '{{1}}' ) { return; }
+ var needle = 'mz_str', reText = '.?';
+ if ( needle !== '' && needle !== '{{2}}' ) {
+ reText = /^\/.+\/$/.test(needle)
+ ? needle.slice(1,-1)
+ : needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ var re = new RegExp(reText);
+ var chain = target.split('.');
+ var owner = window, prop;
+ for (;;) {
+ prop = chain.shift();
+ if ( chain.length === 0 ) { break; }
+ owner = owner[prop];
+ if ( owner instanceof Object === false ) { return; }
+ }
+ var desc = Object.getOwnPropertyDescriptor(owner, prop);
+ if ( desc && desc.get !== undefined ) { return; }
+ var magic = String.fromCharCode(Date.now() % 26 + 97) +
+ Math.floor(Math.random() * 982451653 + 982451653).toString(36);
+ var value = owner[prop];
+ var validate = function() {
+ var e = document.currentScript;
+ if ( e instanceof HTMLScriptElement && e.src === '' && re.test(e.textContent) ) {
+ throw new ReferenceError(magic);
+ }
+ };
+ Object.defineProperty(owner, prop, {
+ get: function() {
+ validate();
+ return value;
+ },
+ set: function(a) {
+ validate();
+ value = a;
+ }
+ });
+ var oe = window.onerror;
+ window.onerror = function(msg) {
+ if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) {
+ return true;
+ }
+ if ( oe instanceof Function ) {
+ return oe.apply(this, arguments);
+ }
+ }.bind();
+})();
+} catch ( e ) { }
+(function() {
+ var c = document.currentScript, p = c && c.parentNode;
+ if ( p ) { p.removeChild(c); }
+})();</script></head>
+<body>
+
+<div class="container">
+ <div class="responsive-container"></div>
+</div>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/layout/reftests/css-grid/bug1349571.html b/layout/reftests/css-grid/bug1349571.html
new file mode 100644
index 000000000..f836fe36e
--- /dev/null
+++ b/layout/reftests/css-grid/bug1349571.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta charset="utf-8">
+ <title>Testcase for bug 1349571</title>
+ <style type="text/css">
+html,body {
+ color:black; background-color:white; font:16px/1 monospace; padding:0; margin:0;
+}
+
+.container {
+ display: grid;
+ grid-template-columns: 1fr;
+ border: 3px solid;
+ width: 500px;
+}
+
+.responsive-container {
+ padding-bottom: 50%;
+ height: 0;
+ background: lightgrey;
+}
+
+ </style>
+<script>try {
+(function() {
+ var target = 'blur';
+ if ( target === '' || target === '{{1}}' ) { return; }
+ var needle = 'mz_str', reText = '.?';
+ if ( needle !== '' && needle !== '{{2}}' ) {
+ reText = /^\/.+\/$/.test(needle)
+ ? needle.slice(1,-1)
+ : needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ var re = new RegExp(reText);
+ var chain = target.split('.');
+ var owner = window, prop;
+ for (;;) {
+ prop = chain.shift();
+ if ( chain.length === 0 ) { break; }
+ owner = owner[prop];
+ if ( owner instanceof Object === false ) { return; }
+ }
+ var desc = Object.getOwnPropertyDescriptor(owner, prop);
+ if ( desc && desc.get !== undefined ) { return; }
+ var magic = String.fromCharCode(Date.now() % 26 + 97) +
+ Math.floor(Math.random() * 982451653 + 982451653).toString(36);
+ var value = owner[prop];
+ var validate = function() {
+ var e = document.currentScript;
+ if ( e instanceof HTMLScriptElement && e.src === '' && re.test(e.textContent) ) {
+ throw new ReferenceError(magic);
+ }
+ };
+ Object.defineProperty(owner, prop, {
+ get: function() {
+ validate();
+ return value;
+ },
+ set: function(a) {
+ validate();
+ value = a;
+ }
+ });
+ var oe = window.onerror;
+ window.onerror = function(msg) {
+ if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) {
+ return true;
+ }
+ if ( oe instanceof Function ) {
+ return oe.apply(this, arguments);
+ }
+ }.bind();
+})();
+} catch ( e ) { }
+(function() {
+ var c = document.currentScript, p = c && c.parentNode;
+ if ( p ) { p.removeChild(c); }
+})();</script></head>
+<body>
+
+<div class="container">
+ <div>
+ <div class="responsive-container"></div>
+ </div>
+</div>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/layout/reftests/css-grid/bug1356820-ref.html b/layout/reftests/css-grid/bug1356820-ref.html
new file mode 100644
index 000000000..b203ba203
--- /dev/null
+++ b/layout/reftests/css-grid/bug1356820-ref.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><script>try {
+(function() {
+ var target = 'blur';
+ if ( target === '' || target === '{{1}}' ) { return; }
+ var needle = 'mz_str', reText = '.?';
+ if ( needle !== '' && needle !== '{{2}}' ) {
+ reText = /^\/.+\/$/.test(needle)
+ ? needle.slice(1,-1)
+ : needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ var re = new RegExp(reText);
+ var chain = target.split('.');
+ var owner = window, prop;
+ for (;;) {
+ prop = chain.shift();
+ if ( chain.length === 0 ) { break; }
+ owner = owner[prop];
+ if ( owner instanceof Object === false ) { return; }
+ }
+ var desc = Object.getOwnPropertyDescriptor(owner, prop);
+ if ( desc && desc.get !== undefined ) { return; }
+ var magic = String.fromCharCode(Date.now() % 26 + 97) +
+ Math.floor(Math.random() * 982451653 + 982451653).toString(36);
+ var value = owner[prop];
+ var validate = function() {
+ var e = document.currentScript;
+ if ( e instanceof HTMLScriptElement && e.src === '' && re.test(e.textContent) ) {
+ throw new ReferenceError(magic);
+ }
+ };
+ Object.defineProperty(owner, prop, {
+ get: function() {
+ validate();
+ return value;
+ },
+ set: function(a) {
+ validate();
+ value = a;
+ }
+ });
+ var oe = window.onerror;
+ window.onerror = function(msg) {
+ if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) {
+ return true;
+ }
+ if ( oe instanceof Function ) {
+ return oe.apply(this, arguments);
+ }
+ }.bind();
+})();
+} catch ( e ) { }
+(function() {
+ var c = document.currentScript, p = c && c.parentNode;
+ if ( p ) { p.removeChild(c); }
+})();</script></head><body><div style="display: grid; width: 5em;">
+ <div style="word-wrap: break-word; width: 5em; justify-self:start">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+<div style="display: grid; width: 5em;">
+ <div style="width: 5em; justify-self:start">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+<div style="display: grid; width: 5em;">
+ <div style="word-wrap: break-word; writing-mode:vertical-lr; justify-self:start">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+</body></html> \ No newline at end of file
diff --git a/layout/reftests/css-grid/bug1356820.html b/layout/reftests/css-grid/bug1356820.html
new file mode 100644
index 000000000..2f2f36014
--- /dev/null
+++ b/layout/reftests/css-grid/bug1356820.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><script>try {
+(function() {
+ var target = 'blur';
+ if ( target === '' || target === '{{1}}' ) { return; }
+ var needle = 'mz_str', reText = '.?';
+ if ( needle !== '' && needle !== '{{2}}' ) {
+ reText = /^\/.+\/$/.test(needle)
+ ? needle.slice(1,-1)
+ : needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ var re = new RegExp(reText);
+ var chain = target.split('.');
+ var owner = window, prop;
+ for (;;) {
+ prop = chain.shift();
+ if ( chain.length === 0 ) { break; }
+ owner = owner[prop];
+ if ( owner instanceof Object === false ) { return; }
+ }
+ var desc = Object.getOwnPropertyDescriptor(owner, prop);
+ if ( desc && desc.get !== undefined ) { return; }
+ var magic = String.fromCharCode(Date.now() % 26 + 97) +
+ Math.floor(Math.random() * 982451653 + 982451653).toString(36);
+ var value = owner[prop];
+ var validate = function() {
+ var e = document.currentScript;
+ if ( e instanceof HTMLScriptElement && e.src === '' && re.test(e.textContent) ) {
+ throw new ReferenceError(magic);
+ }
+ };
+ Object.defineProperty(owner, prop, {
+ get: function() {
+ validate();
+ return value;
+ },
+ set: function(a) {
+ validate();
+ value = a;
+ }
+ });
+ var oe = window.onerror;
+ window.onerror = function(msg) {
+ if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) {
+ return true;
+ }
+ if ( oe instanceof Function ) {
+ return oe.apply(this, arguments);
+ }
+ }.bind();
+})();
+} catch ( e ) { }
+(function() {
+ var c = document.currentScript, p = c && c.parentNode;
+ if ( p ) { p.removeChild(c); }
+})();</script></head><body><div style="display: grid; width: 5em;">
+ <div style="word-wrap: break-word; min-width: 0;">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+<div style="display: grid; width: 5em;">
+ <div style="min-width: 0;">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+<div style="display: grid; width: 5em;">
+ <div style="word-wrap: break-word; min-height: 0; writing-mode:vertical-lr">
+ first item with a longlonglongword
+ </div>
+ <div>
+ second item
+ </div>
+</div>
+</body></html> \ No newline at end of file
diff --git a/layout/reftests/css-grid/reftest.list b/layout/reftests/css-grid/reftest.list
index c2ee57c1a..3087ca49b 100644
--- a/layout/reftests/css-grid/reftest.list
+++ b/layout/reftests/css-grid/reftest.list
@@ -280,3 +280,5 @@ asserts(1-10) == grid-fragmentation-dyn4-021.html grid-fragmentation-021-ref.htm
== grid-fragmentation-dyn2-031.html grid-fragmentation-031-ref.html
== bug1306106.html bug1306106-ref.html
== grid-percent-intrinsic-sizing-001.html grid-percent-intrinsic-sizing-001-ref.html
+== bug1349571.html bug1349571-ref.html
+== bug1356820.html bug1356820-ref.html
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 5030804ed..4c11d2704 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -2681,14 +2681,14 @@ nsTableFrame::GetOuterBCBorder(const WritingMode aWM) const
const_cast<nsTableFrame*>(this)->CalcBCBorders();
}
- int32_t p2t = nsPresContext::AppUnitsPerCSSPixel();
+ int32_t d2a = PresContext()->AppUnitsPerDevPixel();
BCPropertyData* propData = GetBCProperty();
if (propData) {
return LogicalMargin(aWM,
- BC_BORDER_START_HALF_COORD(p2t, propData->mBStartBorderWidth),
- BC_BORDER_END_HALF_COORD(p2t, propData->mIEndBorderWidth),
- BC_BORDER_END_HALF_COORD(p2t, propData->mBEndBorderWidth),
- BC_BORDER_START_HALF_COORD(p2t, propData->mIStartBorderWidth));
+ BC_BORDER_START_HALF_COORD(d2a, propData->mBStartBorderWidth),
+ BC_BORDER_END_HALF_COORD(d2a, propData->mIEndBorderWidth),
+ BC_BORDER_END_HALF_COORD(d2a, propData->mBEndBorderWidth),
+ BC_BORDER_START_HALF_COORD(d2a, propData->mIStartBorderWidth));
}
return LogicalMargin(aWM);
}
@@ -2700,14 +2700,14 @@ nsTableFrame::GetIncludedOuterBCBorder(const WritingMode aWM) const
const_cast<nsTableFrame*>(this)->CalcBCBorders();
}
- int32_t p2t = nsPresContext::AppUnitsPerCSSPixel();
+ int32_t d2a = PresContext()->AppUnitsPerDevPixel();
BCPropertyData* propData = GetBCProperty();
if (propData) {
return LogicalMargin(aWM,
- BC_BORDER_START_HALF_COORD(p2t, propData->mBStartBorderWidth),
- BC_BORDER_END_HALF_COORD(p2t, propData->mIEndCellBorderWidth),
- BC_BORDER_END_HALF_COORD(p2t, propData->mBEndBorderWidth),
- BC_BORDER_START_HALF_COORD(p2t, propData->mIStartCellBorderWidth));
+ BC_BORDER_START_HALF_COORD(d2a, propData->mBStartBorderWidth),
+ BC_BORDER_END_HALF_COORD(d2a, propData->mIEndCellBorderWidth),
+ BC_BORDER_END_HALF_COORD(d2a, propData->mBEndBorderWidth),
+ BC_BORDER_START_HALF_COORD(d2a, propData->mIStartCellBorderWidth));
}
return LogicalMargin(aWM);
}
@@ -4791,7 +4791,7 @@ GetColorAndStyle(const nsIFrame* aFrame,
if (aWidth) {
nscoord width = styleData->GetComputedBorderWidth(physicalSide);
- *aWidth = nsPresContext::AppUnitsToIntCSSPixels(width);
+ *aWidth = aFrame->PresContext()->AppUnitsToDevPixels(width);
}
}
@@ -6476,8 +6476,8 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nscoord rowBSize = rowFrame->BSize(mTableWM);
if (haveIntersect) {
// conservatively estimate the half border widths outside the row
- nscoord borderHalf = mTable->GetPrevInFlow() ? 0 : nsPresContext::
- CSSPixelsToAppUnits(rowFrame->GetBStartBCBorderWidth() + 1);
+ nscoord borderHalf = mTable->GetPrevInFlow() ? 0 :
+ mTable->PresContext()->DevPixelsToAppUnits(rowFrame->GetBStartBCBorderWidth() + 1);
if (dirtyRect.BEnd(mTableWM) >= rowB - borderHalf) {
nsTableRowFrame* fifRow =
static_cast<nsTableRowFrame*>(rowFrame->FirstInFlow());
@@ -6487,8 +6487,8 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
}
else {
// conservatively estimate the half border widths outside the row
- nscoord borderHalf = mTable->GetNextInFlow() ? 0 : nsPresContext::
- CSSPixelsToAppUnits(rowFrame->GetBEndBCBorderWidth() + 1);
+ nscoord borderHalf = mTable->GetNextInFlow() ? 0 :
+ mTable->PresContext()->DevPixelsToAppUnits(rowFrame->GetBEndBCBorderWidth() + 1);
if (rowB + rowBSize + borderHalf >= dirtyRect.BStart(mTableWM)) {
mStartRg = rgFrame;
mStartRow = rowFrame;
@@ -6532,8 +6532,8 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nscoord colISize = colFrame->ISize(mTableWM);
if (haveIntersect) {
// conservatively estimate the iStart half border width outside the col
- nscoord iStartBorderHalf = nsPresContext::
- CSSPixelsToAppUnits(colFrame->GetIStartBorderWidth() + 1);
+ nscoord iStartBorderHalf =
+ mTable->PresContext()->DevPixelsToAppUnits(colFrame->GetIStartBorderWidth() + 1);
if (dirtyRect.IEnd(mTableWM) >= x - iStartBorderHalf) {
endColIndex = colIdx;
}
@@ -6541,8 +6541,8 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
}
else {
// conservatively estimate the iEnd half border width outside the col
- nscoord iEndBorderHalf = nsPresContext::
- CSSPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
+ nscoord iEndBorderHalf =
+ mTable->PresContext()->DevPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
if (x + colISize + iEndBorderHalf >= dirtyRect.IStart(mTableWM)) {
startColIndex = endColIndex = colIdx;
haveIntersect = true;
@@ -6785,7 +6785,8 @@ CalcVerCornerOffset(LogicalSide aCornerOwnerSide,
BCPixelSize aCornerSubWidth,
BCPixelSize aHorWidth,
bool aIsStartOfSeg,
- bool aIsBevel)
+ bool aIsBevel,
+ nsPresContext* aPresContext)
{
nscoord offset = 0;
// XXX These should be replaced with appropriate side-specific macros (which?)
@@ -6808,7 +6809,7 @@ CalcVerCornerOffset(LogicalSide aCornerOwnerSide,
offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
}
}
- return nsPresContext::CSSPixelsToAppUnits(offset);
+ return aPresContext->DevPixelsToAppUnits(offset);
}
/** Compute the horizontal offset of a horizontal border segment
@@ -6824,7 +6825,8 @@ CalcHorCornerOffset(LogicalSide aCornerOwnerSide,
BCPixelSize aCornerSubWidth,
BCPixelSize aVerWidth,
bool aIsStartOfSeg,
- bool aIsBevel)
+ bool aIsBevel,
+ nsPresContext* aPresContext)
{
nscoord offset = 0;
// XXX These should be replaced with appropriate side-specific macros (which?)
@@ -6847,7 +6849,7 @@ CalcHorCornerOffset(LogicalSide aCornerOwnerSide,
offset = (aIsStartOfSeg) ? smallHalf : -largeHalf;
}
}
- return nsPresContext::CSSPixelsToAppUnits(offset);
+ return aPresContext->DevPixelsToAppUnits(offset);
}
BCBlockDirSeg::BCBlockDirSeg()
@@ -6883,10 +6885,10 @@ BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
BCPixelSize maxInlineSegBSize = std::max(aIter.mPrevInlineSegBSize, aInlineSegBSize);
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
maxInlineSegBSize, true,
- bStartBevel);
+ bStartBevel, aIter.mTable->PresContext());
mBStartBevelOffset = bStartBevel ?
- nsPresContext::CSSPixelsToAppUnits(maxInlineSegBSize): 0;
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(maxInlineSegBSize): 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mBStartBevelSide = (aInlineSegBSize > 0) ? eLogicalSideIEnd : eLogicalSideIStart;
mOffsetB += offset;
@@ -6944,8 +6946,8 @@ BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
mIsBEndBevel = (mWidth > 0) ? bevel : false;
mBEndInlineSegBSize = std::max(aIter.mPrevInlineSegBSize, aInlineSegBSize);
mBEndOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
- mBEndInlineSegBSize,
- false, mIsBEndBevel);
+ mBEndInlineSegBSize, false,
+ mIsBEndBevel, aIter.mTable->PresContext());
mLength += mBEndOffset;
}
@@ -7029,11 +7031,11 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
BCPixelSize smallHalf, largeHalf;
DivideBCBorderSize(mWidth, smallHalf, largeHalf);
LogicalRect segRect(aIter.mTableWM,
- mOffsetI - nsPresContext::CSSPixelsToAppUnits(largeHalf),
+ mOffsetI - aIter.mTable->PresContext()->DevPixelsToAppUnits(largeHalf),
mOffsetB,
- nsPresContext::CSSPixelsToAppUnits(mWidth), mLength);
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(mWidth), mLength);
nscoord bEndBevelOffset = (mIsBEndBevel) ?
- nsPresContext::CSSPixelsToAppUnits(mBEndInlineSegBSize) : 0;
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(mBEndInlineSegBSize) : 0;
LogicalSide bEndBevelSide =
(aInlineSegBSize > 0) ? eLogicalSideIEnd : eLogicalSideIStart;
@@ -7067,7 +7069,7 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
nsCSSRendering::DrawTableBorderSegment(aDrawTarget, style, color,
aIter.mTableBgColor, physicalRect,
appUnitsPerDevPixel,
- nsPresContext::AppUnitsPerCSSPixel(),
+ aIter.mTable->PresContext()->AppUnitsPerDevPixel(),
startBevelSide, startBevelOffset,
endBevelSide, endBevelOffset);
}
@@ -7123,7 +7125,8 @@ BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
nscoord maxBlockSegISize = std::max(aIter.mBlockDirInfo[relColIndex].mWidth,
aBEndBlockSegISize);
nscoord offset = CalcHorCornerOffset(cornerOwnerSide, cornerSubWidth,
- maxBlockSegISize, true, iStartBevel);
+ maxBlockSegISize, true, iStartBevel,
+ aIter.mTable->PresContext());
mIStartBevelOffset = (iStartBevel && (aInlineSegBSize > 0)) ? maxBlockSegISize : 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mIStartBevelSide = (aBEndBlockSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
@@ -7157,10 +7160,10 @@ BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
nscoord verWidth = std::max(aIter.mBlockDirInfo[relColIndex].mWidth,
aIStartSegISize);
mEndOffset = CalcHorCornerOffset(ownerSide, cornerSubWidth, verWidth,
- false, mIsIEndBevel);
+ false, mIsIEndBevel, aIter.mTable->PresContext());
mLength += mEndOffset;
mIEndBevelOffset = (mIsIEndBevel) ?
- nsPresContext::CSSPixelsToAppUnits(verWidth) : 0;
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(verWidth) : 0;
mIEndBevelSide = (aIStartSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
}
@@ -7240,9 +7243,9 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget)
BCPixelSize smallHalf, largeHalf;
DivideBCBorderSize(mWidth, smallHalf, largeHalf);
LogicalRect segRect(aIter.mTableWM, mOffsetI,
- mOffsetB - nsPresContext::CSSPixelsToAppUnits(largeHalf),
+ mOffsetB - aIter.mTable->PresContext()->DevPixelsToAppUnits(largeHalf),
mLength,
- nsPresContext::CSSPixelsToAppUnits(mWidth));
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(mWidth));
// Convert logical to physical sides/coordinates for DrawTableBorderSegment.
nsRect physicalRect = segRect.GetPhysicalRect(aIter.mTableWM,
@@ -7250,7 +7253,7 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget)
uint8_t startBevelSide = aIter.mTableWM.PhysicalSide(mIStartBevelSide);
uint8_t endBevelSide = aIter.mTableWM.PhysicalSide(mIEndBevelSide);
nscoord startBevelOffset =
- nsPresContext::CSSPixelsToAppUnits(mIStartBevelOffset);
+ aIter.mTable->PresContext()->DevPixelsToAppUnits(mIStartBevelOffset);
nscoord endBevelOffset = mIEndBevelOffset;
// With inline-RTL directionality, the 'start' and 'end' of the inline-dir
// border segment need to be swapped because DrawTableBorderSegment will
@@ -7271,7 +7274,7 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter, DrawTarget& aDrawTarget)
nsCSSRendering::DrawTableBorderSegment(aDrawTarget, style, color,
aIter.mTableBgColor, physicalRect,
appUnitsPerDevPixel,
- nsPresContext::AppUnitsPerCSSPixel(),
+ aIter.mTable->PresContext()->AppUnitsPerDevPixel(),
startBevelSide, startBevelOffset,
endBevelSide, endBevelOffset);
}