mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 14:54:25 +00:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
@@ -80,7 +80,7 @@ StyleInfo::TextIndent(nsAString& aValue)
|
||||
}
|
||||
|
||||
void
|
||||
StyleInfo::Margin(css::Side aSide, nsAString& aValue)
|
||||
StyleInfo::Margin(Side aSide, nsAString& aValue)
|
||||
{
|
||||
MOZ_ASSERT(mElement->GetPrimaryFrame(), " mElement->GetPrimaryFrame() needs to be valid pointer");
|
||||
aValue.Truncate();
|
||||
|
||||
@@ -209,6 +209,9 @@ SplitView.prototype = {
|
||||
this._nav.appendChild(aSummary);
|
||||
|
||||
aSummary.addEventListener("click", (aEvent) => {
|
||||
if (aEvent.button != 0) {
|
||||
return;
|
||||
}
|
||||
aEvent.stopPropagation();
|
||||
this.activeSummary = aSummary;
|
||||
}, false);
|
||||
|
||||
@@ -97,6 +97,9 @@ AutocompletePopup.prototype = {
|
||||
},
|
||||
|
||||
onClick: function (e) {
|
||||
if (e.button != 0) {
|
||||
return;
|
||||
}
|
||||
let item = e.target.closest(".autocomplete-item");
|
||||
if (item && typeof item.dataset.index !== "undefined") {
|
||||
this.selectedIndex = parseInt(item.dataset.index, 10);
|
||||
|
||||
@@ -240,6 +240,9 @@ Spectrum.prototype = {
|
||||
},
|
||||
|
||||
onElementClick: function (e) {
|
||||
if (e.button != 0) {
|
||||
return;
|
||||
}
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
|
||||
@@ -1480,6 +1480,9 @@ Column.prototype = {
|
||||
* for sorting.
|
||||
*/
|
||||
onClick: function (event) {
|
||||
if (event.button != 0) {
|
||||
return;
|
||||
}
|
||||
let target = event.originalTarget;
|
||||
|
||||
if (target.nodeType !== target.ELEMENT_NODE || target == this.column) {
|
||||
|
||||
@@ -174,7 +174,10 @@ StyleEditorUI.prototype = {
|
||||
|
||||
this._view = new SplitView(viewRoot);
|
||||
|
||||
wire(this._view.rootElement, ".style-editor-newButton", () =>{
|
||||
wire(this._view.rootElement, ".style-editor-newButton", (e) =>{
|
||||
if (e.button != 0) {
|
||||
return;
|
||||
}
|
||||
this._debuggee.addStyleSheet(null);
|
||||
});
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
||||
|
||||
nsMargin rootMargin;
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
nscoord basis = side == NS_SIDE_TOP || side == NS_SIDE_BOTTOM ?
|
||||
nscoord basis = side == eSideTop || side == eSideBottom ?
|
||||
rootRect.height : rootRect.width;
|
||||
nsCSSValue value = mRootMargin.*nsCSSRect::sides[side];
|
||||
nsStyleCoord coord;
|
||||
|
||||
@@ -7270,11 +7270,6 @@ nsDocument::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
aVisitor.mCanHandle = true;
|
||||
// Middle/right click shouldn't dispatch click event, use auxclick to instead.
|
||||
Element* docElement = GetRootElement();
|
||||
if (docElement && docElement->IsXULElement()) {
|
||||
// FIXME! This is a hack to make middle mouse paste working also in Editor.
|
||||
// Bug 329119
|
||||
aVisitor.mForceContentDispatch = true;
|
||||
}
|
||||
|
||||
// Load events must not propagate to |window| object, see bug 335251.
|
||||
if (aVisitor.mEvent->mMessage != eLoad) {
|
||||
|
||||
@@ -3549,12 +3549,6 @@ nsGlobalWindow::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
|
||||
aVisitor.mCanHandle = true;
|
||||
// Middle/right click shouldn't dispatch click event, use auxclick to instead.
|
||||
// Note: mDoc should always exist here, but check just in case someone yanked
|
||||
// it out from under us.
|
||||
if (mDoc && mDoc->IsXULDocument()) {
|
||||
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
|
||||
}
|
||||
if (msg == eResize && aVisitor.mEvent->IsTrusted()) {
|
||||
// QIing to window so that we can keep the old behavior also in case
|
||||
// a child window is handling resize.
|
||||
|
||||
@@ -252,7 +252,6 @@ nsInProcessTabChildGlobal::GetOwnerContent()
|
||||
nsresult
|
||||
nsInProcessTabChildGlobal::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mForceContentDispatch = true;
|
||||
aVisitor.mCanHandle = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -182,7 +182,6 @@ nsresult
|
||||
nsWindowRoot::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = true;
|
||||
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
|
||||
// To keep mWindow alive
|
||||
aVisitor.mItemData = static_cast<nsISupports *>(mWindow);
|
||||
aVisitor.SetParentTarget(mParent, false);
|
||||
|
||||
@@ -214,16 +214,6 @@ public:
|
||||
mRetargetedRelatedTarget = aTarget;
|
||||
}
|
||||
|
||||
void SetForceContentDispatch(bool aForce)
|
||||
{
|
||||
mFlags.mForceContentDispatch = aForce;
|
||||
}
|
||||
|
||||
bool ForceContentDispatch()
|
||||
{
|
||||
return mFlags.mForceContentDispatch;
|
||||
}
|
||||
|
||||
void SetWantsWillHandleEvent(bool aWants)
|
||||
{
|
||||
mFlags.mWantsWillHandleEvent = aWants;
|
||||
@@ -387,7 +377,6 @@ private:
|
||||
// Cached flags for each EventTargetChainItem which are set when calling
|
||||
// GetEventTargetParent to create event target chain. They are used to
|
||||
// manage or speedup event dispatching.
|
||||
bool mForceContentDispatch : 1;
|
||||
bool mWantsWillHandleEvent : 1;
|
||||
bool mMayHaveManager : 1;
|
||||
bool mChechedIfChrome : 1;
|
||||
@@ -439,7 +428,6 @@ EventTargetChainItem::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.Reset();
|
||||
Unused << mTarget->GetEventTargetParent(aVisitor);
|
||||
SetForceContentDispatch(aVisitor.mForceContentDispatch);
|
||||
SetWantsWillHandleEvent(aVisitor.mWantsWillHandleEvent);
|
||||
SetMayHaveListenerManager(aVisitor.mMayHaveListenerManager);
|
||||
SetWantsPreHandleEvent(aVisitor.mWantsPreHandleEvent);
|
||||
@@ -492,9 +480,7 @@ EventTargetChainItem::HandleEventTargetChain(
|
||||
if (item.PreHandleEventOnly()) {
|
||||
continue;
|
||||
}
|
||||
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
|
||||
item.ForceContentDispatch()) &&
|
||||
!aVisitor.mEvent->PropagationStopped()) {
|
||||
if (!aVisitor.mEvent->PropagationStopped()) {
|
||||
item.HandleEvent(aVisitor, aCd);
|
||||
}
|
||||
|
||||
@@ -538,9 +524,7 @@ EventTargetChainItem::HandleEventTargetChain(
|
||||
// Target
|
||||
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
|
||||
EventTargetChainItem& targetItem = aChain[firstCanHandleEventTargetIdx];
|
||||
if (!aVisitor.mEvent->PropagationStopped() &&
|
||||
(!aVisitor.mEvent->mFlags.mNoContentDispatch ||
|
||||
targetItem.ForceContentDispatch())) {
|
||||
if (!aVisitor.mEvent->PropagationStopped()) {
|
||||
targetItem.HandleEvent(aVisitor, aCd);
|
||||
}
|
||||
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
|
||||
@@ -570,9 +554,7 @@ EventTargetChainItem::HandleEventTargetChain(
|
||||
}
|
||||
|
||||
if (aVisitor.mEvent->mFlags.mBubbles || newTarget) {
|
||||
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
|
||||
item.ForceContentDispatch()) &&
|
||||
!aVisitor.mEvent->PropagationStopped()) {
|
||||
if (!aVisitor.mEvent->PropagationStopped()) {
|
||||
item.HandleEvent(aVisitor, aCd);
|
||||
}
|
||||
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
|
||||
|
||||
@@ -118,7 +118,6 @@ public:
|
||||
: EventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus)
|
||||
, mCanHandle(true)
|
||||
, mAutomaticChromeDispatch(true)
|
||||
, mForceContentDispatch(false)
|
||||
, mRelatedTargetIsInAnon(false)
|
||||
, mOriginalTargetIsInAnon(aIsInAnon)
|
||||
, mWantsWillHandleEvent(false)
|
||||
@@ -143,7 +142,6 @@ public:
|
||||
mItemData = nullptr;
|
||||
mCanHandle = true;
|
||||
mAutomaticChromeDispatch = true;
|
||||
mForceContentDispatch = false;
|
||||
mWantsWillHandleEvent = false;
|
||||
mMayHaveListenerManager = true;
|
||||
mWantsPreHandleEvent = false;
|
||||
@@ -195,13 +193,6 @@ public:
|
||||
*/
|
||||
bool mAutomaticChromeDispatch;
|
||||
|
||||
/**
|
||||
* If mForceContentDispatch is set to true,
|
||||
* content dispatching is not disabled for this event target.
|
||||
* FIXME! This is here for backward compatibility. Bug 329119
|
||||
*/
|
||||
bool mForceContentDispatch;
|
||||
|
||||
/**
|
||||
* true if it is known that related target is or is a descendant of an
|
||||
* element which is anonymous for events.
|
||||
|
||||
@@ -4668,7 +4668,7 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aMouseUpEvent,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIContent* aMouseUpContent,
|
||||
nsWeakFrame aCurrentTarget,
|
||||
bool aNoContentDispatch)
|
||||
bool aOnlyChromeDispatch)
|
||||
{
|
||||
MOZ_ASSERT(aMouseUpEvent);
|
||||
MOZ_ASSERT(EventCausesClickEvents(*aMouseUpEvent));
|
||||
@@ -4682,8 +4682,7 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aMouseUpEvent,
|
||||
event.buttons = aMouseUpEvent->buttons;
|
||||
event.mTime = aMouseUpEvent->mTime;
|
||||
event.mTimeStamp = aMouseUpEvent->mTimeStamp;
|
||||
event.mFlags.mOnlyChromeDispatch = aNoContentDispatch;
|
||||
event.mFlags.mNoContentDispatch = aNoContentDispatch;
|
||||
event.mFlags.mOnlyChromeDispatch = aOnlyChromeDispatch;
|
||||
event.button = aMouseUpEvent->button;
|
||||
event.inputSource = aMouseUpEvent->inputSource;
|
||||
|
||||
@@ -4750,41 +4749,41 @@ EventStateManager::DispatchClickEvents(nsIPresShell* aPresShell,
|
||||
MOZ_ASSERT(aStatus);
|
||||
MOZ_ASSERT(aClickTarget);
|
||||
|
||||
bool notDispatchToContents =
|
||||
bool onlyDispatchInChrome =
|
||||
(aMouseUpEvent->button == WidgetMouseEvent::eMiddleButton ||
|
||||
aMouseUpEvent->button == WidgetMouseEvent::eRightButton);
|
||||
|
||||
bool fireAuxClick = notDispatchToContents;
|
||||
bool fireAuxClick = onlyDispatchInChrome;
|
||||
|
||||
nsWeakFrame currentTarget = aClickTarget->GetPrimaryFrame();
|
||||
nsresult ret =
|
||||
nsresult rv =
|
||||
InitAndDispatchClickEvent(aMouseUpEvent, aStatus, eMouseClick,
|
||||
aPresShell, aClickTarget, currentTarget,
|
||||
notDispatchToContents);
|
||||
if (NS_WARN_IF(NS_FAILED(ret))) {
|
||||
return ret;
|
||||
onlyDispatchInChrome);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Fire auxclick even if necessary.
|
||||
if (fireAuxClick && aClickTarget && aClickTarget->IsInComposedDoc()) {
|
||||
ret = InitAndDispatchClickEvent(aMouseUpEvent, aStatus, eMouseAuxClick,
|
||||
rv = InitAndDispatchClickEvent(aMouseUpEvent, aStatus, eMouseAuxClick,
|
||||
aPresShell, aClickTarget, currentTarget,
|
||||
false);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(ret), "Failed to dispatch eMouseAuxClick");
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to dispatch eMouseAuxClick");
|
||||
}
|
||||
|
||||
// Fire double click event if click count is 2.
|
||||
if (aMouseUpEvent->mClickCount == 2 && !fireAuxClick &&
|
||||
aClickTarget && aClickTarget->IsInComposedDoc()) {
|
||||
ret = InitAndDispatchClickEvent(aMouseUpEvent, aStatus, eMouseDoubleClick,
|
||||
rv = InitAndDispatchClickEvent(aMouseUpEvent, aStatus, eMouseDoubleClick,
|
||||
aPresShell, aClickTarget, currentTarget,
|
||||
notDispatchToContents);
|
||||
if (NS_WARN_IF(NS_FAILED(ret))) {
|
||||
return ret;
|
||||
onlyDispatchInChrome);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
||||
@@ -340,8 +340,8 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
|
||||
if (parent &&
|
||||
parent->StylePosition()->mBoxSizing != StyleBoxSizing::Border) {
|
||||
const nsStyleBorder* border = parent->StyleBorder();
|
||||
origin.x -= border->GetComputedBorderWidth(NS_SIDE_LEFT);
|
||||
origin.y -= border->GetComputedBorderWidth(NS_SIDE_TOP);
|
||||
origin.x -= border->GetComputedBorderWidth(eSideLeft);
|
||||
origin.y -= border->GetComputedBorderWidth(eSideTop);
|
||||
}
|
||||
|
||||
// XXX We should really consider subtracting out padding for
|
||||
|
||||
@@ -136,7 +136,6 @@ public:
|
||||
nsresult
|
||||
GetEventTargetParent(EventChainPreVisitor& aVisitor) override
|
||||
{
|
||||
aVisitor.mForceContentDispatch = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
/* 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/.
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 03/27/2000 IBM Corp. Added PR_CALLBACK for Optlink
|
||||
* use in OS2
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
@@ -1299,7 +1287,6 @@ nsXULElement::DispatchXULCommand(const EventChainVisitor& aVisitor,
|
||||
nsresult
|
||||
nsXULElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
|
||||
if (IsEventStoppedFromAnonymousScrollbar(aVisitor.mEvent->mMessage)) {
|
||||
// Don't propagate these events from native anonymous scrollbar.
|
||||
aVisitor.mCanHandle = true;
|
||||
|
||||
+17
-17
@@ -383,30 +383,30 @@ struct BaseRect {
|
||||
Point TopRight() const { return Point(XMost(), y); }
|
||||
Point BottomLeft() const { return Point(x, YMost()); }
|
||||
Point BottomRight() const { return Point(XMost(), YMost()); }
|
||||
Point AtCorner(int aCorner) const {
|
||||
Point AtCorner(Corner aCorner) const {
|
||||
switch (aCorner) {
|
||||
case RectCorner::TopLeft: return TopLeft();
|
||||
case RectCorner::TopRight: return TopRight();
|
||||
case RectCorner::BottomRight: return BottomRight();
|
||||
case RectCorner::BottomLeft: return BottomLeft();
|
||||
case eCornerTopLeft: return TopLeft();
|
||||
case eCornerTopRight: return TopRight();
|
||||
case eCornerBottomRight: return BottomRight();
|
||||
case eCornerBottomLeft: return BottomLeft();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
Point CCWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopLeft();
|
||||
case NS_SIDE_RIGHT: return TopRight();
|
||||
case NS_SIDE_BOTTOM: return BottomRight();
|
||||
case NS_SIDE_LEFT: return BottomLeft();
|
||||
case eSideTop: return TopLeft();
|
||||
case eSideRight: return TopRight();
|
||||
case eSideBottom: return BottomRight();
|
||||
case eSideLeft: return BottomLeft();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
Point CWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopRight();
|
||||
case NS_SIDE_RIGHT: return BottomRight();
|
||||
case NS_SIDE_BOTTOM: return BottomLeft();
|
||||
case NS_SIDE_LEFT: return TopLeft();
|
||||
case eSideTop: return TopRight();
|
||||
case eSideRight: return BottomRight();
|
||||
case eSideBottom: return BottomLeft();
|
||||
case eSideLeft: return TopLeft();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
@@ -427,10 +427,10 @@ struct BaseRect {
|
||||
T Edge(mozilla::Side aSide) const
|
||||
{
|
||||
switch (aSide) {
|
||||
case NS_SIDE_TOP: return Y();
|
||||
case NS_SIDE_RIGHT: return XMost();
|
||||
case NS_SIDE_BOTTOM: return YMost();
|
||||
case NS_SIDE_LEFT: return X();
|
||||
case eSideTop: return Y();
|
||||
case eSideRight: return XMost();
|
||||
case eSideBottom: return YMost();
|
||||
case eSideLeft: return X();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ FindBezierNearestPoint(const Bezier& aBezier, const Point& aTarget,
|
||||
}
|
||||
|
||||
void
|
||||
GetBezierPointsForCorner(Bezier* aBezier, mozilla::css::Corner aCorner,
|
||||
GetBezierPointsForCorner(Bezier* aBezier, mozilla::Corner aCorner,
|
||||
const Point& aCornerPoint, const Size& aCornerSize)
|
||||
{
|
||||
// Calculate bezier control points for elliptic arc.
|
||||
|
||||
@@ -127,7 +127,7 @@ Point FindBezierNearestPoint(const Bezier& aBezier, const Point& aTarget,
|
||||
// | |
|
||||
// v mPoints[0] |
|
||||
// -------------+
|
||||
void GetBezierPointsForCorner(Bezier* aBezier, mozilla::css::Corner aCorner,
|
||||
void GetBezierPointsForCorner(Bezier* aBezier, mozilla::Corner aCorner,
|
||||
const Point& aCornerPoint,
|
||||
const Size& aCornerSize);
|
||||
|
||||
|
||||
@@ -125,10 +125,10 @@ AppendRoundedRectToPath(PathBuilder* aPathBuilder,
|
||||
Point pc, p0, p1, p2, p3;
|
||||
|
||||
if (aDrawClockwise) {
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aRadii[RectCorner::TopLeft].width,
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aRadii[eCornerTopLeft].width,
|
||||
aRect.Y()));
|
||||
} else {
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aRect.Width() - aRadii[RectCorner::TopRight].width,
|
||||
aPathBuilder->MoveTo(Point(aRect.X() + aRect.Width() - aRadii[eCornerTopRight].width,
|
||||
aRect.Y()));
|
||||
}
|
||||
|
||||
|
||||
+27
-30
@@ -178,35 +178,35 @@ inline already_AddRefed<Path> MakePathForRect(const DrawTarget& aDrawTarget,
|
||||
}
|
||||
|
||||
struct RectCornerRadii {
|
||||
Size radii[RectCorner::Count];
|
||||
Size radii[eCornerCount];
|
||||
|
||||
RectCornerRadii() {}
|
||||
|
||||
explicit RectCornerRadii(Float radius) {
|
||||
for (int i = 0; i < RectCorner::Count; i++) {
|
||||
NS_FOR_CSS_FULL_CORNERS(i) {
|
||||
radii[i].SizeTo(radius, radius);
|
||||
}
|
||||
}
|
||||
|
||||
explicit RectCornerRadii(Float radiusX, Float radiusY) {
|
||||
for (int i = 0; i < RectCorner::Count; i++) {
|
||||
NS_FOR_CSS_FULL_CORNERS(i) {
|
||||
radii[i].SizeTo(radiusX, radiusY);
|
||||
}
|
||||
}
|
||||
|
||||
RectCornerRadii(Float tl, Float tr, Float br, Float bl) {
|
||||
radii[RectCorner::TopLeft].SizeTo(tl, tl);
|
||||
radii[RectCorner::TopRight].SizeTo(tr, tr);
|
||||
radii[RectCorner::BottomRight].SizeTo(br, br);
|
||||
radii[RectCorner::BottomLeft].SizeTo(bl, bl);
|
||||
radii[eCornerTopLeft].SizeTo(tl, tl);
|
||||
radii[eCornerTopRight].SizeTo(tr, tr);
|
||||
radii[eCornerBottomRight].SizeTo(br, br);
|
||||
radii[eCornerBottomLeft].SizeTo(bl, bl);
|
||||
}
|
||||
|
||||
RectCornerRadii(const Size& tl, const Size& tr,
|
||||
const Size& br, const Size& bl) {
|
||||
radii[RectCorner::TopLeft] = tl;
|
||||
radii[RectCorner::TopRight] = tr;
|
||||
radii[RectCorner::BottomRight] = br;
|
||||
radii[RectCorner::BottomLeft] = bl;
|
||||
radii[eCornerTopLeft] = tl;
|
||||
radii[eCornerTopRight] = tr;
|
||||
radii[eCornerBottomRight] = br;
|
||||
radii[eCornerBottomLeft] = bl;
|
||||
}
|
||||
|
||||
const Size& operator[](size_t aCorner) const {
|
||||
@@ -218,38 +218,35 @@ struct RectCornerRadii {
|
||||
}
|
||||
|
||||
bool operator==(const RectCornerRadii& aOther) const {
|
||||
for (size_t i = 0; i < RectCorner::Count; i++) {
|
||||
if (radii[i] != aOther.radii[i]) return false;
|
||||
}
|
||||
return true;
|
||||
return TopLeft() == aOther.TopLeft() &&
|
||||
TopRight() == aOther.TopRight() &&
|
||||
BottomRight() == aOther.BottomRight() &&
|
||||
BottomLeft() == aOther.BottomLeft();
|
||||
}
|
||||
|
||||
bool AreRadiiSame() const {
|
||||
for (size_t i = 1; i < RectCorner::Count; i++) {
|
||||
if (radii[i] != radii[0]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return TopLeft() == TopRight() &&
|
||||
TopLeft() == BottomRight() &&
|
||||
TopLeft() == BottomLeft();
|
||||
}
|
||||
|
||||
void Scale(Float aXScale, Float aYScale) {
|
||||
for (int i = 0; i < RectCorner::Count; i++) {
|
||||
NS_FOR_CSS_FULL_CORNERS(i) {
|
||||
radii[i].Scale(aXScale, aYScale);
|
||||
}
|
||||
}
|
||||
|
||||
const Size TopLeft() const { return radii[RectCorner::TopLeft]; }
|
||||
Size& TopLeft() { return radii[RectCorner::TopLeft]; }
|
||||
const Size TopLeft() const { return radii[eCornerTopLeft]; }
|
||||
Size& TopLeft() { return radii[eCornerTopLeft]; }
|
||||
|
||||
const Size TopRight() const { return radii[RectCorner::TopRight]; }
|
||||
Size& TopRight() { return radii[RectCorner::TopRight]; }
|
||||
const Size TopRight() const { return radii[eCornerTopRight]; }
|
||||
Size& TopRight() { return radii[eCornerTopRight]; }
|
||||
|
||||
const Size BottomRight() const { return radii[RectCorner::BottomRight]; }
|
||||
Size& BottomRight() { return radii[RectCorner::BottomRight]; }
|
||||
const Size BottomRight() const { return radii[eCornerBottomRight]; }
|
||||
Size& BottomRight() { return radii[eCornerBottomRight]; }
|
||||
|
||||
const Size BottomLeft() const { return radii[RectCorner::BottomLeft]; }
|
||||
Size& BottomLeft() { return radii[RectCorner::BottomLeft]; }
|
||||
const Size BottomLeft() const { return radii[eCornerBottomLeft]; }
|
||||
Size& BottomLeft() { return radii[eCornerBottomLeft]; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+127
-20
@@ -7,6 +7,7 @@
|
||||
#define MOZILLA_GFX_TYPES_H_
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MacroArgs.h" // for MOZ_CONCAT
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -358,21 +359,6 @@ typedef mozilla::gfx::SurfaceFormat gfxImageFormat;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// We can't use MOZ_BEGIN_ENUM_CLASS here because that prevents the enum
|
||||
// values from being used for indexing. Wrapping the enum in a struct does at
|
||||
// least gives us name scoping.
|
||||
struct RectCorner {
|
||||
enum {
|
||||
// This order is important since Rect::AtCorner, AppendRoundedRectToPath
|
||||
// and other code depends on it!
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
BottomRight = 2,
|
||||
BottomLeft = 3,
|
||||
Count = 4
|
||||
};
|
||||
};
|
||||
|
||||
// Side constants for use in various places.
|
||||
enum Side { eSideTop, eSideRight, eSideBottom, eSideLeft };
|
||||
|
||||
@@ -387,11 +373,132 @@ enum SideBits {
|
||||
eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
|
||||
};
|
||||
|
||||
// Creates a for loop that walks over the four mozilla::Side values.
|
||||
// We use an int32_t helper variable (instead of a Side) for our loop counter,
|
||||
// to avoid triggering undefined behavior just before we exit the loop (at
|
||||
// which point the counter is incremented beyond the largest valid Side value).
|
||||
#define NS_FOR_CSS_SIDES(var_) \
|
||||
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eSideTop; \
|
||||
for (mozilla::Side var_; \
|
||||
MOZ_CONCAT(var_,__LINE__) <= mozilla::eSideLeft && \
|
||||
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
|
||||
++MOZ_CONCAT(var_,__LINE__))
|
||||
|
||||
static inline Side& operator++(Side& side) {
|
||||
MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
|
||||
"Out of range side");
|
||||
side = Side(side + 1);
|
||||
return side;
|
||||
}
|
||||
|
||||
enum Corner {
|
||||
// This order is important!
|
||||
eCornerTopLeft = 0,
|
||||
eCornerTopRight = 1,
|
||||
eCornerBottomRight = 2,
|
||||
eCornerBottomLeft = 3
|
||||
};
|
||||
|
||||
// RectCornerRadii::radii depends on this value. It is not being added to
|
||||
// Corner because we want to lift the responsibility to handle it in the
|
||||
// switch-case.
|
||||
constexpr int eCornerCount = 4;
|
||||
|
||||
// Creates a for loop that walks over the four mozilla::Corner values. This
|
||||
// implementation uses the same technique as NS_FOR_CSS_SIDES.
|
||||
#define NS_FOR_CSS_FULL_CORNERS(var_) \
|
||||
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eCornerTopLeft; \
|
||||
for (mozilla::Corner var_; \
|
||||
MOZ_CONCAT(var_,__LINE__) <= mozilla::eCornerBottomLeft && \
|
||||
(var_ = mozilla::Corner(MOZ_CONCAT(var_,__LINE__)), true); \
|
||||
++MOZ_CONCAT(var_,__LINE__))
|
||||
|
||||
static inline mozilla::Corner operator++(mozilla::Corner& aCorner) {
|
||||
MOZ_ASSERT(aCorner >= eCornerTopLeft && aCorner <= eCornerBottomLeft,
|
||||
"Out of range corner!");
|
||||
aCorner = mozilla::Corner(aCorner + 1);
|
||||
return aCorner;
|
||||
}
|
||||
|
||||
// Indices into "half corner" arrays (e.g. nsStyleCorners)
|
||||
enum HalfCorner {
|
||||
// This order is important!
|
||||
eCornerTopLeftX = 0,
|
||||
eCornerTopLeftY = 1,
|
||||
eCornerTopRightX = 2,
|
||||
eCornerTopRightY = 3,
|
||||
eCornerBottomRightX = 4,
|
||||
eCornerBottomRightY = 5,
|
||||
eCornerBottomLeftX = 6,
|
||||
eCornerBottomLeftY = 7
|
||||
};
|
||||
|
||||
// Creates a for loop that walks over the eight mozilla::HalfCorner values.
|
||||
// This implementation uses the same technique as NS_FOR_CSS_SIDES.
|
||||
#define NS_FOR_CSS_HALF_CORNERS(var_) \
|
||||
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eCornerTopLeftX; \
|
||||
for (mozilla::HalfCorner var_; \
|
||||
MOZ_CONCAT(var_,__LINE__) <= mozilla::eCornerBottomLeftY && \
|
||||
(var_ = mozilla::HalfCorner(MOZ_CONCAT(var_,__LINE__)), true); \
|
||||
++MOZ_CONCAT(var_,__LINE__))
|
||||
|
||||
static inline mozilla::HalfCorner operator++(mozilla::HalfCorner& aHalfCorner) {
|
||||
MOZ_ASSERT(aHalfCorner >= eCornerTopLeftX && aHalfCorner <= eCornerBottomLeftY,
|
||||
"Out of range half corner!");
|
||||
aHalfCorner = mozilla::HalfCorner(aHalfCorner + 1);
|
||||
return aHalfCorner;
|
||||
}
|
||||
|
||||
// The result of the conversion functions below are exhaustively checked in
|
||||
// nsStyleCoord.cpp, which also serves as usage examples.
|
||||
|
||||
constexpr bool HalfCornerIsX(HalfCorner aHalfCorner)
|
||||
{
|
||||
return !(aHalfCorner % 2);
|
||||
}
|
||||
|
||||
constexpr Corner HalfToFullCorner(HalfCorner aHalfCorner)
|
||||
{
|
||||
return Corner(aHalfCorner / 2);
|
||||
}
|
||||
|
||||
constexpr HalfCorner FullToHalfCorner(Corner aCorner, bool aIsVertical)
|
||||
{
|
||||
return HalfCorner(aCorner * 2 + aIsVertical);
|
||||
}
|
||||
|
||||
constexpr bool SideIsVertical(Side aSide)
|
||||
{
|
||||
return aSide % 2;
|
||||
}
|
||||
|
||||
/* @param aIsSecond: when true, return the clockwise second of the two
|
||||
* corners associated with aSide. For example, with aSide = eSideBottom the
|
||||
* result is eCornerBottomRight when aIsSecond is false, and
|
||||
* eCornerBottomLeft when aIsSecond is true.
|
||||
*/
|
||||
constexpr Corner SideToFullCorner(Side aSide, bool aIsSecond)
|
||||
{
|
||||
return Corner((aSide + aIsSecond) % 4);
|
||||
}
|
||||
|
||||
/* @param aIsSecond: when true, return the clockwise second of the two
|
||||
* corners associated with aSide. For example, with aSide = eSideBottom the
|
||||
* result is eCornerBottomRight when aIsSecond is false, and
|
||||
* eCornerBottomLeft when aIsSecond is true.
|
||||
* @param aIsParallel: return the half-corner that is parallel with aSide
|
||||
* when aIsParallel is true. For example with aSide=eSideTop, aIsSecond=true
|
||||
* the result is eCornerTopRightX when aIsParallel is true, and
|
||||
* eCornerTopRightY when aIsParallel is false (because "X" is parallel with
|
||||
* eSideTop/eSideBottom, similarly "Y" is parallel with eSideLeft/eSideRight)
|
||||
*/
|
||||
constexpr HalfCorner SideToHalfCorner(Side aSide,
|
||||
bool aIsSecond,
|
||||
bool aIsParallel)
|
||||
{
|
||||
return HalfCorner(((aSide + aIsSecond) * 2 + (aSide + !aIsParallel) % 2) % 8);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_SIDE_TOP mozilla::eSideTop
|
||||
#define NS_SIDE_RIGHT mozilla::eSideRight
|
||||
#define NS_SIDE_BOTTOM mozilla::eSideBottom
|
||||
#define NS_SIDE_LEFT mozilla::eSideLeft
|
||||
|
||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||
|
||||
@@ -84,7 +84,7 @@ GLXLibrary::EnsureInitialized()
|
||||
// see e.g. bug 608526: it is intrinsically interesting to know whether we have dynamically linked to libGL.so.1
|
||||
// because at least the NVIDIA implementation requires an executable stack, which causes mprotect calls,
|
||||
// which trigger glibc bug http://sourceware.org/bugzilla/show_bug.cgi?id=12225
|
||||
#ifdef __OpenBSD__
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
libGLfilename = "libGL.so";
|
||||
#else
|
||||
libGLfilename = "libGL.so.1";
|
||||
|
||||
+6
-6
@@ -4,17 +4,17 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsRect.h"
|
||||
#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
|
||||
#include "mozilla/gfx/Types.h" // for eSideBottom, etc
|
||||
#include "mozilla/CheckedInt.h" // for CheckedInt
|
||||
#include "nsDeviceContext.h" // for nsDeviceContext
|
||||
#include "nsString.h" // for nsAutoString, etc
|
||||
#include "nsMargin.h" // for nsMargin
|
||||
|
||||
static_assert((int(NS_SIDE_TOP) == 0) &&
|
||||
(int(NS_SIDE_RIGHT) == 1) &&
|
||||
(int(NS_SIDE_BOTTOM) == 2) &&
|
||||
(int(NS_SIDE_LEFT) == 3),
|
||||
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
|
||||
static_assert((int(eSideTop) == 0) &&
|
||||
(int(eSideRight) == 1) &&
|
||||
(int(eSideBottom) == 2) &&
|
||||
(int(eSideLeft) == 3),
|
||||
"The mozilla::Side sequence must match the nsMargin nscoord sequence");
|
||||
|
||||
const mozilla::gfx::IntRect& GetMaxSizedIntRect() {
|
||||
static const mozilla::gfx::IntRect r(0, 0, INT32_MAX, INT32_MAX);
|
||||
|
||||
@@ -24,17 +24,25 @@ struct RoundedRect {
|
||||
rect.width = std::max(0., rect.width - aLeftWidth - aRightWidth);
|
||||
rect.height = std::max(0., rect.height - aTopWidth - aBottomWidth);
|
||||
|
||||
corners.radii[NS_CORNER_TOP_LEFT].width = std::max(0., corners.radii[NS_CORNER_TOP_LEFT].width - aLeftWidth);
|
||||
corners.radii[NS_CORNER_TOP_LEFT].height = std::max(0., corners.radii[NS_CORNER_TOP_LEFT].height - aTopWidth);
|
||||
corners.radii[mozilla::eCornerTopLeft].width =
|
||||
std::max(0., corners.radii[mozilla::eCornerTopLeft].width - aLeftWidth);
|
||||
corners.radii[mozilla::eCornerTopLeft].height =
|
||||
std::max(0., corners.radii[mozilla::eCornerTopLeft].height - aTopWidth);
|
||||
|
||||
corners.radii[NS_CORNER_TOP_RIGHT].width = std::max(0., corners.radii[NS_CORNER_TOP_RIGHT].width - aRightWidth);
|
||||
corners.radii[NS_CORNER_TOP_RIGHT].height = std::max(0., corners.radii[NS_CORNER_TOP_RIGHT].height - aTopWidth);
|
||||
corners.radii[mozilla::eCornerTopRight].width =
|
||||
std::max(0., corners.radii[mozilla::eCornerTopRight].width - aRightWidth);
|
||||
corners.radii[mozilla::eCornerTopRight].height =
|
||||
std::max(0., corners.radii[mozilla::eCornerTopRight].height - aTopWidth);
|
||||
|
||||
corners.radii[NS_CORNER_BOTTOM_LEFT].width = std::max(0., corners.radii[NS_CORNER_BOTTOM_LEFT].width - aLeftWidth);
|
||||
corners.radii[NS_CORNER_BOTTOM_LEFT].height = std::max(0., corners.radii[NS_CORNER_BOTTOM_LEFT].height - aBottomWidth);
|
||||
corners.radii[mozilla::eCornerBottomLeft].width =
|
||||
std::max(0., corners.radii[mozilla::eCornerBottomLeft].width - aLeftWidth);
|
||||
corners.radii[mozilla::eCornerBottomLeft].height =
|
||||
std::max(0., corners.radii[mozilla::eCornerBottomLeft].height - aBottomWidth);
|
||||
|
||||
corners.radii[NS_CORNER_BOTTOM_RIGHT].width = std::max(0., corners.radii[NS_CORNER_BOTTOM_RIGHT].width - aRightWidth);
|
||||
corners.radii[NS_CORNER_BOTTOM_RIGHT].height = std::max(0., corners.radii[NS_CORNER_BOTTOM_RIGHT].height - aBottomWidth);
|
||||
corners.radii[mozilla::eCornerBottomRight].width =
|
||||
std::max(0., corners.radii[mozilla::eCornerBottomRight].width - aRightWidth);
|
||||
corners.radii[mozilla::eCornerBottomRight].height =
|
||||
std::max(0., corners.radii[mozilla::eCornerBottomRight].height - aBottomWidth);
|
||||
}
|
||||
gfxRect rect;
|
||||
RectCornerRadii corners;
|
||||
|
||||
@@ -435,7 +435,7 @@ ComputeMinSizeForShadowShape(const RectCornerRadii* aCornerRadii,
|
||||
Size cornerSize(0, 0);
|
||||
if (aCornerRadii) {
|
||||
const RectCornerRadii& corners = *aCornerRadii;
|
||||
for (size_t i = 0; i < RectCorner::Count; i++) {
|
||||
NS_FOR_CSS_FULL_CORNERS(i) {
|
||||
cornerSize.width = std::max(cornerSize.width, corners[i].width);
|
||||
cornerSize.height = std::max(cornerSize.height, corners[i].height);
|
||||
}
|
||||
@@ -1169,7 +1169,7 @@ static void GetBlurMargins(const RectCornerRadii* aInnerClipRadii,
|
||||
Size cornerSize(0, 0);
|
||||
if (aInnerClipRadii) {
|
||||
const RectCornerRadii& corners = *aInnerClipRadii;
|
||||
for (size_t i = 0; i < RectCorner::Count; i++) {
|
||||
NS_FOR_CSS_FULL_CORNERS(i) {
|
||||
cornerSize.width = std::max(cornerSize.width, corners[i].width);
|
||||
cornerSize.height = std::max(cornerSize.height, corners[i].height);
|
||||
}
|
||||
|
||||
+13
-46
@@ -27,36 +27,6 @@ struct gfxMargin : public mozilla::gfx::BaseMargin<gfxFloat, gfxMargin> {
|
||||
: Super(aTop, aRight, aBottom, aLeft) {}
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
enum Corner {
|
||||
// this order is important!
|
||||
eCornerTopLeft = 0,
|
||||
eCornerTopRight = 1,
|
||||
eCornerBottomRight = 2,
|
||||
eCornerBottomLeft = 3,
|
||||
eNumCorners = 4
|
||||
};
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
#define NS_CORNER_TOP_LEFT mozilla::css::eCornerTopLeft
|
||||
#define NS_CORNER_TOP_RIGHT mozilla::css::eCornerTopRight
|
||||
#define NS_CORNER_BOTTOM_RIGHT mozilla::css::eCornerBottomRight
|
||||
#define NS_CORNER_BOTTOM_LEFT mozilla::css::eCornerBottomLeft
|
||||
#define NS_NUM_CORNERS mozilla::css::eNumCorners
|
||||
|
||||
#define NS_FOR_CSS_CORNERS(var_) \
|
||||
for (mozilla::css::Corner var_ = NS_CORNER_TOP_LEFT; \
|
||||
var_ <= NS_CORNER_BOTTOM_LEFT; \
|
||||
var_++)
|
||||
|
||||
static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
|
||||
NS_PRECONDITION(corner >= NS_CORNER_TOP_LEFT &&
|
||||
corner < NS_NUM_CORNERS, "Out of range corner");
|
||||
corner = mozilla::css::Corner(corner + 1);
|
||||
return corner;
|
||||
}
|
||||
|
||||
struct gfxRect :
|
||||
public mozilla::gfx::BaseRect<gfxFloat, gfxRect, gfxPoint, gfxSize, gfxMargin> {
|
||||
typedef mozilla::gfx::BaseRect<gfxFloat, gfxRect, gfxPoint, gfxSize, gfxMargin> Super;
|
||||
@@ -75,35 +45,32 @@ struct gfxRect :
|
||||
*/
|
||||
bool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
|
||||
|
||||
gfxPoint AtCorner(mozilla::css::Corner corner) const {
|
||||
gfxPoint AtCorner(mozilla::Corner corner) const {
|
||||
switch (corner) {
|
||||
case NS_CORNER_TOP_LEFT: return TopLeft();
|
||||
case NS_CORNER_TOP_RIGHT: return TopRight();
|
||||
case NS_CORNER_BOTTOM_RIGHT: return BottomRight();
|
||||
case NS_CORNER_BOTTOM_LEFT: return BottomLeft();
|
||||
default:
|
||||
NS_ERROR("Invalid corner!");
|
||||
break;
|
||||
case mozilla::eCornerTopLeft: return TopLeft();
|
||||
case mozilla::eCornerTopRight: return TopRight();
|
||||
case mozilla::eCornerBottomRight: return BottomRight();
|
||||
case mozilla::eCornerBottomLeft: return BottomLeft();
|
||||
}
|
||||
return gfxPoint(0.0, 0.0);
|
||||
}
|
||||
|
||||
gfxPoint CCWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopLeft();
|
||||
case NS_SIDE_RIGHT: return TopRight();
|
||||
case NS_SIDE_BOTTOM: return BottomRight();
|
||||
case NS_SIDE_LEFT: return BottomLeft();
|
||||
case mozilla::eSideTop: return TopLeft();
|
||||
case mozilla::eSideRight: return TopRight();
|
||||
case mozilla::eSideBottom: return BottomRight();
|
||||
case mozilla::eSideLeft: return BottomLeft();
|
||||
}
|
||||
MOZ_CRASH("Incomplete switch");
|
||||
}
|
||||
|
||||
gfxPoint CWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopRight();
|
||||
case NS_SIDE_RIGHT: return BottomRight();
|
||||
case NS_SIDE_BOTTOM: return BottomLeft();
|
||||
case NS_SIDE_LEFT: return TopLeft();
|
||||
case mozilla::eSideTop: return TopRight();
|
||||
case mozilla::eSideRight: return BottomRight();
|
||||
case mozilla::eSideBottom: return BottomLeft();
|
||||
case mozilla::eSideLeft: return TopLeft();
|
||||
}
|
||||
MOZ_CRASH("Incomplete switch");
|
||||
}
|
||||
|
||||
@@ -10,17 +10,10 @@
|
||||
#define DOT_LENGTH 1 // square
|
||||
#define DASH_LENGTH 3 // 3 times longer than dot
|
||||
|
||||
// some shorthand for side bits
|
||||
#define SIDE_BIT_TOP (1 << NS_SIDE_TOP)
|
||||
#define SIDE_BIT_RIGHT (1 << NS_SIDE_RIGHT)
|
||||
#define SIDE_BIT_BOTTOM (1 << NS_SIDE_BOTTOM)
|
||||
#define SIDE_BIT_LEFT (1 << NS_SIDE_LEFT)
|
||||
#define SIDE_BITS_ALL (SIDE_BIT_TOP|SIDE_BIT_RIGHT|SIDE_BIT_BOTTOM|SIDE_BIT_LEFT)
|
||||
|
||||
#define C_TL NS_CORNER_TOP_LEFT
|
||||
#define C_TR NS_CORNER_TOP_RIGHT
|
||||
#define C_BR NS_CORNER_BOTTOM_RIGHT
|
||||
#define C_BL NS_CORNER_BOTTOM_LEFT
|
||||
#define C_TL mozilla::eCornerTopLeft
|
||||
#define C_TR mozilla::eCornerTopRight
|
||||
#define C_BR mozilla::eCornerBottomRight
|
||||
#define C_BL mozilla::eCornerBottomLeft
|
||||
|
||||
#define BORDER_SEGMENT_COUNT_MAX 100
|
||||
#define BORDER_DOTTED_CORNER_MAX_RADIUS 100000
|
||||
|
||||
@@ -203,49 +203,49 @@ DisplayItemClip::IsRectClippedByRoundedCorner(const nsRect& aRect) const
|
||||
i < iEnd; ++i) {
|
||||
const RoundedRect &rr = mRoundedClipRects[i];
|
||||
// top left
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
||||
rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[eCornerTopLeftX] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[eCornerTopLeftY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerTopLeftX],
|
||||
rr.mRect.x + rr.mRadii[eCornerTopLeftX],
|
||||
rect.x,
|
||||
rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
||||
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
||||
rr.mRadii[eCornerTopLeftY],
|
||||
rr.mRect.y + rr.mRadii[eCornerTopLeftY],
|
||||
rect.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// top right
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[eCornerTopRightX] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[eCornerTopRightY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerTopRightX],
|
||||
rr.mRect.XMost() - rr.mRadii[eCornerTopRightX],
|
||||
rect.XMost(),
|
||||
rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
||||
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
||||
rr.mRadii[eCornerTopRightY],
|
||||
rr.mRect.y + rr.mRadii[eCornerTopRightY],
|
||||
rect.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bottom left
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[eCornerBottomLeftX] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[eCornerBottomLeftY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerBottomLeftX],
|
||||
rr.mRect.x + rr.mRadii[eCornerBottomLeftX],
|
||||
rect.x,
|
||||
rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
rr.mRadii[eCornerBottomLeftY],
|
||||
rr.mRect.YMost() - rr.mRadii[eCornerBottomLeftY],
|
||||
rect.YMost())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bottom right
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[eCornerBottomRightX] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[eCornerBottomRightY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerBottomRightX],
|
||||
rr.mRect.XMost() - rr.mRadii[eCornerBottomRightX],
|
||||
rect.XMost(),
|
||||
rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
||||
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
||||
rr.mRadii[eCornerBottomRightY],
|
||||
rr.mRect.YMost() - rr.mRadii[eCornerBottomRightY],
|
||||
rect.YMost())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ nsDataHashtable<FourFloatsHashKey, BestOverlap> DottedCornerCache;
|
||||
|
||||
DottedCornerFinder::DottedCornerFinder(const Bezier& aOuterBezier,
|
||||
const Bezier& aInnerBezier,
|
||||
mozilla::css::Corner aCorner,
|
||||
mozilla::Corner aCorner,
|
||||
Float aBorderRadiusX,
|
||||
Float aBorderRadiusY,
|
||||
const Point& aC0, Float aR0,
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
// |<------->|
|
||||
// aRn
|
||||
DottedCornerFinder(const Bezier& aOuterBezier, const Bezier& aInnerBezier,
|
||||
mozilla::css::Corner aCorner,
|
||||
mozilla::Corner aCorner,
|
||||
Float aBorderRadiusX, Float aBorderRadiusY,
|
||||
const Point& aC0, Float aR0, const Point& aCn, Float aRn,
|
||||
const Size& aCornerDim);
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
Bezier mInnerBezier;
|
||||
Bezier mCenterBezier;
|
||||
|
||||
mozilla::css::Corner mCorner;
|
||||
mozilla::Corner mCorner;
|
||||
|
||||
// Sign of the normal vector used in radius calculation, flipped depends on
|
||||
// corner and start and end radii.
|
||||
|
||||
@@ -436,7 +436,7 @@ static DrawResult DrawBorderImage(nsPresContext* aPresContext,
|
||||
Sides aSkipSides,
|
||||
PaintBorderFlags aFlags);
|
||||
|
||||
static nscolor MakeBevelColor(mozilla::css::Side whichSide, uint8_t style,
|
||||
static nscolor MakeBevelColor(mozilla::Side whichSide, uint8_t style,
|
||||
nscolor aBackgroundColor,
|
||||
nscolor aBorderColor);
|
||||
|
||||
@@ -460,7 +460,7 @@ void nsCSSRendering::Shutdown()
|
||||
* Make a bevel color
|
||||
*/
|
||||
static nscolor
|
||||
MakeBevelColor(mozilla::css::Side whichSide, uint8_t style,
|
||||
MakeBevelColor(mozilla::Side whichSide, uint8_t style,
|
||||
nscolor aBackgroundColor, nscolor aBorderColor)
|
||||
{
|
||||
|
||||
@@ -475,24 +475,24 @@ MakeBevelColor(mozilla::css::Side whichSide, uint8_t style,
|
||||
(style == NS_STYLE_BORDER_STYLE_RIDGE)) {
|
||||
// Flip colors for these two border styles
|
||||
switch (whichSide) {
|
||||
case NS_SIDE_BOTTOM: whichSide = NS_SIDE_TOP; break;
|
||||
case NS_SIDE_RIGHT: whichSide = NS_SIDE_LEFT; break;
|
||||
case NS_SIDE_TOP: whichSide = NS_SIDE_BOTTOM; break;
|
||||
case NS_SIDE_LEFT: whichSide = NS_SIDE_RIGHT; break;
|
||||
case eSideBottom: whichSide = eSideTop; break;
|
||||
case eSideRight: whichSide = eSideLeft; break;
|
||||
case eSideTop: whichSide = eSideBottom; break;
|
||||
case eSideLeft: whichSide = eSideRight; break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (whichSide) {
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
theColor = colors[1];
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
theColor = colors[1];
|
||||
break;
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
theColor = colors[0];
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
default:
|
||||
theColor = colors[0];
|
||||
break;
|
||||
@@ -632,14 +632,14 @@ nsCSSRendering::ComputePixelRadii(const nscoord *aAppUnitsRadii,
|
||||
NS_FOR_CSS_HALF_CORNERS(corner)
|
||||
radii[corner] = Float(aAppUnitsRadii[corner]) / aAppUnitsPerPixel;
|
||||
|
||||
(*oBorderRadii)[C_TL] = Size(radii[NS_CORNER_TOP_LEFT_X],
|
||||
radii[NS_CORNER_TOP_LEFT_Y]);
|
||||
(*oBorderRadii)[C_TR] = Size(radii[NS_CORNER_TOP_RIGHT_X],
|
||||
radii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
(*oBorderRadii)[C_BR] = Size(radii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
radii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
(*oBorderRadii)[C_BL] = Size(radii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
radii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
(*oBorderRadii)[C_TL] = Size(radii[eCornerTopLeftX],
|
||||
radii[eCornerTopLeftY]);
|
||||
(*oBorderRadii)[C_TR] = Size(radii[eCornerTopRightX],
|
||||
radii[eCornerTopRightY]);
|
||||
(*oBorderRadii)[C_BR] = Size(radii[eCornerBottomRightX],
|
||||
radii[eCornerBottomRightY]);
|
||||
(*oBorderRadii)[C_BL] = Size(radii[eCornerBottomLeftX],
|
||||
radii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
DrawResult
|
||||
@@ -1483,10 +1483,10 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
||||
|
||||
Float borderSizes[4];
|
||||
|
||||
borderSizes[NS_SIDE_LEFT] = spreadDistance;
|
||||
borderSizes[NS_SIDE_TOP] = spreadDistance;
|
||||
borderSizes[NS_SIDE_RIGHT] = spreadDistance;
|
||||
borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
|
||||
borderSizes[eSideLeft] = spreadDistance;
|
||||
borderSizes[eSideTop] = spreadDistance;
|
||||
borderSizes[eSideRight] = spreadDistance;
|
||||
borderSizes[eSideBottom] = spreadDistance;
|
||||
|
||||
nsCSSBorderRenderer::ComputeOuterRadii(borderRadii, borderSizes,
|
||||
&clipRectRadii);
|
||||
@@ -1595,19 +1595,19 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
|
||||
|
||||
// See PaintBoxShadowOuter and bug 514670
|
||||
if (innerRadii[C_TL].width > 0 || innerRadii[C_BL].width > 0) {
|
||||
borderSizes[NS_SIDE_LEFT] = spreadDistance;
|
||||
borderSizes[eSideLeft] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_TL].height > 0 || innerRadii[C_TR].height > 0) {
|
||||
borderSizes[NS_SIDE_TOP] = spreadDistance;
|
||||
borderSizes[eSideTop] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_TR].width > 0 || innerRadii[C_BR].width > 0) {
|
||||
borderSizes[NS_SIDE_RIGHT] = spreadDistance;
|
||||
borderSizes[eSideRight] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_BL].height > 0 || innerRadii[C_BR].height > 0) {
|
||||
borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
|
||||
borderSizes[eSideBottom] = spreadDistance;
|
||||
}
|
||||
|
||||
nsCSSBorderRenderer::ComputeInnerRadii(innerRadii, borderSizes,
|
||||
@@ -1738,7 +1738,7 @@ nsCSSRendering::PaintBackground(const PaintBGParams& aParams)
|
||||
}
|
||||
|
||||
static bool
|
||||
IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::css::Side aSide)
|
||||
IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::Side aSide)
|
||||
{
|
||||
if (aBorder.GetComputedBorder().Side(aSide) == 0)
|
||||
return true;
|
||||
@@ -3920,10 +3920,8 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
nsMargin border;
|
||||
NS_FOR_CSS_SIDES(s) {
|
||||
nsStyleCoord coord = aStyleBorder.mBorderImageSlice.Get(s);
|
||||
int32_t imgDimension = NS_SIDE_IS_VERTICAL(s)
|
||||
? imageSize.width : imageSize.height;
|
||||
nscoord borderDimension = NS_SIDE_IS_VERTICAL(s)
|
||||
? borderImgArea.width : borderImgArea.height;
|
||||
int32_t imgDimension = SideIsVertical(s) ? imageSize.width : imageSize.height;
|
||||
nscoord borderDimension = SideIsVertical(s) ? borderImgArea.width : borderImgArea.height;
|
||||
double value;
|
||||
switch (coord.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
@@ -4264,32 +4262,32 @@ DrawSolidBorderSegment(DrawTarget& aDrawTarget,
|
||||
Float startBevelOffset =
|
||||
NSAppUnitsToFloatPixels(aStartBevelOffset, aAppUnitsPerDevPixel);
|
||||
switch(aStartBevelSide) {
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
poly[0].x += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
poly[3].x += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
poly[1].y += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
poly[0].y += startBevelOffset;
|
||||
}
|
||||
|
||||
Float endBevelOffset =
|
||||
NSAppUnitsToFloatPixels(aEndBevelOffset, aAppUnitsPerDevPixel);
|
||||
switch(aEndBevelSide) {
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
poly[1].x -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
poly[2].x -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
poly[2].y -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
poly[3].y -= endBevelOffset;
|
||||
}
|
||||
|
||||
@@ -4341,7 +4339,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
uint8_t aEndBevelSide,
|
||||
nscoord aEndBevelOffset)
|
||||
{
|
||||
bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide));
|
||||
bool horizontal = ((eSideTop == aStartBevelSide) || (eSideBottom == aStartBevelSide));
|
||||
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
|
||||
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
|
||||
|
||||
@@ -4425,7 +4423,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
|
||||
nscoord endBevel = (aEndBevelOffset > 0)
|
||||
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, true) : 0;
|
||||
mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
|
||||
mozilla::Side ridgeGrooveSide = (horizontal) ? eSideTop : eSideLeft;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
nscolor bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
|
||||
@@ -4436,11 +4434,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
if (horizontal) { // top, bottom
|
||||
half = RoundFloatToPixel(0.5f * (float)aBorder.height, twipsPerPixel);
|
||||
rect.height = half;
|
||||
if (NS_SIDE_TOP == aStartBevelSide) {
|
||||
if (eSideTop == aStartBevelSide) {
|
||||
rect.x += startBevel;
|
||||
rect.width -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_TOP == aEndBevelSide) {
|
||||
if (eSideTop == aEndBevelSide) {
|
||||
rect.width -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
@@ -4451,11 +4449,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
else { // left, right
|
||||
half = RoundFloatToPixel(0.5f * (float)aBorder.width, twipsPerPixel);
|
||||
rect.width = half;
|
||||
if (NS_SIDE_LEFT == aStartBevelSide) {
|
||||
if (eSideLeft == aStartBevelSide) {
|
||||
rect.y += startBevel;
|
||||
rect.height -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_LEFT == aEndBevelSide) {
|
||||
if (eSideLeft == aEndBevelSide) {
|
||||
rect.height -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
@@ -4465,7 +4463,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
}
|
||||
|
||||
rect = aBorder;
|
||||
ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
|
||||
ridgeGrooveSide = (eSideTop == ridgeGrooveSide) ? eSideBottom : eSideRight;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
|
||||
@@ -4473,11 +4471,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
if (horizontal) {
|
||||
rect.y = rect.y + half;
|
||||
rect.height = aBorder.height - half;
|
||||
if (NS_SIDE_BOTTOM == aStartBevelSide) {
|
||||
if (eSideBottom == aStartBevelSide) {
|
||||
rect.x += startBevel;
|
||||
rect.width -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_BOTTOM == aEndBevelSide) {
|
||||
if (eSideBottom == aEndBevelSide) {
|
||||
rect.width -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
@@ -4488,11 +4486,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
else {
|
||||
rect.x = rect.x + half;
|
||||
rect.width = aBorder.width - half;
|
||||
if (NS_SIDE_RIGHT == aStartBevelSide) {
|
||||
if (eSideRight == aStartBevelSide) {
|
||||
rect.y += aStartBevelOffset - startBevel;
|
||||
rect.height -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_RIGHT == aEndBevelSide) {
|
||||
if (eSideRight == aEndBevelSide) {
|
||||
rect.height -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
@@ -4517,11 +4515,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
|
||||
// draw the top line or rect
|
||||
nsRect topRect(aBorder.x, aBorder.y, aBorder.width, thirdHeight);
|
||||
if (NS_SIDE_TOP == aStartBevelSide) {
|
||||
if (eSideTop == aStartBevelSide) {
|
||||
topRect.x += aStartBevelOffset - startBevel;
|
||||
topRect.width -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_TOP == aEndBevelSide) {
|
||||
if (eSideTop == aEndBevelSide) {
|
||||
topRect.width -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, topRect, aBorderColor,
|
||||
@@ -4532,11 +4530,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
// draw the botom line or rect
|
||||
nscoord heightOffset = aBorder.height - thirdHeight;
|
||||
nsRect bottomRect(aBorder.x, aBorder.y + heightOffset, aBorder.width, aBorder.height - heightOffset);
|
||||
if (NS_SIDE_BOTTOM == aStartBevelSide) {
|
||||
if (eSideBottom == aStartBevelSide) {
|
||||
bottomRect.x += aStartBevelOffset - startBevel;
|
||||
bottomRect.width -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_BOTTOM == aEndBevelSide) {
|
||||
if (eSideBottom == aEndBevelSide) {
|
||||
bottomRect.width -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, bottomRect, aBorderColor,
|
||||
@@ -4548,11 +4546,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
nscoord thirdWidth = RoundFloatToPixel(0.333333f * (float)aBorder.width, twipsPerPixel);
|
||||
|
||||
nsRect leftRect(aBorder.x, aBorder.y, thirdWidth, aBorder.height);
|
||||
if (NS_SIDE_LEFT == aStartBevelSide) {
|
||||
if (eSideLeft == aStartBevelSide) {
|
||||
leftRect.y += aStartBevelOffset - startBevel;
|
||||
leftRect.height -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_LEFT == aEndBevelSide) {
|
||||
if (eSideLeft == aEndBevelSide) {
|
||||
leftRect.height -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, leftRect, aBorderColor,
|
||||
@@ -4562,11 +4560,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
||||
|
||||
nscoord widthOffset = aBorder.width - thirdWidth;
|
||||
nsRect rightRect(aBorder.x + widthOffset, aBorder.y, aBorder.width - widthOffset, aBorder.height);
|
||||
if (NS_SIDE_RIGHT == aStartBevelSide) {
|
||||
if (eSideRight == aStartBevelSide) {
|
||||
rightRect.y += aStartBevelOffset - startBevel;
|
||||
rightRect.height -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_RIGHT == aEndBevelSide) {
|
||||
if (eSideRight == aEndBevelSide) {
|
||||
rightRect.height -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rightRect, aBorderColor,
|
||||
|
||||
@@ -63,12 +63,12 @@ static void ComputeBorderCornerDimensions(const Float* aBorderWidths,
|
||||
RectCornerRadii *aDimsResult);
|
||||
|
||||
// given a side index, get the previous and next side index
|
||||
#define NEXT_SIDE(_s) mozilla::css::Side(((_s) + 1) & 3)
|
||||
#define PREV_SIDE(_s) mozilla::css::Side(((_s) + 3) & 3)
|
||||
#define NEXT_SIDE(_s) mozilla::Side(((_s) + 1) & 3)
|
||||
#define PREV_SIDE(_s) mozilla::Side(((_s) + 3) & 3)
|
||||
|
||||
// given a corner index, get the previous and next corner index
|
||||
#define NEXT_CORNER(_s) mozilla::css::Corner(((_s) + 1) & 3)
|
||||
#define PREV_CORNER(_s) mozilla::css::Corner(((_s) + 3) & 3)
|
||||
#define NEXT_CORNER(_s) mozilla::Corner(((_s) + 1) & 3)
|
||||
#define PREV_CORNER(_s) mozilla::Corner(((_s) + 3) & 3)
|
||||
|
||||
// from the given base color and the background color, turn
|
||||
// color into a color for the given border pattern style
|
||||
@@ -107,47 +107,47 @@ IsZeroSize(const Size& sz) {
|
||||
|
||||
static bool
|
||||
AllCornersZeroSize(const RectCornerRadii& corners) {
|
||||
return IsZeroSize(corners[NS_CORNER_TOP_LEFT]) &&
|
||||
IsZeroSize(corners[NS_CORNER_TOP_RIGHT]) &&
|
||||
IsZeroSize(corners[NS_CORNER_BOTTOM_RIGHT]) &&
|
||||
IsZeroSize(corners[NS_CORNER_BOTTOM_LEFT]);
|
||||
return IsZeroSize(corners[eCornerTopLeft]) &&
|
||||
IsZeroSize(corners[eCornerTopRight]) &&
|
||||
IsZeroSize(corners[eCornerBottomRight]) &&
|
||||
IsZeroSize(corners[eCornerBottomLeft]);
|
||||
}
|
||||
|
||||
static mozilla::css::Side
|
||||
GetHorizontalSide(mozilla::css::Corner aCorner)
|
||||
static mozilla::Side
|
||||
GetHorizontalSide(mozilla::Corner aCorner)
|
||||
{
|
||||
return (aCorner == C_TL || aCorner == C_TR) ? NS_SIDE_TOP : NS_SIDE_BOTTOM;
|
||||
return (aCorner == C_TL || aCorner == C_TR) ? eSideTop : eSideBottom;
|
||||
}
|
||||
|
||||
static mozilla::css::Side
|
||||
GetVerticalSide(mozilla::css::Corner aCorner)
|
||||
static mozilla::Side
|
||||
GetVerticalSide(mozilla::Corner aCorner)
|
||||
{
|
||||
return (aCorner == C_TL || aCorner == C_BL) ? NS_SIDE_LEFT : NS_SIDE_RIGHT;
|
||||
return (aCorner == C_TL || aCorner == C_BL) ? eSideLeft : eSideRight;
|
||||
}
|
||||
|
||||
static mozilla::css::Corner
|
||||
GetCWCorner(mozilla::css::Side aSide)
|
||||
static mozilla::Corner
|
||||
GetCWCorner(mozilla::Side aSide)
|
||||
{
|
||||
return mozilla::css::Corner(NEXT_SIDE(aSide));
|
||||
return mozilla::Corner(NEXT_SIDE(aSide));
|
||||
}
|
||||
|
||||
static mozilla::css::Corner
|
||||
GetCCWCorner(mozilla::css::Side aSide)
|
||||
static mozilla::Corner
|
||||
GetCCWCorner(mozilla::Side aSide)
|
||||
{
|
||||
return mozilla::css::Corner(aSide);
|
||||
return mozilla::Corner(aSide);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsSingleSide(int aSides)
|
||||
{
|
||||
return aSides == SIDE_BIT_TOP || aSides == SIDE_BIT_RIGHT ||
|
||||
aSides == SIDE_BIT_BOTTOM || aSides == SIDE_BIT_LEFT;
|
||||
return aSides == eSideBitsTop || aSides == eSideBitsRight ||
|
||||
aSides == eSideBitsBottom || aSides == eSideBitsLeft;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsHorizontalSide(mozilla::css::Side aSide)
|
||||
IsHorizontalSide(mozilla::Side aSide)
|
||||
{
|
||||
return aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM;
|
||||
return aSide == eSideTop || aSide == eSideBottom;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
@@ -215,17 +215,17 @@ nsCSSBorderRenderer::ComputeInnerRadii(const RectCornerRadii& aRadii,
|
||||
{
|
||||
RectCornerRadii& iRadii = *aInnerRadiiRet;
|
||||
|
||||
iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[NS_SIDE_LEFT]);
|
||||
iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[NS_SIDE_TOP]);
|
||||
iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[eSideLeft]);
|
||||
iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[eSideTop]);
|
||||
|
||||
iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[NS_SIDE_RIGHT]);
|
||||
iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[NS_SIDE_TOP]);
|
||||
iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[eSideRight]);
|
||||
iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[eSideTop]);
|
||||
|
||||
iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[NS_SIDE_RIGHT]);
|
||||
iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[eSideRight]);
|
||||
iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[eSideBottom]);
|
||||
|
||||
iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[NS_SIDE_LEFT]);
|
||||
iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[eSideLeft]);
|
||||
iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
@@ -240,23 +240,23 @@ nsCSSBorderRenderer::ComputeOuterRadii(const RectCornerRadii& aRadii,
|
||||
|
||||
// round the edges that have radii > 0.0 to start with
|
||||
if (aRadii[C_TL].width > 0.f && aRadii[C_TL].height > 0.f) {
|
||||
oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[NS_SIDE_LEFT]);
|
||||
oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[NS_SIDE_TOP]);
|
||||
oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[eSideLeft]);
|
||||
oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aRadii[C_TR].width > 0.f && aRadii[C_TR].height > 0.f) {
|
||||
oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[NS_SIDE_RIGHT]);
|
||||
oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[NS_SIDE_TOP]);
|
||||
oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[eSideRight]);
|
||||
oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aRadii[C_BR].width > 0.f && aRadii[C_BR].height > 0.f) {
|
||||
oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[NS_SIDE_RIGHT]);
|
||||
oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[eSideRight]);
|
||||
oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
if (aRadii[C_BL].width > 0.f && aRadii[C_BL].height > 0.f) {
|
||||
oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[NS_SIDE_LEFT]);
|
||||
oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[eSideLeft]);
|
||||
oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[eSideBottom]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,10 +265,10 @@ ComputeBorderCornerDimensions(const Float* aBorderWidths,
|
||||
const RectCornerRadii& aRadii,
|
||||
RectCornerRadii* aDimsRet)
|
||||
{
|
||||
Float leftWidth = aBorderWidths[NS_SIDE_LEFT];
|
||||
Float topWidth = aBorderWidths[NS_SIDE_TOP];
|
||||
Float rightWidth = aBorderWidths[NS_SIDE_RIGHT];
|
||||
Float bottomWidth = aBorderWidths[NS_SIDE_BOTTOM];
|
||||
Float leftWidth = aBorderWidths[eSideLeft];
|
||||
Float topWidth = aBorderWidths[eSideTop];
|
||||
Float rightWidth = aBorderWidths[eSideRight];
|
||||
Float bottomWidth = aBorderWidths[eSideBottom];
|
||||
|
||||
if (AllCornersZeroSize(aRadii)) {
|
||||
// These will always be in pixel units from CSS
|
||||
@@ -294,7 +294,7 @@ ComputeBorderCornerDimensions(const Float* aBorderWidths,
|
||||
bool
|
||||
nsCSSBorderRenderer::AreBorderSideFinalStylesSame(uint8_t aSides)
|
||||
{
|
||||
NS_ASSERTION(aSides != 0 && (aSides & ~SIDE_BITS_ALL) == 0,
|
||||
NS_ASSERTION(aSides != 0 && (aSides & ~eSideBitsAll) == 0,
|
||||
"AreBorderSidesSame: invalid whichSides!");
|
||||
|
||||
/* First check if the specified styles and colors are the same for all sides */
|
||||
@@ -324,15 +324,15 @@ nsCSSBorderRenderer::AreBorderSideFinalStylesSame(uint8_t aSides)
|
||||
case NS_STYLE_BORDER_STYLE_RIDGE:
|
||||
case NS_STYLE_BORDER_STYLE_INSET:
|
||||
case NS_STYLE_BORDER_STYLE_OUTSET:
|
||||
return ((aSides & ~(SIDE_BIT_TOP | SIDE_BIT_LEFT)) == 0 ||
|
||||
(aSides & ~(SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == 0);
|
||||
return ((aSides & ~(eSideBitsTop | eSideBitsLeft)) == 0 ||
|
||||
(aSides & ~(eSideBitsBottom | eSideBitsRight)) == 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::Corner aCorner)
|
||||
{
|
||||
switch (aStyle) {
|
||||
case NS_STYLE_BORDER_STYLE_SOLID:
|
||||
@@ -340,11 +340,11 @@ nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCo
|
||||
|
||||
case NS_STYLE_BORDER_STYLE_INSET:
|
||||
case NS_STYLE_BORDER_STYLE_OUTSET:
|
||||
return (aCorner == NS_CORNER_TOP_LEFT || aCorner == NS_CORNER_BOTTOM_RIGHT);
|
||||
return (aCorner == eCornerTopLeft || aCorner == eCornerBottomRight);
|
||||
|
||||
case NS_STYLE_BORDER_STYLE_GROOVE:
|
||||
case NS_STYLE_BORDER_STYLE_RIDGE:
|
||||
return mOneUnitBorder && (aCorner == NS_CORNER_TOP_LEFT || aCorner == NS_CORNER_BOTTOM_RIGHT);
|
||||
return mOneUnitBorder && (aCorner == eCornerTopLeft || aCorner == eCornerBottomRight);
|
||||
|
||||
case NS_STYLE_BORDER_STYLE_DOUBLE:
|
||||
return mOneUnitBorder;
|
||||
@@ -355,7 +355,7 @@ nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCo
|
||||
}
|
||||
|
||||
bool
|
||||
nsCSSBorderRenderer::IsCornerMergeable(mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::IsCornerMergeable(mozilla::Corner aCorner)
|
||||
{
|
||||
// Corner between dotted borders with same width and small radii is
|
||||
// merged into single dot.
|
||||
@@ -385,8 +385,8 @@ nsCSSBorderRenderer::IsCornerMergeable(mozilla::css::Corner aCorner)
|
||||
// +-------------------------+----
|
||||
// | |
|
||||
// | |
|
||||
mozilla::css::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::css::Side sideV(GetVerticalSide(aCorner));
|
||||
mozilla::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::Side sideV(GetVerticalSide(aCorner));
|
||||
uint8_t styleH = mBorderStyles[sideH];
|
||||
uint8_t styleV = mBorderStyles[sideV];
|
||||
if (styleH != styleV || styleH != NS_STYLE_BORDER_STYLE_DOTTED) {
|
||||
@@ -405,7 +405,7 @@ nsCSSBorderRenderer::IsCornerMergeable(mozilla::css::Corner aCorner)
|
||||
}
|
||||
|
||||
BorderColorStyle
|
||||
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::Corner aCorner)
|
||||
{
|
||||
// note that this function assumes that the corner is already solid,
|
||||
// as per the earlier function
|
||||
@@ -416,17 +416,17 @@ nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css
|
||||
|
||||
case NS_STYLE_BORDER_STYLE_INSET:
|
||||
case NS_STYLE_BORDER_STYLE_GROOVE:
|
||||
if (aCorner == NS_CORNER_TOP_LEFT)
|
||||
if (aCorner == eCornerTopLeft)
|
||||
return BorderColorStyleDark;
|
||||
else if (aCorner == NS_CORNER_BOTTOM_RIGHT)
|
||||
else if (aCorner == eCornerBottomRight)
|
||||
return BorderColorStyleLight;
|
||||
break;
|
||||
|
||||
case NS_STYLE_BORDER_STYLE_OUTSET:
|
||||
case NS_STYLE_BORDER_STYLE_RIDGE:
|
||||
if (aCorner == NS_CORNER_TOP_LEFT)
|
||||
if (aCorner == eCornerTopLeft)
|
||||
return BorderColorStyleLight;
|
||||
else if (aCorner == NS_CORNER_BOTTOM_RIGHT)
|
||||
else if (aCorner == eCornerBottomRight)
|
||||
return BorderColorStyleDark;
|
||||
break;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css
|
||||
}
|
||||
|
||||
Rect
|
||||
nsCSSBorderRenderer::GetCornerRect(mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::GetCornerRect(mozilla::Corner aCorner)
|
||||
{
|
||||
Point offset(0.f, 0.f);
|
||||
|
||||
@@ -449,7 +449,7 @@ nsCSSBorderRenderer::GetCornerRect(mozilla::css::Corner aCorner)
|
||||
}
|
||||
|
||||
Rect
|
||||
nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::css::Side aSide)
|
||||
nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::Side aSide)
|
||||
{
|
||||
Point offset(0.f, 0.f);
|
||||
|
||||
@@ -458,15 +458,15 @@ nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::css::Side aSide)
|
||||
// must be the border height; the x start must take into account
|
||||
// the corner size (which may be bigger than the right or left
|
||||
// side's width). The same applies to the right and left sides.
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
offset.x = mBorderCornerDimensions[C_TL].width;
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
offset.x = mOuterRect.Width() - mBorderWidths[NS_SIDE_RIGHT];
|
||||
} else if (aSide == eSideRight) {
|
||||
offset.x = mOuterRect.Width() - mBorderWidths[eSideRight];
|
||||
offset.y = mBorderCornerDimensions[C_TR].height;
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
offset.x = mBorderCornerDimensions[C_BL].width;
|
||||
offset.y = mOuterRect.Height() - mBorderWidths[NS_SIDE_BOTTOM];
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
offset.y = mOuterRect.Height() - mBorderWidths[eSideBottom];
|
||||
} else if (aSide == eSideLeft) {
|
||||
offset.y = mBorderCornerDimensions[C_TL].height;
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ MaybeMoveToMidPoint(Point& aP0, Point& aP1, const Point& aMidPoint)
|
||||
}
|
||||
|
||||
already_AddRefed<Path>
|
||||
nsCSSBorderRenderer::GetSideClipSubPath(mozilla::css::Side aSide)
|
||||
nsCSSBorderRenderer::GetSideClipSubPath(mozilla::Side aSide)
|
||||
{
|
||||
// the clip proceeds clockwise from the top left corner;
|
||||
// so "start" in each case is the start of the region from that side.
|
||||
@@ -673,15 +673,15 @@ nsCSSBorderRenderer::GetSideClipSubPath(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
Point
|
||||
nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner,
|
||||
nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner,
|
||||
bool* aIsUnfilled,
|
||||
Float aDotOffset)
|
||||
|
||||
{
|
||||
// Calculate the end point of the side for dashed/dotted border, that is also
|
||||
// the end point of the corner curve. The point is specified by aSide and
|
||||
// aCorner. (e.g. NS_SIDE_TOP and C_TL means the left end of border-top)
|
||||
// aCorner. (e.g. eSideTop and C_TL means the left end of border-top)
|
||||
//
|
||||
//
|
||||
// aCorner aSide
|
||||
@@ -726,7 +726,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::css::Side aSide,
|
||||
// | |
|
||||
// otherSide | |
|
||||
// | |
|
||||
mozilla::css::Side otherSide = ((uint8_t)aSide == (uint8_t)aCorner)
|
||||
mozilla::Side otherSide = ((uint8_t)aSide == (uint8_t)aCorner)
|
||||
? PREV_SIDE(aSide)
|
||||
: NEXT_SIDE(aSide);
|
||||
uint8_t otherStyle = mBorderStyles[otherSide];
|
||||
@@ -1070,7 +1070,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::css::Side aSide,
|
||||
void
|
||||
nsCSSBorderRenderer::GetOuterAndInnerBezier(Bezier* aOuterBezier,
|
||||
Bezier* aInnerBezier,
|
||||
mozilla::css::Corner aCorner)
|
||||
mozilla::Corner aCorner)
|
||||
{
|
||||
// Return bezier control points for outer and inner curve for given corner.
|
||||
//
|
||||
@@ -1091,8 +1091,8 @@ nsCSSBorderRenderer::GetOuterAndInnerBezier(Bezier* aOuterBezier,
|
||||
// | |
|
||||
// +---------+
|
||||
|
||||
mozilla::css::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::css::Side sideV(GetVerticalSide(aCorner));
|
||||
mozilla::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::Side sideV(GetVerticalSide(aCorner));
|
||||
|
||||
Size outerCornerSize(ceil(mBorderRadii[aCorner].width),
|
||||
ceil(mBorderRadii[aCorner].height));
|
||||
@@ -1144,7 +1144,7 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect,
|
||||
// sides is probably second in the list -- there are a bunch of
|
||||
// common border styles, such as inset and outset, that are
|
||||
// top-left/bottom-right split.
|
||||
if (aSides == SIDE_BITS_ALL &&
|
||||
if (aSides == eSideBitsAll &&
|
||||
CheckFourFloatsEqual(aBorderSizes, aBorderSizes[0]) &&
|
||||
!mAvoidStroke)
|
||||
{
|
||||
@@ -1162,28 +1162,28 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect,
|
||||
Rect r[4];
|
||||
|
||||
// compute base rects for each side
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
r[NS_SIDE_TOP] =
|
||||
if (aSides & eSideBitsTop) {
|
||||
r[eSideTop] =
|
||||
Rect(aOuterRect.X(), aOuterRect.Y(),
|
||||
aOuterRect.Width(), aBorderSizes[NS_SIDE_TOP]);
|
||||
aOuterRect.Width(), aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
r[NS_SIDE_BOTTOM] =
|
||||
Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[NS_SIDE_BOTTOM],
|
||||
aOuterRect.Width(), aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
if (aSides & eSideBitsBottom) {
|
||||
r[eSideBottom] =
|
||||
Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[eSideBottom],
|
||||
aOuterRect.Width(), aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_LEFT) {
|
||||
r[NS_SIDE_LEFT] =
|
||||
if (aSides & eSideBitsLeft) {
|
||||
r[eSideLeft] =
|
||||
Rect(aOuterRect.X(), aOuterRect.Y(),
|
||||
aBorderSizes[NS_SIDE_LEFT], aOuterRect.Height());
|
||||
aBorderSizes[eSideLeft], aOuterRect.Height());
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_RIGHT) {
|
||||
r[NS_SIDE_RIGHT] =
|
||||
Rect(aOuterRect.XMost() - aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Y(),
|
||||
aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Height());
|
||||
if (aSides & eSideBitsRight) {
|
||||
r[eSideRight] =
|
||||
Rect(aOuterRect.XMost() - aBorderSizes[eSideRight], aOuterRect.Y(),
|
||||
aBorderSizes[eSideRight], aOuterRect.Height());
|
||||
}
|
||||
|
||||
// If two sides meet at a corner that we're rendering, then
|
||||
@@ -1191,26 +1191,26 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect,
|
||||
// This is especially important in the case of colors with
|
||||
// an alpha channel.
|
||||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == (SIDE_BIT_TOP | SIDE_BIT_LEFT)) {
|
||||
if ((aSides & (eSideBitsTop | eSideBitsLeft)) == (eSideBitsTop | eSideBitsLeft)) {
|
||||
// adjust the left's top down a bit
|
||||
r[NS_SIDE_LEFT].y += aBorderSizes[NS_SIDE_TOP];
|
||||
r[NS_SIDE_LEFT].height -= aBorderSizes[NS_SIDE_TOP];
|
||||
r[eSideLeft].y += aBorderSizes[eSideTop];
|
||||
r[eSideLeft].height -= aBorderSizes[eSideTop];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) == (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) {
|
||||
if ((aSides & (eSideBitsTop | eSideBitsRight)) == (eSideBitsTop | eSideBitsRight)) {
|
||||
// adjust the top's left a bit
|
||||
r[NS_SIDE_TOP].width -= aBorderSizes[NS_SIDE_RIGHT];
|
||||
r[eSideTop].width -= aBorderSizes[eSideRight];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) {
|
||||
if ((aSides & (eSideBitsBottom | eSideBitsRight)) == (eSideBitsBottom | eSideBitsRight)) {
|
||||
// adjust the right's bottom a bit
|
||||
r[NS_SIDE_RIGHT].height -= aBorderSizes[NS_SIDE_BOTTOM];
|
||||
r[eSideRight].height -= aBorderSizes[eSideBottom];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) {
|
||||
if ((aSides & (eSideBitsBottom | eSideBitsLeft)) == (eSideBitsBottom | eSideBitsLeft)) {
|
||||
// adjust the bottom's left a bit
|
||||
r[NS_SIDE_BOTTOM].x += aBorderSizes[NS_SIDE_LEFT];
|
||||
r[NS_SIDE_BOTTOM].width -= aBorderSizes[NS_SIDE_LEFT];
|
||||
r[eSideBottom].x += aBorderSizes[eSideLeft];
|
||||
r[eSideBottom].width -= aBorderSizes[eSideLeft];
|
||||
}
|
||||
|
||||
// Filling these one by one is faster than filling them all at once.
|
||||
@@ -1305,10 +1305,10 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(int aSides, const nsBorderCo
|
||||
|
||||
siRect = Rect(tl.x, tl.y, br.x - tl.x , br.y - tl.y);
|
||||
|
||||
fakeBorderSizes[NS_SIDE_TOP] = siRect.TopLeft().y - soRect.TopLeft().y;
|
||||
fakeBorderSizes[NS_SIDE_RIGHT] = soRect.TopRight().x - siRect.TopRight().x;
|
||||
fakeBorderSizes[NS_SIDE_BOTTOM] = soRect.BottomRight().y - siRect.BottomRight().y;
|
||||
fakeBorderSizes[NS_SIDE_LEFT] = siRect.BottomLeft().x - soRect.BottomLeft().x;
|
||||
fakeBorderSizes[eSideTop] = siRect.TopLeft().y - soRect.TopLeft().y;
|
||||
fakeBorderSizes[eSideRight] = soRect.TopRight().x - siRect.TopRight().x;
|
||||
fakeBorderSizes[eSideBottom] = soRect.BottomRight().y - siRect.BottomRight().y;
|
||||
fakeBorderSizes[eSideLeft] = siRect.BottomLeft().x - soRect.BottomLeft().x;
|
||||
|
||||
FillSolidBorder(soRect, siRect, radii, fakeBorderSizes, aSides, color);
|
||||
|
||||
@@ -1321,7 +1321,7 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(int aSides, const nsBorderCo
|
||||
void
|
||||
nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
||||
{
|
||||
if (aSides == 0 || (aSides & ~SIDE_BITS_ALL) != 0) {
|
||||
if (aSides == 0 || (aSides & ~eSideBitsAll) != 0) {
|
||||
NS_WARNING("DrawBorderSides: invalid sides!");
|
||||
return;
|
||||
}
|
||||
@@ -1350,28 +1350,28 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
||||
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_DASHED ||
|
||||
borderRenderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
|
||||
// Draw each corner separately, with the given side's color.
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TL);
|
||||
} else if (aSides & SIDE_BIT_LEFT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_TL);
|
||||
if (aSides & eSideBitsTop) {
|
||||
DrawDashedOrDottedCorner(eSideTop, C_TL);
|
||||
} else if (aSides & eSideBitsLeft) {
|
||||
DrawDashedOrDottedCorner(eSideLeft, C_TL);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TR);
|
||||
} else if (aSides & SIDE_BIT_RIGHT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_TR);
|
||||
if (aSides & eSideBitsTop) {
|
||||
DrawDashedOrDottedCorner(eSideTop, C_TR);
|
||||
} else if (aSides & eSideBitsRight) {
|
||||
DrawDashedOrDottedCorner(eSideRight, C_TR);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BL);
|
||||
} else if (aSides & SIDE_BIT_LEFT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_BL);
|
||||
if (aSides & eSideBitsBottom) {
|
||||
DrawDashedOrDottedCorner(eSideBottom, C_BL);
|
||||
} else if (aSides & eSideBitsLeft) {
|
||||
DrawDashedOrDottedCorner(eSideLeft, C_BL);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BR);
|
||||
} else if (aSides & SIDE_BIT_RIGHT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_BR);
|
||||
if (aSides & eSideBitsBottom) {
|
||||
DrawDashedOrDottedCorner(eSideBottom, C_BR);
|
||||
} else if (aSides & eSideBitsRight) {
|
||||
DrawDashedOrDottedCorner(eSideRight, C_BR);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1474,7 +1474,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
||||
// The caller should never give us anything with a mix
|
||||
// of TL/BR if the border style would require a
|
||||
// TL/BR split.
|
||||
if (aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT))
|
||||
if (aSides & (eSideBitsBottom | eSideBitsRight))
|
||||
borderColorStyle = borderColorStyleBottomRight;
|
||||
else
|
||||
borderColorStyle = borderColorStyleTopLeft;
|
||||
@@ -1544,39 +1544,39 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
||||
|
||||
// If there is at least one dotted side, every side is rendered separately.
|
||||
if (IsSingleSide(aSides)) {
|
||||
if (aSides == SIDE_BIT_TOP) {
|
||||
if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (aSides == eSideBitsTop) {
|
||||
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TR])) {
|
||||
noMarginRight = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TL])) {
|
||||
noMarginLeft = true;
|
||||
}
|
||||
} else if (aSides == SIDE_BIT_RIGHT) {
|
||||
if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
} else if (aSides == eSideBitsRight) {
|
||||
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TR])) {
|
||||
noMarginTop = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BR])) {
|
||||
noMarginBottom = true;
|
||||
}
|
||||
} else if (aSides == SIDE_BIT_BOTTOM) {
|
||||
if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
} else if (aSides == eSideBitsBottom) {
|
||||
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BR])) {
|
||||
noMarginRight = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BL])) {
|
||||
noMarginLeft = true;
|
||||
}
|
||||
} else {
|
||||
if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TL])) {
|
||||
noMarginTop = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BL])) {
|
||||
noMarginBottom = true;
|
||||
}
|
||||
@@ -1627,7 +1627,7 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
||||
void
|
||||
nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
|
||||
Float aDash[2],
|
||||
mozilla::css::Side aSide,
|
||||
mozilla::Side aSide,
|
||||
Float aBorderLength, bool isCorner)
|
||||
{
|
||||
uint8_t style = mBorderStyles[aSide];
|
||||
@@ -1803,23 +1803,23 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
|
||||
}
|
||||
|
||||
static Float
|
||||
GetBorderLength(mozilla::css::Side aSide,
|
||||
GetBorderLength(mozilla::Side aSide,
|
||||
const Point& aStart, const Point& aEnd)
|
||||
{
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
return aEnd.x - aStart.x;
|
||||
}
|
||||
if (aSide == NS_SIDE_RIGHT) {
|
||||
if (aSide == eSideRight) {
|
||||
return aEnd.y - aStart.y;
|
||||
}
|
||||
if (aSide == NS_SIDE_BOTTOM) {
|
||||
if (aSide == eSideBottom) {
|
||||
return aStart.x - aEnd.x;
|
||||
}
|
||||
return aStart.y - aEnd.y;
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::css::Side aSide)
|
||||
nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::Side aSide)
|
||||
{
|
||||
// Draw dashed/dotted side with following approach.
|
||||
//
|
||||
@@ -1888,7 +1888,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::css::Side aSide)
|
||||
// For dotted sides that can merge with their prior dotted sides, advance the
|
||||
// dash offset to measure the distance around the combined path. This prevents
|
||||
// two dots from bunching together at a corner.
|
||||
mozilla::css::Side mergeSide = aSide;
|
||||
mozilla::Side mergeSide = aSide;
|
||||
while (IsCornerMergeable(GetCCWCorner(mergeSide))) {
|
||||
mergeSide = PREV_SIDE(mergeSide);
|
||||
// If we looped all the way around, measure starting at the top side, since
|
||||
@@ -1927,7 +1927,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedSide(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
||||
{
|
||||
// Draw each circles separately for dotted with borderWidth > 2.0.
|
||||
// Dashed line with CapStyle::ROUND doesn't render perfect circles.
|
||||
@@ -2081,16 +2081,16 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
// Ei
|
||||
|
||||
Point I(0.0f, 0.0f), J(0.0f, 0.0f);
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
I.x = 1.0f;
|
||||
J.y = 1.0f;
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
} else if (aSide == eSideRight) {
|
||||
I.y = 1.0f;
|
||||
J.x = -1.0f;
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
I.x = -1.0f;
|
||||
J.y = -1.0f;
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
} else if (aSide == eSideLeft) {
|
||||
I.y = -1.0f;
|
||||
J.x = 1.0f;
|
||||
}
|
||||
@@ -2167,7 +2167,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
// Extend dirty rect to avoid clipping pixel for anti-aliasing.
|
||||
const Float AA_MARGIN = 2.0f;
|
||||
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
// Tweak |from| and |to| to fit into |mDirtyRect + radius margin|,
|
||||
// to render only paths that may overlap mDirtyRect.
|
||||
//
|
||||
@@ -2212,7 +2212,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
} else if (aSide == eSideRight) {
|
||||
Float top = mDirtyRect.y - radius - AA_MARGIN;
|
||||
if (fromP.y < top) {
|
||||
size_t tmp = ceil(count * (top - start.y) / (end.y - start.y));
|
||||
@@ -2235,7 +2235,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
Float right = mDirtyRect.x + mDirtyRect.width + radius + AA_MARGIN;
|
||||
if (fromP.x > right) {
|
||||
size_t tmp = ceil(count * (right - start.x) / (end.x - start.x));
|
||||
@@ -2258,7 +2258,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
} else if (aSide == eSideLeft) {
|
||||
Float bottom = mDirtyRect.y + mDirtyRect.height + radius + AA_MARGIN;
|
||||
if (fromP.y > bottom) {
|
||||
size_t tmp = ceil(count * (bottom - start.y) / (end.y - start.y));
|
||||
@@ -2307,8 +2307,8 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner)
|
||||
{
|
||||
// Draw dashed/dotted corner with following approach.
|
||||
//
|
||||
@@ -2345,8 +2345,8 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::css::Side aSide,
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::css::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::css::Side sideV(GetVerticalSide(aCorner));
|
||||
mozilla::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::Side sideV(GetVerticalSide(aCorner));
|
||||
Float borderWidthH = mBorderWidths[sideH];
|
||||
Float borderWidthV = mBorderWidths[sideV];
|
||||
if (borderWidthH == 0.0f && borderWidthV == 0.0f) {
|
||||
@@ -2416,14 +2416,14 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::css::Side aSide,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner)
|
||||
{
|
||||
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
|
||||
"Style should be dotted.");
|
||||
|
||||
mozilla::css::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::css::Side sideV(GetVerticalSide(aCorner));
|
||||
mozilla::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::Side sideV(GetVerticalSide(aCorner));
|
||||
Float R0 = mBorderWidths[sideH] / 2.0f;
|
||||
Float Rn = mBorderWidths[sideV] / 2.0f;
|
||||
if (R0 == 0.0f && Rn == 0.0f) {
|
||||
@@ -2493,14 +2493,14 @@ DashedPathOverlapsRect(Rect& pathRect,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner)
|
||||
{
|
||||
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED,
|
||||
"Style should be dashed.");
|
||||
|
||||
mozilla::css::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::css::Side sideV(GetVerticalSide(aCorner));
|
||||
mozilla::Side sideH(GetHorizontalSide(aCorner));
|
||||
mozilla::Side sideV(GetVerticalSide(aCorner));
|
||||
Float borderWidthH = mBorderWidths[sideH];
|
||||
Float borderWidthV = mBorderWidths[sideV];
|
||||
if (borderWidthH == 0.0f && borderWidthV == 0.0f) {
|
||||
@@ -2609,8 +2609,8 @@ nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::css::Side aSide,
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner)
|
||||
nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner)
|
||||
{
|
||||
// Render too large dashed or dotted corner with solid style, to avoid hangup
|
||||
// inside DashedCornerFinder and DottedCornerFinder.
|
||||
@@ -2839,7 +2839,7 @@ ComputeCornerSkirtSize(Float aAlpha1, Float aAlpha2,
|
||||
// seams when anti-aliased drawing is used.
|
||||
static void
|
||||
DrawBorderRadius(DrawTarget* aDrawTarget,
|
||||
mozilla::css::Corner c,
|
||||
mozilla::Corner c,
|
||||
const Point& aOuterCorner, const Point& aInnerCorner,
|
||||
const twoFloats& aCornerMultPrev, const twoFloats& aCornerMultNext,
|
||||
const Size& aCornerDims,
|
||||
@@ -3046,8 +3046,8 @@ nsCSSBorderRenderer::DrawNoCompositeColorSolidBorder()
|
||||
// Thus, the CCW corner of the next side will end up drawn here.
|
||||
|
||||
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
|
||||
mozilla::css::Corner c = mozilla::css::Corner((i+1) % 4);
|
||||
mozilla::css::Corner prevCorner = mozilla::css::Corner(i);
|
||||
mozilla::Corner c = mozilla::Corner((i+1) % 4);
|
||||
mozilla::Corner prevCorner = mozilla::Corner(i);
|
||||
|
||||
// i+2 and i+3 respectively. These are used to index into the corner
|
||||
// multiplier table, and were deduced by calculating out the long form
|
||||
@@ -3184,9 +3184,9 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
|
||||
// Examine the border style to figure out if we can draw it in one
|
||||
// go or not.
|
||||
bool tlBordersSame = AreBorderSideFinalStylesSame(SIDE_BIT_TOP | SIDE_BIT_LEFT);
|
||||
bool brBordersSame = AreBorderSideFinalStylesSame(SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT);
|
||||
bool allBordersSame = AreBorderSideFinalStylesSame(SIDE_BITS_ALL);
|
||||
bool tlBordersSame = AreBorderSideFinalStylesSame(eSideBitsTop | eSideBitsLeft);
|
||||
bool brBordersSame = AreBorderSideFinalStylesSame(eSideBitsBottom | eSideBitsRight);
|
||||
bool allBordersSame = AreBorderSideFinalStylesSame(eSideBitsAll);
|
||||
if (allBordersSame &&
|
||||
((mCompositeColors[0] == nullptr &&
|
||||
(mBorderStyles[0] == NS_STYLE_BORDER_STYLE_NONE ||
|
||||
@@ -3240,8 +3240,8 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
}
|
||||
|
||||
// Initial values only used when the border colors/widths are all the same:
|
||||
ColorPattern color(ToDeviceColor(mBorderColors[NS_SIDE_TOP]));
|
||||
StrokeOptions strokeOptions(mBorderWidths[NS_SIDE_TOP]); // stroke width
|
||||
ColorPattern color(ToDeviceColor(mBorderColors[eSideTop]));
|
||||
StrokeOptions strokeOptions(mBorderWidths[eSideTop]); // stroke width
|
||||
|
||||
bool allBordersSolid;
|
||||
|
||||
@@ -3271,10 +3271,10 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
// Relatively simple case.
|
||||
gfxRect outerRect = ThebesRect(mOuterRect);
|
||||
RoundedRect borderInnerRect(outerRect, mBorderRadii);
|
||||
borderInnerRect.Deflate(mBorderWidths[NS_SIDE_TOP],
|
||||
mBorderWidths[NS_SIDE_BOTTOM],
|
||||
mBorderWidths[NS_SIDE_LEFT],
|
||||
mBorderWidths[NS_SIDE_RIGHT]);
|
||||
borderInnerRect.Deflate(mBorderWidths[eSideTop],
|
||||
mBorderWidths[eSideBottom],
|
||||
mBorderWidths[eSideLeft],
|
||||
mBorderWidths[eSideRight]);
|
||||
|
||||
// Instead of stroking we just use two paths: an inner and an outer.
|
||||
// This allows us to draw borders that we couldn't when stroking. For example,
|
||||
@@ -3368,7 +3368,7 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
|
||||
if (allBordersSame && !forceSeparateCorners) {
|
||||
/* Draw everything in one go */
|
||||
DrawBorderSides(SIDE_BITS_ALL);
|
||||
DrawBorderSides(eSideBitsAll);
|
||||
PrintAsStringNewline("---------------- (1)");
|
||||
} else {
|
||||
PROFILER_LABEL("nsCSSBorderRenderer", "DrawBorders::multipass",
|
||||
@@ -3385,14 +3385,14 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
* a 1.0 unit border all around and no border radius.
|
||||
*/
|
||||
|
||||
NS_FOR_CSS_CORNERS(corner) {
|
||||
const mozilla::css::Side sides[2] = { mozilla::css::Side(corner), PREV_SIDE(corner) };
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
const mozilla::Side sides[2] = { mozilla::Side(corner), PREV_SIDE(corner) };
|
||||
|
||||
if (!IsZeroSize(mBorderRadii[corner]))
|
||||
continue;
|
||||
|
||||
if (mBorderWidths[sides[0]] == 1.0 && mBorderWidths[sides[1]] == 1.0) {
|
||||
if (corner == NS_CORNER_TOP_LEFT || corner == NS_CORNER_TOP_RIGHT)
|
||||
if (corner == eCornerTopLeft || corner == eCornerTopRight)
|
||||
mBorderCornerDimensions[corner].width = 0.0;
|
||||
else
|
||||
mBorderCornerDimensions[corner].height = 0.0;
|
||||
@@ -3400,7 +3400,7 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
}
|
||||
|
||||
// First, the corners
|
||||
NS_FOR_CSS_CORNERS(corner) {
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
// if there's no corner, don't do all this work for it
|
||||
if (IsZeroSize(mBorderCornerDimensions[corner]))
|
||||
continue;
|
||||
@@ -3447,7 +3447,7 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
// advantages outway the modest easthetic improvement.
|
||||
|
||||
for (int cornerSide = 0; cornerSide < 2; cornerSide++) {
|
||||
mozilla::css::Side side = mozilla::css::Side(sides[cornerSide]);
|
||||
mozilla::Side side = mozilla::Side(sides[cornerSide]);
|
||||
uint8_t style = mBorderStyles[side];
|
||||
|
||||
PrintAsFormatString("corner: %d cornerSide: %d side: %d style: %d\n", corner, cornerSide, side, style);
|
||||
@@ -3476,16 +3476,16 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
int alreadyDrawnSides = 0;
|
||||
if (mOneUnitBorder &&
|
||||
mNoBorderRadius &&
|
||||
(dashedSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == 0)
|
||||
(dashedSides & (eSideBitsTop | eSideBitsLeft)) == 0)
|
||||
{
|
||||
if (tlBordersSame) {
|
||||
DrawBorderSides(SIDE_BIT_TOP | SIDE_BIT_LEFT);
|
||||
alreadyDrawnSides |= (SIDE_BIT_TOP | SIDE_BIT_LEFT);
|
||||
DrawBorderSides(eSideBitsTop | eSideBitsLeft);
|
||||
alreadyDrawnSides |= (eSideBitsTop | eSideBitsLeft);
|
||||
}
|
||||
|
||||
if (brBordersSame && (dashedSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == 0) {
|
||||
DrawBorderSides(SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT);
|
||||
alreadyDrawnSides |= (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT);
|
||||
if (brBordersSame && (dashedSides & (eSideBitsBottom | eSideBitsRight)) == 0) {
|
||||
DrawBorderSides(eSideBitsBottom | eSideBitsRight);
|
||||
alreadyDrawnSides |= (eSideBitsBottom | eSideBitsRight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,22 +142,22 @@ private:
|
||||
bool AreBorderSideFinalStylesSame(uint8_t aSides);
|
||||
|
||||
// For the given style, is the given corner a solid color?
|
||||
bool IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCorner);
|
||||
bool IsSolidCornerStyle(uint8_t aStyle, mozilla::Corner aCorner);
|
||||
|
||||
// For the given corner, is the given corner mergeable into one dot?
|
||||
bool IsCornerMergeable(mozilla::css::Corner aCorner);
|
||||
bool IsCornerMergeable(mozilla::Corner aCorner);
|
||||
|
||||
// For the given solid corner, what color style should be used?
|
||||
BorderColorStyle BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css::Corner aCorner);
|
||||
BorderColorStyle BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::Corner aCorner);
|
||||
|
||||
//
|
||||
// Path generation functions
|
||||
//
|
||||
|
||||
// Get the Rect for drawing the given corner
|
||||
Rect GetCornerRect(mozilla::css::Corner aCorner);
|
||||
Rect GetCornerRect(mozilla::Corner aCorner);
|
||||
// add the path for drawing the given side without any adjacent corners to the context
|
||||
Rect GetSideClipWithoutCornersRect(mozilla::css::Side aSide);
|
||||
Rect GetSideClipWithoutCornersRect(mozilla::Side aSide);
|
||||
|
||||
// Create a clip path for the wedge that this side of
|
||||
// the border should take up. This is only called
|
||||
@@ -167,11 +167,11 @@ private:
|
||||
// This code needs to make sure that the individual pieces
|
||||
// don't ever (mathematically) overlap; the pixel overlap
|
||||
// is taken care of by the ADD compositing.
|
||||
already_AddRefed<Path> GetSideClipSubPath(mozilla::css::Side aSide);
|
||||
already_AddRefed<Path> GetSideClipSubPath(mozilla::Side aSide);
|
||||
|
||||
// Return start or end point for dashed/dotted side
|
||||
Point GetStraightBorderPoint(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner,
|
||||
Point GetStraightBorderPoint(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner,
|
||||
bool* aIsUnfilled,
|
||||
Float aDotOffset = 0.0f);
|
||||
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
// corner
|
||||
void GetOuterAndInnerBezier(Bezier* aOuterBezier,
|
||||
Bezier* aInnerBezier,
|
||||
mozilla::css::Corner aCorner);
|
||||
mozilla::Corner aCorner);
|
||||
|
||||
// Given a set of sides to fill and a color, do so in the fastest way.
|
||||
//
|
||||
@@ -213,30 +213,30 @@ private:
|
||||
|
||||
// Setup the stroke options for the given dashed/dotted side
|
||||
void SetupDashedOptions(StrokeOptions* aStrokeOptions,
|
||||
Float aDash[2], mozilla::css::Side aSide,
|
||||
Float aDash[2], mozilla::Side aSide,
|
||||
Float aBorderLength, bool isCorner);
|
||||
|
||||
// Draw the given dashed/dotte side
|
||||
void DrawDashedOrDottedSide(mozilla::css::Side aSide);
|
||||
void DrawDashedOrDottedSide(mozilla::Side aSide);
|
||||
|
||||
// Draw the given dotted side, each dot separately
|
||||
void DrawDottedSideSlow(mozilla::css::Side aSide);
|
||||
void DrawDottedSideSlow(mozilla::Side aSide);
|
||||
|
||||
// Draw the given dashed/dotted corner
|
||||
void DrawDashedOrDottedCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
void DrawDashedOrDottedCorner(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner);
|
||||
|
||||
// Draw the given dotted corner, each segment separately
|
||||
void DrawDottedCornerSlow(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
void DrawDottedCornerSlow(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner);
|
||||
|
||||
// Draw the given dashed corner, each dot separately
|
||||
void DrawDashedCornerSlow(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
void DrawDashedCornerSlow(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner);
|
||||
|
||||
// Draw the given dashed/dotted corner with solid style
|
||||
void DrawFallbackSolidCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
void DrawFallbackSolidCorner(mozilla::Side aSide,
|
||||
mozilla::Corner aCorner);
|
||||
|
||||
// Analyze if all border sides have the same width.
|
||||
bool AllBordersSameWidth();
|
||||
|
||||
@@ -4129,19 +4129,19 @@ nsDisplayBorder::CalculateBounds(const nsStyleBorder& aStyleBorder)
|
||||
nscoord radii[8];
|
||||
if (mFrame->GetBorderRadii(radii)) {
|
||||
if (border.left > 0 || border.top > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_LEFT_X], radii[NS_CORNER_TOP_LEFT_Y]);
|
||||
nsSize cornerSize(radii[eCornerTopLeftX], radii[eCornerTopLeftY]);
|
||||
result.UnionRect(result, nsRect(borderBounds.TopLeft(), cornerSize));
|
||||
}
|
||||
if (border.top > 0 || border.right > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_RIGHT_X], radii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
nsSize cornerSize(radii[eCornerTopRightX], radii[eCornerTopRightY]);
|
||||
result.UnionRect(result, nsRect(borderBounds.TopRight() - nsPoint(cornerSize.width, 0), cornerSize));
|
||||
}
|
||||
if (border.right > 0 || border.bottom > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_RIGHT_X], radii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
nsSize cornerSize(radii[eCornerBottomRightX], radii[eCornerBottomRightY]);
|
||||
result.UnionRect(result, nsRect(borderBounds.BottomRight() - nsPoint(cornerSize.width, cornerSize.height), cornerSize));
|
||||
}
|
||||
if (border.bottom > 0 || border.left > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_LEFT_X], radii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
nsSize cornerSize(radii[eCornerBottomLeftX], radii[eCornerBottomLeftY]);
|
||||
result.UnionRect(result, nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2412,18 +2412,18 @@ nsLayoutUtils::RoundedRectIntersectRect(const nsRect& aRoundedRect,
|
||||
// rectFullHeight and rectFullWidth together will approximately contain
|
||||
// the total area of the frame minus the rounded corners.
|
||||
nsRect rectFullHeight = aRoundedRect;
|
||||
nscoord xDiff = std::max(aRadii[NS_CORNER_TOP_LEFT_X], aRadii[NS_CORNER_BOTTOM_LEFT_X]);
|
||||
nscoord xDiff = std::max(aRadii[eCornerTopLeftX], aRadii[eCornerBottomLeftX]);
|
||||
rectFullHeight.x += xDiff;
|
||||
rectFullHeight.width -= std::max(aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X]) + xDiff;
|
||||
rectFullHeight.width -= std::max(aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerBottomRightX]) + xDiff;
|
||||
nsRect r1;
|
||||
r1.IntersectRect(rectFullHeight, aContainedRect);
|
||||
|
||||
nsRect rectFullWidth = aRoundedRect;
|
||||
nscoord yDiff = std::max(aRadii[NS_CORNER_TOP_LEFT_Y], aRadii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
nscoord yDiff = std::max(aRadii[eCornerTopLeftY], aRadii[eCornerTopRightY]);
|
||||
rectFullWidth.y += yDiff;
|
||||
rectFullWidth.height -= std::max(aRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]) + yDiff;
|
||||
rectFullWidth.height -= std::max(aRadii[eCornerBottomLeftY],
|
||||
aRadii[eCornerBottomRightY]) + yDiff;
|
||||
nsRect r2;
|
||||
r2.IntersectRect(rectFullWidth, aContainedRect);
|
||||
|
||||
@@ -2505,17 +2505,17 @@ nsLayoutUtils::RoundedRectIntersectsRect(const nsRect& aRoundedRect,
|
||||
// top left corner of aBounds when rounded by aRadii, etc. If any
|
||||
// corner is not, then fail; otherwise succeed.
|
||||
return CheckCorner(insets.left, insets.top,
|
||||
aRadii[NS_CORNER_TOP_LEFT_X],
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y]) &&
|
||||
aRadii[eCornerTopLeftX],
|
||||
aRadii[eCornerTopLeftY]) &&
|
||||
CheckCorner(insets.right, insets.top,
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y]) &&
|
||||
aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerTopRightY]) &&
|
||||
CheckCorner(insets.right, insets.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]) &&
|
||||
aRadii[eCornerBottomRightX],
|
||||
aRadii[eCornerBottomRightY]) &&
|
||||
CheckCorner(insets.left, insets.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
aRadii[eCornerBottomLeftX],
|
||||
aRadii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
nsRect
|
||||
@@ -4655,9 +4655,9 @@ GetBSizeTakenByBoxSizing(StyleBoxSizing aBoxSizing,
|
||||
const nsStyleSides& stylePadding =
|
||||
aFrame->StylePadding()->mPadding;
|
||||
const nsStyleCoord& paddingStart =
|
||||
stylePadding.Get(aHorizontalAxis ? NS_SIDE_TOP : NS_SIDE_LEFT);
|
||||
stylePadding.Get(aHorizontalAxis ? eSideTop : eSideLeft);
|
||||
const nsStyleCoord& paddingEnd =
|
||||
stylePadding.Get(aHorizontalAxis ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT);
|
||||
stylePadding.Get(aHorizontalAxis ? eSideBottom : eSideRight);
|
||||
nscoord pad;
|
||||
// XXXbz Calling GetPercentBSize on padding values looks bogus, since
|
||||
// percent padding is always a percentage of the inline-size of the
|
||||
@@ -6787,32 +6787,32 @@ nsLayoutUtils::HasNonZeroCorner(const nsStyleCorners& aCorners)
|
||||
}
|
||||
|
||||
// aCorner is a "full corner" value, i.e. NS_CORNER_TOP_LEFT etc
|
||||
static bool IsCornerAdjacentToSide(uint8_t aCorner, css::Side aSide)
|
||||
static bool IsCornerAdjacentToSide(uint8_t aCorner, Side aSide)
|
||||
{
|
||||
static_assert((int)NS_SIDE_TOP == NS_CORNER_TOP_LEFT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideTop == eCornerTopLeft, "Check for Full Corner");
|
||||
static_assert((int)eSideRight == eCornerTopRight, "Check for Full Corner");
|
||||
static_assert((int)eSideBottom == eCornerBottomRight, "Check for Full Corner");
|
||||
static_assert((int)eSideLeft == eCornerBottomLeft, "Check for Full Corner");
|
||||
static_assert((int)eSideTop == ((eCornerTopRight - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideRight == ((eCornerBottomRight - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideBottom == ((eCornerBottomLeft - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideLeft == ((eCornerTopLeft - 1)&3), "Check for Full Corner");
|
||||
|
||||
return aSide == aCorner || aSide == ((aCorner - 1)&3);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
|
||||
css::Side aSide)
|
||||
Side aSide)
|
||||
{
|
||||
static_assert(NS_CORNER_TOP_LEFT_X/2 == NS_CORNER_TOP_LEFT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_LEFT_Y/2 == NS_CORNER_TOP_LEFT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_RIGHT_X/2 == NS_CORNER_TOP_RIGHT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_RIGHT_Y/2 == NS_CORNER_TOP_RIGHT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_RIGHT_X/2 == NS_CORNER_BOTTOM_RIGHT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_RIGHT_Y/2 == NS_CORNER_BOTTOM_RIGHT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_LEFT_X/2 == NS_CORNER_BOTTOM_LEFT, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_LEFT_Y/2 == NS_CORNER_BOTTOM_LEFT, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopLeftX/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopLeftY/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopRightX/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopRightY/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomRightX/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomRightY/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomLeftX/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomLeftY/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
|
||||
NS_FOR_CSS_HALF_CORNERS(corner) {
|
||||
// corner is a "half corner" value, so dividing by two gives us a
|
||||
|
||||
@@ -1911,7 +1911,7 @@ public:
|
||||
* given side.
|
||||
*/
|
||||
static bool HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
|
||||
mozilla::css::Side aSide);
|
||||
mozilla::Side aSide);
|
||||
|
||||
/**
|
||||
* Determine if a widget is likely to require transparency or translucency.
|
||||
|
||||
@@ -48,7 +48,7 @@ nsRect
|
||||
nsFieldSetFrame::VisualBorderRectRelativeToSelf() const
|
||||
{
|
||||
WritingMode wm = GetWritingMode();
|
||||
css::Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
|
||||
Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
|
||||
nscoord legendBorder = StyleBorder()->GetComputedBorderWidth(legendSide);
|
||||
LogicalRect r(wm, LogicalPoint(wm, 0, 0), GetLogicalSize(wm));
|
||||
nsSize containerSize = r.Size(wm).GetPhysicalSize(wm);
|
||||
@@ -234,7 +234,7 @@ nsFieldSetFrame::PaintBorder(
|
||||
this, rect);
|
||||
|
||||
if (nsIFrame* legend = GetLegend()) {
|
||||
css::Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
|
||||
Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
|
||||
nscoord legendBorderWidth =
|
||||
StyleBorder()->GetComputedBorderWidth(legendSide);
|
||||
|
||||
|
||||
@@ -900,10 +900,10 @@ ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
|
||||
nsMargin& aComputedOffsets)
|
||||
{
|
||||
LogicalMargin offsets(aWM);
|
||||
mozilla::css::Side inlineStart = aWM.PhysicalSide(eLogicalSideIStart);
|
||||
mozilla::css::Side inlineEnd = aWM.PhysicalSide(eLogicalSideIEnd);
|
||||
mozilla::css::Side blockStart = aWM.PhysicalSide(eLogicalSideBStart);
|
||||
mozilla::css::Side blockEnd = aWM.PhysicalSide(eLogicalSideBEnd);
|
||||
mozilla::Side inlineStart = aWM.PhysicalSide(eLogicalSideIStart);
|
||||
mozilla::Side inlineEnd = aWM.PhysicalSide(eLogicalSideIEnd);
|
||||
mozilla::Side blockStart = aWM.PhysicalSide(eLogicalSideBStart);
|
||||
mozilla::Side blockEnd = aWM.PhysicalSide(eLogicalSideBEnd);
|
||||
|
||||
const nsStylePosition* position = aFrame->StylePosition();
|
||||
|
||||
@@ -1139,9 +1139,9 @@ ReflowInput::CalculateBorderPaddingMargin(
|
||||
nscoord* aOutsideBoxSizing) const
|
||||
{
|
||||
WritingMode wm = GetWritingMode();
|
||||
mozilla::css::Side startSide =
|
||||
mozilla::Side startSide =
|
||||
wm.PhysicalSide(MakeLogicalSide(aAxis, eLogicalEdgeStart));
|
||||
mozilla::css::Side endSide =
|
||||
mozilla::Side endSide =
|
||||
wm.PhysicalSide(MakeLogicalSide(aAxis, eLogicalEdgeEnd));
|
||||
|
||||
nsMargin styleBorder = mStyleBorder->GetComputedBorder();
|
||||
|
||||
@@ -324,11 +324,11 @@ public:
|
||||
// two-bit values:
|
||||
// bit 0 = the eOrientationMask value
|
||||
// bit 1 = the eBlockFlowMask value
|
||||
static const mozilla::css::Side kLogicalBlockSides[][2] = {
|
||||
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // horizontal-tb
|
||||
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // vertical-rl
|
||||
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // (horizontal-bt)
|
||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // vertical-lr
|
||||
static const mozilla::Side kLogicalBlockSides[][2] = {
|
||||
{ eSideTop, eSideBottom }, // horizontal-tb
|
||||
{ eSideRight, eSideLeft }, // vertical-rl
|
||||
{ eSideBottom, eSideTop }, // (horizontal-bt)
|
||||
{ eSideLeft, eSideRight }, // vertical-lr
|
||||
};
|
||||
|
||||
// Ignore the SIDEWAYS_MASK bit of the writing-mode value, as this has no
|
||||
@@ -352,23 +352,23 @@ public:
|
||||
// is no horizontal-bt writing-mode, and no text-orientation value that
|
||||
// produces "inverted" text. (The former 'sideways-left' value, no longer
|
||||
// in the spec, would have produced this in vertical-rl mode.)
|
||||
static const mozilla::css::Side kLogicalInlineSides[][2] = {
|
||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb ltr
|
||||
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl ltr
|
||||
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb rtl
|
||||
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl rtl
|
||||
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) (inverted) ltr
|
||||
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // sideways-lr rtl
|
||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) (inverted) rtl
|
||||
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // sideways-lr ltr
|
||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb (inverted) rtl
|
||||
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl (inverted) rtl
|
||||
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb (inverted) ltr
|
||||
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl (inverted) ltr
|
||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) ltr
|
||||
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-lr ltr
|
||||
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) rtl
|
||||
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-lr rtl
|
||||
static const mozilla::Side kLogicalInlineSides[][2] = {
|
||||
{ eSideLeft, eSideRight }, // horizontal-tb ltr
|
||||
{ eSideTop, eSideBottom }, // vertical-rl ltr
|
||||
{ eSideRight, eSideLeft }, // horizontal-tb rtl
|
||||
{ eSideBottom, eSideTop }, // vertical-rl rtl
|
||||
{ eSideRight, eSideLeft }, // (horizontal-bt) (inverted) ltr
|
||||
{ eSideTop, eSideBottom }, // sideways-lr rtl
|
||||
{ eSideLeft, eSideRight }, // (horizontal-bt) (inverted) rtl
|
||||
{ eSideBottom, eSideTop }, // sideways-lr ltr
|
||||
{ eSideLeft, eSideRight }, // horizontal-tb (inverted) rtl
|
||||
{ eSideTop, eSideBottom }, // vertical-rl (inverted) rtl
|
||||
{ eSideRight, eSideLeft }, // horizontal-tb (inverted) ltr
|
||||
{ eSideBottom, eSideTop }, // vertical-rl (inverted) ltr
|
||||
{ eSideLeft, eSideRight }, // (horizontal-bt) ltr
|
||||
{ eSideTop, eSideBottom }, // vertical-lr ltr
|
||||
{ eSideRight, eSideLeft }, // (horizontal-bt) rtl
|
||||
{ eSideBottom, eSideTop }, // vertical-lr rtl
|
||||
};
|
||||
|
||||
// Inline axis sides depend on all three of writing-mode, text-orientation
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
* given the current writing mode.
|
||||
* (This is the inverse of the PhysicalSide() method above.)
|
||||
*/
|
||||
LogicalSide LogicalSideForPhysicalSide(mozilla::css::Side aSide) const
|
||||
LogicalSide LogicalSideForPhysicalSide(mozilla::Side aSide) const
|
||||
{
|
||||
// indexes are four-bit values:
|
||||
// bit 0 = the eOrientationMask value
|
||||
|
||||
@@ -93,14 +93,14 @@ nsColumnSetFrame::PaintColumnRule(nsRenderingContext* aCtx,
|
||||
nsStyleBorder border(presContext);
|
||||
Sides skipSides;
|
||||
if (isVertical) {
|
||||
border.SetBorderWidth(NS_SIDE_TOP, ruleWidth);
|
||||
border.SetBorderStyle(NS_SIDE_TOP, ruleStyle);
|
||||
border.SetBorderWidth(eSideTop, ruleWidth);
|
||||
border.SetBorderStyle(eSideTop, ruleStyle);
|
||||
border.mBorderTopColor = StyleComplexColor::FromColor(ruleColor);
|
||||
skipSides |= mozilla::eSideBitsLeftRight;
|
||||
skipSides |= mozilla::eSideBitsBottom;
|
||||
} else {
|
||||
border.SetBorderWidth(NS_SIDE_LEFT, ruleWidth);
|
||||
border.SetBorderStyle(NS_SIDE_LEFT, ruleStyle);
|
||||
border.SetBorderWidth(eSideLeft, ruleWidth);
|
||||
border.SetBorderStyle(eSideLeft, ruleStyle);
|
||||
border.mBorderLeftColor = StyleComplexColor::FromColor(ruleColor);
|
||||
skipSides |= mozilla::eSideBitsTopBottom;
|
||||
skipSides |= mozilla::eSideBitsRight;
|
||||
|
||||
@@ -847,9 +847,9 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
|
||||
aType == nsLayoutUtils::PREF_ISIZE, "bad type");
|
||||
|
||||
WritingMode wm = GetWritingMode();
|
||||
mozilla::css::Side startSide =
|
||||
mozilla::Side startSide =
|
||||
wm.PhysicalSideForInlineAxis(eLogicalEdgeStart);
|
||||
mozilla::css::Side endSide =
|
||||
mozilla::Side endSide =
|
||||
wm.PhysicalSideForInlineAxis(eLogicalEdgeEnd);
|
||||
|
||||
const nsStylePadding *stylePadding = StylePadding();
|
||||
|
||||
+28
-28
@@ -1237,7 +1237,7 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
||||
NS_FOR_CSS_HALF_CORNERS(i) {
|
||||
const nsStyleCoord c = aBorderRadius.Get(i);
|
||||
nscoord axis =
|
||||
NS_HALF_CORNER_IS_X(i) ? aFrameSize.width : aFrameSize.height;
|
||||
HalfCornerIsX(i) ? aFrameSize.width : aFrameSize.height;
|
||||
|
||||
if (c.IsCoordPercentCalcUnit()) {
|
||||
aRadii[i] = nsRuleNode::ComputeCoordPercentCalc(c, axis);
|
||||
@@ -1252,31 +1252,31 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
||||
}
|
||||
|
||||
if (aSkipSides.Top()) {
|
||||
aRadii[NS_CORNER_TOP_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y] = 0;
|
||||
aRadii[eCornerTopLeftX] = 0;
|
||||
aRadii[eCornerTopLeftY] = 0;
|
||||
aRadii[eCornerTopRightX] = 0;
|
||||
aRadii[eCornerTopRightY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Right()) {
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0;
|
||||
aRadii[eCornerTopRightX] = 0;
|
||||
aRadii[eCornerTopRightY] = 0;
|
||||
aRadii[eCornerBottomRightX] = 0;
|
||||
aRadii[eCornerBottomRightY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Bottom()) {
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0;
|
||||
aRadii[eCornerBottomRightX] = 0;
|
||||
aRadii[eCornerBottomRightY] = 0;
|
||||
aRadii[eCornerBottomLeftX] = 0;
|
||||
aRadii[eCornerBottomLeftY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Left()) {
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y] = 0;
|
||||
aRadii[eCornerBottomLeftX] = 0;
|
||||
aRadii[eCornerBottomLeftY] = 0;
|
||||
aRadii[eCornerTopLeftX] = 0;
|
||||
aRadii[eCornerTopLeftY] = 0;
|
||||
}
|
||||
|
||||
// css3-background specifies this algorithm for reducing
|
||||
@@ -1284,10 +1284,10 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
||||
bool haveRadius = false;
|
||||
double ratio = 1.0f;
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
uint32_t hc1 = NS_SIDE_TO_HALF_CORNER(side, false, true);
|
||||
uint32_t hc2 = NS_SIDE_TO_HALF_CORNER(side, true, true);
|
||||
uint32_t hc1 = SideToHalfCorner(side, false, true);
|
||||
uint32_t hc2 = SideToHalfCorner(side, true, true);
|
||||
nscoord length =
|
||||
NS_SIDE_IS_VERTICAL(side) ? aBorderArea.height : aBorderArea.width;
|
||||
SideIsVertical(side) ? aBorderArea.height : aBorderArea.width;
|
||||
nscoord sum = aRadii[hc1] + aRadii[hc2];
|
||||
if (sum)
|
||||
haveRadius = true;
|
||||
@@ -1310,8 +1310,8 @@ nsIFrame::InsetBorderRadii(nscoord aRadii[8], const nsMargin &aOffsets)
|
||||
{
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
nscoord offset = aOffsets.Side(side);
|
||||
uint32_t hc1 = NS_SIDE_TO_HALF_CORNER(side, false, false);
|
||||
uint32_t hc2 = NS_SIDE_TO_HALF_CORNER(side, true, false);
|
||||
uint32_t hc1 = SideToHalfCorner(side, false, false);
|
||||
uint32_t hc2 = SideToHalfCorner(side, true, false);
|
||||
aRadii[hc1] = std::max(0, aRadii[hc1] - offset);
|
||||
aRadii[hc2] = std::max(0, aRadii[hc2] - offset);
|
||||
}
|
||||
@@ -1322,8 +1322,8 @@ nsIFrame::OutsetBorderRadii(nscoord aRadii[8], const nsMargin &aOffsets)
|
||||
{
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
nscoord offset = aOffsets.Side(side);
|
||||
uint32_t hc1 = NS_SIDE_TO_HALF_CORNER(side, false, false);
|
||||
uint32_t hc2 = NS_SIDE_TO_HALF_CORNER(side, true, false);
|
||||
uint32_t hc1 = SideToHalfCorner(side, false, false);
|
||||
uint32_t hc2 = SideToHalfCorner(side, true, false);
|
||||
if (aRadii[hc1] > 0)
|
||||
aRadii[hc1] += offset;
|
||||
if (aRadii[hc2] > 0)
|
||||
@@ -4579,11 +4579,11 @@ IntrinsicSizeOffsets(nsIFrame* aFrame, nscoord aPercentageBasis, bool aForISize)
|
||||
|
||||
const nsStyleBorder* styleBorder = aFrame->StyleBorder();
|
||||
if (verticalAxis) {
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_TOP);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_BOTTOM);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(eSideTop);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(eSideBottom);
|
||||
} else {
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(eSideLeft);
|
||||
result.hBorder += styleBorder->GetComputedBorderWidth(eSideRight);
|
||||
}
|
||||
|
||||
const nsStyleDisplay* disp = aFrame->StyleDisplay();
|
||||
|
||||
@@ -5814,26 +5814,26 @@ ScrollFrameHelper::GetBorderRadii(const nsSize& aFrameSize,
|
||||
|
||||
if (sb.left > 0 || sb.top > 0) {
|
||||
ReduceRadii(border.left, border.top,
|
||||
aRadii[NS_CORNER_TOP_LEFT_X],
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y]);
|
||||
aRadii[eCornerTopLeftX],
|
||||
aRadii[eCornerTopLeftY]);
|
||||
}
|
||||
|
||||
if (sb.top > 0 || sb.right > 0) {
|
||||
ReduceRadii(border.right, border.top,
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerTopRightY]);
|
||||
}
|
||||
|
||||
if (sb.right > 0 || sb.bottom > 0) {
|
||||
ReduceRadii(border.right, border.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
aRadii[eCornerBottomRightX],
|
||||
aRadii[eCornerBottomRightY]);
|
||||
}
|
||||
|
||||
if (sb.bottom > 0 || sb.left > 0) {
|
||||
ReduceRadii(border.left, border.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
aRadii[eCornerBottomLeftX],
|
||||
aRadii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -114,20 +114,20 @@ nsInlineFrame::IsSelfEmpty()
|
||||
// get logical start and end flags.
|
||||
if (wm.IsVertical()) {
|
||||
haveStart =
|
||||
border->GetComputedBorderWidth(NS_SIDE_TOP) != 0 ||
|
||||
border->GetComputedBorderWidth(eSideTop) != 0 ||
|
||||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetTop()) ||
|
||||
!IsMarginZero(margin->mMargin.GetTop());
|
||||
haveEnd =
|
||||
border->GetComputedBorderWidth(NS_SIDE_BOTTOM) != 0 ||
|
||||
border->GetComputedBorderWidth(eSideBottom) != 0 ||
|
||||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetBottom()) ||
|
||||
!IsMarginZero(margin->mMargin.GetBottom());
|
||||
} else {
|
||||
haveStart =
|
||||
border->GetComputedBorderWidth(NS_SIDE_LEFT) != 0 ||
|
||||
border->GetComputedBorderWidth(eSideLeft) != 0 ||
|
||||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetLeft()) ||
|
||||
!IsMarginZero(margin->mMargin.GetLeft());
|
||||
haveEnd =
|
||||
border->GetComputedBorderWidth(NS_SIDE_RIGHT) != 0 ||
|
||||
border->GetComputedBorderWidth(eSideRight) != 0 ||
|
||||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetRight()) ||
|
||||
!IsMarginZero(margin->mMargin.GetRight());
|
||||
}
|
||||
|
||||
@@ -760,8 +760,8 @@ IsPercentageAware(const nsIFrame* aFrame)
|
||||
pos->mWidth.GetUnit() != eStyleUnit_Auto) ||
|
||||
pos->MaxWidthDependsOnContainer() ||
|
||||
pos->MinWidthDependsOnContainer() ||
|
||||
pos->OffsetHasPercent(NS_SIDE_RIGHT) ||
|
||||
pos->OffsetHasPercent(NS_SIDE_LEFT)) {
|
||||
pos->OffsetHasPercent(eSideRight) ||
|
||||
pos->OffsetHasPercent(eSideLeft)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
||||
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
|
||||
if (xmost > aDesiredSize.Width()) {
|
||||
nscoord widthToFit = xmost + padding.right +
|
||||
kidReflowInput.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
|
||||
kidReflowInput.mStyleBorder->GetComputedBorderWidth(eSideRight);
|
||||
float ratio = float(maxSize.width) / widthToFit;
|
||||
NS_ASSERTION(ratio >= 0.0 && ratio < 1.0, "invalid shrink-to-fit ratio");
|
||||
mPD->mShrinkToFitRatio = std::min(mPD->mShrinkToFitRatio, ratio);
|
||||
|
||||
@@ -200,13 +200,13 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
|
||||
// values, we simply repeat the last value.
|
||||
uint32_t listLength = rowLinesList->Length();
|
||||
if (rowIndex < listLength) {
|
||||
aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
|
||||
aStyleBorder.SetBorderStyle(eSideTop,
|
||||
rowLinesList->ElementAt(rowIndex - 1));
|
||||
} else {
|
||||
aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
|
||||
aStyleBorder.SetBorderStyle(eSideTop,
|
||||
rowLinesList->ElementAt(listLength - 1));
|
||||
}
|
||||
aStyleBorder.SetBorderWidth(NS_SIDE_TOP, borderWidth);
|
||||
aStyleBorder.SetBorderWidth(eSideTop, borderWidth);
|
||||
}
|
||||
|
||||
// We don't place a column line on the left of the first column.
|
||||
@@ -215,13 +215,13 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
|
||||
// values, we simply repeat the last value.
|
||||
uint32_t listLength = columnLinesList->Length();
|
||||
if (columnIndex < listLength) {
|
||||
aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
|
||||
aStyleBorder.SetBorderStyle(eSideLeft,
|
||||
columnLinesList->ElementAt(columnIndex - 1));
|
||||
} else {
|
||||
aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
|
||||
aStyleBorder.SetBorderStyle(eSideLeft,
|
||||
columnLinesList->ElementAt(listLength - 1));
|
||||
}
|
||||
aStyleBorder.SetBorderWidth(NS_SIDE_LEFT, borderWidth);
|
||||
aStyleBorder.SetBorderWidth(eSideLeft, borderWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3945,9 +3945,9 @@ StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
|
||||
const nsStyleCorners& radii = shape->GetRadius();
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
auto pair = MakeUnique<nsCSSValuePair>();
|
||||
if (!StyleCoordToCSSValue(radii.Get(NS_FULL_TO_HALF_CORNER(corner, false)),
|
||||
if (!StyleCoordToCSSValue(radii.Get(FullToHalfCorner(corner, false)),
|
||||
pair->mXValue) ||
|
||||
!StyleCoordToCSSValue(radii.Get(NS_FULL_TO_HALF_CORNER(corner, true)),
|
||||
!StyleCoordToCSSValue(radii.Get(FullToHalfCorner(corner, true)),
|
||||
pair->mYValue)) {
|
||||
return false;
|
||||
}
|
||||
@@ -4373,15 +4373,15 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
|
||||
case eStyleAnimType_Sides_Bottom:
|
||||
case eStyleAnimType_Sides_Left: {
|
||||
static_assert(
|
||||
NS_SIDE_TOP == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
|
||||
NS_SIDE_RIGHT == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
|
||||
NS_SIDE_BOTTOM == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
|
||||
NS_SIDE_LEFT == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
|
||||
eSideTop == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
|
||||
eSideRight == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
|
||||
eSideBottom == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
|
||||
eSideLeft == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
|
||||
"box side constants out of sync with animation side constants");
|
||||
|
||||
const nsStyleCoord &coord =
|
||||
StyleDataAtOffset<nsStyleSides>(styleStruct, ssOffset).
|
||||
Get(mozilla::css::Side(animType - eStyleAnimType_Sides_Top));
|
||||
Get(mozilla::Side(animType - eStyleAnimType_Sides_Top));
|
||||
return StyleCoordToValue(coord, aComputedValue);
|
||||
}
|
||||
case eStyleAnimType_Corner_TopLeft:
|
||||
@@ -4389,23 +4389,23 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
|
||||
case eStyleAnimType_Corner_BottomRight:
|
||||
case eStyleAnimType_Corner_BottomLeft: {
|
||||
static_assert(
|
||||
NS_CORNER_TOP_LEFT == eStyleAnimType_Corner_TopLeft -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
NS_CORNER_TOP_RIGHT == eStyleAnimType_Corner_TopRight -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
NS_CORNER_BOTTOM_RIGHT == eStyleAnimType_Corner_BottomRight -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
NS_CORNER_BOTTOM_LEFT == eStyleAnimType_Corner_BottomLeft -
|
||||
eStyleAnimType_Corner_TopLeft,
|
||||
eCornerTopLeft == eStyleAnimType_Corner_TopLeft -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
eCornerTopRight == eStyleAnimType_Corner_TopRight -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
eCornerBottomRight == eStyleAnimType_Corner_BottomRight -
|
||||
eStyleAnimType_Corner_TopLeft &&
|
||||
eCornerBottomLeft == eStyleAnimType_Corner_BottomLeft -
|
||||
eStyleAnimType_Corner_TopLeft,
|
||||
"box corner constants out of sync with animation corner constants");
|
||||
|
||||
const nsStyleCorners& corners =
|
||||
StyleDataAtOffset<nsStyleCorners>(styleStruct, ssOffset);
|
||||
uint8_t fullCorner = animType - eStyleAnimType_Corner_TopLeft;
|
||||
Corner fullCorner = Corner(animType - eStyleAnimType_Corner_TopLeft);
|
||||
const nsStyleCoord &horiz =
|
||||
corners.Get(NS_FULL_TO_HALF_CORNER(fullCorner, false));
|
||||
corners.Get(FullToHalfCorner(fullCorner, false));
|
||||
const nsStyleCoord &vert =
|
||||
corners.Get(NS_FULL_TO_HALF_CORNER(fullCorner, true));
|
||||
corners.Get(FullToHalfCorner(fullCorner, true));
|
||||
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
|
||||
if (!StyleCoordToCSSValue(horiz, pair->mXValue) ||
|
||||
!StyleCoordToCSSValue(vert, pair->mYValue)) {
|
||||
|
||||
@@ -238,7 +238,7 @@ EnsurePhysicalProperty(nsCSSPropertyID& aProperty, nsRuleData* aRuleData)
|
||||
// We handle block axis logical properties separately to save a bit of
|
||||
// work that the WritingMode constructor does that is unnecessary
|
||||
// unless we have an inline axis property.
|
||||
mozilla::css::Side side;
|
||||
mozilla::Side side;
|
||||
if (isBlock) {
|
||||
uint8_t wm = aRuleData->mStyleContext->StyleVisibility()->mWritingMode;
|
||||
side = WritingMode::PhysicalSideForBlockAxis(wm, edge);
|
||||
@@ -249,8 +249,8 @@ EnsurePhysicalProperty(nsCSSPropertyID& aProperty, nsRuleData* aRuleData)
|
||||
|
||||
// We rely on the physical side constant values matching the order of
|
||||
// the physical properties in the logical group array.
|
||||
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
||||
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
||||
static_assert(eSideTop == 0 && eSideRight == 1 &&
|
||||
eSideBottom == 2 && eSideLeft == 3,
|
||||
"unexpected side constant values");
|
||||
index = side;
|
||||
}
|
||||
|
||||
@@ -2794,8 +2794,8 @@ static const nsCSSPropertyID gBorderBottomSubpropTable[] = {
|
||||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
||||
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
||||
static_assert(eSideTop == 0 && eSideRight == 1 &&
|
||||
eSideBottom == 2 && eSideLeft == 3,
|
||||
"box side constants not top/right/bottom/left == 0/1/2/3");
|
||||
static const nsCSSPropertyID gBorderColorSubpropTable[] = {
|
||||
// Code relies on these being in top-right-bottom-left order.
|
||||
|
||||
@@ -2565,8 +2565,8 @@ nsCSSRect_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
return n;
|
||||
}
|
||||
|
||||
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
||||
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
||||
static_assert(eSideTop == 0 && eSideRight == 1 &&
|
||||
eSideBottom == 2 && eSideLeft == 3,
|
||||
"box side constants not top/right/bottom/left == 0/1/2/3");
|
||||
|
||||
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
|
||||
@@ -3253,8 +3253,8 @@ nsCSSCornerSizes::Reset()
|
||||
}
|
||||
}
|
||||
|
||||
static_assert(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 &&
|
||||
NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3,
|
||||
static_assert(eCornerTopLeft == 0 && eCornerTopRight == 1 &&
|
||||
eCornerBottomRight == 2 && eCornerBottomLeft == 3,
|
||||
"box corner constants not tl/tr/br/bl == 0/1/2/3");
|
||||
|
||||
/* static */ const nsCSSCornerSizes::corner_type
|
||||
|
||||
@@ -985,7 +985,7 @@ nsComputedDOMStyle::DoGetFloat()
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBottom()
|
||||
{
|
||||
return GetOffsetWidthFor(NS_SIDE_BOTTOM);
|
||||
return GetOffsetWidthFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
@@ -3013,25 +3013,25 @@ nsComputedDOMStyle::DoGetRowGap()
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetPaddingTop()
|
||||
{
|
||||
return GetPaddingWidthFor(NS_SIDE_TOP);
|
||||
return GetPaddingWidthFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetPaddingBottom()
|
||||
{
|
||||
return GetPaddingWidthFor(NS_SIDE_BOTTOM);
|
||||
return GetPaddingWidthFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetPaddingLeft()
|
||||
{
|
||||
return GetPaddingWidthFor(NS_SIDE_LEFT);
|
||||
return GetPaddingWidthFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetPaddingRight()
|
||||
{
|
||||
return GetPaddingWidthFor(NS_SIDE_RIGHT);
|
||||
return GetPaddingWidthFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
@@ -3095,150 +3095,150 @@ nsComputedDOMStyle::DoGetTableLayout()
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopStyle()
|
||||
{
|
||||
return GetBorderStyleFor(NS_SIDE_TOP);
|
||||
return GetBorderStyleFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomStyle()
|
||||
{
|
||||
return GetBorderStyleFor(NS_SIDE_BOTTOM);
|
||||
return GetBorderStyleFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderLeftStyle()
|
||||
{
|
||||
return GetBorderStyleFor(NS_SIDE_LEFT);
|
||||
return GetBorderStyleFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderRightStyle()
|
||||
{
|
||||
return GetBorderStyleFor(NS_SIDE_RIGHT);
|
||||
return GetBorderStyleFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomColors()
|
||||
{
|
||||
return GetBorderColorsFor(NS_SIDE_BOTTOM);
|
||||
return GetBorderColorsFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderLeftColors()
|
||||
{
|
||||
return GetBorderColorsFor(NS_SIDE_LEFT);
|
||||
return GetBorderColorsFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderRightColors()
|
||||
{
|
||||
return GetBorderColorsFor(NS_SIDE_RIGHT);
|
||||
return GetBorderColorsFor(eSideRight);
|
||||
}
|
||||
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopColors()
|
||||
{
|
||||
return GetBorderColorsFor(NS_SIDE_TOP);
|
||||
return GetBorderColorsFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomLeftRadius()
|
||||
{
|
||||
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
||||
NS_CORNER_BOTTOM_LEFT);
|
||||
eCornerBottomLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomRightRadius()
|
||||
{
|
||||
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
||||
NS_CORNER_BOTTOM_RIGHT);
|
||||
eCornerBottomRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopLeftRadius()
|
||||
{
|
||||
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
||||
NS_CORNER_TOP_LEFT);
|
||||
eCornerTopLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopRightRadius()
|
||||
{
|
||||
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
||||
NS_CORNER_TOP_RIGHT);
|
||||
eCornerTopRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopWidth()
|
||||
{
|
||||
return GetBorderWidthFor(NS_SIDE_TOP);
|
||||
return GetBorderWidthFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomWidth()
|
||||
{
|
||||
return GetBorderWidthFor(NS_SIDE_BOTTOM);
|
||||
return GetBorderWidthFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderLeftWidth()
|
||||
{
|
||||
return GetBorderWidthFor(NS_SIDE_LEFT);
|
||||
return GetBorderWidthFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderRightWidth()
|
||||
{
|
||||
return GetBorderWidthFor(NS_SIDE_RIGHT);
|
||||
return GetBorderWidthFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderTopColor()
|
||||
{
|
||||
return GetBorderColorFor(NS_SIDE_TOP);
|
||||
return GetBorderColorFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderBottomColor()
|
||||
{
|
||||
return GetBorderColorFor(NS_SIDE_BOTTOM);
|
||||
return GetBorderColorFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderLeftColor()
|
||||
{
|
||||
return GetBorderColorFor(NS_SIDE_LEFT);
|
||||
return GetBorderColorFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBorderRightColor()
|
||||
{
|
||||
return GetBorderColorFor(NS_SIDE_RIGHT);
|
||||
return GetBorderColorFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetMarginTopWidth()
|
||||
{
|
||||
return GetMarginWidthFor(NS_SIDE_TOP);
|
||||
return GetMarginWidthFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetMarginBottomWidth()
|
||||
{
|
||||
return GetMarginWidthFor(NS_SIDE_BOTTOM);
|
||||
return GetMarginWidthFor(eSideBottom);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetMarginLeftWidth()
|
||||
{
|
||||
return GetMarginWidthFor(NS_SIDE_LEFT);
|
||||
return GetMarginWidthFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetMarginRightWidth()
|
||||
{
|
||||
return GetMarginWidthFor(NS_SIDE_RIGHT);
|
||||
return GetMarginWidthFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
@@ -3406,28 +3406,28 @@ already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetOutlineRadiusBottomLeft()
|
||||
{
|
||||
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
||||
NS_CORNER_BOTTOM_LEFT);
|
||||
eCornerBottomLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetOutlineRadiusBottomRight()
|
||||
{
|
||||
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
||||
NS_CORNER_BOTTOM_RIGHT);
|
||||
eCornerBottomRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetOutlineRadiusTopLeft()
|
||||
{
|
||||
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
||||
NS_CORNER_TOP_LEFT);
|
||||
eCornerTopLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetOutlineRadiusTopRight()
|
||||
{
|
||||
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
||||
NS_CORNER_TOP_RIGHT);
|
||||
eCornerTopRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
@@ -3440,10 +3440,10 @@ nsComputedDOMStyle::DoGetOutlineColor()
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius,
|
||||
uint8_t aFullCorner)
|
||||
Corner aFullCorner)
|
||||
{
|
||||
nsStyleCoord radiusX = aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, false));
|
||||
nsStyleCoord radiusY = aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, true));
|
||||
nsStyleCoord radiusX = aRadius.Get(FullToHalfCorner(aFullCorner, false));
|
||||
nsStyleCoord radiusY = aRadius.Get(FullToHalfCorner(aFullCorner, true));
|
||||
|
||||
// for compatibility, return a single value if X and Y are equal
|
||||
if (radiusX == radiusY) {
|
||||
@@ -5069,23 +5069,23 @@ nsComputedDOMStyle::DoGetObjectPosition()
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetLeft()
|
||||
{
|
||||
return GetOffsetWidthFor(NS_SIDE_LEFT);
|
||||
return GetOffsetWidthFor(eSideLeft);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetRight()
|
||||
{
|
||||
return GetOffsetWidthFor(NS_SIDE_RIGHT);
|
||||
return GetOffsetWidthFor(eSideRight);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetTop()
|
||||
{
|
||||
return GetOffsetWidthFor(NS_SIDE_TOP);
|
||||
return GetOffsetWidthFor(eSideTop);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetOffsetWidthFor(mozilla::Side aSide)
|
||||
{
|
||||
const nsStyleDisplay* display = StyleDisplay();
|
||||
|
||||
@@ -5116,7 +5116,7 @@ nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetAbsoluteOffset(mozilla::Side aSide)
|
||||
{
|
||||
MOZ_ASSERT(mOuterFrame, "need a frame, so we can call GetContainingBlock()");
|
||||
|
||||
@@ -5143,21 +5143,21 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
|
||||
|
||||
nscoord offset = 0;
|
||||
switch (aSide) {
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
offset = rect.y - margin.top - border.top - scrollbarSizes.top;
|
||||
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
offset = containerRect.width - rect.width -
|
||||
rect.x - margin.right - border.right - scrollbarSizes.right;
|
||||
|
||||
break;
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
offset = containerRect.height - rect.height -
|
||||
rect.y - margin.bottom - border.bottom - scrollbarSizes.bottom;
|
||||
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
offset = rect.x - margin.left - border.left - scrollbarSizes.left;
|
||||
|
||||
break;
|
||||
@@ -5171,13 +5171,13 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
|
||||
return val.forget();
|
||||
}
|
||||
|
||||
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
||||
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
||||
static_assert(eSideTop == 0 && eSideRight == 1 &&
|
||||
eSideBottom == 2 && eSideLeft == 3,
|
||||
"box side constants not as expected for NS_OPPOSITE_SIDE");
|
||||
#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
|
||||
#define NS_OPPOSITE_SIDE(s_) mozilla::Side(((s_) + 2) & 3)
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetRelativeOffset(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
@@ -5196,7 +5196,7 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
|
||||
sign = -1;
|
||||
}
|
||||
PercentageBaseGetter baseGetter;
|
||||
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
||||
if (aSide == eSideLeft || aSide == eSideRight) {
|
||||
baseGetter = &nsComputedDOMStyle::GetCBContentWidth;
|
||||
} else {
|
||||
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
|
||||
@@ -5207,7 +5207,7 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetStickyOffset(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetStickyOffset(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
@@ -5225,7 +5225,7 @@ nsComputedDOMStyle::GetStickyOffset(mozilla::css::Side aSide)
|
||||
return val.forget();
|
||||
}
|
||||
PercentageBaseGetter baseGetter;
|
||||
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
||||
if (aSide == eSideLeft || aSide == eSideRight) {
|
||||
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentWidth;
|
||||
} else {
|
||||
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentHeight;
|
||||
@@ -5237,7 +5237,7 @@ nsComputedDOMStyle::GetStickyOffset(mozilla::css::Side aSide)
|
||||
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetStaticOffset(mozilla::Side aSide)
|
||||
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
@@ -5246,7 +5246,7 @@ nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetPaddingWidthFor(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
@@ -5302,7 +5302,7 @@ nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetBorderColorsFor(mozilla::Side aSide)
|
||||
{
|
||||
const nsStyleBorder *border = StyleBorder();
|
||||
|
||||
@@ -5330,7 +5330,7 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetBorderWidthFor(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
@@ -5347,7 +5347,7 @@ nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetBorderColorFor(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
SetValueFromComplexColor(val, StyleBorder()->mBorderColor[aSide]);
|
||||
@@ -5355,7 +5355,7 @@ nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetMarginWidthFor(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
@@ -5376,7 +5376,7 @@ nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide)
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide)
|
||||
nsComputedDOMStyle::GetBorderStyleFor(mozilla::Side aSide)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(
|
||||
@@ -6002,9 +6002,9 @@ nsComputedDOMStyle::BasicShapeRadiiToString(nsAString& aCssText,
|
||||
nsAutoString horizontalString, verticalString;
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
horizontal.AppendElement(
|
||||
aCorners.Get(NS_FULL_TO_HALF_CORNER(corner, false)));
|
||||
aCorners.Get(FullToHalfCorner(corner, false)));
|
||||
vertical.AppendElement(
|
||||
aCorners.Get(NS_FULL_TO_HALF_CORNER(corner, true)));
|
||||
aCorners.Get(FullToHalfCorner(corner, true)));
|
||||
}
|
||||
BoxValuesToString(horizontalString, horizontal);
|
||||
BoxValuesToString(verticalString, vertical);
|
||||
|
||||
@@ -158,29 +158,29 @@ private:
|
||||
#undef STYLE_STRUCT
|
||||
|
||||
already_AddRefed<CSSValue> GetEllipseRadii(const nsStyleCorners& aRadius,
|
||||
uint8_t aFullCorner);
|
||||
mozilla::Corner aFullCorner);
|
||||
|
||||
already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetRelativeOffset(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetRelativeOffset(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetStickyOffset(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetStickyOffset(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetStaticOffset(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetStaticOffset(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetBorderColorsFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetBorderColorsFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetBorderColorFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetBorderColorFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::css::Side aSide);
|
||||
already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::Side aSide);
|
||||
|
||||
already_AddRefed<CSSValue> GetSVGPaintFor(bool aFill);
|
||||
|
||||
|
||||
@@ -7874,8 +7874,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
||||
const nsCSSPropertyID* subprops =
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
|
||||
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
|
||||
int cx = FullToHalfCorner(corner, false);
|
||||
int cy = FullToHalfCorner(corner, true);
|
||||
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
|
||||
nsStyleCoord parentX = parentBorder->mBorderRadius.Get(cx);
|
||||
nsStyleCoord parentY = parentBorder->mBorderRadius.Get(cy);
|
||||
@@ -8066,8 +8066,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct,
|
||||
const nsCSSPropertyID* subprops =
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty__moz_outline_radius);
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
|
||||
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
|
||||
int cx = FullToHalfCorner(corner, false);
|
||||
int cy = FullToHalfCorner(corner, true);
|
||||
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
|
||||
nsStyleCoord parentX = parentOutline->mOutlineRadius.Get(cx);
|
||||
nsStyleCoord parentY = parentOutline->mOutlineRadius.Get(cy);
|
||||
@@ -9915,8 +9915,8 @@ GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
|
||||
if (shapeFunction->Item(5).GetUnit() == eCSSUnit_Array) {
|
||||
nsCSSValue::Array* radiiArray = shapeFunction->Item(5).GetArrayValue();
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
|
||||
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
|
||||
int cx = FullToHalfCorner(corner, false);
|
||||
int cy = FullToHalfCorner(corner, true);
|
||||
const nsCSSValue& radius = radiiArray->Item(corner);
|
||||
nsStyleCoord coordX, coordY;
|
||||
DebugOnly<bool> didSetRadii = SetPairCoords(radius, coordX, coordY,
|
||||
|
||||
@@ -10,61 +10,11 @@
|
||||
|
||||
#include "gfxRect.h"
|
||||
#include "nsFont.h"
|
||||
#include "mozilla/MacroArgs.h" // for MOZ_CONCAT
|
||||
#include "X11UndefineNone.h"
|
||||
|
||||
// XXX fold this into nsStyleContext and group by nsStyleXXX struct
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
typedef mozilla::Side Side;
|
||||
} // namespace css
|
||||
|
||||
// Creates a for loop that walks over the four mozilla::css::Side values.
|
||||
// We use an int32_t helper variable (instead of a Side) for our loop counter,
|
||||
// to avoid triggering undefined behavior just before we exit the loop (at
|
||||
// which point the counter is incremented beyond the largest valid Side value).
|
||||
#define NS_FOR_CSS_SIDES(var_) \
|
||||
int32_t MOZ_CONCAT(var_,__LINE__) = NS_SIDE_TOP; \
|
||||
for (mozilla::css::Side var_; \
|
||||
MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT && \
|
||||
((var_ = mozilla::css::Side(MOZ_CONCAT(var_,__LINE__))), true); \
|
||||
MOZ_CONCAT(var_,__LINE__)++)
|
||||
|
||||
static inline css::Side operator++(css::Side& side, int) {
|
||||
NS_PRECONDITION(side >= NS_SIDE_TOP &&
|
||||
side <= NS_SIDE_LEFT, "Out of range side");
|
||||
side = css::Side(side + 1);
|
||||
return side;
|
||||
}
|
||||
|
||||
#define NS_FOR_CSS_FULL_CORNERS(var_) for (int32_t var_ = 0; var_ < 4; ++var_)
|
||||
|
||||
// Indices into "half corner" arrays (nsStyleCorners e.g.)
|
||||
#define NS_CORNER_TOP_LEFT_X 0
|
||||
#define NS_CORNER_TOP_LEFT_Y 1
|
||||
#define NS_CORNER_TOP_RIGHT_X 2
|
||||
#define NS_CORNER_TOP_RIGHT_Y 3
|
||||
#define NS_CORNER_BOTTOM_RIGHT_X 4
|
||||
#define NS_CORNER_BOTTOM_RIGHT_Y 5
|
||||
#define NS_CORNER_BOTTOM_LEFT_X 6
|
||||
#define NS_CORNER_BOTTOM_LEFT_Y 7
|
||||
|
||||
#define NS_FOR_CSS_HALF_CORNERS(var_) for (int32_t var_ = 0; var_ < 8; ++var_)
|
||||
|
||||
// The results of these conversion macros are exhaustively checked in
|
||||
// nsStyleCoord.cpp.
|
||||
// Arguments must not have side effects.
|
||||
|
||||
#define NS_HALF_CORNER_IS_X(var_) (!((var_)%2))
|
||||
#define NS_HALF_TO_FULL_CORNER(var_) ((var_)/2)
|
||||
#define NS_FULL_TO_HALF_CORNER(var_, vert_) ((var_)*2 + !!(vert_))
|
||||
|
||||
#define NS_SIDE_IS_VERTICAL(side_) ((side_) % 2)
|
||||
#define NS_SIDE_TO_FULL_CORNER(side_, second_) \
|
||||
(((side_) + !!(second_)) % 4)
|
||||
#define NS_SIDE_TO_HALF_CORNER(side_, second_, parallel_) \
|
||||
((((side_) + !!(second_))*2 + ((side_) + !(parallel_))%2) % 8)
|
||||
|
||||
// Basic shapes
|
||||
enum class StyleBasicShapeType : uint8_t {
|
||||
|
||||
@@ -328,94 +328,96 @@ void nsStyleCorners::Reset()
|
||||
}
|
||||
}
|
||||
|
||||
// Validation of NS_SIDE_IS_VERTICAL and NS_HALF_CORNER_IS_X.
|
||||
// Validation of SideIsVertical.
|
||||
#define CASE(side, result) \
|
||||
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
|
||||
"NS_SIDE_IS_VERTICAL is wrong")
|
||||
CASE(NS_SIDE_TOP, false);
|
||||
CASE(NS_SIDE_RIGHT, true);
|
||||
CASE(NS_SIDE_BOTTOM, false);
|
||||
CASE(NS_SIDE_LEFT, true);
|
||||
static_assert(SideIsVertical(side) == result, \
|
||||
"SideIsVertical is wrong")
|
||||
CASE(eSideTop, false);
|
||||
CASE(eSideRight, true);
|
||||
CASE(eSideBottom, false);
|
||||
CASE(eSideLeft, true);
|
||||
#undef CASE
|
||||
|
||||
// Validation of HalfCornerIsX.
|
||||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
|
||||
"NS_HALF_CORNER_IS_X is wrong")
|
||||
CASE(NS_CORNER_TOP_LEFT_X, true);
|
||||
CASE(NS_CORNER_TOP_LEFT_Y, false);
|
||||
CASE(NS_CORNER_TOP_RIGHT_X, true);
|
||||
CASE(NS_CORNER_TOP_RIGHT_Y, false);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_X, true);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_Y, false);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_X, true);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_Y, false);
|
||||
static_assert(HalfCornerIsX(corner) == result, \
|
||||
"HalfCornerIsX is wrong")
|
||||
CASE(eCornerTopLeftX, true);
|
||||
CASE(eCornerTopLeftY, false);
|
||||
CASE(eCornerTopRightX, true);
|
||||
CASE(eCornerTopRightY, false);
|
||||
CASE(eCornerBottomRightX, true);
|
||||
CASE(eCornerBottomRightY, false);
|
||||
CASE(eCornerBottomLeftX, true);
|
||||
CASE(eCornerBottomLeftY, false);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_HALF_TO_FULL_CORNER.
|
||||
// Validation of HalfToFullCorner.
|
||||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
|
||||
"NS_HALF_TO_FULL_CORNER is wrong")
|
||||
CASE(NS_CORNER_TOP_LEFT_X, NS_CORNER_TOP_LEFT);
|
||||
CASE(NS_CORNER_TOP_LEFT_Y, NS_CORNER_TOP_LEFT);
|
||||
CASE(NS_CORNER_TOP_RIGHT_X, NS_CORNER_TOP_RIGHT);
|
||||
CASE(NS_CORNER_TOP_RIGHT_Y, NS_CORNER_TOP_RIGHT);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_X, NS_CORNER_BOTTOM_RIGHT);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_Y, NS_CORNER_BOTTOM_RIGHT);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_X, NS_CORNER_BOTTOM_LEFT);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_Y, NS_CORNER_BOTTOM_LEFT);
|
||||
static_assert(HalfToFullCorner(corner) == result, \
|
||||
"HalfToFullCorner is wrong")
|
||||
CASE(eCornerTopLeftX, eCornerTopLeft);
|
||||
CASE(eCornerTopLeftY, eCornerTopLeft);
|
||||
CASE(eCornerTopRightX, eCornerTopRight);
|
||||
CASE(eCornerTopRightY, eCornerTopRight);
|
||||
CASE(eCornerBottomRightX, eCornerBottomRight);
|
||||
CASE(eCornerBottomRightY, eCornerBottomRight);
|
||||
CASE(eCornerBottomLeftX, eCornerBottomLeft);
|
||||
CASE(eCornerBottomLeftY, eCornerBottomLeft);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_FULL_TO_HALF_CORNER.
|
||||
// Validation of FullToHalfCorner.
|
||||
#define CASE(corner, vert, result) \
|
||||
static_assert(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
|
||||
"NS_FULL_TO_HALF_CORNER is wrong")
|
||||
CASE(NS_CORNER_TOP_LEFT, false, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(NS_CORNER_TOP_LEFT, true, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(NS_CORNER_TOP_RIGHT, false, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(NS_CORNER_TOP_RIGHT, true, NS_CORNER_TOP_RIGHT_Y);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT, false, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT, true, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT, false, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT, true, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
static_assert(FullToHalfCorner(corner, vert) == result, \
|
||||
"FullToHalfCorner is wrong")
|
||||
CASE(eCornerTopLeft, false, eCornerTopLeftX);
|
||||
CASE(eCornerTopLeft, true, eCornerTopLeftY);
|
||||
CASE(eCornerTopRight, false, eCornerTopRightX);
|
||||
CASE(eCornerTopRight, true, eCornerTopRightY);
|
||||
CASE(eCornerBottomRight, false, eCornerBottomRightX);
|
||||
CASE(eCornerBottomRight, true, eCornerBottomRightY);
|
||||
CASE(eCornerBottomLeft, false, eCornerBottomLeftX);
|
||||
CASE(eCornerBottomLeft, true, eCornerBottomLeftY);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
|
||||
// Validation of SideToFullCorner.
|
||||
#define CASE(side, second, result) \
|
||||
static_assert(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
|
||||
"NS_SIDE_TO_FULL_CORNER is wrong")
|
||||
CASE(NS_SIDE_TOP, false, NS_CORNER_TOP_LEFT);
|
||||
CASE(NS_SIDE_TOP, true, NS_CORNER_TOP_RIGHT);
|
||||
static_assert(SideToFullCorner(side, second) == result, \
|
||||
"SideToFullCorner is wrong")
|
||||
CASE(eSideTop, false, eCornerTopLeft);
|
||||
CASE(eSideTop, true, eCornerTopRight);
|
||||
|
||||
CASE(NS_SIDE_RIGHT, false, NS_CORNER_TOP_RIGHT);
|
||||
CASE(NS_SIDE_RIGHT, true, NS_CORNER_BOTTOM_RIGHT);
|
||||
CASE(eSideRight, false, eCornerTopRight);
|
||||
CASE(eSideRight, true, eCornerBottomRight);
|
||||
|
||||
CASE(NS_SIDE_BOTTOM, false, NS_CORNER_BOTTOM_RIGHT);
|
||||
CASE(NS_SIDE_BOTTOM, true, NS_CORNER_BOTTOM_LEFT);
|
||||
CASE(eSideBottom, false, eCornerBottomRight);
|
||||
CASE(eSideBottom, true, eCornerBottomLeft);
|
||||
|
||||
CASE(NS_SIDE_LEFT, false, NS_CORNER_BOTTOM_LEFT);
|
||||
CASE(NS_SIDE_LEFT, true, NS_CORNER_TOP_LEFT);
|
||||
CASE(eSideLeft, false, eCornerBottomLeft);
|
||||
CASE(eSideLeft, true, eCornerTopLeft);
|
||||
#undef CASE
|
||||
|
||||
//Validation of SideToHalfCorner.
|
||||
#define CASE(side, second, parallel, result) \
|
||||
static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
|
||||
"NS_SIDE_TO_HALF_CORNER is wrong")
|
||||
CASE(NS_SIDE_TOP, false, true, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(NS_SIDE_TOP, false, false, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(NS_SIDE_TOP, true, true, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(NS_SIDE_TOP, true, false, NS_CORNER_TOP_RIGHT_Y);
|
||||
static_assert(SideToHalfCorner(side, second, parallel) == result, \
|
||||
"SideToHalfCorner is wrong")
|
||||
CASE(eSideTop, false, true, eCornerTopLeftX);
|
||||
CASE(eSideTop, false, false, eCornerTopLeftY);
|
||||
CASE(eSideTop, true, true, eCornerTopRightX);
|
||||
CASE(eSideTop, true, false, eCornerTopRightY);
|
||||
|
||||
CASE(NS_SIDE_RIGHT, false, false, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(NS_SIDE_RIGHT, false, true, NS_CORNER_TOP_RIGHT_Y);
|
||||
CASE(NS_SIDE_RIGHT, true, false, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(NS_SIDE_RIGHT, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(eSideRight, false, false, eCornerTopRightX);
|
||||
CASE(eSideRight, false, true, eCornerTopRightY);
|
||||
CASE(eSideRight, true, false, eCornerBottomRightX);
|
||||
CASE(eSideRight, true, true, eCornerBottomRightY);
|
||||
|
||||
CASE(NS_SIDE_BOTTOM, false, true, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(NS_SIDE_BOTTOM, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(NS_SIDE_BOTTOM, true, true, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(NS_SIDE_BOTTOM, true, false, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
CASE(eSideBottom, false, true, eCornerBottomRightX);
|
||||
CASE(eSideBottom, false, false, eCornerBottomRightY);
|
||||
CASE(eSideBottom, true, true, eCornerBottomLeftX);
|
||||
CASE(eSideBottom, true, false, eCornerBottomLeftY);
|
||||
|
||||
CASE(NS_SIDE_LEFT, false, false, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(NS_SIDE_LEFT, false, true, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
CASE(NS_SIDE_LEFT, true, false, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(NS_SIDE_LEFT, true, true, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(eSideLeft, false, false, eCornerBottomLeftX);
|
||||
CASE(eSideLeft, false, true, eCornerBottomLeftY);
|
||||
CASE(eSideLeft, true, false, eCornerTopLeftX);
|
||||
CASE(eSideLeft, true, true, eCornerTopLeftY);
|
||||
#undef CASE
|
||||
|
||||
+28
-20
@@ -15,7 +15,7 @@ namespace mozilla {
|
||||
|
||||
class WritingMode;
|
||||
|
||||
// Logical axis, edge and side constants for use in various places.
|
||||
// Logical axis, edge, side and corner constants for use in various places.
|
||||
enum LogicalAxis {
|
||||
eLogicalAxisBlock = 0x0,
|
||||
eLogicalAxisInline = 0x1
|
||||
@@ -31,6 +31,14 @@ enum LogicalSide {
|
||||
eLogicalSideIEnd = (eLogicalAxisInline << 1) | eLogicalEdgeEnd // 0x3
|
||||
};
|
||||
|
||||
enum LogicalCorner
|
||||
{
|
||||
eLogicalCornerBStartIStart = 0,
|
||||
eLogicalCornerBStartIEnd = 1,
|
||||
eLogicalCornerBEndIEnd = 2,
|
||||
eLogicalCornerBEndIStart = 3
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
enum nsStyleUnit : uint8_t {
|
||||
@@ -272,13 +280,13 @@ public:
|
||||
bool operator==(const nsStyleSides& aOther) const;
|
||||
bool operator!=(const nsStyleSides& aOther) const;
|
||||
|
||||
inline nsStyleUnit GetUnit(mozilla::css::Side aSide) const;
|
||||
inline nsStyleUnit GetUnit(mozilla::Side aSide) const;
|
||||
inline nsStyleUnit GetLeftUnit() const;
|
||||
inline nsStyleUnit GetTopUnit() const;
|
||||
inline nsStyleUnit GetRightUnit() const;
|
||||
inline nsStyleUnit GetBottomUnit() const;
|
||||
|
||||
inline nsStyleCoord Get(mozilla::css::Side aSide) const;
|
||||
inline nsStyleCoord Get(mozilla::Side aSide) const;
|
||||
inline nsStyleCoord GetLeft() const;
|
||||
inline nsStyleCoord GetTop() const;
|
||||
inline nsStyleCoord GetRight() const;
|
||||
@@ -311,13 +319,13 @@ public:
|
||||
// constructors).
|
||||
void Reset();
|
||||
|
||||
inline void Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord);
|
||||
inline void Set(mozilla::Side aSide, const nsStyleCoord& aCoord);
|
||||
inline void SetLeft(const nsStyleCoord& aCoord);
|
||||
inline void SetTop(const nsStyleCoord& aCoord);
|
||||
inline void SetRight(const nsStyleCoord& aCoord);
|
||||
inline void SetBottom(const nsStyleCoord& aCoord);
|
||||
|
||||
nscoord ToLength(mozilla::css::Side aSide) const {
|
||||
nscoord ToLength(mozilla::Side aSide) const {
|
||||
return nsStyleCoord::ToLength(mUnits[aSide], mValues[aSide]);
|
||||
}
|
||||
|
||||
@@ -545,79 +553,79 @@ inline bool nsStyleSides::operator!=(const nsStyleSides& aOther) const
|
||||
return !((*this) == aOther);
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetUnit(mozilla::css::Side aSide) const
|
||||
inline nsStyleUnit nsStyleSides::GetUnit(mozilla::Side aSide) const
|
||||
{
|
||||
return (nsStyleUnit)mUnits[aSide];
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetLeftUnit() const
|
||||
{
|
||||
return GetUnit(NS_SIDE_LEFT);
|
||||
return GetUnit(mozilla::eSideLeft);
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetTopUnit() const
|
||||
{
|
||||
return GetUnit(NS_SIDE_TOP);
|
||||
return GetUnit(mozilla::eSideTop);
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetRightUnit() const
|
||||
{
|
||||
return GetUnit(NS_SIDE_RIGHT);
|
||||
return GetUnit(mozilla::eSideRight);
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetBottomUnit() const
|
||||
{
|
||||
return GetUnit(NS_SIDE_BOTTOM);
|
||||
return GetUnit(mozilla::eSideBottom);
|
||||
}
|
||||
|
||||
inline nsStyleCoord nsStyleSides::Get(mozilla::css::Side aSide) const
|
||||
inline nsStyleCoord nsStyleSides::Get(mozilla::Side aSide) const
|
||||
{
|
||||
return nsStyleCoord(mValues[aSide], nsStyleUnit(mUnits[aSide]));
|
||||
}
|
||||
|
||||
inline nsStyleCoord nsStyleSides::GetLeft() const
|
||||
{
|
||||
return Get(NS_SIDE_LEFT);
|
||||
return Get(mozilla::eSideLeft);
|
||||
}
|
||||
|
||||
inline nsStyleCoord nsStyleSides::GetTop() const
|
||||
{
|
||||
return Get(NS_SIDE_TOP);
|
||||
return Get(mozilla::eSideTop);
|
||||
}
|
||||
|
||||
inline nsStyleCoord nsStyleSides::GetRight() const
|
||||
{
|
||||
return Get(NS_SIDE_RIGHT);
|
||||
return Get(mozilla::eSideRight);
|
||||
}
|
||||
|
||||
inline nsStyleCoord nsStyleSides::GetBottom() const
|
||||
{
|
||||
return Get(NS_SIDE_BOTTOM);
|
||||
return Get(mozilla::eSideBottom);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord)
|
||||
inline void nsStyleSides::Set(mozilla::Side aSide, const nsStyleCoord& aCoord)
|
||||
{
|
||||
nsStyleCoord::SetValue(mUnits[aSide], mValues[aSide], aCoord);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
|
||||
{
|
||||
Set(NS_SIDE_LEFT, aCoord);
|
||||
Set(mozilla::eSideLeft, aCoord);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
|
||||
{
|
||||
Set(NS_SIDE_TOP, aCoord);
|
||||
Set(mozilla::eSideTop, aCoord);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
|
||||
{
|
||||
Set(NS_SIDE_RIGHT, aCoord);
|
||||
Set(mozilla::eSideRight, aCoord);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
|
||||
{
|
||||
Set(NS_SIDE_BOTTOM, aCoord);
|
||||
Set(mozilla::eSideBottom, aCoord);
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
|
||||
@@ -1207,7 +1207,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
|
||||
}
|
||||
}
|
||||
|
||||
void ClearBorderColors(mozilla::css::Side aSide) {
|
||||
void ClearBorderColors(mozilla::Side aSide) {
|
||||
if (mBorderColors && mBorderColors[aSide]) {
|
||||
delete mBorderColors[aSide];
|
||||
mBorderColors[aSide] = nullptr;
|
||||
@@ -1219,13 +1219,13 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
|
||||
// Note that this does *not* consider the effects of 'border-image':
|
||||
// if border-style is none, but there is a loaded border image,
|
||||
// HasVisibleStyle will be false even though there *is* a border.
|
||||
bool HasVisibleStyle(mozilla::css::Side aSide) const
|
||||
bool HasVisibleStyle(mozilla::Side aSide) const
|
||||
{
|
||||
return IsVisibleBorderStyle(mBorderStyle[aSide]);
|
||||
}
|
||||
|
||||
// aBorderWidth is in twips
|
||||
void SetBorderWidth(mozilla::css::Side aSide, nscoord aBorderWidth)
|
||||
void SetBorderWidth(mozilla::Side aSide, nscoord aBorderWidth)
|
||||
{
|
||||
nscoord roundedWidth =
|
||||
NS_ROUND_BORDER_TO_PIXELS(aBorderWidth, mTwipsPerPixel);
|
||||
@@ -1252,20 +1252,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
|
||||
// this is zero if and only if there is no border to be painted for this
|
||||
// side. That is, this value takes into account the border style and the
|
||||
// value is rounded to the nearest device pixel by NS_ROUND_BORDER_TO_PIXELS.
|
||||
nscoord GetComputedBorderWidth(mozilla::css::Side aSide) const
|
||||
nscoord GetComputedBorderWidth(mozilla::Side aSide) const
|
||||
{
|
||||
return GetComputedBorder().Side(aSide);
|
||||
}
|
||||
|
||||
uint8_t GetBorderStyle(mozilla::css::Side aSide) const
|
||||
uint8_t GetBorderStyle(mozilla::Side aSide) const
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
NS_ASSERTION(aSide <= eSideLeft, "bad side");
|
||||
return mBorderStyle[aSide];
|
||||
}
|
||||
|
||||
void SetBorderStyle(mozilla::css::Side aSide, uint8_t aStyle)
|
||||
void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
NS_ASSERTION(aSide <= eSideLeft, "bad side");
|
||||
mBorderStyle[aSide] = aStyle;
|
||||
mComputedBorder.Side(aSide) =
|
||||
(HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);
|
||||
@@ -1826,7 +1826,7 @@ public:
|
||||
bool MaxHeightDependsOnContainer() const
|
||||
{ return HeightCoordDependsOnContainer(mMaxHeight); }
|
||||
|
||||
bool OffsetHasPercent(mozilla::css::Side aSide) const
|
||||
bool OffsetHasPercent(mozilla::Side aSide) const
|
||||
{
|
||||
return mOffset.Get(aSide).HasPercent();
|
||||
}
|
||||
|
||||
@@ -1055,7 +1055,7 @@ nsTableCellMap::SetBCBorderEdge(LogicalSide aSide,
|
||||
// (aRowIndex, aColIndex). For eBStartIEnd, store it in the entry to the iEnd-wards where
|
||||
// it would be BStartIStart. For eBEndIEnd, store it in the entry to the bEnd-wards. etc.
|
||||
void
|
||||
nsTableCellMap::SetBCBorderCorner(Corner aCorner,
|
||||
nsTableCellMap::SetBCBorderCorner(LogicalCorner aCorner,
|
||||
nsCellMap& aCellMap,
|
||||
uint32_t aCellMapStart,
|
||||
uint32_t aRowIndex,
|
||||
@@ -1076,15 +1076,15 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner,
|
||||
int32_t yPos = aRowIndex;
|
||||
int32_t rgYPos = aRowIndex - aCellMapStart;
|
||||
|
||||
if (eBStartIEnd == aCorner) {
|
||||
if (eLogicalCornerBStartIEnd == aCorner) {
|
||||
xPos++;
|
||||
}
|
||||
else if (eBEndIEnd == aCorner) {
|
||||
else if (eLogicalCornerBEndIEnd == aCorner) {
|
||||
xPos++;
|
||||
rgYPos++;
|
||||
yPos++;
|
||||
}
|
||||
else if (eBEndIStart == aCorner) {
|
||||
else if (eLogicalCornerBEndIStart == aCorner) {
|
||||
rgYPos++;
|
||||
yPos++;
|
||||
}
|
||||
|
||||
@@ -35,14 +35,6 @@ struct nsColInfo
|
||||
int32_t aNumCellsSpan);
|
||||
};
|
||||
|
||||
enum Corner
|
||||
{
|
||||
eBStartIStart = 0,
|
||||
eBStartIEnd = 1,
|
||||
eBEndIEnd = 2,
|
||||
eBEndIStart = 3
|
||||
};
|
||||
|
||||
struct BCInfo
|
||||
{
|
||||
nsTArray<BCData> mIEndBorders;
|
||||
@@ -213,7 +205,7 @@ public:
|
||||
nscoord aSize,
|
||||
bool aChanged);
|
||||
|
||||
void SetBCBorderCorner(::Corner aCorner,
|
||||
void SetBCBorderCorner(mozilla::LogicalCorner aCorner,
|
||||
nsCellMap& aCellMap,
|
||||
uint32_t aCellMapStart,
|
||||
uint32_t aYPos,
|
||||
|
||||
@@ -5733,7 +5733,8 @@ nsTableFrame::CalcBCBorders()
|
||||
}
|
||||
else {
|
||||
tlCorner.Update(eLogicalSideIEnd, currentBorder);
|
||||
tableCellMap->SetBCBorderCorner(eBStartIStart, *iter.mCellMap, 0, 0, colIdx,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIStart,
|
||||
*iter.mCellMap, 0, 0, colIdx,
|
||||
LogicalSide(tlCorner.ownerSide),
|
||||
tlCorner.subWidth,
|
||||
tlCorner.bevel);
|
||||
@@ -5783,7 +5784,7 @@ nsTableFrame::CalcBCBorders()
|
||||
currentBorder = info.GetIStartEdgeBorder();
|
||||
BCCornerInfo& tlCorner = (0 == rowB) ? bStartCorners[0] : bEndCorners[0];
|
||||
tlCorner.Update(eLogicalSideBEnd, currentBorder);
|
||||
tableCellMap->SetBCBorderCorner(eBStartIStart, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIStart, *iter.mCellMap,
|
||||
iter.mRowGroupStart, rowB, 0,
|
||||
LogicalSide(tlCorner.ownerSide),
|
||||
tlCorner.subWidth,
|
||||
@@ -5822,7 +5823,7 @@ nsTableFrame::CalcBCBorders()
|
||||
bStartCorners[info.GetCellEndColIndex() + 1] :
|
||||
bEndCorners[info.GetCellEndColIndex() + 1];
|
||||
trCorner.Update(eLogicalSideBEnd, currentBorder); // bStart-iEnd
|
||||
tableCellMap->SetBCBorderCorner(eBStartIEnd, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIEnd, *iter.mCellMap,
|
||||
iter.mRowGroupStart, rowB,
|
||||
info.GetCellEndColIndex(),
|
||||
LogicalSide(trCorner.ownerSide),
|
||||
@@ -5830,7 +5831,7 @@ nsTableFrame::CalcBCBorders()
|
||||
trCorner.bevel);
|
||||
BCCornerInfo& brCorner = bEndCorners[info.GetCellEndColIndex() + 1];
|
||||
brCorner.Set(eLogicalSideBStart, currentBorder); // bEnd-iEnd
|
||||
tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap,
|
||||
iter.mRowGroupStart, rowB,
|
||||
info.GetCellEndColIndex(),
|
||||
LogicalSide(brCorner.ownerSide),
|
||||
@@ -5899,7 +5900,7 @@ nsTableFrame::CalcBCBorders()
|
||||
if (info.GetCellEndColIndex() < damageArea.EndCol() &&
|
||||
rowB >= damageArea.StartRow()) {
|
||||
if (0 != rowB) {
|
||||
tableCellMap->SetBCBorderCorner(eBStartIEnd, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBStartIEnd, *iter.mCellMap,
|
||||
iter.mRowGroupStart, rowB,
|
||||
info.GetCellEndColIndex(),
|
||||
LogicalSide(trCorner->ownerSide),
|
||||
@@ -5908,7 +5909,7 @@ nsTableFrame::CalcBCBorders()
|
||||
}
|
||||
// store any corners this cell spans together with the aja cell
|
||||
for (int32_t rX = rowB + 1; rX < rowB + segLength; rX++) {
|
||||
tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap,
|
||||
iter.mRowGroupStart, rX,
|
||||
info.GetCellEndColIndex(),
|
||||
LogicalSide(trCorner->ownerSide),
|
||||
@@ -5945,7 +5946,7 @@ nsTableFrame::CalcBCBorders()
|
||||
// update/store the bEnd-iStart & bEnd-IEnd corners
|
||||
BCCornerInfo& blCorner = bEndCorners[colIdx]; // bEnd-iStart
|
||||
blCorner.Update(eLogicalSideIEnd, currentBorder);
|
||||
tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap,
|
||||
iter.mRowGroupStart,
|
||||
info.GetCellEndRowIndex(),
|
||||
colIdx,
|
||||
@@ -5954,7 +5955,7 @@ nsTableFrame::CalcBCBorders()
|
||||
BCCornerInfo& brCorner = bEndCorners[colIdx + 1]; // bEnd-iEnd
|
||||
brCorner.Update(eLogicalSideIStart, currentBorder);
|
||||
if (info.mNumTableCols == colIdx + 1) { // bEnd-IEnd corner of the table
|
||||
tableCellMap->SetBCBorderCorner(eBEndIEnd, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIEnd, *iter.mCellMap,
|
||||
iter.mRowGroupStart,
|
||||
info.GetCellEndRowIndex(), colIdx,
|
||||
LogicalSide(brCorner.ownerSide),
|
||||
@@ -6026,7 +6027,7 @@ nsTableFrame::CalcBCBorders()
|
||||
if (info.GetCellEndRowIndex() < damageArea.EndRow() &&
|
||||
colIdx >= damageArea.StartCol()) {
|
||||
if (hitsSpanBelow) {
|
||||
tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap,
|
||||
iter.mRowGroupStart,
|
||||
info.GetCellEndRowIndex(), colIdx,
|
||||
LogicalSide(blCorner.ownerSide),
|
||||
@@ -6036,7 +6037,7 @@ nsTableFrame::CalcBCBorders()
|
||||
for (int32_t c = colIdx + 1; c < colIdx + segLength; c++) {
|
||||
BCCornerInfo& corner = bEndCorners[c];
|
||||
corner.Set(eLogicalSideIEnd, currentBorder);
|
||||
tableCellMap->SetBCBorderCorner(eBEndIStart, *iter.mCellMap,
|
||||
tableCellMap->SetBCBorderCorner(eLogicalCornerBEndIStart, *iter.mCellMap,
|
||||
iter.mRowGroupStart,
|
||||
info.GetCellEndRowIndex(), c,
|
||||
LogicalSide(corner.ownerSide),
|
||||
|
||||
@@ -183,13 +183,13 @@ BoxObject::GetOffsetRect(nsIntRect& aRect)
|
||||
|
||||
// For the origin, add in the border for the frame
|
||||
const nsStyleBorder* border = frame->StyleBorder();
|
||||
origin.x += border->GetComputedBorderWidth(NS_SIDE_LEFT);
|
||||
origin.y += border->GetComputedBorderWidth(NS_SIDE_TOP);
|
||||
origin.x += border->GetComputedBorderWidth(eSideLeft);
|
||||
origin.y += border->GetComputedBorderWidth(eSideTop);
|
||||
|
||||
// And subtract out the border for the parent
|
||||
const nsStyleBorder* parentBorder = parent->StyleBorder();
|
||||
origin.x -= parentBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
|
||||
origin.y -= parentBorder->GetComputedBorderWidth(NS_SIDE_TOP);
|
||||
origin.x -= parentBorder->GetComputedBorderWidth(eSideLeft);
|
||||
origin.y -= parentBorder->GetComputedBorderWidth(eSideTop);
|
||||
|
||||
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
|
||||
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);
|
||||
|
||||
@@ -1707,23 +1707,23 @@ void nsMenuPopupFrame::CanAdjustEdges(int8_t aHorizontalSide,
|
||||
popupAlign = -popupAlign;
|
||||
}
|
||||
|
||||
if (aHorizontalSide == (mHFlip ? NS_SIDE_RIGHT : NS_SIDE_LEFT)) {
|
||||
if (aHorizontalSide == (mHFlip ? eSideRight : eSideLeft)) {
|
||||
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_BOTTOMLEFT) {
|
||||
aChange.x = 0;
|
||||
}
|
||||
}
|
||||
else if (aHorizontalSide == (mHFlip ? NS_SIDE_LEFT : NS_SIDE_RIGHT)) {
|
||||
else if (aHorizontalSide == (mHFlip ? eSideLeft : eSideRight)) {
|
||||
if (popupAlign == POPUPALIGNMENT_TOPRIGHT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
|
||||
aChange.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (aVerticalSide == (mVFlip ? NS_SIDE_BOTTOM : NS_SIDE_TOP)) {
|
||||
if (aVerticalSide == (mVFlip ? eSideBottom : eSideTop)) {
|
||||
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_TOPRIGHT) {
|
||||
aChange.y = 0;
|
||||
}
|
||||
}
|
||||
else if (aVerticalSide == (mVFlip ? NS_SIDE_TOP : NS_SIDE_BOTTOM)) {
|
||||
else if (aVerticalSide == (mVFlip ? eSideTop : eSideBottom)) {
|
||||
if (popupAlign == POPUPALIGNMENT_BOTTOMLEFT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
|
||||
aChange.y = 0;
|
||||
}
|
||||
|
||||
@@ -173,8 +173,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
if (window || menuPopupFrame) {
|
||||
if (menuPopupFrame) {
|
||||
menuPopupFrame->CanAdjustEdges(
|
||||
(direction.mHorizontal == -1) ? NS_SIDE_LEFT : NS_SIDE_RIGHT,
|
||||
(direction.mVertical == -1) ? NS_SIDE_TOP : NS_SIDE_BOTTOM, mouseMove);
|
||||
(direction.mHorizontal == -1) ? eSideLeft : eSideRight,
|
||||
(direction.mVertical == -1) ? eSideTop : eSideBottom, mouseMove);
|
||||
}
|
||||
}
|
||||
else if (!contentToResize) {
|
||||
|
||||
@@ -23,10 +23,10 @@ using namespace mozilla;
|
||||
|
||||
nsBoxLayout* nsStackLayout::gInstance = nullptr;
|
||||
|
||||
#define SPECIFIED_LEFT (1 << NS_SIDE_LEFT)
|
||||
#define SPECIFIED_RIGHT (1 << NS_SIDE_RIGHT)
|
||||
#define SPECIFIED_TOP (1 << NS_SIDE_TOP)
|
||||
#define SPECIFIED_BOTTOM (1 << NS_SIDE_BOTTOM)
|
||||
#define SPECIFIED_LEFT (1 << eSideLeft)
|
||||
#define SPECIFIED_RIGHT (1 << eSideRight)
|
||||
#define SPECIFIED_TOP (1 << eSideTop)
|
||||
#define SPECIFIED_BOTTOM (1 << eSideBottom)
|
||||
|
||||
nsresult
|
||||
NS_NewStackLayout(nsCOMPtr<nsBoxLayout>& aNewLayout)
|
||||
|
||||
@@ -3322,7 +3322,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
|
||||
CalcComplexColor(borderStyle->mBorderLeftColor);
|
||||
ColorPattern colorPatt(ToDeviceColor(color));
|
||||
|
||||
uint8_t style = borderStyle->GetBorderStyle(NS_SIDE_LEFT);
|
||||
uint8_t style = borderStyle->GetBorderStyle(eSideLeft);
|
||||
StrokeOptions strokeOptions;
|
||||
nsLayoutUtils::InitDashPattern(strokeOptions, style);
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ CPU_preprocessor_checks = OrderedDict((
|
||||
('ia64', '__ia64__'),
|
||||
('s390x', '__s390x__'),
|
||||
('s390', '__s390__'),
|
||||
('ppc64', '__powerpc64__'),
|
||||
('ppc', '__powerpc__'),
|
||||
('ppc64', '__powerpc64__ || __ppc64__'),
|
||||
('ppc', '__powerpc__ || __ppc__'),
|
||||
('Alpha', '__alpha__'),
|
||||
('hppa', '__hppa__'),
|
||||
('sparc64', '__sparc__ && __arch64__'),
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
Twemoji Mozilla
|
||||
================
|
||||
|
||||
This is a COLR compiled version of the Twemoji font in TTF format.
|
||||
|
||||
The upstream repository of Twemoji Mozilla can be found at
|
||||
|
||||
https://github.com/mozilla/twemoji-colr
|
||||
|
||||
Please refer commit history for the current version of the font.
|
||||
Please refer to the commit history for the current version of the font.
|
||||
This file purposely omits the version, so there is no need to update it here.
|
||||
|
||||
Note: this version slightly deviates from upstream to account for slow uptake
|
||||
of changes by upstream.
|
||||
|
||||
|
||||
Binary file not shown.
@@ -161,7 +161,7 @@ void glxtest()
|
||||
fatal_error("The MOZ_AVOID_OPENGL_ALTOGETHER environment variable is defined");
|
||||
|
||||
///// Open libGL and load needed symbols /////
|
||||
#ifdef __OpenBSD__
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#define LIBGL_FILENAME "libGL.so"
|
||||
#else
|
||||
#define LIBGL_FILENAME "libGL.so.1"
|
||||
|
||||
@@ -100,16 +100,6 @@ public:
|
||||
// If mNoCrossProcessBoundaryForwarding is true, the event is not allowed to
|
||||
// cross process boundary.
|
||||
bool mNoCrossProcessBoundaryForwarding : 1;
|
||||
// If mNoContentDispatch is true, the event is never dispatched to the
|
||||
// event handlers which are added to the contents, onfoo attributes and
|
||||
// properties. Note that this flag is ignored when
|
||||
// EventChainPreVisitor::mForceContentDispatch is set true. For exapmle,
|
||||
// window and document object sets it true. Therefore, web applications
|
||||
// can handle the event if they add event listeners to the window or the
|
||||
// document.
|
||||
// XXX This is an ancient and broken feature, don't use this for new bug
|
||||
// as far as possible.
|
||||
bool mNoContentDispatch : 1;
|
||||
// If mOnlyChromeDispatch is true, the event is dispatched to only chrome.
|
||||
bool mOnlyChromeDispatch : 1;
|
||||
// If mOnlySystemGroupDispatchInContent is true, event listeners added to
|
||||
|
||||
Reference in New Issue
Block a user