Title: [126567] trunk/Source/WebCore
- Revision
- 126567
- Author
- [email protected]
- Date
- 2012-08-24 03:08:49 -0700 (Fri, 24 Aug 2012)
Log Message
Remove RefPtr from HTMLTextAreaElement::m_placeholder
https://bugs.webkit.org/show_bug.cgi?id=94338
Reviewed by Kent Tamura.
To avoid reference cycles of RefPtr<Node>s, we want to remove
unnecessary RefPtr<Node>s. The rationale is described in bug 94324.
HTMLTextAreaElement::m_placeholder does not need to be a RefPtr<Node>,
because it is guaranteed to point to a shadow DOM tree of the
HTMLTextAreaElement node, which is guaranteed to exist in the subtree
of the HTMLTextAreaElement node.
No tests. No change in behavior.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::HTMLTextAreaElement):
(WebCore::HTMLTextAreaElement::placeholderElement):
(WebCore::HTMLTextAreaElement::attach):
(WebCore::HTMLTextAreaElement::updatePlaceholderText):
* html/HTMLTextAreaElement.h:
(HTMLTextAreaElement):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126566 => 126567)
--- trunk/Source/WebCore/ChangeLog 2012-08-24 09:40:44 UTC (rev 126566)
+++ trunk/Source/WebCore/ChangeLog 2012-08-24 10:08:49 UTC (rev 126567)
@@ -1,3 +1,28 @@
+2012-08-24 Kentaro Hara <[email protected]>
+
+ Remove RefPtr from HTMLTextAreaElement::m_placeholder
+ https://bugs.webkit.org/show_bug.cgi?id=94338
+
+ Reviewed by Kent Tamura.
+
+ To avoid reference cycles of RefPtr<Node>s, we want to remove
+ unnecessary RefPtr<Node>s. The rationale is described in bug 94324.
+
+ HTMLTextAreaElement::m_placeholder does not need to be a RefPtr<Node>,
+ because it is guaranteed to point to a shadow DOM tree of the
+ HTMLTextAreaElement node, which is guaranteed to exist in the subtree
+ of the HTMLTextAreaElement node.
+
+ No tests. No change in behavior.
+
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::HTMLTextAreaElement):
+ (WebCore::HTMLTextAreaElement::placeholderElement):
+ (WebCore::HTMLTextAreaElement::attach):
+ (WebCore::HTMLTextAreaElement::updatePlaceholderText):
+ * html/HTMLTextAreaElement.h:
+ (HTMLTextAreaElement):
+
2012-08-24 Dan Carney <[email protected]>
[V8] Refactor away IsolatedWorld
Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (126566 => 126567)
--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp 2012-08-24 09:40:44 UTC (rev 126566)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp 2012-08-24 10:08:49 UTC (rev 126567)
@@ -72,6 +72,7 @@
, m_rows(defaultRows)
, m_cols(defaultCols)
, m_wrap(SoftWrap)
+ , m_placeholder(0)
, m_isDirty(false)
, m_wasModifiedByUser(false)
{
@@ -490,13 +491,13 @@
HTMLElement* HTMLTextAreaElement::placeholderElement() const
{
- return m_placeholder.get();
+ return m_placeholder;
}
void HTMLTextAreaElement::attach()
{
HTMLTextFormControlElement::attach();
- fixPlaceholderRenderer(m_placeholder.get(), innerTextElement());
+ fixPlaceholderRenderer(m_placeholder, innerTextElement());
}
void HTMLTextAreaElement::updatePlaceholderText()
@@ -505,21 +506,22 @@
String placeholderText = strippedPlaceholder();
if (placeholderText.isEmpty()) {
if (m_placeholder) {
- userAgentShadowRoot()->removeChild(m_placeholder.get(), ec);
+ userAgentShadowRoot()->removeChild(m_placeholder, ec);
ASSERT(!ec);
- m_placeholder.clear();
+ m_placeholder = 0;
}
return;
}
if (!m_placeholder) {
- m_placeholder = HTMLDivElement::create(document());
+ RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
+ m_placeholder = placeholder.get();
m_placeholder->setShadowPseudoId("-webkit-input-placeholder");
userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec);
ASSERT(!ec);
}
m_placeholder->setInnerText(placeholderText, ec);
ASSERT(!ec);
- fixPlaceholderRenderer(m_placeholder.get(), innerTextElement());
+ fixPlaceholderRenderer(m_placeholder, innerTextElement());
}
}
Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.h (126566 => 126567)
--- trunk/Source/WebCore/html/HTMLTextAreaElement.h 2012-08-24 09:40:44 UTC (rev 126566)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.h 2012-08-24 10:08:49 UTC (rev 126567)
@@ -117,7 +117,7 @@
int m_rows;
int m_cols;
WrapMethod m_wrap;
- RefPtr<HTMLElement> m_placeholder;
+ HTMLElement* m_placeholder;
mutable String m_value;
mutable bool m_isDirty;
mutable bool m_wasModifiedByUser;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes