Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: Source/core/editing/FormatBlockCommand.cpp

Issue 101933003: Preserving inline style of the replaced block element for FormatBlock('execCommand'). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebaselining Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/execCommand/format-block-with-block-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « LayoutTests/editing/execCommand/format-block-with-block-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698