Ignore:
Timestamp:
Sep 28, 2013, 1:20:56 PM (12 years ago)
Author:
Antti Koivisto
Message:

Add first()/last() to ElementIteratorAdapters
https://bugs.webkit.org/show_bug.cgi?id=122067

Reviewed by Darin Adler.

Add a convenient way for getting the first and last element if it exists.

Use it in some places.

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::canvasHasFallbackContent):

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::getFontData):

  • dom/Document.cpp:

(WebCore::Document::childrenChanged):
(WebCore::Document::removeTitle):

  • dom/ElementChildIterator.h:

(WebCore::::first):
(WebCore::::last):

  • dom/ElementDescendantIterator.h:

(WebCore::::first):
(WebCore::::last):

  • html/HTMLFieldSetElement.cpp:

(WebCore::HTMLFieldSetElement::legend):

  • html/HTMLLegendElement.cpp:

(WebCore::HTMLLegendElement::associatedControl):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::finishParsingChildren):
(WebCore::HTMLMediaElement::selectMediaResource):

  • svg/SVGElement.cpp:

(WebCore::SVGElement::title):

  • svg/SVGFontFaceElement.cpp:

(WebCore::SVGFontFaceElement::rebuildFontFace):

  • svg/graphics/SVGImage.cpp:

(WebCore::SVGImage::hasSingleSecurityOrigin):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r155729 r156612  
    140140                    return 0;
    141141
    142                 auto fontFaceChildren = childrenOfType<SVGFontFaceElement>(m_externalSVGFontElement.get());
    143                 auto firstFontFace = fontFaceChildren.begin();
    144                 if (firstFontFace != fontFaceChildren.end()) {
     142                if (auto firstFontFace = childrenOfType<SVGFontFaceElement>(m_externalSVGFontElement.get()).first()) {
    145143                    if (!m_svgFontFaceElement) {
    146144                        // We're created using a CSS @font-face rule, that means we're not associated with a SVGFontFaceElement.
    147145                        // Use the imported <font-face> tag as referencing font-face element for these cases.
    148                         m_svgFontFaceElement = &*firstFontFace;
     146                        m_svgFontFaceElement = firstFontFace;
    149147                    }
    150148
    151                     fontData = SimpleFontData::create(SVGFontData::create(&*firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
     149                    fontData = SimpleFontData::create(SVGFontData::create(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
    152150                }
    153151            } else
Note: See TracChangeset for help on using the changeset viewer.