Index: third_party/WebKit/Source/core/layout/LayoutInline.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp |
index 0a4eda2dd57eb310ed1135c0862e548400dc8632..f33c3e2ec468f3682adb8ec08d0678d708cc1408 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp |
@@ -343,8 +343,18 @@ void LayoutInline::AddChildIgnoringContinuation(LayoutObject* new_child, |
// of this inline. We take all of the children after |beforeChild| and put |
// them in a clone of this object. |
RefPtr<ComputedStyle> new_style = |
- ComputedStyle::CreateAnonymousStyleWithDisplay( |
- ContainingBlock()->StyleRef(), EDisplay::kBlock); |
+ ComputedStyle::CreateAnonymousStyleWithDisplay(StyleRef(), |
+ EDisplay::kBlock); |
+ // The anon block we create here doesn't exist in the CSS spec, so |
+ // we need to ensure that any blocks it contains inherit properly |
+ // from its true parent. This means they must use the direction set by the |
+ // anon block's containing block, so we need to prevent the anon block |
+ // from inheriting direction from the inline. If there are any other |
+ // inheritable properties that apply to block and inline elements |
+ // but only affect the layout of children we will want to special-case |
+ // them here too. Writing-mode would be one if it didn't create a |
+ // formatting context of its own, removing the need for continuations. |
+ new_style->SetDirection(ContainingBlock()->StyleRef().Direction()); |
// If inside an inline affected by in-flow positioning the block needs to be |
// affected by it too. Giving the block a layer like this allows it to |