Convert more of HTMLConverter to C++
Created attachment 227907 [details] Patch
Comment on attachment 227907 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227907&action=review > Source/WebCore/editing/cocoa/HTMLConverter.mm:1357 > + auto result = m_attributesForElements.add(&coreElement, nullptr); > + if (result.isNewEntry) > + result.iterator->value = _computedAttributesForElement(coreElement); I think you should do auto& attributes = m_attributesForElements.add(&coreElement, nullptr).iterator->value; if (!attributes) attributes = _computedAttributesForElement(coreElement); > Source/WebCore/editing/cocoa/HTMLConverter.mm:1566 > + NSString *width = element.getAttribute(WebCore::HTMLNames::widthAttr); Does this do the right thing for table cell elements now?
(In reply to comment #2) > (From update of attachment 227907 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=227907&action=review > > > Source/WebCore/editing/cocoa/HTMLConverter.mm:1357 > > + auto result = m_attributesForElements.add(&coreElement, nullptr); > > + if (result.isNewEntry) > > + result.iterator->value = _computedAttributesForElement(coreElement); > > I think you should do > > auto& attributes = m_attributesForElements.add(&coreElement, nullptr).iterator->value; > if (!attributes) > attributes = _computedAttributesForElement(coreElement); Will do! Though I really want to add my m_attributesForElements.add(key, [] { return computeNewValue(); }); patch one day when we can think of a good name for add() :(. > > > Source/WebCore/editing/cocoa/HTMLConverter.mm:1566 > > + NSString *width = element.getAttribute(WebCore::HTMLNames::widthAttr); > > Does this do the right thing for table cell elements now? Yeah, [(DOMHTMLTableCellElement *)element width] just called getAttribute(WebCore::HTMLNames::widthAttr);
Committed r166335: <http://trac.webkit.org/changeset/166335>