| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "MouseEvent.h" | 37 #include "MouseEvent.h" |
| 38 #include "RenderTextControlSingleLine.h" | 38 #include "RenderTextControlSingleLine.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class RenderTextControlInnerBlock : public RenderBlock { | 42 class RenderTextControlInnerBlock : public RenderBlock { |
| 43 public: | 43 public: |
| 44 RenderTextControlInnerBlock(Node* node, bool isMultiLine) : RenderBlock(node
), m_multiLine(isMultiLine) { } | 44 RenderTextControlInnerBlock(Node* node, bool isMultiLine) : RenderBlock(node
), m_multiLine(isMultiLine) { } |
| 45 | 45 |
| 46 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); | 46 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); |
| 47 virtual VisiblePosition positionForCoordinates(int x, int y); | 47 virtual VisiblePosition positionForPoint(const IntPoint&); |
| 48 private: | 48 private: |
| 49 bool m_multiLine; | 49 bool m_multiLine; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 bool RenderTextControlInnerBlock::nodeAtPoint(const HitTestRequest& request, Hit
TestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) | 52 bool RenderTextControlInnerBlock::nodeAtPoint(const HitTestRequest& request, Hit
TestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) |
| 53 { | 53 { |
| 54 RenderObject* renderer = node()->shadowAncestorNode()->renderer(); | 54 RenderObject* renderer = node()->shadowAncestorNode()->renderer(); |
| 55 | 55 |
| 56 bool placeholderIsVisible = false; | 56 bool placeholderIsVisible = false; |
| 57 if (renderer->isTextField()) | 57 if (renderer->isTextField()) |
| 58 placeholderIsVisible = static_cast<RenderTextControlSingleLine*>(rendere
r)->placeholderIsVisible(); | 58 placeholderIsVisible = static_cast<RenderTextControlSingleLine*>(rendere
r)->placeholderIsVisible(); |
| 59 return RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, placeholderIs
Visible ? HitTestBlockBackground : hitTestAction); | 59 return RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, placeholderIs
Visible ? HitTestBlockBackground : hitTestAction); |
| 60 } | 60 } |
| 61 | 61 |
| 62 VisiblePosition RenderTextControlInnerBlock::positionForCoordinates(int x, int y
) | 62 VisiblePosition RenderTextControlInnerBlock::positionForPoint(const IntPoint& po
int) |
| 63 { | 63 { |
| 64 int contentsX = x; | 64 int contentsX = point.x(); |
| 65 int contentsY = y; | 65 int contentsY = point.y(); |
| 66 | 66 |
| 67 // Multiline text controls have the scroll on shadowAncestorNode, so we need
to take that | 67 // Multiline text controls have the scroll on shadowAncestorNode, so we need
to take that |
| 68 // into account here. | 68 // into account here. |
| 69 if (m_multiLine) { | 69 if (m_multiLine) { |
| 70 RenderTextControl* renderer = static_cast<RenderTextControl*>(node()->sh
adowAncestorNode()->renderer()); | 70 RenderTextControl* renderer = static_cast<RenderTextControl*>(node()->sh
adowAncestorNode()->renderer()); |
| 71 if (renderer->hasOverflowClip()) | 71 if (renderer->hasOverflowClip()) |
| 72 renderer->layer()->addScrolledContentOffset(contentsX, contentsY); | 72 renderer->layer()->addScrolledContentOffset(contentsX, contentsY); |
| 73 } | 73 } |
| 74 | 74 |
| 75 return RenderBlock::positionForCoordinates(contentsX, contentsY); | 75 return RenderBlock::positionForPoint(IntPoint(contentsX, contentsY)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 TextControlInnerElement::TextControlInnerElement(Document* doc, Node* shadowPare
nt) | 78 TextControlInnerElement::TextControlInnerElement(Document* doc, Node* shadowPare
nt) |
| 79 : HTMLDivElement(HTMLNames::divTag, doc) | 79 : HTMLDivElement(HTMLNames::divTag, doc) |
| 80 , m_shadowParent(shadowParent) | 80 , m_shadowParent(shadowParent) |
| 81 { | 81 { |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render
Style> style, RenderArena* arena) | 84 void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render
Style> style, RenderArena* arena) |
| 85 { | 85 { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 frame->eventHandler()->setCapturingMouseEventsNode(0); | 193 frame->eventHandler()->setCapturingMouseEventsNode(0); |
| 194 m_capturing = false; | 194 m_capturing = false; |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 if (!evt->defaultHandled()) | 198 if (!evt->defaultHandled()) |
| 199 HTMLDivElement::defaultEventHandler(evt); | 199 HTMLDivElement::defaultEventHandler(evt); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } | 202 } |
| OLD | NEW |