#include "RenderTheme.h"
#include "RuntimeEnabledFeatures.h"
#include "ScriptEventListener.h"
-<<<<<<< HEAD:WebCore/html/HTMLInputElement.cpp
-#include "Settings.h"
-#include "StepRange.h"
-#include "TextEvent.h"
-#ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS
-#include "PlatformBridge.h"
-#endif
-=======
->>>>>>> webkit.org at r75315:Source/WebCore/html/HTMLInputElement.cpp
#include "WheelEvent.h"
#include <wtf/MathExtras.h>
#include <wtf/StdLibExtras.h>
+#ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS
+#include "PlatformBridge.h"
+#endif
+
using namespace std;
namespace WebCore {
void HTMLInputElement::updateType()
{
const AtomicString& typeString = fastGetAttribute(typeAttr);
-<<<<<<< HEAD:WebCore/html/HTMLInputElement.cpp
- DeprecatedInputType newType = typeString.isEmpty() ? TEXT : typeMap->get(typeString);
+
+ OwnPtr<InputType> newType = InputType::create(this, typeString);
#ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS
- if (newType == PASSWORD && document()->focusedNode() == this)
+ if (newType->isPasswordField() && document()->focusedNode() == this)
PlatformBridge::updateTextfield(document()->view(), this, true, String());
#endif
- // IMPORTANT: Don't allow the type to be changed to FILE after the first
- // type change, otherwise a JavaScript programmer would be able to set a text
- // field's value to something like /etc/passwd and then change it to a file field.
- if (deprecatedInputType() != newType) {
- if (newType == FILE && m_haveType)
- // Set the attribute back to the old value.
- // Useful in case we were called from inside parseMappedAttribute.
- setAttribute(typeAttr, type());
- else {
- checkedRadioButtons().removeButton(this);
-
- if (newType == FILE && !m_fileList)
- m_fileList = FileList::create();
-
- bool wasAttached = attached();
- if (wasAttached)
- detach();
-
- bool didStoreValue = storesValueSeparateFromAttribute();
- bool wasPasswordField = deprecatedInputType() == PASSWORD;
- bool didRespectHeightAndWidth = respectHeightAndWidthAttrs();
- m_deprecatedTypeNumber = newType;
- m_inputType = InputType::create(this, typeString);
- setNeedsWillValidateCheck();
- bool willStoreValue = storesValueSeparateFromAttribute();
- bool isPasswordField = deprecatedInputType() == PASSWORD;
- bool willRespectHeightAndWidth = respectHeightAndWidthAttrs();
-
- if (didStoreValue && !willStoreValue && !m_data.value().isNull()) {
- setAttribute(valueAttr, m_data.value());
- m_data.setValue(String());
- }
- if (!didStoreValue && willStoreValue)
- m_data.setValue(sanitizeValue(getAttribute(valueAttr)));
- else
- InputElement::updateValueIfNeeded(m_data, this);
-=======
->>>>>>> webkit.org at r75315:Source/WebCore/html/HTMLInputElement.cpp
-
- OwnPtr<InputType> newType = InputType::create(this, typeString);
-
if (m_hasType && !newType->canChangeFromAnotherType()) {
// Set the attribute back to the old value.
// Useful in case we were called from inside parseMappedAttribute.
return;
}
-<<<<<<< HEAD:WebCore/html/HTMLInputElement.cpp
- if (deprecatedInputType() == RANGE
- && renderer()
- && (evt->isMouseEvent()
-#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS)
- || evt->isTouchEvent()
-#endif
- || evt->isDragEvent()
- || evt->isWheelEvent()))
- toRenderSlider(renderer())->forwardEvent(evt);
-=======
m_inputType->forwardEvent(evt);
->>>>>>> webkit.org at r75315:Source/WebCore/html/HTMLInputElement.cpp
if (!callBaseClassEarly && !evt->defaultHandled())
HTMLFormControlElementWithState::defaultEventHandler(evt);
// Now iterate the changedTouches list and m_targets within it, sending events to the tagets as required.
bool defaultPrevented = false;
-<<<<<<< HEAD:WebCore/page/EventHandler.cpp
- Touch* changedTouch = 0;
- EventTarget* touchEventTarget = 0;
-
- if (cancelTouches->length() > 0) {
- // We dispatch the event to the target of the touch that caused this touch event to be generated, i.e.
- // we take it from the list that will be used as the changedTouches property of the event.
- // The choice to use the touch at index 0 guarantees that there is a target (as we checked the length
- // above). In the case that there are multiple touches in what becomes the changedTouches list, it is
- // difficult to say how we should prioritise touches and as such, item 0 is an arbitrary choice.
- changedTouch = cancelTouches->item(0);
- ASSERT(changedTouch);
- touchEventTarget = changedTouch->target();
- ASSERT(touchEventTarget);
-
- eventName = &eventNames().touchcancelEvent;
- RefPtr<TouchEvent> cancelEv =
- TouchEvent::create(TouchList::create().get(), TouchList::create().get(), cancelTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(cancelEv.get(), ec);
- defaultPrevented |= cancelEv->defaultPrevented();
- }
-
- if (releasedTouches->length() > 0) {
- Touch* changedTouch = releasedTouches->item(0);
- ASSERT(changedTouch);
- touchEventTarget = changedTouch->target();
- ASSERT(touchEventTarget);
-
- RefPtr<TouchList> targetTouches = assembleTargetTouches(changedTouch, touches.get());
-
- eventName = &eventNames().touchendEvent;
- RefPtr<TouchEvent> endEv =
- TouchEvent::create(touches.get(), targetTouches.get(), releasedTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(endEv.get(), ec);
- defaultPrevented |= endEv->defaultPrevented();
- }
- if (pressedTouches->length() > 0) {
- Touch* changedTouch = pressedTouches->item(0);
- ASSERT(changedTouch);
- touchEventTarget = changedTouch->target();
- ASSERT(touchEventTarget);
-
- RefPtr<TouchList> targetTouches = assembleTargetTouches(changedTouch, touches.get());
-
-#if PLATFORM(ANDROID)
- if (event.type() == TouchLongPress) {
- eventName = &eventNames().touchlongpressEvent;
- RefPtr<TouchEvent> longpressEv =
- TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(longpressEv.get(), ec);
- defaultPrevented |= longpressEv->defaultPrevented();
- } else if (event.type() == TouchDoubleTap) {
- eventName = &eventNames().touchdoubletapEvent;
- RefPtr<TouchEvent> doubleTapEv =
- TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(doubleTapEv.get(), ec);
- defaultPrevented |= doubleTapEv->defaultPrevented();
- } else {
-#endif
- eventName = &eventNames().touchstartEvent;
- RefPtr<TouchEvent> startEv =
- TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(startEv.get(), ec);
- defaultPrevented |= startEv->defaultPrevented();
-#if PLATFORM(ANDROID)
- }
-#endif
- }
-
- if (movedTouches->length() > 0) {
- Touch* changedTouch = movedTouches->item(0);
- ASSERT(changedTouch);
- touchEventTarget = changedTouch->target();
- ASSERT(touchEventTarget);
-
- RefPtr<TouchList> targetTouches = assembleTargetTouches(changedTouch, touches.get());
-
- eventName = &eventNames().touchmoveEvent;
- RefPtr<TouchEvent> moveEv =
- TouchEvent::create(touches.get(), targetTouches.get(), movedTouches.get(),
- *eventName, touchEventTarget->toNode()->document()->defaultView(),
- 0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(),
- event.metaKey());
- ExceptionCode ec = 0;
- touchEventTarget->dispatchEvent(moveEv.get(), ec);
- defaultPrevented |= moveEv->defaultPrevented();
-=======
RefPtr<TouchList> emptyList = TouchList::create();
for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state) {
if (!changedTouches[state].m_touches)
// When sending a touch cancel event, use empty touches and targetTouches lists.
bool isTouchCancelEvent = (state == PlatformTouchPoint::TouchCancelled);
RefPtr<TouchList>& effectiveTouches(isTouchCancelEvent ? emptyList : touches);
+#if PLATFORM(ANDROID)
+ AtomicString stateName(eventNameForTouchPointState(static_cast<PlatformTouchPoint::State>(state)));
+ if (event.type() == TouchLongPress)
+ stateName = eventNames().touchlongpressEvent;
+ else if (event.type() == TouchDoubleTap)
+ stateName = eventNames().touchdoubletapEvent;
+#else
const AtomicString& stateName(eventNameForTouchPointState(static_cast<PlatformTouchPoint::State>(state)));
+#endif
const EventTargetSet& targetsForState = changedTouches[state].m_targets;
for (EventTargetSet::const_iterator it = targetsForState.begin(); it != targetsForState.end(); ++it) {
touchEventTarget->dispatchEvent(touchEvent.get(), ec);
defaultPrevented |= touchEvent->defaultPrevented();
}
->>>>>>> webkit.org at r75315:Source/WebCore/page/EventHandler.cpp
}
return defaultPrevented;
RenderText* text = toRenderText(renderer());
RenderStyle* style = text->style(m_firstLine);
const Font* f = &style->font();
-<<<<<<< HEAD:WebCore/rendering/InlineTextBox.cpp
#ifdef ANDROID_DISABLE_ROUNDING_HACKS
TextRun textRun = TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
if (m_disableRoundingHacks)
textRun.disableRoundingHacks();
- return f->offsetForPosition(textRun, lineOffset - logicalLeft(), includePartialGlyphs);
+ int offset = f->offsetForPosition(textRun, lineOffset - logicalLeft(), includePartialGlyphs);
#else
- return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
- lineOffset - logicalLeft(), includePartialGlyphs);
-#endif
-=======
int offset = f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len,
textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
lineOffset - logicalLeft(), includePartialGlyphs);
+#endif
if (blockIsInOppositeDirection && (!offset || offset == m_len))
return !offset ? m_len : 0;
return offset;
->>>>>>> webkit.org at r75315:Source/WebCore/rendering/InlineTextBox.cpp
}
int InlineTextBox::positionForOffset(int offset) const