mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 811836. Fast path eCSSUnit_Color colors when parsing colors in canvas. r=dholbert
This will avoid doing extra work/flushing layout in the common case. --HG-- extra : rebase_source : 95df23c3e6a5118ec4964336465a6554705b99dd
This commit is contained in:
parent
9b8069b669
commit
517a0e7414
@ -591,17 +591,23 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPresShell* presShell = GetPresShell();
|
if (value.GetUnit() == nsCSSUnit::eCSSUnit_Color) {
|
||||||
nsRefPtr<nsStyleContext> parentContext;
|
// if we already have a color we can just use it directly
|
||||||
if (mCanvasElement && mCanvasElement->IsInDoc()) {
|
*aColor = value.GetColorValue();
|
||||||
// Inherit from the canvas element.
|
} else {
|
||||||
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
|
// otherwise resolve it
|
||||||
mCanvasElement, nullptr, presShell);
|
nsIPresShell* presShell = GetPresShell();
|
||||||
}
|
nsRefPtr<nsStyleContext> parentContext;
|
||||||
|
if (mCanvasElement && mCanvasElement->IsInDoc()) {
|
||||||
|
// Inherit from the canvas element.
|
||||||
|
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
|
||||||
|
mCanvasElement, nullptr, presShell);
|
||||||
|
}
|
||||||
|
|
||||||
unused << nsRuleNode::ComputeColor(
|
unused << nsRuleNode::ComputeColor(
|
||||||
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
|
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
|
||||||
*aColor);
|
*aColor);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user