Index: Source/core/editing/FormatBlockCommand.cpp |
diff --git a/Source/core/editing/FormatBlockCommand.cpp b/Source/core/editing/FormatBlockCommand.cpp |
index 8f49839357156e8969474632819bea2dc1f3ebc0..57b9634a83ad8daeb6a38ab26cb49ce4716e81b8 100644 |
--- a/Source/core/editing/FormatBlockCommand.cpp |
+++ b/Source/core/editing/FormatBlockCommand.cpp |
@@ -32,6 +32,7 @@ |
#include "core/editing/FormatBlockCommand.h" |
#include "core/editing/VisibleUnits.h" |
#include "core/editing/htmlediting.h" |
+#include "core/html/HTMLElement.h" |
namespace WebCore { |
@@ -92,6 +93,10 @@ void FormatBlockCommand::formatRange(const Position& start, const Position& end, |
moveParagraphWithClones(start, end, blockNode.get(), outerBlock.get()); |
+ // Copy the inline style of the original block element to the newly created block-style element. |
+ if (outerBlock.get() != nodeAfterInsertionPosition.get() && toHTMLElement(nodeAfterInsertionPosition.get())->hasAttribute(styleAttr)) |
+ blockNode->setAttribute(styleAttr, toHTMLElement(nodeAfterInsertionPosition.get())->getAttribute(styleAttr)); |
+ |
if (wasEndOfParagraph && !isEndOfParagraph(lastParagraphInBlockNode) && !isStartOfParagraph(lastParagraphInBlockNode)) |
insertBlockPlaceholder(lastParagraphInBlockNode); |
} |