Vector<String> FileChooserSettings::acceptTypes() const { Vector<String> acceptTypes; acceptTypes.reserveCapacity(acceptMIMETypes.size() + acceptFileExtensions.size()); acceptTypes.appendVector(acceptMIMETypes); acceptTypes.appendVector(acceptFileExtensions); return acceptTypes; }
Vector<uint8_t> CrossThreadCopierBase<false, false, Vector<uint8_t>>::copy(const Vector<uint8_t>& vector) { Vector<uint8_t> result; result.reserveInitialCapacity(vector.size()); result.appendVector(vector); return result; }
Vector<RefPtr<StyleRule>> StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount(unsigned maxCount) const { ASSERT(selectorList().componentCount() > maxCount); Vector<RefPtr<StyleRule>> rules; Vector<const CSSSelector*> componentsSinceLastSplit; for (const CSSSelector* selector = selectorList().first(); selector; selector = CSSSelectorList::next(selector)) { Vector<const CSSSelector*, 8> componentsInThisSelector; for (const CSSSelector* component = selector; component; component = component->tagHistory()) componentsInThisSelector.append(component); if (componentsInThisSelector.size() + componentsSinceLastSplit.size() > maxCount && !componentsSinceLastSplit.isEmpty()) { rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get()))); componentsSinceLastSplit.clear(); } componentsSinceLastSplit.appendVector(componentsInThisSelector); } if (!componentsSinceLastSplit.isEmpty()) rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get()))); return rules; }
void checkTextOfParagraph(TextCheckerClient& client, StringView text, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { #if USE(UNIFIED_TEXT_CHECKING) results = client.checkTextOfParagraph(text, checkingTypes); #else Vector<TextCheckingResult> mispellings; if (checkingTypes & TextCheckingTypeSpelling) findMisspellings(client, text, mispellings); #if USE(GRAMMAR_CHECKING) // Look for grammatical errors that occur before the first misspelling. Vector<TextCheckingResult> grammaticalErrors; if (checkingTypes & TextCheckingTypeGrammar) { unsigned grammarCheckLength = text.length(); for (auto& mispelling : mispellings) grammarCheckLength = std::min<unsigned>(grammarCheckLength, mispelling.location); findGrammaticalErrors(client, text.substring(0, grammarCheckLength), grammaticalErrors); } results = std::move(grammaticalErrors); #endif if (results.isEmpty()) results = std::move(mispellings); else results.appendVector(mispellings); #endif // USE(UNIFIED_TEXT_CHECKING) }
void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { #if USE(UNIFIED_TEXT_CHECKING) client->checkTextOfParagraph(text, length, checkingTypes, results); #else Vector<TextCheckingResult> spellingResult; if (checkingTypes & TextCheckingTypeSpelling) findMisspellings(client, text, 0, length, spellingResult); #if USE(GRAMMAR_CHECKING) Vector<TextCheckingResult> grammarResult; if (checkingTypes & TextCheckingTypeGrammar) { // Only checks grammartical error before the first misspellings int grammarCheckLength = length; for (size_t i = 0; i < spellingResult.size(); ++i) { if (spellingResult[i].location < grammarCheckLength) grammarCheckLength = spellingResult[i].location; } findBadGrammars(client, text, 0, grammarCheckLength, grammarResult); } if (grammarResult.size()) results.swap(grammarResult); #endif if (spellingResult.size()) { if (results.isEmpty()) results.swap(spellingResult); else results.appendVector(spellingResult); } #endif }
void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(HTMLStackItem* newItem, Vector<HTMLStackItem*>& remainingCandidates) { ASSERT(remainingCandidates.isEmpty()); if (m_entries.size() < kNoahsArkCapacity) return; // Use a vector with inline capacity to avoid a malloc in the common case // of a quickly ensuring the condition. Vector<HTMLStackItem*, 10> candidates; size_t newItemAttributeCount = newItem->attributes().size(); for (size_t i = m_entries.size(); i; ) { --i; Entry& entry = m_entries[i]; if (entry.isMarker()) break; // Quickly reject obviously non-matching candidates. HTMLStackItem* candidate = entry.stackItem(); if (newItem->localName() != candidate->localName() || newItem->namespaceURI() != candidate->namespaceURI()) continue; if (candidate->attributes().size() != newItemAttributeCount) continue; candidates.append(candidate); } if (candidates.size() < kNoahsArkCapacity) return; // There's room for the new element in the ark. There's no need to copy out the remainingCandidates. remainingCandidates.appendVector(candidates); }
static bool addIntersectionPoints(Vector<FloatPointGraph::Polygon>& polys, FloatPointGraph& graph) { bool foundAnyIntersections = false; Vector<FloatPointGraph::Edge> allEdges; for (auto& poly : polys) allEdges.appendVector(poly); for (const FloatPointGraph::Edge& edgeA : allEdges) { Vector<FloatPointGraph::Node*> intersectionPoints({edgeA.first, edgeA.second}); for (const FloatPointGraph::Edge& edgeB : allEdges) { if (&edgeA == &edgeB) continue; FloatPoint intersectionPoint; if (!findLineSegmentIntersection(edgeA, edgeB, intersectionPoint)) continue; foundAnyIntersections = true; intersectionPoints.append(graph.findOrCreateNode(intersectionPoint)); } std::sort(intersectionPoints.begin(), intersectionPoints.end(), [edgeA] (FloatPointGraph::Node* a, FloatPointGraph::Node* b) { return FloatPoint(*edgeA.first - *b).lengthSquared() > FloatPoint(*edgeA.first - *a).lengthSquared(); }); for (unsigned pointIndex = 1; pointIndex < intersectionPoints.size(); pointIndex++) intersectionPoints[pointIndex - 1]->addNextPoint(intersectionPoints[pointIndex]); } return foundAnyIntersections; }
void checkTextOfParagraph(TextCheckerClient& client, const String& text, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { Vector<UChar> characters; text.appendTo(characters); unsigned length = text.length(); Vector<TextCheckingResult> spellingResult; if (checkingTypes & TextCheckingTypeSpelling) findMisspellings(client, characters.data(), 0, length, spellingResult); Vector<TextCheckingResult> grammarResult; if (checkingTypes & TextCheckingTypeGrammar) { // Only checks grammartical error before the first misspellings int grammarCheckLength = length; for (const auto& spelling : spellingResult) { if (spelling.location < grammarCheckLength) grammarCheckLength = spelling.location; } findBadGrammars(client, characters.data(), 0, grammarCheckLength, grammarResult); } if (grammarResult.size()) results.swap(grammarResult); if (spellingResult.size()) { if (results.isEmpty()) results.swap(spellingResult); else results.appendVector(spellingResult); } }
void TiledBackingStore::updateTileBuffers() { if (m_contentsFrozen) return; m_client->tiledBackingStorePaintBegin(); Vector<IntRect> paintedArea; Vector<RefPtr<Tile> > dirtyTiles; TileMap::iterator end = m_tiles.end(); for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { if (!it->value->isDirty()) continue; dirtyTiles.append(it->value); } if (dirtyTiles.isEmpty()) { m_client->tiledBackingStorePaintEnd(paintedArea); return; } // FIXME: In single threaded case, tile back buffers could be updated asynchronously // one by one and then swapped to front in one go. This would minimize the time spent // blocking on tile updates. unsigned size = dirtyTiles.size(); for (unsigned n = 0; n < size; ++n) { Vector<IntRect> paintedRects = dirtyTiles[n]->updateBackBuffer(); paintedArea.appendVector(paintedRects); dirtyTiles[n]->swapBackBufferToFront(); } m_client->tiledBackingStorePaintEnd(paintedArea); }
static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyleSheet> >& sheets, Document* document) { HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame(); if (!seamlessParentIFrame) return; sheets.appendVector(seamlessParentIFrame->document()->styleSheetCollection()->activeAuthorStyleSheets()); }
ObjectPropertyConditionSet ObjectPropertyConditionSet::mergedWith( const ObjectPropertyConditionSet& other) const { if (!isValid() || !other.isValid()) return invalid(); Vector<ObjectPropertyCondition> result; if (!isEmpty()) result.appendVector(m_data->vector); for (const ObjectPropertyCondition& newCondition : other) { bool foundMatch = false; for (const ObjectPropertyCondition& existingCondition : *this) { if (newCondition == existingCondition) { foundMatch = true; continue; } if (!newCondition.isCompatibleWith(existingCondition)) return invalid(); } if (!foundMatch) result.append(newCondition); } return create(result); }
Vector<RefPtr<TransformOperation>> concat(const TransformOperations& a, const TransformOperations& b) { Vector<RefPtr<TransformOperation>> result; result.reserveCapacity(a.size() + b.size()); result.appendVector(a.operations()); result.appendVector(b.operations()); return result; }
void SensorCondition::getIndexList(Vector<int>& v) const { size_t size = mList.size(); for(size_t i = 0; i < size; i ++) { Vector<int> temp; mList[i].getIndexList(temp); v.appendVector(temp); } }
Vector<String> FormController::getReferencedFilePaths(const Vector<String>& stateVector) { Vector<String> toReturn; SavedFormStateMap map; formStatesFromStateVector(stateVector, map); for (SavedFormStateMap::const_iterator it = map.begin(), end = map.end(); it != end; ++it) toReturn.appendVector(it->value->getReferencedFilePaths()); return toReturn; }
Vector<String> FormController::getReferencedFilePaths(const Vector<String>& stateVector) { Vector<String> toReturn; SavedFormStateMap map; formStatesFromStateVector(stateVector, map); for (auto& state : map.values()) toReturn.appendVector(state->getReferencedFilePaths()); return toReturn; }
void GraphicsLayer::collectTrackedRepaintRects(Vector<FloatRect>& rects) const { if (!m_client->isTrackingRepaints()) return; RepaintMap::iterator repaintIt = repaintRectMap().find(this); if (repaintIt != repaintRectMap().end()) rects.appendVector(repaintIt->value); }
void MediaPlayer::getSitesInMediaCache(Vector<String>& sites) { for (auto& engine : installedMediaEngines()) { if (!engine.getSitesInMediaCache) continue; Vector<String> engineSites; engine.getSitesInMediaCache(engineSites); sites.appendVector(engineSites); } }
bool AuthorStyleSheets::updateActiveStyleSheets(UpdateFlag updateFlag) { if (m_document.inStyleRecalc() || m_document.inRenderTreeUpdate()) { // Protect against deleting style resolver in the middle of a style resolution. // Crash stacks indicate we can get here when z resource load fails synchronously (for example due to content blocking). // FIXME: These kind of cases should be eliminated and this path replaced by an assert. m_pendingUpdateType = FullUpdate; m_document.scheduleForcedStyleRecalc(); return false; } if (!m_document.hasLivingRenderTree()) return false; Vector<RefPtr<StyleSheet>> activeStyleSheets; collectActiveStyleSheets(activeStyleSheets); Vector<RefPtr<CSSStyleSheet>> activeCSSStyleSheets; activeCSSStyleSheets.appendVector(m_document.extensionStyleSheets().injectedAuthorStyleSheets()); activeCSSStyleSheets.appendVector(m_document.extensionStyleSheets().authorStyleSheetsForTesting()); filterEnabledNonemptyCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets); bool requiresFullStyleRecalc; auto styleResolverUpdateType = analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, requiresFullStyleRecalc); updateStyleResolver(activeCSSStyleSheets, styleResolverUpdateType); m_weakCopyOfActiveStyleSheetListForFastLookup = nullptr; m_activeStyleSheets.swap(activeCSSStyleSheets); m_styleSheetsForStyleSheetList.swap(activeStyleSheets); InspectorInstrumentation::activeStyleSheetsUpdated(m_document); for (const auto& sheet : m_activeStyleSheets) { if (sheet->contents().usesRemUnits()) m_usesRemUnits = true; if (sheet->contents().usesStyleBasedEditability()) m_usesStyleBasedEditability = true; } m_pendingUpdateType = NoUpdate; return requiresFullStyleRecalc; }
InterpolationValue SVGTransformListInterpolationType::maybeConvertSingle( const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { Vector<SVGTransformType> types; Vector<std::unique_ptr<InterpolableValue>> interpolableParts; if (keyframe.composite() == EffectModel::CompositeAdd) { if (underlying) { types.appendVector(getTransformTypes(underlying)); interpolableParts.append(underlying.interpolableValue->clone()); } conversionCheckers.append(SVGTransformListChecker::create(underlying)); } else { DCHECK(!keyframe.isNeutral()); } if (!keyframe.isNeutral()) { SVGPropertyBase* svgValue = environment.svgBaseValue().cloneForAnimation( toSVGPropertySpecificKeyframe(keyframe).value()); InterpolationValue value = maybeConvertSVGValue(*svgValue); if (!value) return nullptr; types.appendVector(getTransformTypes(value)); interpolableParts.append(std::move(value.interpolableValue)); } std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(types.size()); size_t interpolableListIndex = 0; for (auto& part : interpolableParts) { InterpolableList& list = toInterpolableList(*part); for (size_t i = 0; i < list.length(); ++i) { interpolableList->set(interpolableListIndex, std::move(list.getMutable(i))); ++interpolableListIndex; } } return InterpolationValue(std::move(interpolableList), SVGTransformNonInterpolableValue::create(types)); }
void EventHub::getVirtualKeyDefinitions(int32_t deviceId, Vector<VirtualKeyDefinition>& outVirtualKeys) const { outVirtualKeys.clear(); AutoMutex _l(mLock); Device* device = getDeviceLocked(deviceId); if (device && device->virtualKeyMap) { outVirtualKeys.appendVector(device->virtualKeyMap->getVirtualKeys()); } }
bool AuthorStyleSheets::updateActiveStyleSheets(UpdateFlag updateFlag) { if (m_document.inStyleRecalc()) { // SVG <use> element may manage to invalidate style selector in the middle of a style recalc. // https://bugs.webkit.org/show_bug.cgi?id=54344 // FIXME: This should be fixed in SVG and the call site replaced by ASSERT(!m_inStyleRecalc). m_pendingUpdateType = FullUpdate; m_document.scheduleForcedStyleRecalc(); return false; } if (!m_document.hasLivingRenderTree()) return false; Vector<RefPtr<StyleSheet>> activeStyleSheets; collectActiveStyleSheets(activeStyleSheets); Vector<RefPtr<CSSStyleSheet>> activeCSSStyleSheets; activeCSSStyleSheets.appendVector(m_document.extensionStyleSheets().injectedAuthorStyleSheets()); activeCSSStyleSheets.appendVector(m_document.extensionStyleSheets().authorStyleSheetsForTesting()); filterEnabledNonemptyCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets); bool requiresFullStyleRecalc; auto styleResolverUpdateType = analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, requiresFullStyleRecalc); updateStyleResolver(activeCSSStyleSheets, styleResolverUpdateType); m_weakCopyOfActiveStyleSheetListForFastLookup = nullptr; m_activeStyleSheets.swap(activeCSSStyleSheets); m_styleSheetsForStyleSheetList.swap(activeStyleSheets); InspectorInstrumentation::activeStyleSheetsUpdated(m_document); for (const auto& sheet : m_activeStyleSheets) { if (sheet->contents().usesRemUnits()) m_usesRemUnits = true; if (sheet->contents().usesStyleBasedEditability()) m_usesStyleBasedEditability = true; } m_pendingUpdateType = NoUpdate; return requiresFullStyleRecalc; }
void RenderLineBreak::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const { if (auto* layout = simpleLineLayout(*this)) { quads.appendVector(SimpleLineLayout::collectAbsoluteQuads(*this, *layout, wasFixed)); return; } if (!m_inlineBoxWrapper) return; quads.append(localToAbsoluteQuad(FloatRect(m_inlineBoxWrapper->topLeft(), m_inlineBoxWrapper->size()), UseTransforms, wasFixed)); }
Vector<String> PluginDatabase::defaultPluginDirectories() { Vector<String> paths; // Add paths specific to each platform #if defined(XP_UNIX) String userPluginPath = homeDirectoryPath(); userPluginPath.append(String("/.mozilla/plugins")); paths.append(userPluginPath); userPluginPath = homeDirectoryPath(); userPluginPath.append(String("/.netscape/plugins")); paths.append(userPluginPath); paths.append("/opt/java/jdk1.7.0_65/jre/lib/i386"); paths.append("/usr/lib/browser/plugins"); paths.append("/usr/local/lib/mozilla/plugins"); paths.append("/usr/lib/firefox/plugins"); paths.append("/usr/lib64/browser-plugins"); paths.append("/usr/lib/browser-plugins"); paths.append("/usr/lib/mozilla/plugins"); paths.append("/usr/local/netscape/plugins"); paths.append("/opt/mozilla/plugins"); paths.append("/opt/mozilla/lib/plugins"); paths.append("/opt/netscape/plugins"); paths.append("/opt/netscape/communicator/plugins"); paths.append("/usr/lib/netscape/plugins"); paths.append("/usr/lib/netscape/plugins-libc5"); paths.append("/usr/lib/netscape/plugins-libc6"); paths.append("/usr/lib64/netscape/plugins"); paths.append("/usr/lib64/mozilla/plugins"); paths.append("/usr/lib/nsbrowser/plugins"); paths.append("/usr/lib64/nsbrowser/plugins"); String mozHome(getenv("MOZILLA_HOME")); mozHome.append("/plugins"); paths.append(mozHome); Vector<String> mozPaths; String mozPath(getenv("MOZ_PLUGIN_PATH")); mozPath.split(UChar(':'), /* allowEmptyEntries */ false, mozPaths); paths.appendVector(mozPaths); #elif defined(XP_MACOSX) String userPluginPath = homeDirectoryPath(); userPluginPath.append(String("/Library/Internet Plug-Ins")); paths.append(userPluginPath); paths.append("/Library/Internet Plug-Ins"); #elif defined(XP_WIN) String userPluginPath = homeDirectoryPath(); userPluginPath.append(String("\\Application Data\\Mozilla\\plugins")); paths.append(userPluginPath); #endif return paths; }
const Vector<RefPtr<CSSStyleSheet>> AuthorStyleSheets::activeStyleSheetsForInspector() const { Vector<RefPtr<CSSStyleSheet>> result; result.appendVector(m_document.extensionStyleSheets().injectedAuthorStyleSheets()); result.appendVector(m_document.extensionStyleSheets().authorStyleSheetsForTesting()); for (auto& styleSheet : m_styleSheetsForStyleSheetList) { if (!is<CSSStyleSheet>(*styleSheet)) continue; CSSStyleSheet& sheet = downcast<CSSStyleSheet>(*styleSheet); if (sheet.disabled()) continue; result.append(&sheet); } return result; }
void RenderLineBreak::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const { if (auto* layout = simpleLineLayout(*this)) { rects.appendVector(SimpleLineLayout::collectAbsoluteRects(*this, *layout, accumulatedOffset)); return; } if (!m_inlineBoxWrapper) return; rects.append(enclosingIntRect(FloatRect(accumulatedOffset + m_inlineBoxWrapper->topLeft(), m_inlineBoxWrapper->size()))); }
bool DocumentStyleSheetCollection::updateActiveStyleSheets(UpdateFlag updateFlag) { if (m_document.inStyleRecalc()) { // SVG <use> element may manage to invalidate style selector in the middle of a style recalc. // https://bugs.webkit.org/show_bug.cgi?id=54344 // FIXME: This should be fixed in SVG and the call site replaced by ASSERT(!m_inStyleRecalc). m_pendingUpdateType = FullUpdate; m_document.scheduleForcedStyleRecalc(); return false; } if (!m_document.hasLivingRenderTree()) return false; Vector<RefPtr<StyleSheet>> activeStyleSheets; collectActiveStyleSheets(activeStyleSheets); Vector<RefPtr<CSSStyleSheet>> activeCSSStyleSheets; activeCSSStyleSheets.appendVector(injectedAuthorStyleSheets()); activeCSSStyleSheets.appendVector(documentAuthorStyleSheets()); filterEnabledNonemptyCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets); StyleResolverUpdateType styleResolverUpdateType; bool requiresFullStyleRecalc; analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc); if (styleResolverUpdateType == Reconstruct) m_document.clearStyleResolver(); else { StyleResolver& styleResolver = m_document.ensureStyleResolver(); if (styleResolverUpdateType == Reset) { styleResolver.ruleSets().resetAuthorStyle(); styleResolver.appendAuthorStyleSheets(0, activeCSSStyleSheets); } else { ASSERT(styleResolverUpdateType == Additive); styleResolver.appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets); } resetCSSFeatureFlags(); } m_weakCopyOfActiveStyleSheetListForFastLookup = nullptr; m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); m_styleSheetsForStyleSheetList.swap(activeStyleSheets); for (const auto& sheet : m_activeAuthorStyleSheets) { if (sheet->contents().usesRemUnits()) m_usesRemUnits = true; if (sheet->contents().usesStyleBasedEditability()) m_usesStyleBasedEditability = true; } m_pendingUpdateType = NoUpdate; return requiresFullStyleRecalc; }
void MediaPlayer::getSitesInMediaCache(Vector<String>& sites) { Vector<MediaPlayerFactory*>& engines = installedMediaEngines(); unsigned size = engines.size(); for (unsigned i = 0; i < size; i++) { if (!engines[i]->getSitesInMediaCache) continue; Vector<String> engineSites; engines[i]->getSitesInMediaCache(engineSites); sites.appendVector(engineSites); } }
const Vector<RefPtr<StyleSheet> > StyleEngine::activeStyleSheetsForInspector() const { if (m_activeTreeScopes.isEmpty()) return m_documentStyleSheetCollection.styleSheetsForStyleSheetList(); Vector<RefPtr<StyleSheet> > activeStyleSheets; activeStyleSheets.appendVector(m_documentStyleSheetCollection.styleSheetsForStyleSheetList()); TreeScopeSet::const_iterator begin = m_activeTreeScopes.begin(); TreeScopeSet::const_iterator end = m_activeTreeScopes.end(); for (TreeScopeSet::const_iterator it = begin; it != end; ++it) { if (TreeScopeStyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it)) activeStyleSheets.appendVector(collection->styleSheetsForStyleSheetList()); } // FIXME: Inspector needs a vector which has all active stylesheets. // However, creating such a large vector might cause performance regression. // Need to implement some smarter solution. return activeStyleSheets; }
bool DocumentStyleSheetCollection::updateActiveStyleSheets(UpdateFlag updateFlag) { if (m_document->inStyleRecalc()) { // SVG <use> element may manage to invalidate style selector in the middle of a style recalc. // https://bugs.webkit.org/show_bug.cgi?id=54344 // FIXME: This should be fixed in SVG and the call site replaced by ASSERT(!m_inStyleRecalc). m_pendingUpdateType = FullUpdate; m_document->scheduleForcedStyleRecalc(); return false; } if (!m_document->renderer() || !m_document->attached()) return false; Vector<RefPtr<StyleSheet> > activeStyleSheets; collectActiveStyleSheets(activeStyleSheets); Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; activeCSSStyleSheets.appendVector(injectedAuthorStyleSheets()); activeCSSStyleSheets.appendVector(documentAuthorStyleSheets()); collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document); filterEnabledNonemptyCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets); StyleResolverUpdateType styleResolverUpdateType; bool requiresFullStyleRecalc; analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc); if (styleResolverUpdateType == Reconstruct) m_document->clearStyleResolver(); else { StyleResolver& styleResolver = m_document->ensureStyleResolver(); if (styleResolverUpdateType == Reset) { styleResolver.ruleSets().resetAuthorStyle(); styleResolver.appendAuthorStyleSheets(0, activeCSSStyleSheets); } else { ASSERT(styleResolverUpdateType == Additive); styleResolver.appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets); } resetCSSFeatureFlags(); } m_weakCopyOfActiveStyleSheetListForFastLookup.clear(); m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); m_styleSheetsForStyleSheetList.swap(activeStyleSheets); m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); m_pendingUpdateType = NoUpdate; m_document->notifySeamlessChildDocumentsOfStylesheetUpdate(); return requiresFullStyleRecalc; }
bool CSSVariableData::resolveVariableReference(const CustomPropertyValueMap& customProperties, CSSParserTokenRange range, Vector<CSSParserToken>& result) const { range.consumeWhitespace(); ASSERT(range.peek().type() == IdentToken); AtomicString variableName = range.consumeIncludingWhitespace().value().toAtomicString(); ASSERT(range.atEnd() || (range.peek().type() == CommaToken)); RefPtr<CSSCustomPropertyValue> property = customProperties.get(variableName); if (!property || !property->value()) return resolveVariableFallback(customProperties, range, result); if (property->containsVariables()) { // FIXME: Avoid doing this work more than once. RefPtr<CSSVariableData> resolvedData = property->value()->resolveVariableReferences(customProperties); if (!resolvedData) return false; result.appendVector(resolvedData->tokens()); } else result.appendVector(property->value()->tokens()); return true; }