Change ComputedStyle::setWritingMode() to return void instead of bool

Change ComputedStyle::setWritingMode() to return void instead of bool,
and updated the 2 callsites that use this functionality to match.

There is overhead from checking whether writingMode has changed and
returning instead of setting the value, and this patch removes that
overhead for callers that don't need this functionality.

Also, this is pre-work to generating writing-mode in ComputedStyleBase,
which aims to make all properties regular and share the same getter and
setter patterns where possible.

BUG=628043

Review-Url: https://codereview.chromium.org/2567963002
Cr-Commit-Position: refs/heads/master@{#438448}
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h
index 25189860..699f06b 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h
@@ -182,9 +182,12 @@
     if (m_style->setEffectiveZoom(f))
       m_fontBuilder.didChangeEffectiveZoom();
   }
-  void setWritingMode(WritingMode writingMode) {
-    if (m_style->setWritingMode(writingMode))
-      m_fontBuilder.didChangeWritingMode();
+  void setWritingMode(WritingMode newWritingMode) {
+    if (m_style->getWritingMode() == newWritingMode) {
+      return;
+    }
+    m_style->setWritingMode(newWritingMode);
+    m_fontBuilder.didChangeWritingMode();
   }
   void setTextOrientation(TextOrientation textOrientation) {
     if (m_style->setTextOrientation(textOrientation))
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 88ed08c..700adf8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1953,8 +1953,11 @@
 
 void LayoutObject::addChildWithWritingModeOfParent(LayoutObject* newChild,
                                                    LayoutObject* beforeChild) {
-  if (newChild->mutableStyleRef().setWritingMode(styleRef().getWritingMode()) &&
-      newChild->isBoxModelObject()) {
+  const WritingMode oldWritingMode =
+      newChild->mutableStyleRef().getWritingMode();
+  const WritingMode newWritingMode = styleRef().getWritingMode();
+  if (oldWritingMode != newWritingMode && newChild->isBoxModelObject()) {
+    newChild->mutableStyleRef().setWritingMode(newWritingMode);
     newChild->setHorizontalWritingMode(isHorizontalWritingMode());
   }
   addChild(newChild, beforeChild);
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index 8088675..514f63b 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -2280,13 +2280,7 @@
   WritingMode getWritingMode() const {
     return static_cast<WritingMode>(m_inheritedData.m_writingMode);
   }
-  bool setWritingMode(WritingMode v) {
-    if (v == getWritingMode())
-      return false;
-
-    m_inheritedData.m_writingMode = v;
-    return true;
-  }
+  void setWritingMode(WritingMode v) { m_inheritedData.m_writingMode = v; }
 
   // Text emphasis properties.
   static TextEmphasisFill initialTextEmphasisFill() {