void JointsElement::ReadNode(const DOMNode* node) { _ASSERTE(node != NULL); ReadAttributes( node ); DOMNode* currentNode = node->getFirstChild(); while( currentNode != NULL ) { #if _DEBUG // デバッグ時に名前をチェックする為に const XMLCh* name = currentNode->getNodeName(); #endif if( IsElementNode( currentNode ) ) { if( Is_input_NodeName( currentNode ) ) { InputElement* elemInput = new InputElement(); elemInput->ReadNode( currentNode ); vecElemInput.push_back( elemInput ); } } currentNode = currentNode->getNextSibling(); // 次の要素を処理する } }
void RenderTextControlSingleLine::subtreeHasChanged() { bool wasEdited = isEdited(); RenderTextControl::subtreeHasChanged(); InputElement* input = inputElement(); input->setValueFromRenderer(input->constrainValue(text())); if (RenderObject* cancelButtonRenderer = m_cancelButton ? m_cancelButton->renderer() : 0) updateCancelButtonVisibility(cancelButtonRenderer->style()); // If the incremental attribute is set, then dispatch the search event if (input->searchEventsShouldBeDispatched()) startSearchEventTimer(); if (!wasEdited && node()->focused()) { if (Frame* frame = document()->frame()) frame->textFieldDidBeginEditing(static_cast<Element*>(node())); } if (node()->focused()) { if (Frame* frame = document()->frame()) frame->textDidChangeInTextField(static_cast<Element*>(node())); } }
void AXObjectCache::textMarkerDataForVisiblePosition(TextMarkerData& textMarkerData, const VisiblePosition& visiblePos) { // This memory must be bzero'd so instances of TextMarkerData can be tested for byte-equivalence. // This also allows callers to check for failure by looking at textMarkerData upon return. memset(&textMarkerData, 0, sizeof(TextMarkerData)); if (visiblePos.isNull()) return; Position deepPos = visiblePos.deepEquivalent(); Node* domNode = deepPos.node(); ASSERT(domNode); if (!domNode) return; if (domNode->isHTMLElement()) { InputElement* inputElement = toInputElement(static_cast<Element*>(domNode)); if (inputElement && inputElement->isPasswordField()) return; } // locate the renderer, which must exist for a visible dom node RenderObject* renderer = domNode->renderer(); ASSERT(renderer); // find or create an accessibility object for this renderer AXObjectCache* cache = renderer->document()->axObjectCache(); RefPtr<AccessibilityObject> obj = cache->getOrCreate(renderer); textMarkerData.axID = obj.get()->axObjectID(); textMarkerData.node = domNode; textMarkerData.offset = deepPos.deprecatedEditingOffset(); textMarkerData.affinity = visiblePos.affinity(); }
bool RenderThemeBal::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { i.context->save(); i.context->setStrokeStyle(SolidStroke); i.context->setStrokeColor(Color::black); PassRefPtr<RenderStyle> style = RenderStyle::create(); addIntrinsicMargins(style.get()); EBorderStyle v = INSET; style->setBorderTopStyle(v); style->setBorderLeftStyle(v); style->setBorderBottomStyle(v); style->setBorderRightStyle(v); int borderWidth = 1; style->setBorderTopWidth(borderWidth); style->setBorderLeftWidth(borderWidth); style->setBorderBottomWidth(borderWidth); style->setBorderRightWidth(borderWidth); toRenderBox(o)->paintFillLayerExtended(i, o->style()->backgroundColor(), o->style()->backgroundLayers(), r.y(), toRenderBox(o)->height(), r.x(), r.y(), toRenderBox(o)->width(), toRenderBox(o)->height()); toRenderBox(o)->paintBorder(i.context, r.x(), r.y(), r.width(), r.height(), style.get(), true, true); if( o->node()->active() ) { IntRect r2(r); r2.inflate(-2); i.context->setFillColor(WebCore::Color(0xc0,0xc0,0xc0)); i.context->drawRect(r2); v = GROOVE; style->setBorderTopStyle(v); style->setBorderLeftStyle(v); style->setBorderBottomStyle(v); style->setBorderRightStyle(v); int borderWidth = 1; style->setBorderTopWidth(borderWidth); style->setBorderLeftWidth(borderWidth); style->setBorderBottomWidth(borderWidth); style->setBorderRightWidth(borderWidth); toRenderBox(o)->paintFillLayerExtended(i, o->style()->backgroundColor(), o->style()->backgroundLayers(), r.y(), toRenderBox(o)->height(), r.x(), r.y(), toRenderBox(o)->width(), toRenderBox(o)->height()); toRenderBox(o)->paintBorder(i.context, r.x(), r.y(), r.width(), r.height(), style.get(), true, true); } InputElement *input = toInputElement(static_cast<Element*>(o->node())); if(input && input->isChecked()) { i.context->setStrokeColor(Color::black); i.context->setStrokeStyle(SolidStroke); IntRect r2(r); r2.inflate(-borderWidth-2); i.context->drawLine(IntPoint(r2.x(),r2.y()), IntPoint(r2.x()+r2.width(),r2.y()+r2.height())); i.context->drawLine(IntPoint(r2.x()+r2.width(),r2.y()), IntPoint(r2.x(),r2.y()+r2.height())); } i.context->restore(); return false; }
bool RenderTheme::isIndeterminate(const RenderObject* o) const { if (!o->node()) return false; InputElement* inputElement = o->node()->toInputElement(); if (!inputElement) return false; return inputElement->isIndeterminate(); }
bool RenderTheme::isIndeterminate(const RenderObject* o) const { if (!o->node() || !o->node()->isElementNode()) return false; InputElement* inputElement = toInputElement(static_cast<Element*>(o->node())); if (!inputElement) return false; return inputElement->isIndeterminate(); }
bool RenderThemeAndroid::paintRadio(RenderObject* obj, const PaintInfo& info, const IntRect& rect) { Node* node = obj->node(); Element* element = static_cast<Element*>(node); if (element) { InputElement* input = element->toInputElement(); GraphicsContext* context = info.context; if (!element->isEnabledFormControl()) { context->setAlpha(0.5f); } const IntRect inner = IntRect(rect.x() - 2, rect.y() - 2, rect.width() - 4, rect.height() - 4); context->setFillColor(Color(defaultBgBright), context->fillColorSpace()); context->setStrokeColor(Color(defaultBgBright), context->strokeColorSpace()); context->setStrokeThickness(1.0f); //SAMSUNG CHANGE [Cq - 5912] /* if (input->isCheckbox()) { context->drawRect(inner); } else { context->drawEllipse(inner); } context->setStrokeColor(Color(defaultFgColor), context->strokeColorSpace());*/ //SAMSUNG CHANGE [Cq - 5912] if (input->isCheckbox()) { context->drawRect(IntRect(inner.x() + 2, inner.y() + 2, inner.width() -4, inner.height() - 4)); } else { context->drawEllipse(IntRect(inner.x() + 2, inner.y() + 2, inner.width() -4, inner.height() - 4)); } if (input->isChecked()) { context->setFillColor(Color(defaultCheckColor), context->fillColorSpace()); context->setStrokeColor(Color(defaultCheckColor), context->strokeColorSpace()); if (input->isCheckbox()) { const float w2 = ((float) rect.width() / 2); const float cx = ((float) rect.x()); const float cy = ((float) rect.y()); context->save(); // magic numbers due to weird scale in context context->translate(cx + w2 / 2.2f, cy + w2 / 1.2f); context->rotate(3.93f); // 225 degrees context->drawRect(IntRect(0, 0, rect.width() / 4, 2)); context->rotate(1.57f); // 90 degrees context->drawRect(IntRect(0, 0, rect.width() / 2, 2)); context->restore(); } else { context->drawEllipse(IntRect(inner.x() + 5, inner.y() + 5, inner.width() - 10, inner.height() - 10)); } } } return false; }
void DumpRenderTreeSupportGtk::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) { JSC::ExecState* exec = toJS(context); Element* element = toElement(toJS(exec, nodeObject)); if (!element) return; InputElement* inputElement = element->toInputElement(); if (!inputElement) return; size_t bufferSize = JSStringGetMaximumUTF8CStringSize(value); GOwnPtr<gchar> valueBuffer(static_cast<gchar*>(g_malloc(bufferSize))); JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize); inputElement->setValueForUser(String::fromUTF8(valueBuffer.get())); }
void CheckedRadioButtons::removeButton(HTMLFormControlElement* element) { if (element->name().isEmpty() || !m_nameToCheckedRadioButtonMap) return; NameToInputMap::iterator it = m_nameToCheckedRadioButtonMap->find(element->name().impl()); if (it == m_nameToCheckedRadioButtonMap->end() || it->second != element) return; InputElement* inputElement = toInputElement(element); ASSERT_UNUSED(inputElement, inputElement); ASSERT(inputElement->isChecked()); ASSERT(element->isRadioButton()); m_nameToCheckedRadioButtonMap->remove(it); if (m_nameToCheckedRadioButtonMap->isEmpty()) m_nameToCheckedRadioButtonMap.clear(); }
bool RenderThemeBal::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { i.context->save(); i.context->setStrokeStyle(SolidStroke); PassRefPtr<RenderStyle> style = RenderStyle::create(); EBorderStyle v = RIDGE; style->setBorderTopStyle(v); style->setBorderLeftStyle(v); style->setBorderBottomStyle(v); style->setBorderRightStyle(v); #if PLATFORM(AMIGAOS4) int borderWidth = 2; #else int borderWidth = 1; #endif style->setBorderTopWidth(borderWidth); style->setBorderLeftWidth(borderWidth); style->setBorderBottomWidth(borderWidth); style->setBorderRightWidth(borderWidth); toRenderBox(o)->paintFillLayerExtended(i, o->style()->backgroundColor(), o->style()->backgroundLayers(), r.y(), toRenderBox(o)->height(), r.x(), r.y(), toRenderBox(o)->width(), toRenderBox(o)->height()); toRenderBox(o)->paintBorder(i.context, r.x(), r.y(), r.width(), r.height(), style.get(), true, true); InputElement *input = toInputElement(static_cast<Element*>(o->node())); if(input && input->isChecked()) { IntRect r2(r); #if PLATFORM(AMIGAOS4) r2.inflate(-borderWidth - 1); i.context->setFillColor(Color(0xFF618ECE)); #else r2.inflate(-borderWidth - 2); #endif i.context->drawRect(r2); } i.context->restore(); return false; }
void PassElement::ReadNode(const DOMNode* node) { _ASSERTE(node != NULL); DOMNode* currentNode = node->getFirstChild(); while( currentNode != NULL ) { #if _DEBUG // デバッグ時に名前をチェックする為に const XMLCh* name = currentNode->getNodeName(); #endif if( IsElementNode( currentNode ) ) { if( Is_param_NodeName( currentNode ) ) { ParamElement* elemParam = new ParamElement(); elemParam->ReadNode( currentNode ); vecElemParam.push_back( elemParam ); } else if( Is_input_NodeName( currentNode ) ) { InputElement* elemInput = new InputElement(); elemInput->ReadNode( currentNode ); vecElemInput.push_back( elemInput ); } else if( Is_program_NodeName( currentNode ) ) { _ASSERTE(elemProgram == NULL); // 0または1つ存在するのでこの時点ではNULL elemProgram = new ProgramElement(); elemProgram->ReadNode( currentNode ); } } currentNode = currentNode->getNextSibling(); // 次の要素を処理する } }
void KeyboardNotificationLayer::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) { //if no node was watching, return, no handle anymore. int count = this->nodeArray->count(); if (count == 0) { return; } // decide the trackNode is clicked. CCRect rect; CCPoint point = convertTouchToNodeSpaceAR(pTouch); //loop InputElement inside, decide to call which InputElement* preFocus = this->current; InputElement *nowFocus = NULL; for (int i = 0; i < count; i++) { InputElement *input = (InputElement*)this->nodeArray->objectAtIndex(i); CCRect rect = input->GetRangeRect(); if (rect.containsPoint(point)) { nowFocus = input; break; } } this->current = nowFocus; //if select on the same object, do nothing if (nowFocus == preFocus) { return; } //leave pre input if (preFocus != NULL) { preFocus->OnLeave(); } //enter new select input if (nowFocus != NULL) { nowFocus->OnEnter(); } }
void RenderRadio::paintObject(PaintInfo& i, int _tx, int _ty) { ASSERT(node()); Element* element = static_cast<Element*>(node()); InputElement* inputElement = toInputElement(element); bool isEnabled = element->isEnabledFormControl(); bool isChecked = inputElement->isChecked(); i.context->save(); RefPtr<Image> image = Image::loadPlatformResource( "radioButtonStates" ).get(); IntPoint destPt( _tx, _ty ); IntRect srcRect( 0, 0, 14, 16 ); if (isEnabled) { if (node()->active()) { if (isChecked) { srcRect.move( 75, 0 ); } else { srcRect.move( 60, 0 ); } } else if (node()->hovered()) { if (isChecked) { srcRect.move( 45, 0 ); } else { srcRect.move( 30, 0 ); } } else { if (isChecked) { srcRect.move( 15, 0 ); } else { } } } else { if (isChecked) { srcRect.move( 105, 0 ); } else { srcRect.move( 90, 0 ); } } i.context->drawImage( image.get(), DeviceColorSpace, destPt, srcRect ); // draw the focus ring. // if (node()->focused()) { IntRect focusRingSrcRect( 120, 0, 15, 17 ); i.context->drawImage( image.get(), DeviceColorSpace, destPt, focusRingSrcRect ); } #if 0 // this is the old "moveto - lineto" drawing code IntRect checkRect(_tx + borderLeft() , _ty + borderTop() , width() - borderLeft() - borderRight() , height() - borderBottom() - borderTop()); Color fillColor(0xff, 0xff, 0xff, 0x00); Color rectColor(0x18, 0x52, 0x84); Color checkColor(0x21, 0xa5, 0x21); if (!node()->isEnabled()) { rectColor = Color(0xce, 0xce, 0xdb); checkColor = Color(0xce, 0xce, 0xdb); } i.context->setStrokeThickness(1); i.context->setStrokeStyle(SolidStroke); i.context->setStrokeColor(rectColor); i.context->setFillColor(fillColor); i.context->drawEllipse(checkRect); if(node()->isEnabled() && node()->hovered()) { i.context->setStrokeColor(Color(0xff, 0xb5, 0x31)); IntRect hoverRect = checkRect; hoverRect.inflateX(-1); hoverRect.inflateY(-1); i.context->drawEllipse( hoverRect ); hoverRect.inflateX(-1); hoverRect.inflateY(-1); i.context->drawEllipse( hoverRect ); } if (isChecked) { i.context->setStrokeThickness(2); i.context->setStrokeColor(checkColor); i.context->setFillColor(checkColor); IntRect fillRect = checkRect; fillRect.inflateX(-2); fillRect.inflateY(-2); i.context->drawEllipse(fillRect); } #endif i.context->restore(); }