[webkit-changes] cvs commit: WebCore/khtml/editing markup.cpp
replace_selection_command.cpp
John
sullivan at opensource.apple.com
Fri Aug 26 15:39:34 PDT 2005
sullivan 05/08/26 15:39:34
Modified: . ChangeLog
khtml/editing markup.cpp replace_selection_command.cpp
Log:
Reviewed by Darin Adler.
Test cases added: none, doesn't affect layout
- fixed these leaks:
<rdar://problem/4232514> many leaks of StyleBaseImpl called within computeAndStoreNodeDesiredStyle within -[WebView paste:],
seen running webkit tests (probably affects Mail)
<rdar://problem/4232572> many leaks of StyleBaseImpl called within fixupNodeStyles within -[WebView paste:],
seen running webkit tests (probably affects Mail)
<rdar://problem/4232629> many leaks of StyleBaseImpl within startMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
seen running webkit tests
<rdar://problem/4232779> many leaks of StyleBaseImpl within createMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
seen running webkit tests
* khtml/editing/markup.cpp:
(khtml::startMarkup):
Put Position::computedStyle() result into a local variable so it can be reffed/dereffed, avoids a leak.
Done in two places in this method. This fixes 4232629.
(khtml::createMarkup):
ditto, but only in one place. This fixes 4232779.
* khtml/editing/replace_selection_command.cpp:
(khtml::ReplaceSelectionCommand::fixupNodeStyles):
ditto. This fixes 4232572.
(khtml::computeAndStoreNodeDesiredStyle):
ditto, but in two places. This fixes 4232514.
Revision Changes Path
1.16 +29 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ChangeLog 25 Aug 2005 23:13:39 -0000 1.15
+++ ChangeLog 26 Aug 2005 22:39:32 -0000 1.16
@@ -1,3 +1,32 @@
+2005-08-26 John Sullivan <sullivan at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Test cases added: none, doesn't affect layout
+
+ - fixed these leaks:
+ <rdar://problem/4232514> many leaks of StyleBaseImpl called within computeAndStoreNodeDesiredStyle within -[WebView paste:],
+ seen running webkit tests (probably affects Mail)
+ <rdar://problem/4232572> many leaks of StyleBaseImpl called within fixupNodeStyles within -[WebView paste:],
+ seen running webkit tests (probably affects Mail)
+ <rdar://problem/4232629> many leaks of StyleBaseImpl within startMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
+ seen running webkit tests
+ <rdar://problem/4232779> many leaks of StyleBaseImpl within createMarkup within -[WebHTMLView _writeSelectionToPasteboard:],
+ seen running webkit tests
+
+ * khtml/editing/markup.cpp:
+ (khtml::startMarkup):
+ Put Position::computedStyle() result into a local variable so it can be reffed/dereffed, avoids a leak.
+ Done in two places in this method. This fixes 4232629.
+ (khtml::createMarkup):
+ ditto, but only in one place. This fixes 4232779.
+
+ * khtml/editing/replace_selection_command.cpp:
+ (khtml::ReplaceSelectionCommand::fixupNodeStyles):
+ ditto. This fixes 4232572.
+ (khtml::computeAndStoreNodeDesiredStyle):
+ ditto, but in two places. This fixes 4232514.
+
2005-08-25 Darin Adler <darin at apple.com>
Reviewed by John Sullivan.
1.32 +12 -3 WebCore/khtml/editing/markup.cpp
Index: markup.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/markup.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- markup.cpp 25 Aug 2005 23:13:45 -0000 1.31
+++ markup.cpp 26 Aug 2005 22:39:33 -0000 1.32
@@ -186,7 +186,10 @@
if (defaultStyle) {
NodeImpl *element = node->parentNode();
if (element) {
- CSSMutableStyleDeclarationImpl *style = Position(element, 0).computedStyle()->copyInheritableProperties();
+ CSSComputedStyleDeclarationImpl *computedStyle = Position(element, 0).computedStyle();
+ computedStyle->ref();
+ CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
+ computedStyle->deref();
style->ref();
defaultStyle->diff(style);
if (style->length() > 0) {
@@ -209,7 +212,10 @@
const ElementImpl *el = static_cast<const ElementImpl *>(node);
DOMString additionalStyle;
if (defaultStyle && el->isHTMLElement()) {
- CSSMutableStyleDeclarationImpl *style = Position(const_cast<ElementImpl *>(el), 0).computedStyle()->copyInheritableProperties();
+ CSSComputedStyleDeclarationImpl *computedStyle = Position(const_cast<ElementImpl *>(el), 0).computedStyle();
+ computedStyle->ref();
+ CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
+ computedStyle->deref();
style->ref();
defaultStyle->diff(style);
if (style->length() > 0) {
@@ -334,7 +340,10 @@
// calculate the "default style" for this markup
Position pos(doc->documentElement(), 0);
- CSSMutableStyleDeclarationImpl *defaultStyle = pos.computedStyle()->copyInheritableProperties();
+ CSSComputedStyleDeclarationImpl *computedStyle = pos.computedStyle();
+ computedStyle->ref();
+ CSSMutableStyleDeclarationImpl *defaultStyle = computedStyle->copyInheritableProperties();
+ computedStyle->deref();
defaultStyle->ref();
NodeImpl *startNode = range->startNode();
1.11 +10 -2 WebCore/khtml/editing/replace_selection_command.cpp
Index: replace_selection_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/replace_selection_command.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- replace_selection_command.cpp 25 Aug 2005 23:13:45 -0000 1.10
+++ replace_selection_command.cpp 26 Aug 2005 22:39:33 -0000 1.11
@@ -360,8 +360,10 @@
NodeImpl *blockquote = nearestMailBlockquote(node);
Position pos(blockquote ? blockquote : node->getDocument()->documentElement(), 0);
CSSComputedStyleDeclarationImpl *style = pos.computedStyle();
+ style->ref();
DOMString desiredColor = desiredStyle->getPropertyValue(CSS_PROP_COLOR);
DOMString nearestColor = style->getPropertyValue(CSS_PROP_COLOR);
+ style->deref();
if (desiredColor != nearestColor)
desiredStyle->setProperty(CSS_PROP_COLOR, nearestColor);
}
@@ -409,7 +411,10 @@
// being pasted in.
if (NodeImpl *blockquote = nearestMailBlockquote(node)) {
CSSComputedStyleDeclarationImpl *blockquoteStyle = Position(blockquote, 0).computedStyle();
- if (blockquoteStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR)) {
+ blockquoteStyle->ref();
+ bool match = (blockquoteStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR));
+ blockquoteStyle->deref();
+ if (match) {
style->setProperty(CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR, matchNearestBlockquoteColorString());
return;
}
@@ -417,7 +422,10 @@
NodeImpl *documentElement = node->getDocument() ? node->getDocument()->documentElement() : 0;
if (documentElement) {
CSSComputedStyleDeclarationImpl *documentStyle = Position(documentElement, 0).computedStyle();
- if (documentStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR)) {
+ documentStyle->ref();
+ bool match = (documentStyle->getPropertyValue(CSS_PROP_COLOR) == style->getPropertyValue(CSS_PROP_COLOR));
+ documentStyle->deref();
+ if (match) {
style->setProperty(CSS_PROP__KHTML_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR, matchNearestBlockquoteColorString());
}
}
More information about the webkit-changes
mailing list