Diff
Modified: trunk/Source/WebCore/ChangeLog (174731 => 174732)
--- trunk/Source/WebCore/ChangeLog 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/ChangeLog 2014-10-15 17:36:38 UTC (rev 174732)
@@ -1,5 +1,37 @@
2014-10-15 Chris Dumez <[email protected]>
+ Use is<>() / downcast<>() for RenderTextControl / RenderTextControlSingleLine
+ https://bugs.webkit.org/show_bug.cgi?id=137727
+
+ Reviewed by Darin Adler.
+
+ Use is<>() / downcast<>() for RenderTextControl / RenderTextControlSingleLine.
+
+ No new tests, no behavior change.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::selectedText):
+ (WebCore::AccessibilityRenderObject::selectedTextRange):
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange):
+ (WebCore::AccessibilityRenderObject::visiblePositionForIndex):
+ (WebCore::AccessibilityRenderObject::indexForVisiblePosition):
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::handleReplacedElement):
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::forwardEvent):
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerElement::customStyleForRenderer):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::capsLockStateMayHaveChanged):
+ * page/ios/FrameIOS.mm:
+ (WebCore::ancestorRespondingToScrollWheelEvents):
+ * rendering/RenderTextControl.h:
+ * rendering/RenderTextControlSingleLine.h:
+ * rendering/SimpleLineLayout.cpp:
+ (WebCore::SimpleLineLayout::canUseFor):
+
+2014-10-15 Chris Dumez <[email protected]>
+
Use is<>() / downcast<>() for ClipPathOperation subclasses
https://bugs.webkit.org/show_bug.cgi?id=137733
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (174731 => 174732)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -1438,7 +1438,7 @@
return String(); // need to return something distinct from empty string
if (isNativeTextControl()) {
- HTMLTextFormControlElement& textControl = toRenderTextControl(m_renderer)->textFormControlElement();
+ HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
return textControl.selectedText();
}
@@ -1467,7 +1467,7 @@
AccessibilityRole ariaRole = ariaRoleAttribute();
if (isNativeTextControl() && ariaRole == UnknownRole) {
- HTMLTextFormControlElement& textControl = toRenderTextControl(m_renderer)->textFormControlElement();
+ HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
return PlainTextRange(textControl.selectionStart(), textControl.selectionEnd() - textControl.selectionStart());
}
@@ -1477,7 +1477,7 @@
void AccessibilityRenderObject::setSelectedTextRange(const PlainTextRange& range)
{
if (isNativeTextControl()) {
- HTMLTextFormControlElement& textControl = toRenderTextControl(m_renderer)->textFormControlElement();
+ HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
textControl.setSelectionRange(range.start, range.start + range.length);
return;
}
@@ -1831,9 +1831,9 @@
return VisiblePosition();
if (isNativeTextControl())
- return toRenderTextControl(m_renderer)->textFormControlElement().visiblePositionForIndex(index);
+ return downcast<RenderTextControl>(*m_renderer).textFormControlElement().visiblePositionForIndex(index);
- if (!allowsTextRanges() && !m_renderer->isText())
+ if (!allowsTextRanges() && !is<RenderText>(*m_renderer))
return VisiblePosition();
Node* node = m_renderer->node();
@@ -1846,7 +1846,7 @@
int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
{
if (isNativeTextControl())
- return toRenderTextControl(m_renderer)->textFormControlElement().indexForVisiblePosition(pos);
+ return downcast<RenderTextControl>(*m_renderer).textFormControlElement().indexForVisiblePosition(pos);
if (!isTextControl())
return 0;
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (174731 => 174732)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -728,8 +728,8 @@
return false;
}
- if ((m_behavior & TextIteratorEntersTextControls) && renderer.isTextControl()) {
- if (TextControlInnerTextElement* innerTextElement = toRenderTextControl(renderer).textFormControlElement().innerTextElement()) {
+ if ((m_behavior & TextIteratorEntersTextControls) && is<RenderTextControl>(renderer)) {
+ if (TextControlInnerTextElement* innerTextElement = downcast<RenderTextControl>(renderer).textFormControlElement().innerTextElement()) {
m_node = innerTextElement->containingShadowRoot();
pushFullyClippedState(m_fullyClippedStack, *m_node);
m_offset = 0;
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (174731 => 174732)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -180,18 +180,18 @@
element().document().updateStyleIfNeededForNode(element());
if (element().renderer()) {
- RenderTextControlSingleLine* renderTextControl = toRenderTextControlSingleLine(element().renderer());
+ RenderTextControlSingleLine& renderTextControl = downcast<RenderTextControlSingleLine>(*element().renderer());
if (event->type() == eventNames().blurEvent) {
if (RenderTextControlInnerBlock* innerTextRenderer = innerTextElement()->renderer()) {
if (RenderLayer* innerLayer = innerTextRenderer->layer()) {
- IntSize scrollOffset(!renderTextControl->style().isLeftToRightDirection() ? innerLayer->scrollWidth() : 0, 0);
+ IntSize scrollOffset(!renderTextControl.style().isLeftToRightDirection() ? innerLayer->scrollWidth() : 0, 0);
innerLayer->scrollToOffset(scrollOffset, RenderLayer::ScrollOffsetClamped);
}
}
- renderTextControl->capsLockStateMayHaveChanged();
+ renderTextControl.capsLockStateMayHaveChanged();
} else if (event->type() == eventNames().focusEvent)
- renderTextControl->capsLockStateMayHaveChanged();
+ renderTextControl.capsLockStateMayHaveChanged();
element().forwardEvent(event);
}
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (174731 => 174732)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -74,8 +74,8 @@
PassRefPtr<RenderStyle> TextControlInnerElement::customStyleForRenderer(RenderStyle&)
{
- RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowHost()->renderer());
- return parentRenderer->createInnerBlockStyle(&parentRenderer->style());
+ RenderTextControlSingleLine& parentRenderer = downcast<RenderTextControlSingleLine>(*shadowHost()->renderer());
+ return parentRenderer.createInnerBlockStyle(&parentRenderer.style());
}
// ---------------------------
Modified: trunk/Source/WebCore/page/EventHandler.cpp (174731 => 174732)
--- trunk/Source/WebCore/page/EventHandler.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -3690,11 +3690,11 @@
void EventHandler::capsLockStateMayHaveChanged()
{
- Document* d = m_frame.document();
- if (Element* element = d->focusedElement()) {
- if (RenderObject* r = element->renderer()) {
- if (r->isTextField())
- toRenderTextControlSingleLine(r)->capsLockStateMayHaveChanged();
+ Document* document = m_frame.document();
+ if (auto* element = document->focusedElement()) {
+ if (auto* renderer = element->renderer()) {
+ if (is<RenderTextControlSingleLine>(*renderer))
+ downcast<RenderTextControlSingleLine>(*renderer).capsLockStateMayHaveChanged();
}
}
}
Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (174731 => 174732)
--- trunk/Source/WebCore/page/ios/FrameIOS.mm 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm 2014-10-15 17:36:38 UTC (rev 174732)
@@ -293,7 +293,7 @@
if (!renderer)
continue;
- if ((renderer->isTextField() || renderer->isTextArea()) && toRenderTextControl(renderer)->canScroll()) {
+ if ((renderer->isTextField() || renderer->isTextArea()) && downcast<RenderTextControl>(*renderer).canScroll()) {
scrollingAncestor = node;
continue;
}
Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (174731 => 174732)
--- trunk/Source/WebCore/rendering/RenderTextControl.h 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h 2014-10-15 17:36:38 UTC (rev 174732)
@@ -87,8 +87,6 @@
virtual bool requiresForcedStyleRecalcPropagation() const override { return true; }
};
-RENDER_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl())
-
// Renderer for our inner container, for <search> and others.
// We can't use RenderFlexibleBox directly, because flexboxes have a different
// baseline definition, and then inputs of different types wouldn't line up
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h (174731 => 174732)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h 2014-10-15 17:36:38 UTC (rev 174732)
@@ -97,8 +97,6 @@
return inputElement().innerBlockElement();
}
-RENDER_OBJECT_TYPE_CASTS(RenderTextControlSingleLine, isTextField())
-
// ----------------------------
class RenderTextControlInnerBlock final : public RenderBlockFlow {
Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (174731 => 174732)
--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2014-10-15 17:36:38 UTC (rev 174732)
@@ -116,7 +116,7 @@
if (flow.parent()->isTextArea() && flow.parent()->element()->fastHasAttribute(HTMLNames::wrapAttr))
return false;
// FIXME: Placeholders do something strange.
- if (flow.parent()->isTextControl() && toRenderTextControl(*flow.parent()).textFormControlElement().placeholderElement())
+ if (is<RenderTextControl>(*flow.parent()) && downcast<RenderTextControl>(*flow.parent()).textFormControlElement().placeholderElement())
return false;
const RenderStyle& style = flow.style();
if (style.textDecorationsInEffect() != TextDecorationNone)
Modified: trunk/Source/WebKit/ios/ChangeLog (174731 => 174732)
--- trunk/Source/WebKit/ios/ChangeLog 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebKit/ios/ChangeLog 2014-10-15 17:36:38 UTC (rev 174732)
@@ -1,3 +1,18 @@
+2014-10-15 Chris Dumez <[email protected]>
+
+ Use is<>() / downcast<>() for RenderTextControl / RenderTextControlSingleLine
+ https://bugs.webkit.org/show_bug.cgi?id=137727
+
+ Reviewed by Darin Adler.
+
+ Use is<>() / downcast<>() for RenderTextControl / RenderTextControlSingleLine.
+
+ * WebCoreSupport/WebVisiblePosition.mm:
+ (-[DOMHTMLInputElement startPosition]):
+ (-[DOMHTMLInputElement endPosition]):
+ (-[DOMHTMLTextAreaElement startPosition]):
+ (-[DOMHTMLTextAreaElement endPosition]):
+
2014-10-03 Tim Horton <[email protected]>
REGRESSION (r165896): UIWebView PDFs have a forced black background
Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm (174731 => 174732)
--- trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm 2014-10-15 17:33:22 UTC (rev 174731)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm 2014-10-15 17:36:38 UTC (rev 174732)
@@ -573,25 +573,24 @@
- (WebVisiblePosition *)startPosition
{
- Node *node = core(self);
- RenderObject *object = node->renderer();
- if (!object || !object->isTextControl())
+ Node* node = core(self);
+ RenderObject* object = node->renderer();
+ if (!is<RenderTextControl>(object))
return [super startPosition];
- RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(0);
+ VisiblePosition visiblePosition = downcast<RenderTextControl>(*object).textFormControlElement().visiblePositionForIndex(0);
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
- (WebVisiblePosition *)endPosition
{
- Node *node = core(self);
- RenderObject *object = node->renderer();
- if (!object || !object->isTextControl())
+ Node* node = core(self);
+ RenderObject* object = node->renderer();
+ if (!is<RenderTextControl>(object))
return [super endPosition];
- RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(textControl->textFormControlElement().value().length());
+ RenderTextControl& textControl = downcast<RenderTextControl>(*object);
+ VisiblePosition visiblePosition = textControl.textFormControlElement().visiblePositionForIndex(textControl.textFormControlElement().value().length());
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
@@ -601,25 +600,24 @@
- (WebVisiblePosition *)startPosition
{
- Node *node = core(self);
- RenderObject *object = node->renderer();
+ Node* node = core(self);
+ RenderObject* object = node->renderer();
if (!object)
return [super startPosition];
- RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(0);
+ VisiblePosition visiblePosition = downcast<RenderTextControl>(*object).textFormControlElement().visiblePositionForIndex(0);
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
- (WebVisiblePosition *)endPosition
{
- Node *node = core(self);
- RenderObject *object = node->renderer();
+ Node* node = core(self);
+ RenderObject* object = node->renderer();
if (!object)
return [super endPosition];
- RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(textControl->textFormControlElement().value().length());
+ RenderTextControl& textControl = downcast<RenderTextControl>(*object);
+ VisiblePosition visiblePosition = textControl.textFormControlElement().visiblePositionForIndex(textControl.textFormControlElement().value().length());
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}