RESOLVED FIXED 130274
[Mac] Rewrite WebHTMLConverter::_computedStringForNode in C++
https://bugs.webkit.org/show_bug.cgi?id=130274
Summary [Mac] Rewrite WebHTMLConverter::_computedStringForNode in C++
Ryosuke Niwa
Reported 2014-03-14 16:54:02 PDT
_computedStringForNode should be rewritten in C++ for performance.
Attachments
Cleanup (17.08 KB, patch)
2014-03-14 17:05 PDT, Ryosuke Niwa
no flags
Fixed the bug (17.10 KB, patch)
2014-03-17 14:00 PDT, Ryosuke Niwa
kling: review+
Ryosuke Niwa
Comment 1 2014-03-14 17:05:54 PDT
Ryosuke Niwa
Comment 2 2014-03-14 17:06:31 PDT
This reduces the runtime from 25-26s to 21-22s (another 20% improvement).
Andreas Kling
Comment 3 2014-03-15 14:46:04 PDT
Comment on attachment 226781 [details] Cleanup View in context: https://bugs.webkit.org/attachment.cgi?id=226781&action=review > Source/WebCore/platform/mac/HTMLConverter.mm:631 > + if (RefPtr<CSSValue> value = computedStylePropertyForElement(element, propertyName)) { > + String result; > + if (stringFromCSSValue(*value, result)) > + return result; > + } > + > + if (RefPtr<CSSValue> value = computedStylePropertyForElement(element, propertyName)) { > + String result; > + if (value->isInheritedValue()) > + inherit = true; > + else if (stringFromCSSValue(*value, result)) > + return result; > + } Why are we calling computedStylePropertyForElement(element, propertyName) twice here? > Source/WebCore/platform/mac/HTMLConverter.mm:720 > + if (Node* parent = node.parentNode()) This is really a ContainerNode*. > Source/WebCore/platform/mac/HTMLConverter.mm:733 > + if (!result.length()) I'd use isEmpty() here.
Andreas Kling
Comment 4 2014-03-15 14:46:05 PDT
Comment on attachment 226781 [details] Cleanup View in context: https://bugs.webkit.org/attachment.cgi?id=226781&action=review > Source/WebCore/platform/mac/HTMLConverter.mm:631 > + if (RefPtr<CSSValue> value = computedStylePropertyForElement(element, propertyName)) { > + String result; > + if (stringFromCSSValue(*value, result)) > + return result; > + } > + > + if (RefPtr<CSSValue> value = computedStylePropertyForElement(element, propertyName)) { > + String result; > + if (value->isInheritedValue()) > + inherit = true; > + else if (stringFromCSSValue(*value, result)) > + return result; > + } Why are we calling computedStylePropertyForElement(element, propertyName) twice here? > Source/WebCore/platform/mac/HTMLConverter.mm:720 > + if (Node* parent = node.parentNode()) This is really a ContainerNode*. > Source/WebCore/platform/mac/HTMLConverter.mm:733 > + if (!result.length()) I'd use isEmpty() here.
Ryosuke Niwa
Comment 5 2014-03-16 19:17:15 PDT
Comment on attachment 226781 [details] Cleanup View in context: https://bugs.webkit.org/attachment.cgi?id=226781&action=review >>> Source/WebCore/platform/mac/HTMLConverter.mm:631 >>> + } >> >> Why are we calling computedStylePropertyForElement(element, propertyName) twice here? > > Why are we calling computedStylePropertyForElement(element, propertyName) twice here? Oops, the second is supposed to be calling computedStylePropertyForElement.
Ryosuke Niwa
Comment 6 2014-03-17 14:00:12 PDT
Created attachment 226959 [details] Fixed the bug
Ryosuke Niwa
Comment 7 2014-03-17 15:05:05 PDT
Note You need to log in before you can comment on or make changes to this bug.