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