Diff
Modified: trunk/Source/WebCore/ChangeLog (123328 => 123329)
--- trunk/Source/WebCore/ChangeLog 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/ChangeLog 2012-07-23 11:19:43 UTC (rev 123329)
@@ -1,3 +1,48 @@
+2012-07-23 Kent Tamura <[email protected]>
+
+ Replace some instances of shadowAncestorNode() with shadowHost()
+ https://bugs.webkit.org/show_bug.cgi?id=91966
+
+ Reviewed by Hajime Morita.
+
+ shadowAncestorNode() is deprecated. We should use shadowHost().
+ No new tests. This doesn't change any behavior.
+
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkSelector):
+ * dom/TreeScope.cpp:
+ (WebCore::listTreeScopes):
+ * html/HTMLSummaryElement.cpp:
+ (WebCore::isClickableControl):
+ * html/shadow/DetailsMarkerControl.cpp:
+ (WebCore::DetailsMarkerControl::summaryElement):
+ * html/shadow/MeterShadowElement.cpp:
+ (WebCore::MeterShadowElement::meterElement):
+ * html/shadow/ProgressShadowElement.cpp:
+ (WebCore::ProgressShadowElement::progressElement):
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::RenderSliderThumb::layout):
+ (WebCore::RenderSliderContainer::layout):
+ (WebCore::SliderThumbElement::hostInput):
+ (WebCore::TrackLimiterElement::shadowPseudoId):
+ (WebCore::SliderContainerElement::shadowPseudoId):
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerElement::customStyleForRenderer):
+ (WebCore::TextControlInnerTextElement::defaultEventHandler):
+ (WebCore::TextControlInnerTextElement::createRenderer):
+ (WebCore::TextControlInnerTextElement::customStyleForRenderer):
+ (WebCore::SearchFieldResultsButtonElement::shadowPseudoId):
+ (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
+ (WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
+ (WebCore::SpinButtonElement::defaultEventHandler):
+ (WebCore::SpinButtonElement::step):
+ (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
+ (WebCore::InputFieldSpeechButtonElement::setState):
+ (WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
+ (WebCore::InputFieldSpeechButtonElement::startSpeechInput):
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlInnerBlock::positionForPoint):
+
2012-07-23 Pavel Feldman <[email protected]>
[WK2] REGRESSION r122966: Crash when closing tab with Web Inspector open in WebKit::PageOverlay
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (123328 => 123329)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -540,10 +540,10 @@
// If we're in the same tree-scope as the scoping element, then following a shadow descendant combinator would escape that and thus the scope.
if (context.scope && context.scope->treeScope() == context.element->treeScope())
return SelectorFailsCompletely;
- Node* shadowHostNode = context.element->shadowAncestorNode();
- if (shadowHostNode == context.element || !shadowHostNode->isElementNode())
+ Element* shadowHostNode = context.element->shadowHost();
+ if (!shadowHostNode)
return SelectorFailsCompletely;
- nextContext.element = toElement(shadowHostNode);
+ nextContext.element = shadowHostNode;
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
nextContext.elementParentStyle = 0;
Modified: trunk/Source/WebCore/dom/TreeScope.cpp (123328 => 123329)
--- trunk/Source/WebCore/dom/TreeScope.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/dom/TreeScope.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -266,8 +266,8 @@
{
while (true) {
treeScopes.append(node->treeScope());
- Node* ancestor = node->shadowAncestorNode();
- if (node == ancestor)
+ Element* ancestor = node->shadowHost();
+ if (!ancestor)
break;
node = ancestor;
}
Modified: trunk/Source/WebCore/html/HTMLSummaryElement.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/HTMLSummaryElement.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/HTMLSummaryElement.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -108,7 +108,7 @@
Element* element = toElement(node);
if (element->isFormControlElement())
return true;
- Element* host = toElement(element->shadowAncestorNode());
+ Element* host = element->shadowHost();
return host && host->isFormControlElement();
}
Modified: trunk/Source/WebCore/html/shadow/DetailsMarkerControl.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/shadow/DetailsMarkerControl.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/shadow/DetailsMarkerControl.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -63,9 +63,9 @@
HTMLSummaryElement* DetailsMarkerControl::summaryElement()
{
- Node* node = this->shadowAncestorNode();
- ASSERT(!node || toElement(node)->hasTagName(summaryTag));
- return static_cast<HTMLSummaryElement*>(node);
+ Element* element = shadowHost();
+ ASSERT(!element || element->hasTagName(summaryTag));
+ return static_cast<HTMLSummaryElement*>(element);
}
}
Modified: trunk/Source/WebCore/html/shadow/MeterShadowElement.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/shadow/MeterShadowElement.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/shadow/MeterShadowElement.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -50,9 +50,9 @@
HTMLMeterElement* MeterShadowElement::meterElement() const
{
- Node* node = const_cast<MeterShadowElement*>(this)->shadowAncestorNode();
- ASSERT(!node || meterTag == toElement(node)->tagQName());
- return static_cast<HTMLMeterElement*>(node);
+ Element* element = shadowHost();
+ ASSERT(!element || element->hasTagName(meterTag));
+ return static_cast<HTMLMeterElement*>(element);
}
bool MeterShadowElement::rendererIsNeeded(const NodeRenderingContext& context)
Modified: trunk/Source/WebCore/html/shadow/ProgressShadowElement.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/shadow/ProgressShadowElement.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/shadow/ProgressShadowElement.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -47,9 +47,9 @@
HTMLProgressElement* ProgressShadowElement::progressElement() const
{
- Node* node = const_cast<ProgressShadowElement*>(this)->shadowAncestorNode();
- ASSERT(!node || progressTag == toElement(node)->tagQName());
- return static_cast<HTMLProgressElement*>(node);
+ Element* element = shadowHost();
+ ASSERT(!element || element->hasTagName(progressTag));
+ return static_cast<HTMLProgressElement*>(element);
}
bool ProgressShadowElement::rendererIsNeeded(const NodeRenderingContext& context)
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -113,7 +113,7 @@
{
// Do not cast node() to SliderThumbElement. This renderer is used for
// TrackLimitElement too.
- HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
+ HTMLInputElement* input = node()->shadowHost()->toInputElement();
bool isVertical = hasVerticalAppearance(input);
double fraction = (sliderPosition(input) * 100).toDouble();
@@ -142,7 +142,7 @@
void RenderSliderContainer::layout()
{
- HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
+ HTMLInputElement* input = node()->shadowHost()->toInputElement();
bool isVertical = hasVerticalAppearance(input);
style()->setBoxOrient(isVertical ? VERTICAL : HORIZONTAL);
// Sets the concrete height if the height of the <input> is not fixed or a
@@ -343,8 +343,8 @@
HTMLInputElement* SliderThumbElement::hostInput() const
{
// Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes.
- // So, shadowAncestorNode() must be an HTMLInputElement.
- return shadowAncestorNode()->toInputElement();
+ // So, shadowHost() must be an HTMLInputElement.
+ return shadowHost()->toInputElement();
}
static const AtomicString& sliderThumbShadowPseudoId()
@@ -403,7 +403,7 @@
const AtomicString& TrackLimiterElement::shadowPseudoId() const
{
- HTMLInputElement* input = shadowAncestorNode()->toInputElement();
+ HTMLInputElement* input = shadowHost()->toInputElement();
if (!input)
return sliderThumbShadowPseudoId();
@@ -453,7 +453,7 @@
DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderContainer, ("-webkit-media-slider-container"));
DEFINE_STATIC_LOCAL(const AtomicString, sliderContainer, ("-webkit-slider-container"));
- HTMLInputElement* input = shadowAncestorNode()->toInputElement();
+ HTMLInputElement* input = shadowHost()->toInputElement();
if (!input)
return sliderContainer;
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (123328 => 123329)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -63,7 +63,7 @@
PassRefPtr<RenderStyle> TextControlInnerElement::customStyleForRenderer()
{
- RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowAncestorNode()->renderer());
+ RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowHost()->renderer());
return parentRenderer->createInnerBlockStyle(parentRenderer->style());
}
@@ -86,11 +86,13 @@
// Then we would add one to the text field's inner div, and we wouldn't need this subclass.
// Or possibly we could just use a normal event listener.
if (event->isBeforeTextInsertedEvent() || event->type() == eventNames().webkitEditableContentChangedEvent) {
- Node* shadowAncestor = shadowAncestorNode();
- // A TextControlInnerTextElement can be its own shadow ancestor if its been detached, but kept alive by an EditCommand.
- // In this case, an undo/redo can cause events to be sent to the TextControlInnerTextElement.
- // To prevent an infinite loop, we must check for this case before sending the event up the chain.
- if (shadowAncestor && shadowAncestor != this)
+ Element* shadowAncestor = shadowHost();
+ // A TextControlInnerTextElement can have no host if its been detached,
+ // but kept alive by an EditCommand. In this case, an undo/redo can
+ // cause events to be sent to the TextControlInnerTextElement. To
+ // prevent an infinite loop, we must check for this case before sending
+ // the event up the chain.
+ if (shadowAncestor)
shadowAncestor->defaultEventHandler(event);
}
if (!event->defaultHandled())
@@ -100,7 +102,7 @@
RenderObject* TextControlInnerTextElement::createRenderer(RenderArena* arena, RenderStyle*)
{
bool multiLine = false;
- Node* shadowAncestor = shadowAncestorNode();
+ Element* shadowAncestor = shadowHost();
if (shadowAncestor && shadowAncestor->renderer()) {
ASSERT(shadowAncestor->renderer()->isTextField() || shadowAncestor->renderer()->isTextArea());
multiLine = shadowAncestor->renderer()->isTextArea();
@@ -110,7 +112,7 @@
PassRefPtr<RenderStyle> TextControlInnerTextElement::customStyleForRenderer()
{
- RenderTextControl* parentRenderer = toRenderTextControl(shadowAncestorNode()->renderer());
+ RenderTextControl* parentRenderer = toRenderTextControl(shadowHost()->renderer());
return parentRenderer->createInnerTextStyle(parentRenderer->style());
}
@@ -131,7 +133,7 @@
DEFINE_STATIC_LOCAL(AtomicString, resultsId, ("-webkit-search-results-button"));
DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-results-decoration"));
DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration"));
- Node* host = shadowAncestorNode();
+ Element* host = shadowHost();
if (!host)
return resultsId;
if (HTMLInputElement* input = host->toInputElement()) {
@@ -147,7 +149,7 @@
void SearchFieldResultsButtonElement::defaultEventHandler(Event* event)
{
// On mousedown, bring up a menu, if needed
- HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
input->focus();
input->select();
@@ -195,7 +197,7 @@
void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
{
// If the element is visible, on mouseup, clear the value, and set selection
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
+ RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
if (input->disabled() || input->isReadOnlyFormControl()) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
@@ -276,7 +278,7 @@
return;
}
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
+ RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
if (input->disabled() || input->isReadOnlyFormControl()) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
@@ -362,7 +364,7 @@
void SpinButtonElement::step(int amount)
{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
if (input->disabled() || input->isReadOnlyFormControl())
return;
// On Mac OS, NSStepper updates the value for the button under the mouse
@@ -427,7 +429,7 @@
// The call to focus() below dispatches a focus event, and an event handler in the page might
// remove the input element from DOM. To make sure it remains valid until we finish our work
// here, we take a temporary reference.
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
+ RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
if (input->disabled() || input->isReadOnlyFormControl()) {
if (!event->defaultHandled())
@@ -481,7 +483,7 @@
{
if (m_state != state) {
m_state = state;
- shadowAncestorNode()->renderer()->repaint();
+ shadowHost()->renderer()->repaint();
}
}
@@ -507,7 +509,7 @@
// The call to setValue() below dispatches an event, and an event handler in the page might
// remove the input element from DOM. To make sure it remains valid until we finish our work
// here, we take a temporary reference.
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
+ RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
if (input->disabled() || input->isReadOnlyFormControl())
return;
@@ -560,7 +562,7 @@
if (m_state != Idle)
return;
- RefPtr<HTMLInputElement> input = static_cast<HTMLInputElement*>(shadowAncestorNode());
+ RefPtr<HTMLInputElement> input = static_cast<HTMLInputElement*>(shadowHost());
AtomicString language = input->computeInheritedLanguage();
String grammar = input->getAttribute(webkitgrammarAttr);
// FIXME: this should probably respect transforms
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (123328 => 123329)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2012-07-23 11:18:20 UTC (rev 123328)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2012-07-23 11:19:43 UTC (rev 123329)
@@ -53,10 +53,10 @@
{
LayoutPoint contentsPoint(point);
- // Multiline text controls have the scroll on shadowAncestorNode, so we need to take that
- // into account here.
+ // Multiline text controls have the scroll on shadowHost, so we need to take
+ // that into account here.
if (m_multiLine) {
- RenderTextControl* renderer = toRenderTextControl(node()->shadowAncestorNode()->renderer());
+ RenderTextControl* renderer = toRenderTextControl(node()->shadowHost()->renderer());
if (renderer->hasOverflowClip())
contentsPoint += renderer->scrolledContentOffset();
}