diff options
Diffstat (limited to 'Source/WebCore/editing/htmlediting.cpp')
-rw-r--r-- | Source/WebCore/editing/htmlediting.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp index 07046100e..f4d91e9ce 100644 --- a/Source/WebCore/editing/htmlediting.cpp +++ b/Source/WebCore/editing/htmlediting.cpp @@ -29,6 +29,8 @@ #include "AXObjectCache.h" #include "Document.h" #include "EditingText.h" +#include "Editor.h" +#include "Frame.h" #include "HTMLBRElement.h" #include "HTMLDivElement.h" #include "HTMLElementFactory.h" @@ -38,6 +40,7 @@ #include "HTMLNames.h" #include "HTMLObjectElement.h" #include "HTMLOListElement.h" +#include "HTMLParagraphElement.h" #include "HTMLUListElement.h" #include "PositionIterator.h" #include "RenderObject.h" @@ -844,7 +847,15 @@ bool isEmptyTableCell(const Node* node) PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document) { - return HTMLDivElement::create(document); + switch (document->frame()->editor()->defaultParagraphSeparator()) { + case EditorParagraphSeparatorIsDiv: + return HTMLDivElement::create(document); + case EditorParagraphSeparatorIsP: + return HTMLParagraphElement::create(document); + } + + ASSERT_NOT_REACHED(); + return 0; } PassRefPtr<HTMLElement> createBreakElement(Document* document) @@ -1142,22 +1153,15 @@ bool isRenderedAsNonInlineTableImageOrHR(const Node* node) bool areIdenticalElements(const Node* first, const Node* second) { - // check that tag name and all attribute names and values are identical - if (!first->isElementNode() || !second->isElementNode()) return false; - if (!toElement(first)->tagQName().matches(toElement(second)->tagQName())) + const Element* firstElement = toElement(first); + const Element* secondElement = toElement(second); + if (!firstElement->hasTagName(secondElement->tagQName())) return false; - NamedNodeMap* firstMap = toElement(first)->updatedAttributes(); - NamedNodeMap* secondMap = toElement(second)->updatedAttributes(); - - if (firstMap) - return firstMap->mapsEquivalent(secondMap); - if (secondMap) - return secondMap->mapsEquivalent(firstMap); - return true; + return firstElement->hasEquivalentAttributes(secondElement); } bool isNonTableCellHTMLBlockElement(const Node* node) |