Spannable: Add BackgroundSpan 49/285049/7
authorabedalrhman rasem <a.sheikha@partner.samsung.com>
Mon, 5 Dec 2022 08:36:04 +0000 (11:36 +0300)
committerabedalrhman rasem <a.sheikha@partner.samsung.com>
Tue, 20 Dec 2022 11:52:20 +0000 (14:52 +0300)
BackgroundSpan: Span to change the back groundSpan of characters.

Example:
===========================================================================================

    Dali::Toolkit::Text::SpannableString ss =
    Dali::Toolkit::Text::SpannableString::New("Testing");
    auto greenSpan = Dali::Toolkit::Text::BackgroundColorSpan::New(Color::GREEN);
      ss.AttachSpan(
      greenSpan,
      Dali::Toolkit::Text::Range::New(0u, 3u));
    Dali::Toolkit::Text::SetSpannedText(textLabel,ss);

==========================================================================================

Change-Id: I3f5414ee5268799ad8e174db4b693c70f4b9b1b3

automated-tests/src/dali-toolkit-internal/utc-Dali-Text-TextSpannable.cpp
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/utc-Dali-Text-BackgroundColorSpan.cpp [new file with mode: 0644]
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/text/spans/background-color-span.cpp [new file with mode: 0644]
dali-toolkit/devel-api/text/spans/background-color-span.h [new file with mode: 0644]
dali-toolkit/internal/file.list
dali-toolkit/internal/text/spannable/spans/background-color-span-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/text/spannable/spans/background-color-span-impl.h [new file with mode: 0644]
dali-toolkit/internal/visuals/text/text-visual.cpp

index fdfde16..6af7bb0 100644 (file)
@@ -40,6 +40,7 @@
 #include <dali-toolkit/devel-api/text/spans/character-spacing-span.h>
 #include <dali-toolkit/devel-api/text/spans/bold-span.h>
 #include <dali-toolkit/devel-api/text/spans/italic-span.h>
+#include <dali-toolkit/devel-api/text/spans/background-color-span.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -132,6 +133,21 @@ Text::SpannableString CreateSpannableStringForItalicSpan()
   return spannableString;
 }
 
+Text::SpannableString CreateSpannableStringForBackgroundColorSpan()
+{
+
+  Text::SpannableString spannableString = Text::SpannableString::New("Hello مرحبا");
+
+  DALI_TEST_CHECK(spannableString);
+
+  auto isAddedGreen = spannableString.AttachSpan(
+  Text::BackgroundColorSpan::New(Color::GREEN),
+  Text::Range::New(5u, 7u));
+  DALI_TEST_CHECK(isAddedGreen);
+
+  return spannableString;
+}
+
 void CheckColorIndices(const Text::ColorIndex* const colorIndicesBuffer,
                        uint32_t                      numberOfIndices,
                        std::vector<uint32_t>         indicesToCheck,
@@ -453,7 +469,6 @@ int UtcDaliToolkitTextLabelSetSpannedText_BoldSpan(void)
   DALI_TEST_EQUALS(validFonts[0].characterRun.characterIndex,0, TEST_LOCATION);
   DALI_TEST_EQUALS(validFonts[0].characterRun.GetEndCharacterIndex(),3, TEST_LOCATION);
   DALI_TEST_EQUALS(validFonts[0].isBoldRequired, true, TEST_LOCATION);
-
   END_TEST;
 }
 
