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;
|
||||
}
|
||||
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
nsRefPtr<nsStyleContext> parentContext;
|
||||
if (mCanvasElement && mCanvasElement->IsInDoc()) {
|
||||
// Inherit from the canvas element.
|
||||
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
|
||||
mCanvasElement, nullptr, presShell);
|
||||
}
|
||||
if (value.GetUnit() == nsCSSUnit::eCSSUnit_Color) {
|
||||
// if we already have a color we can just use it directly
|
||||
*aColor = value.GetColorValue();
|
||||
} else {
|
||||
// otherwise resolve it
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
nsRefPtr<nsStyleContext> parentContext;
|
||||
if (mCanvasElement && mCanvasElement->IsInDoc()) {
|
||||
// Inherit from the canvas element.
|
||||
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
|
||||
mCanvasElement, nullptr, presShell);
|
||||
}
|
||||
|
||||
unused << nsRuleNode::ComputeColor(
|
||||
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
|
||||
*aColor);
|
||||
unused << nsRuleNode::ComputeColor(
|
||||
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
|
||||
*aColor);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user