void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == srcdocAttr) setLocation("about:srcdoc"); else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr)) setLocation(stripLeadingAndTrailingHTMLSpaces(value)); else if (name == idAttr) { HTMLFrameOwnerElement::parseAttribute(name, value); // Falling back to using the 'id' attribute is not standard but some content relies on this behavior. if (!hasAttributeWithoutSynchronization(nameAttr)) m_frameName = value; } else if (name == nameAttr) { m_frameName = value; // FIXME: If we are already attached, this doesn't actually change the frame's name. // FIXME: If we are already attached, this doesn't check for frame name // conflicts and generate a unique frame name. } else if (name == marginwidthAttr) { m_marginWidth = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == marginheightAttr) { m_marginHeight = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == scrollingAttr) { // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling." if (equalLettersIgnoringASCIICase(value, "auto") || equalLettersIgnoringASCIICase(value, "yes")) m_scrolling = document().frameElementsShouldIgnoreScrolling() ? ScrollbarAlwaysOff : ScrollbarAuto; else if (equalLettersIgnoringASCIICase(value, "no")) m_scrolling = ScrollbarAlwaysOff; // FIXME: If we are already attached, this has no effect. } else HTMLFrameOwnerElement::parseAttribute(name, value); }
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == srcdocAttr) setLocation("about:srcdoc"); else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) setLocation(stripLeadingAndTrailingHTMLSpaces(value)); else if (isIdAttributeName(name)) { // Important to call through to base for the id attribute so the hasID bit gets set. HTMLFrameOwnerElement::parseAttribute(name, value); m_frameName = value; } else if (name == nameAttr) { m_frameName = value; // FIXME: If we are already attached, this doesn't actually change the frame's name. // FIXME: If we are already attached, this doesn't check for frame name // conflicts and generate a unique frame name. } else if (name == marginwidthAttr) { m_marginWidth = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == marginheightAttr) { m_marginHeight = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == scrollingAttr) { // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling." if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) m_scrolling = ScrollbarAuto; else if (equalIgnoringCase(value, "no")) m_scrolling = ScrollbarAlwaysOff; // FIXME: If we are already attached, this has no effect. } else if (name == onbeforeunloadAttr) { // FIXME: should <frame> elements have beforeunload handlers? setAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(this, name, value)); } else HTMLFrameOwnerElement::parseAttribute(name, value); }
void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == rowsAttr) { int rows = value.toInt(); if (rows <= 0) rows = defaultRows; if (m_rows != rows) { m_rows = rows; if (renderer()) renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); } } else if (name == colsAttr) { int cols = value.toInt(); if (cols <= 0) cols = defaultCols; if (m_cols != cols) { m_cols = cols; if (renderer()) renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); } } else if (name == wrapAttr) { // The virtual/physical values were a Netscape extension of HTML 3.0, now deprecated. // The soft/hard /off values are a recommendation for HTML 4 extension by IE and NS 4. WrapMethod wrap; if (equalIgnoringCase(value, "physical") || equalIgnoringCase(value, "hard") || equalIgnoringCase(value, "on")) wrap = HardWrap; else if (equalIgnoringCase(value, "off")) wrap = NoWrap; else wrap = SoftWrap; if (wrap != m_wrap) { m_wrap = wrap; if (renderer()) renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); } } else if (name == accesskeyAttr) { // ignore for the moment } else if (name == maxlengthAttr) { setNeedsValidityCheck(); } else if (name == minlengthAttr) { setNeedsValidityCheck(); } else HTMLTextFormControlElement::parseAttribute(name, value); }
void HTMLTableCellElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) { if (name == nowrapAttr) addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace, CSSValueWebkitNowrap); else if (name == widthAttr) { if (!value.isEmpty()) { int widthInt = value.toInt(); if (widthInt > 0) // width="0" is ignored for compatibility with WinIE. addHTMLLengthToStyle(style, CSSPropertyWidth, value); } } else if (name == heightAttr) { if (!value.isEmpty()) { int heightInt = value.toInt(); if (heightInt > 0) // height="0" is ignored for compatibility with WinIE. addHTMLLengthToStyle(style, CSSPropertyHeight, value); } } else HTMLTablePartElement::collectStyleForPresentationAttribute(name, value, style); }
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == srcdocAttr) setLocation("about:srcdoc"); else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) setLocation(stripLeadingAndTrailingHTMLSpaces(value)); else if (isIdAttributeName(name)) { // Important to call through to base for the id attribute so the hasID bit gets set. HTMLFrameOwnerElement::parseAttribute(name, value); m_frameName = value; } else if (name == nameAttr) { m_frameName = value; // FIXME: If we are already attached, this doesn't actually change the frame's name. // FIXME: If we are already attached, this doesn't check for frame name // conflicts and generate a unique frame name. } else if (name == marginwidthAttr) { m_marginWidth = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == marginheightAttr) { m_marginHeight = value.toInt(); // FIXME: If we are already attached, this has no effect. } else if (name == scrollingAttr) { // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling." if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) m_scrolling = document().frameElementsShouldIgnoreScrolling() ? ScrollbarAlwaysOff : ScrollbarAuto; else if (equalIgnoringCase(value, "no")) m_scrolling = ScrollbarAlwaysOff; // FIXME: If we are already attached, this has no effect. #if ENABLE(VIEWSOURCE_ATTRIBUTE) } else if (name == viewsourceAttr) { m_viewSource = !value.isNull(); if (contentFrame()) contentFrame()->setInViewSourceMode(viewSourceMode()); #endif } else if (name == onbeforeloadAttr) setAttributeEventListener(eventNames().beforeloadEvent, name, value); else if (name == onbeforeunloadAttr) { // FIXME: should <frame> elements have beforeunload handlers? setAttributeEventListener(eventNames().beforeunloadEvent, name, value); } else HTMLFrameOwnerElement::parseAttribute(name, value); }
int trackListIndexForElement(Element* element) { const AtomicString trackIndexAttributeValue = element->getAttribute(trackIndexAttributeName()); if (trackIndexAttributeValue.isNull() || trackIndexAttributeValue.isEmpty()) return HTMLMediaElement::textTracksIndexNotFound(); bool ok; int trackIndex = trackIndexAttributeValue.toInt(&ok); if (!ok) return HTMLMediaElement::textTracksIndexNotFound(); return trackIndex; }
inline void HTMLLIElement::parseValue(const AtomicString& value) { DCHECK(layoutObject()); DCHECK(layoutObject()->isListItem()); bool valueOK; int requestedValue = value.toInt(&valueOK); if (valueOK) toLayoutListItem(layoutObject())->setExplicitValue(requestedValue); else toLayoutListItem(layoutObject())->clearExplicitValue(); }
void HTMLFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == frameborderAttr) { m_frameBorder = value.toInt(); m_frameBorderSet = !value.isNull(); // FIXME: If we are already attached, this has no effect. } else if (name == noresizeAttr) { if (auto* renderer = this->renderer()) renderer->updateFromElement(); } else HTMLFrameElementBase::parseAttribute(name, value); }
void HTMLTableElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { CellBorders bordersBefore = cellBorders(); unsigned short oldPadding = m_padding; if (name == borderAttr) { // FIXME: This attribute is a mess. m_borderAttr = parseBorderWidthAttribute(value); } else if (name == bordercolorAttr) { m_borderColorAttr = !value.isEmpty(); } else if (name == frameAttr) { // FIXME: This attribute is a mess. bool borderTop; bool borderRight; bool borderBottom; bool borderLeft; m_frameAttr = getBordersFromFrameAttributeValue(value, borderTop, borderRight, borderBottom, borderLeft); } else if (name == rulesAttr) { m_rulesAttr = UnsetRules; if (equalIgnoringCase(value, "none")) m_rulesAttr = NoneRules; else if (equalIgnoringCase(value, "groups")) m_rulesAttr = GroupsRules; else if (equalIgnoringCase(value, "rows")) m_rulesAttr = RowsRules; else if (equalIgnoringCase(value, "cols")) m_rulesAttr = ColsRules; else if (equalIgnoringCase(value, "all")) m_rulesAttr = AllRules; } else if (name == cellpaddingAttr) { if (!value.isEmpty()) m_padding = std::max(0, value.toInt()); else m_padding = 1; } else if (name == colsAttr) { // ### } else HTMLElement::parseAttribute(name, value); if (bordersBefore != cellBorders() || oldPadding != m_padding) { m_sharedCellStyle = 0; bool cellChanged = false; for (Node* child = firstChild(); child; child = child->nextSibling()) cellChanged |= setTableCellsChanged(child); if (cellChanged) setNeedsStyleRecalc(); } }
void HTMLTableElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value) { CellBorders bordersBefore = getCellBorders(); unsigned short oldPadding = m_padding; if (name == borderAttr) { // FIXME: This attribute is a mess. m_borderAttr = parseBorderWidthAttribute(value); } else if (name == bordercolorAttr) { m_borderColorAttr = !value.isEmpty(); } else if (name == frameAttr) { // FIXME: This attribute is a mess. bool borderTop; bool borderRight; bool borderBottom; bool borderLeft; m_frameAttr = getBordersFromFrameAttributeValue( value, borderTop, borderRight, borderBottom, borderLeft); } else if (name == rulesAttr) { m_rulesAttr = UnsetRules; if (equalIgnoringCase(value, "none")) m_rulesAttr = NoneRules; else if (equalIgnoringCase(value, "groups")) m_rulesAttr = GroupsRules; else if (equalIgnoringCase(value, "rows")) m_rulesAttr = RowsRules; else if (equalIgnoringCase(value, "cols")) m_rulesAttr = ColsRules; else if (equalIgnoringCase(value, "all")) m_rulesAttr = AllRules; } else if (name == cellpaddingAttr) { if (!value.isEmpty()) m_padding = std::max(0, value.toInt()); else m_padding = 1; } else if (name == colsAttr) { // ### } else { HTMLElement::parseAttribute(name, oldValue, value); } if (bordersBefore != getCellBorders() || oldPadding != m_padding) { m_sharedCellStyle = nullptr; setNeedsTableStyleRecalc(); } }
void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet& style) { if (name == widthAttr) addHTMLLengthToStyle(style, CSSPropertyWidth, value); else if (name == heightAttr) addHTMLLengthToStyle(style, CSSPropertyHeight, value); else if (name == alignAttr) applyAlignmentAttributeToStyle(value, style); else if (name == frameborderAttr) { // Frame border doesn't really match the HTML4 spec definition for iframes. It simply adds // a presentational hint that the border should be off if set to zero. if (!value.toInt()) { // Add a rule that nulls out our border width. addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::CSS_PX); } } else HTMLFrameElementBase::collectStyleForPresentationAttribute(name, value, style); }
void HTMLTableColElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == spanAttr) { m_span = !value.isNull() ? value.toInt() : 1; if (renderer() && renderer()->isRenderTableCol()) renderer()->updateFromElement(); } else if (name == widthAttr) { if (!value.isEmpty()) { if (renderer() && renderer()->isRenderTableCol()) { RenderTableCol* col = toRenderTableCol(renderer()); int newWidth = width().toInt(); if (newWidth != col->width()) col->setNeedsLayoutAndPrefWidthsRecalc(); } } } else HTMLTablePartElement::parseAttribute(name, value); }
void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style) { if (name == alignAttr) { if (equalLettersIgnoringASCIICase(value, "left")) { addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX); addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto); } else if (equalLettersIgnoringASCIICase(value, "right")) { addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto); addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX); } else { addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto); addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto); } } else if (name == widthAttr) { bool ok; int v = value.toInt(&ok); if (ok && !v) addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 1, CSSPrimitiveValue::CSS_PX); else addHTMLLengthToStyle(style, CSSPropertyWidth, value); } else if (name == colorAttr) { addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid); addHTMLColorToStyle(style, CSSPropertyBorderColor, value); addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value); } else if (name == noshadeAttr) { if (!hasAttributeWithoutSynchronization(colorAttr)) { addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid); RefPtr<CSSPrimitiveValue> darkGrayValue = CSSValuePool::singleton().createColorValue(Color::darkGray); style.setProperty(CSSPropertyBorderColor, darkGrayValue); style.setProperty(CSSPropertyBackgroundColor, darkGrayValue); } } else if (name == sizeAttr) { StringImpl* si = value.impl(); int size = si->toInt(); if (size <= 1) addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSPrimitiveValue::CSS_PX); else addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, size - 2, CSSPrimitiveValue::CSS_PX); } else HTMLElement::collectStyleForPresentationAttribute(name, value, style); }
void HTMLOListElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == startAttr) { int oldStart = start(); bool canParse; int parsedStart = value.toInt(&canParse); m_hasExplicitStart = canParse; m_start = canParse ? parsedStart : 0xBADBEEF; if (oldStart == start()) return; updateItemValues(); } else if (name == reversedAttr) { bool reversed = !value.isNull(); if (reversed == m_isReversed) return; m_isReversed = reversed; updateItemValues(); } else HTMLElement::parseAttribute(name, value); }
void HTMLFrameSetElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == rowsAttr) { if (!value.isNull()) { m_rowLengths = newLengthArray(value.string(), m_totalRows); setNeedsStyleRecalc(); } } else if (name == colsAttr) { if (!value.isNull()) { m_colLengths = newLengthArray(value.string(), m_totalCols); setNeedsStyleRecalc(); } } else if (name == frameborderAttr) { if (!value.isNull()) { if (equalIgnoringCase(value, "no") || equalIgnoringCase(value, "0")) { m_frameborder = false; m_frameborderSet = true; } else if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "1")) { m_frameborderSet = true; } } else { m_frameborder = false; m_frameborderSet = false; } } else if (name == noresizeAttr) { m_noresize = true; } else if (name == borderAttr) { if (!value.isNull()) { m_border = value.toInt(); m_borderSet = true; } else m_borderSet = false; } else if (name == bordercolorAttr) m_borderColorSet = !value.isEmpty(); else if (name == onloadAttr) document().setWindowAttributeEventListener(eventNames().loadEvent, name, value); else if (name == onbeforeunloadAttr) document().setWindowAttributeEventListener(eventNames().beforeunloadEvent, name, value); else if (name == onunloadAttr) document().setWindowAttributeEventListener(eventNames().unloadEvent, name, value); else if (name == onblurAttr) document().setWindowAttributeEventListener(eventNames().blurEvent, name, value); else if (name == onfocusAttr) document().setWindowAttributeEventListener(eventNames().focusEvent, name, value); else if (name == onfocusinAttr) document().setWindowAttributeEventListener(eventNames().focusinEvent, name, value); else if (name == onfocusoutAttr) document().setWindowAttributeEventListener(eventNames().focusoutEvent, name, value); #if ENABLE(ORIENTATION_EVENTS) else if (name == onorientationchangeAttr) document().setWindowAttributeEventListener(eventNames().orientationchangeEvent, name, value); #endif else if (name == onhashchangeAttr) document().setWindowAttributeEventListener(eventNames().hashchangeEvent, name, value); else if (name == onresizeAttr) document().setWindowAttributeEventListener(eventNames().resizeEvent, name, value); else if (name == onscrollAttr) document().setWindowAttributeEventListener(eventNames().scrollEvent, name, value); else if (name == onstorageAttr) document().setWindowAttributeEventListener(eventNames().storageEvent, name, value); else if (name == ononlineAttr) document().setWindowAttributeEventListener(eventNames().onlineEvent, name, value); else if (name == onofflineAttr) document().setWindowAttributeEventListener(eventNames().offlineEvent, name, value); else if (name == onpopstateAttr) document().setWindowAttributeEventListener(eventNames().popstateEvent, name, value); else HTMLElement::parseAttribute(name, value); }
void HTMLFrameSetElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == rowsAttr) { if (!value.isNull()) { m_rowLengths = parseListOfDimensions(value.string()); setNeedsStyleRecalc(SubtreeStyleChange); } } else if (name == colsAttr) { if (!value.isNull()) { m_colLengths = parseListOfDimensions(value.string()); setNeedsStyleRecalc(SubtreeStyleChange); } } else if (name == frameborderAttr) { if (!value.isNull()) { if (equalIgnoringCase(value, "no") || equalIgnoringCase(value, "0")) { m_frameborder = false; m_frameborderSet = true; } else if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "1")) { m_frameborderSet = true; } } else { m_frameborder = false; m_frameborderSet = false; } } else if (name == noresizeAttr) { m_noresize = true; } else if (name == borderAttr) { if (!value.isNull()) { m_border = value.toInt(); m_borderSet = true; } else m_borderSet = false; } else if (name == bordercolorAttr) m_borderColorSet = !value.isEmpty(); else if (name == onloadAttr) document().setWindowAttributeEventListener(EventTypeNames::load, createAttributeEventListener(document().frame(), name, value)); else if (name == onbeforeunloadAttr) document().setWindowAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(document().frame(), name, value)); else if (name == onunloadAttr) document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value)); else if (name == onpagehideAttr) document().setWindowAttributeEventListener(EventTypeNames::pagehide, createAttributeEventListener(document().frame(), name, value)); else if (name == onpageshowAttr) document().setWindowAttributeEventListener(EventTypeNames::pageshow, createAttributeEventListener(document().frame(), name, value)); else if (name == onblurAttr) document().setWindowAttributeEventListener(EventTypeNames::blur, createAttributeEventListener(document().frame(), name, value)); else if (name == onerrorAttr) document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value)); else if (name == onfocusAttr) document().setWindowAttributeEventListener(EventTypeNames::focus, createAttributeEventListener(document().frame(), name, value)); else if (name == onfocusinAttr) document().setWindowAttributeEventListener(EventTypeNames::focusin, createAttributeEventListener(document().frame(), name, value)); else if (name == onfocusoutAttr) document().setWindowAttributeEventListener(EventTypeNames::focusout, createAttributeEventListener(document().frame(), name, value)); else if (RuntimeEnabledFeatures::orientationEventEnabled() && name == onorientationchangeAttr) document().setWindowAttributeEventListener(EventTypeNames::orientationchange, createAttributeEventListener(document().frame(), name, value)); else if (name == onhashchangeAttr) document().setWindowAttributeEventListener(EventTypeNames::hashchange, createAttributeEventListener(document().frame(), name, value)); else if (name == onmessageAttr) document().setWindowAttributeEventListener(EventTypeNames::message, createAttributeEventListener(document().frame(), name, value)); else if (name == onresizeAttr) document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value)); else if (name == onscrollAttr) document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value)); else if (name == onstorageAttr) document().setWindowAttributeEventListener(EventTypeNames::storage, createAttributeEventListener(document().frame(), name, value)); else if (name == ononlineAttr) document().setWindowAttributeEventListener(EventTypeNames::online, createAttributeEventListener(document().frame(), name, value)); else if (name == onofflineAttr) document().setWindowAttributeEventListener(EventTypeNames::offline, createAttributeEventListener(document().frame(), name, value)); else if (name == onpopstateAttr) document().setWindowAttributeEventListener(EventTypeNames::popstate, createAttributeEventListener(document().frame(), name, value)); else HTMLElement::parseAttribute(name, value); }