author | Jonathan Kew <jkew@mozilla.com> |
Thu, 13 Nov 2014 08:58:04 +0000 | |
changeset 215482 | 618d8f44d9e29ce6513f2833bf2f633f5dd56784 |
parent 215481 | fad675db45989ce9d487bdf244ce1e85a8e29afa |
child 215483 | 7abada342a017e5eba9aad79b6c581c3a8e08026 |
push id | 27817 |
push user | cbook@mozilla.com |
push date | Thu, 13 Nov 2014 15:21:11 +0000 |
treeherder | mozilla-central@ae27ae77e32f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jdaggett |
bugs | 1090168 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -1352,16 +1352,35 @@ CanvasRenderingContext2D::ClearTarget() mDSPathBuilder = nullptr; ContextState *state = mStyleStack.AppendElement(); state->globalAlpha = 1.0; state->colorStyles[Style::FILL] = NS_RGB(0,0,0); state->colorStyles[Style::STROKE] = NS_RGB(0,0,0); state->shadowColor = NS_RGBA(0,0,0,0); + + // For vertical writing-mode, unless text-orientation is sideways, + // we'll modify the initial value of textBaseline to 'middle'. + nsRefPtr<nsStyleContext> canvasStyle; + if (mCanvasElement && mCanvasElement->IsInDoc()) { + nsCOMPtr<nsIPresShell> presShell = GetPresShell(); + if (presShell) { + canvasStyle = + nsComputedDOMStyle::GetStyleContextForElement(mCanvasElement, + nullptr, + presShell); + if (canvasStyle) { + WritingMode wm(canvasStyle); + if (wm.IsVertical() && !wm.IsSideways()) { + state->textBaseline = TextBaseline::MIDDLE; + } + } + } + } } NS_IMETHODIMP CanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, int32_t width, int32_t height) {