@@ -481,4 +496,30 @@ int UtcDaliToolkitTextLabelSetSpannedText_ItalicSpan(void)
   DALI_TEST_EQUALS(validFontsItalic[0].characterRun.GetEndCharacterIndex(), 3, TEST_LOCATION);
   DALI_TEST_EQUALS(validFontsItalic[0].isItalicRequired, true, TEST_LOCATION);
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliToolkitTextLabelSetSpannedText_BackgroundColorSpan(void)
+{
+
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitTextLabelSetSpannedText_BackgroundColorSpan");
+
+  TextLabel textLabel = TextLabel::New();
+  DALI_TEST_CHECK(textLabel);
+
+  application.GetScene().Add(textLabel);
+
+  Text::SpannableString spannableString = CreateSpannableStringForBackgroundColorSpan();
+  Text::SetSpannedText(textLabel, spannableString);
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::TextLabel& labelImpl          = GetImpl(textLabel);
+  const Text::ColorIndex* const backgroundColorIndicesBuffer  = labelImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
+
+  CheckColorIndices(backgroundColorIndicesBuffer, 4u, {0u, 5u, 7u, 10u}, {0u, 1u, 1u, 0u});
+
+  END_TEST;
+}
+
index 1fd489a..b627f3a 100755 (executable)
@@ -46,6 +46,7 @@ SET(TC_SOURCES
   utc-Dali-Text-FontSpan.cpp
   utc-Dali-Text-BoldSpan.cpp
   utc-Dali-Text-ItalicSpan.cpp
+  utc-Dali-Text-BackgroundColorSpan.cpp
   utc-Dali-Text-Range.cpp
   utc-Dali-Text-SpannableString.cpp
   utc-Dali-Text-UnderlineSpan.cpp
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Text-BackgroundColorSpan.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Text-BackgroundColorSpan.cpp
new file mode 100644 (file)
index 0000000..266f8dc
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <iostream>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/text/spans/background-color-span.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+int UtcDaliToolkitTextBackgroundColorSpanNew(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitTextBackgroundColorSpanNew");
+
+  auto greenSpan = Text::BackgroundColorSpan::New(Color::GREEN);
+  DALI_TEST_CHECK(greenSpan);
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextGetBackgroundColor(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitTextGetBackgroundColor");
+
+  auto greenSpan = Text::BackgroundColorSpan::New(Color::GREEN);
+  DALI_TEST_CHECK(greenSpan);
+  DALI_TEST_EQUALS(Color::GREEN, greenSpan.GetBackgroundColor(), TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextIsBackgroundColorDefined(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitTextIsBackgroundColorDefined");
+
+  auto greenSpan = Text::BackgroundColorSpan::New(Color::GREEN);
+  DALI_TEST_CHECK(greenSpan);
+  DALI_TEST_EQUALS(true, greenSpan.IsBackgroundColorDefined(), TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextBackgroundColorSpanDownCast(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitTextBackgroundColorSpanDownCast");
+
+  Text::BaseSpan baseSpan = Text::BackgroundColorSpan::New(Color::GREEN);
+  DALI_TEST_CHECK(baseSpan);
+
+  Text::BackgroundColorSpan greenSpan = Text::BackgroundColorSpan::DownCast(baseSpan);
+  DALI_TEST_CHECK(greenSpan);
+
+  END_TEST;
+}
index b7d6919..8443b0e 100755 (executable)
@@ -73,6 +73,7 @@ SET( devel_api_src_files
   ${devel_api_src_dir}/text/spans/underline-span.cpp
   ${devel_api_src_dir}/text/spans/bold-span.cpp
   ${devel_api_src_dir}/text/spans/italic-span.cpp
+  ${devel_api_src_dir}/text/spans/background-color-span.cpp
   ${devel_api_src_dir}/transition-effects/cube-transition-cross-effect.cpp
   ${devel_api_src_dir}/transition-effects/cube-transition-effect.cpp
   ${devel_api_src_dir}/transition-effects/cube-transition-fold-effect.cpp
@@ -259,6 +260,7 @@ SET( devel_api_text_header_files
   ${devel_api_src_dir}/text/spans/underline-span.h
   ${devel_api_src_dir}/text/spans/bold-span.h
   ${devel_api_src_dir}/text/spans/italic-span.h
+  ${devel_api_src_dir}/text/spans/background-color-span.h
 )
 
 SET( devel_api_tool_bar_header_files
diff --git a/dali-toolkit/devel-api/text/spans/background-color-span.cpp b/dali-toolkit/devel-api/text/spans/background-color-span.cpp
new file mode 100644 (file)
index 0000000..30972d5
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/text/spans/background-color-span.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/spannable/spans/background-color-span-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+BackgroundColorSpan BackgroundColorSpan::New(const Vector4 &color)
+{
+  return Internal::BackgroundColorSpan::New(color);
+}
+
+BackgroundColorSpan::BackgroundColorSpan(Internal::BackgroundColorSpan* internal)
+: BaseSpan(internal)
+{
+}
+
+BackgroundColorSpan::BackgroundColorSpan() = default;
+
+BackgroundColorSpan::BackgroundColorSpan(const BackgroundColorSpan& rhs) = default;
+
+BackgroundColorSpan::BackgroundColorSpan(BackgroundColorSpan&& rhs) = default;
+
+BackgroundColorSpan& BackgroundColorSpan::operator=(const BackgroundColorSpan& rhs) = default;
+
+BackgroundColorSpan& BackgroundColorSpan::operator=(BackgroundColorSpan&& rhs) = default;
+
+BackgroundColorSpan::~BackgroundColorSpan() = default;
+
+//Methods
+const Vector4 BackgroundColorSpan::GetBackgroundColor() const
+{
+  return GetImplementation(*this).GetBackgroundColor();
+}
+
+bool BackgroundColorSpan::IsBackgroundColorDefined() const
+{
+  return GetImplementation(*this).IsBackgroundColorDefined();
+}
+
+BackgroundColorSpan BackgroundColorSpan::DownCast(BaseHandle handle)
+{
+  return BackgroundColorSpan(dynamic_cast<Dali::Toolkit::Text::Internal::BackgroundColorSpan*>(handle.GetObjectPtr()));
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/devel-api/text/spans/background-color-span.h b/dali-toolkit/devel-api/text/spans/background-color-span.h
new file mode 100644 (file)
index 0000000..951692c
--- /dev/null
@@ -0,0 +1,130 @@
+#ifndef DALI_TOOLKIT_TEXT_BACKGROUND_COLOR_SPAN_H
+#define DALI_TOOLKIT_TEXT_BACKGROUND_COLOR_SPAN_H
+
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/spans/base-span.h>
+#include <dali/public-api/math/vector4.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+namespace Internal DALI_INTERNAL
+{
+class BackgroundColorSpan;
+}
+
+/**
+ * @brief BackgroundColorSpan is a handle to an object that specifies the background-color for range of characters.
+ */
+class DALI_TOOLKIT_API BackgroundColorSpan : public BaseSpan
+{
+public:
+  /**
+   * @brief Create an initialized BackgroundColorSpan.
+   *
+   * @param[in] color The background color.
+   *
+   * @return A handle to a newly allocated Dali resource
+   */
+  static BackgroundColorSpan New(const Vector4 &color);
+
+  /**
+   * @brief Creates an uninitialized BackgroundColorSpan handle.
+   *
+   * Calling member functions with an uninitialized BackgroundColorSpan handle is not allowed.
+   */
+  BackgroundColorSpan();
+
+  /**
+   * @brief Copy constructor.
+   * @param[in] rhs A reference to the copied handle
+   */
+  BackgroundColorSpan(const BackgroundColorSpan& rhs);
+
+  /**
+   * @brief Move constructor.
+   * @param[in] rhs A reference to the handle to move
+   */
+  BackgroundColorSpan(BackgroundColorSpan&& rhs);
+
+  /**
+   * @brief Assignment operator.
+   * @param[in] rhs A reference to the copied handle
+   * @return A reference to this
+   */
+  BackgroundColorSpan& operator=(const BackgroundColorSpan& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this
+   */
+  BackgroundColorSpan& operator=(BackgroundColorSpan&& rhs);
+
+  /**
+   * @brief Non virtual destructor.
+   */
+  ~BackgroundColorSpan();
+
+  /**
+   * @brief Downcasts to a BackgroundColorSpan handle.
+   * If handle is not a BackgroundColorSpan, the returned handle is left uninitialized.
+   *
+   * @param[in] handle Handle to an object
+   * @return BackgroundColorSpan handle or an uninitialized handle
+   */
+  static BackgroundColorSpan DownCast(BaseHandle handle);
+
+public: //Methods
+  /**
+   * @brief Retrive the background-color.
+   *
+   * @return A background-color value.
+   */
+  const Vector4 GetBackgroundColor() const;
+
+  /**
+   * @brief Retrieve whether the background-color is defined.
+   *
+   * @return The return is true if background-color is defined, otherwise false.
+   */
+  bool IsBackgroundColorDefined() const;
+
+public: // Not intended for application developers
+  /// @cond internal
+  /**
+   * @brief This constructor is used internally to Create an initialized BackgroundColorSpan handle.
+   *
+   * @param[in] colorSpan Pointer to internal BackgroundColorSpan
+   */
+  explicit DALI_INTERNAL BackgroundColorSpan(Internal::BackgroundColorSpan* colorSpan);
+  /// @endcond
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_BACKGROUND_COLOR_SPAN_H
index 7018aa1..88e4ea8 100644 (file)
@@ -167,6 +167,7 @@ SET( toolkit_src_files
    ${toolkit_src_dir}/text/spannable/spans/underline-span-impl.cpp
    ${toolkit_src_dir}/text/spannable/spans/bold-span-impl.cpp
    ${toolkit_src_dir}/text/spannable/spans/italic-span-impl.cpp
+   ${toolkit_src_dir}/text/spannable/spans/background-color-span-impl.cpp
    ${toolkit_src_dir}/text/spannable/span-ranges-container-impl.cpp
    ${toolkit_src_dir}/text/hyphenator.cpp
    ${toolkit_src_dir}/text/text-enumerations-impl.cpp
diff --git a/dali-toolkit/internal/text/spannable/spans/background-color-span-impl.cpp b/dali-toolkit/internal/text/spannable/spans/background-color-span-impl.cpp
new file mode 100644 (file)
index 0000000..555759a
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/text/spannable/spans/background-color-span-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/color-run.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+namespace Internal
+{
+struct BackgroundColorSpan::Impl
+{
+  Vector4 mBackgroundColor;            ///< The color of the characters.
+  bool    mBackgroundColorDefined : 1; ///< Whether the background color is defined.
+};
+
+BackgroundColorSpan::BackgroundColorSpan()
+: BaseSpan()
+{
+  mImpl = std::make_unique<Impl>();
+}
+
+BackgroundColorSpan ::~BackgroundColorSpan()
+{
+}
+
+Dali::Toolkit::Text::BackgroundColorSpan BackgroundColorSpan::New(const Vector4 &color)
+{
+  BackgroundColorSpanPtr object = new BackgroundColorSpan();
+  object->SetBackgroundColor(color);
+  Dali::Toolkit::Text::BackgroundColorSpan handle = Dali::Toolkit::Text::BackgroundColorSpan(object.Get());
+
+  return handle;
+}
+
+//Methods
+const Vector4 BackgroundColorSpan::GetBackgroundColor() const
+{
+  return mImpl->mBackgroundColor;
+}
+
+bool BackgroundColorSpan::IsBackgroundColorDefined() const
+{
+  return mImpl->mBackgroundColorDefined;
+}
+
+void BackgroundColorSpan::SetBackgroundColor(const Vector4 &color)
+{
+  mImpl->mBackgroundColor        = color;
+  mImpl->mBackgroundColorDefined = true;
+}
+
+void BackgroundColorSpan::CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const
+{
+  ColorRun backgroundColorRun;
+  backgroundColorRun.characterRun.characterIndex     = range.GetStartIndex();
+  backgroundColorRun.characterRun.numberOfCharacters = range.GetNumberOfIndices();
+  backgroundColorRun.color                           = mImpl->mBackgroundColor;
+  logicalModel->mBackgroundColorRuns.PushBack(backgroundColorRun);
+}
+
+} // namespace Internal
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/text/spannable/spans/background-color-span-impl.h b/dali-toolkit/internal/text/spannable/spans/background-color-span-impl.h
new file mode 100644 (file)
index 0000000..f94bae0
--- /dev/null
@@ -0,0 +1,135 @@
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_COLOR_SPAN_IMPL_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_COLOR_SPAN_IMPL_H
+
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/spans/background-color-span.h>
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/logical-model-impl.h>
+#include <dali-toolkit/internal/text/spannable/spans/base-span-impl.h>
+#include <dali/public-api/math/vector4.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+namespace Internal
+{
+class BackgroundColorSpan;
+using BackgroundColorSpanPtr = IntrusivePtr<BackgroundColorSpan>;
+
+/**
+ * @copydoc Dali::Toolkit::Text::BackgroundColorSpan
+ */
+class BackgroundColorSpan : public BaseSpan
+{
+public:
+  /**
+   * @brief Creates a new BackgroundColorSpan object.
+   */
+  static Dali::Toolkit::Text::BackgroundColorSpan New(const Vector4 &color);
+
+  /**
+   * Default Constructor
+   */
+  BackgroundColorSpan();
+
+  ///< Deleted copy constructor
+  BackgroundColorSpan(const BackgroundColorSpan&) = delete;
+
+  ///< Deleted move constructor
+  BackgroundColorSpan(BackgroundColorSpan&&) = delete;
+
+  ///< Deleted copy assignment operator
+  BackgroundColorSpan& operator=(const BackgroundColorSpan&) = delete;
+
+  ///< Deleted move assignment operator
+  BackgroundColorSpan& operator=(BackgroundColorSpan&&) = delete;
+
+  /**
+   * @brief Destructor
+   *
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  ~BackgroundColorSpan() override;
+
+public: //Methods
+  /**
+   * @copydoc Dali::Toolkit::Text::BackgroundColorSpan::GetBackgroundColor()
+   */
+  const Vector4 GetBackgroundColor() const;
+
+  /**
+   * @copydoc Dali::Toolkit::Text::BackgroundColorSpan::IsBackgroundColorDefined()
+   */
+  bool IsBackgroundColorDefined() const;
+
+public: //Methods. Not intended for application developers
+  /**
+   * @brief Set the background-color.
+   *
+   * @param[in] color The background-color.
+   */
+  void SetBackgroundColor(const Vector4 &color);
+
+public: //Methods for internal only
+  /**
+   * @copydoc Dali::Toolkit::Text::BaseSpan::CreateStyleCharacterRun
+   */
+  void CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const override;
+
+private:
+  struct Impl;
+  std::unique_ptr<Impl> mImpl{nullptr};
+
+}; // class BackgroundColorSpan
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::BackgroundColorSpan& GetImplementation(Dali::Toolkit::Text::BackgroundColorSpan& BackgroundColorSpan)
+{
+  DALI_ASSERT_ALWAYS(BackgroundColorSpan && "BackgroundColorSpan handle is empty");
+
+  BaseObject& object = BackgroundColorSpan.GetBaseObject();
+
+  return static_cast<Internal::BackgroundColorSpan&>(object);
+}
+
+inline const Internal::BackgroundColorSpan& GetImplementation(const Dali::Toolkit::Text::BackgroundColorSpan& BackgroundColorSpan)
+{
+  DALI_ASSERT_ALWAYS(BackgroundColorSpan && "BackgroundColorSpan handle is empty");
+
+  const BaseObject& object = BackgroundColorSpan.GetBaseObject();
+
+  return static_cast<const Internal::BackgroundColorSpan&>(object);
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_COLOR_SPAN_IMPL_H
\ No newline at end of file
index ed778f4..3c6bdf3 100644 (file)
@@ -570,7 +570,8 @@ void TextVisual::UpdateRenderer()
       const bool markupStrikethroughEnabled = markupOrSpannedText && mController->GetTextModel()->IsMarkupStrikethroughSet();
       const bool underlineEnabled           = mController->GetTextModel()->IsUnderlineEnabled() || markupUnderlineEnabled;
       const bool strikethroughEnabled       = mController->GetTextModel()->IsStrikethroughEnabled() || markupStrikethroughEnabled;
-      const bool styleEnabled               = (shadowEnabled || outlineEnabled || backgroundEnabled || markupOrSpannedText);
+      const bool backgroundMarkupSet        = mController->GetTextModel()->IsMarkupBackgroundColorSet();
+      const bool styleEnabled               = (shadowEnabled || outlineEnabled || backgroundEnabled || markupOrSpannedText || backgroundMarkupSet);
       const bool isOverlayStyle             = underlineEnabled || strikethroughEnabled;
 
       AddRenderer(control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled, isOverlayStyle);