当前位置: 首页>>代码示例>>C++>>正文


C++ Document类代码示例

本文整理汇总了C++中Document的典型用法代码示例。如果您正苦于以下问题:C++ Document类的具体用法?C++ Document怎么用?C++ Document使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Document类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: record

void XapianIndex::removeCommonTerms(Xapian::Document &doc)
{
	DocumentInfo docInfo;
	string record(doc.get_data());

	// First, remove the magic term
	doc.remove_term(MAGIC_TERM);

	if (record.empty() == true)
        {
		// Nothing else we can do
		return;
	}

	string language(StringManip::extractField(record, "language=", ""));
	string timestamp(StringManip::extractField(record, "timestamp=", "\n"));

	docInfo = DocumentInfo(StringManip::extractField(record, "caption=", "\n"),
		StringManip::extractField(record, "url=", "\n"),
		StringManip::extractField(record, "type=", "\n"),
		Languages::toLocale(language));
	// We used to use timestamp prior to 0.60
	if (timestamp.empty() == true)
	{
		string modTime(StringManip::extractField(record, "modtime=", "\n"));
		if (modTime.empty() == false)
		{
			time_t timeT = (time_t )atol(modTime.c_str());
			timestamp = TimeConverter::toTimestamp(timeT);
		}
	}
	docInfo.setTimestamp(timestamp);
	Url urlObj(docInfo.getLocation());

	// FIXME: remove terms extracted from the title if they don't have more than one posting
	string title(docInfo.getTitle());
	if (title.empty() == false)
	{
		Document titleDoc;
		titleDoc.setData(title.c_str(), title.length());
		Tokenizer titleTokens(&titleDoc);
		removeFirstPostingsFromDocument(titleTokens, doc, "S", language, STORE_UNSTEM);
		titleTokens.rewind();
		removeFirstPostingsFromDocument(titleTokens, doc, "", language, m_stemMode);
	}

	// Title
	doc.remove_term(limitTermLength(string("U") + docInfo.getLocation(), true));
	// Host name
	string hostName(StringManip::toLowerCase(urlObj.getHost()));
	if (hostName.empty() == false)
	{
		doc.remove_term(limitTermLength(string("H") + hostName, true));
		string::size_type dotPos = hostName.find('.');
		while (dotPos != string::npos)
		{
			doc.remove_term(limitTermLength(string("H") + hostName.substr(dotPos + 1), true));

			// Next
			dotPos = hostName.find('.', dotPos + 1);
		}
	}
	// ...location
	string tree(urlObj.getLocation());
	if (tree.empty() == false)
	{
		doc.remove_term(limitTermLength(string("XDIR:") + tree, true));
		string::size_type slashPos = tree.find('/', 1);
		while (slashPos != string::npos)
		{
			doc.remove_term(limitTermLength(string("XDIR:") + tree.substr(0, slashPos), true));

			// Next
			slashPos = tree.find('/', slashPos + 1);
		}
	}
	// ...and file name
	string fileName(urlObj.getFile());
	if (fileName.empty() == false)
	{
		doc.remove_term(limitTermLength(string("P") + StringManip::toLowerCase(fileName), true));
	}
	// Language code
	doc.remove_term(string("L") + Languages::toCode(language));
	// MIME type
	doc.remove_term(string("T") + docInfo.getType());
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:87,代码来源:XapianIndex.cpp

示例2: insertParagraphSeparator

void TypingCommand::insertParagraphSeparator(Document& document, Options options)
{
    if (RefPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(document.frame())) {
        lastTypingCommand->setShouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator);
        lastTypingCommand->insertParagraphSeparator();
        return;
    }

    applyCommand(TypingCommand::create(document, InsertParagraphSeparator, "", options));
}
开发者ID:shenangovalleyavclub,项目名称:webkit,代码行数:10,代码来源:TypingCommand.cpp

示例3: IsImageExtractionAllowed

bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
                              nsIPrincipal& aPrincipal) {
  // Do the rest of the checks only if privacy.resistFingerprinting is on.
  if (!nsContentUtils::ShouldResistFingerprinting(aDocument)) {
    return true;
  }

  // Don't proceed if we don't have a document or JavaScript context.
  if (!aDocument || !aCx) {
    return false;
  }

  // The system principal can always extract canvas data.
  if (nsContentUtils::IsSystemPrincipal(&aPrincipal)) {
    return true;
  }

  // Allow extension principals.
  auto principal = BasePrincipal::Cast(&aPrincipal);
  if (principal->AddonPolicy() || principal->ContentScriptAddonPolicy()) {
    return true;
  }

  // Get the document URI and its spec.
  nsIURI* docURI = aDocument->GetDocumentURI();
  nsCString docURISpec;
  docURI->GetSpec(docURISpec);

  // Allow local files to extract canvas data.
  bool isFileURL;
  if (NS_SUCCEEDED(docURI->SchemeIs("file", &isFileURL)) && isFileURL) {
    return true;
  }

  // Don't show canvas prompt for PDF.js
  JS::AutoFilename scriptFile;
  if (JS::DescribeScriptedCaller(aCx, &scriptFile) && scriptFile.get() &&
      strcmp(scriptFile.get(), "resource://pdf.js/build/pdf.js") == 0) {
    return true;
  }

  Document* topLevelDocument = aDocument->GetTopLevelContentDocument();
  nsIURI* topLevelDocURI =
      topLevelDocument ? topLevelDocument->GetDocumentURI() : nullptr;
  nsCString topLevelDocURISpec;
  if (topLevelDocURI) {
    topLevelDocURI->GetSpec(topLevelDocURISpec);
  }

  // Load Third Party Util service.
  nsresult rv;
  nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
      do_GetService(THIRDPARTYUTIL_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, false);

  // Block all third-party attempts to extract canvas.
  bool isThirdParty = true;
  rv = thirdPartyUtil->IsThirdPartyURI(topLevelDocURI, docURI, &isThirdParty);
  NS_ENSURE_SUCCESS(rv, false);
  if (isThirdParty) {
    nsAutoString message;
    message.AppendPrintf("Blocked third party %s from extracting canvas data.",
                         docURISpec.get());
    nsContentUtils::ReportToConsoleNonLocalized(
        message, nsIScriptError::warningFlag, NS_LITERAL_CSTRING("Security"),
        aDocument);
    return false;
  }

  // Load Permission Manager service.
  nsCOMPtr<nsIPermissionManager> permissionManager =
      do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, false);

  // Check if the site has permission to extract canvas data.
  // Either permit or block extraction if a stored permission setting exists.
  uint32_t permission;
  rv = permissionManager->TestPermissionFromPrincipal(
      principal, PERMISSION_CANVAS_EXTRACT_DATA, &permission);
  NS_ENSURE_SUCCESS(rv, false);
  switch (permission) {
    case nsIPermissionManager::ALLOW_ACTION:
      return true;
    case nsIPermissionManager::DENY_ACTION:
      return false;
    default:
      break;
  }

  // At this point, permission is unknown
  // (nsIPermissionManager::UNKNOWN_ACTION).

  // Check if the request is in response to user input
  bool isAutoBlockCanvas =
      StaticPrefs::
          privacy_resistFingerprinting_autoDeclineNoUserInputCanvasPrompts() &&
      !EventStateManager::IsHandlingUserInput();

  if (isAutoBlockCanvas) {
    nsAutoString message;
//.........这里部分代码省略.........
开发者ID:jld,项目名称:gecko-dev,代码行数:101,代码来源:CanvasUtils.cpp

示例4: updateGenericFontFamilySettings

void CSSFontSelector::updateGenericFontFamilySettings(Document& document)
{
    ASSERT(document.settings());
    m_genericFontFamilySettings = document.settings()->genericFontFamilySettings();
}
开发者ID:kublaj,项目名称:blink,代码行数:5,代码来源:CSSFontSelector.cpp

示例5: WTF_LOG

void WebSocket::connect(const String& url, const Vector<String>& protocols, ExceptionState& exceptionState)
{
    WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data());
    m_url = KURL(KURL(), url);

    if (!m_url.isValid()) {
        m_state = CLOSED;
        exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is invalid.");
        return;
    }
    if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) {
        m_state = CLOSED;
        exceptionState.throwDOMException(SyntaxError, "The URL's scheme must be either 'ws' or 'wss'. '" + m_url.protocol() + "' is not allowed.");
        return;
    }
    if (MixedContentChecker::isMixedContent(executionContext()->securityOrigin(), m_url)) {
        // FIXME: Throw an exception and close the connection.
        String message = "Connecting to a non-secure WebSocket server from a secure origin is deprecated.";
        executionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, message);
    }
    if (m_url.hasFragmentIdentifier()) {
        m_state = CLOSED;
        exceptionState.throwDOMException(SyntaxError, "The URL contains a fragment identifier ('" + m_url.fragmentIdentifier() + "'). Fragment identifiers are not allowed in WebSocket URLs.");
        return;
    }
    if (!portAllowed(m_url)) {
        m_state = CLOSED;
        exceptionState.throwSecurityError("The port " + String::number(m_url.port()) + " is not allowed.");
        return;
    }

    // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
    bool shouldBypassMainWorldContentSecurityPolicy = false;
    if (executionContext()->isDocument()) {
        Document* document = toDocument(executionContext());
        shouldBypassMainWorldContentSecurityPolicy = document->frame()->script().shouldBypassMainWorldContentSecurityPolicy();
    }
    if (!shouldBypassMainWorldContentSecurityPolicy && !executionContext()->contentSecurityPolicy()->allowConnectToSource(m_url)) {
        m_state = CLOSED;
        // The URL is safe to expose to JavaScript, as this check happens synchronously before redirection.
        exceptionState.throwSecurityError("Refused to connect to '" + m_url.elidedString() + "' because it violates the document's Content Security Policy.");
        return;
    }

    m_channel = WebSocketChannel::create(executionContext(), this);

    // FIXME: There is a disagreement about restriction of subprotocols between WebSocket API and hybi-10 protocol
    // draft. The former simply says "only characters in the range U+0021 to U+007E are allowed," while the latter
    // imposes a stricter rule: "the elements MUST be non-empty strings with characters as defined in [RFC2616],
    // and MUST all be unique strings."
    //
    // Here, we throw SyntaxError if the given protocols do not meet the latter criteria. This behavior does not
    // comply with WebSocket API specification, but it seems to be the only reasonable way to handle this conflict.
    for (size_t i = 0; i < protocols.size(); ++i) {
        if (!isValidProtocolString(protocols[i])) {
            m_state = CLOSED;
            exceptionState.throwDOMException(SyntaxError, "The subprotocol '" + encodeProtocolString(protocols[i]) + "' is invalid.");
            releaseChannel();
            return;
        }
    }
    HashSet<String> visited;
    for (size_t i = 0; i < protocols.size(); ++i) {
        if (!visited.add(protocols[i]).isNewEntry) {
            m_state = CLOSED;
            exceptionState.throwDOMException(SyntaxError, "The subprotocol '" + encodeProtocolString(protocols[i]) + "' is duplicated.");
            releaseChannel();
            return;
        }
    }

    String protocolString;
    if (!protocols.isEmpty())
        protocolString = joinStrings(protocols, subProtocolSeperator());

    m_channel->connect(m_url, protocolString);
}
开发者ID:kublaj,项目名称:blink,代码行数:77,代码来源:WebSocket.cpp

示例6: TextFilter

bool FilterWrapper::filterDocument(IndexInterface &index, const Document &doc,
	const string &originalType, const set<string> &labels,
	unsigned int &docId, bool doUpdate)
{
	Filter *pFilter = FilterFactory::getFilter(doc.getType());
	bool fedFilter = false, success = false;

	if (pFilter != NULL)
	{
		fedFilter = FilterUtils::feedFilter(doc, pFilter);
	}
	else
	{
		// Chances are this type is not supported
		pFilter = new TextFilter("text/plain");

		Document emptyDoc(doc.getTitle(), doc.getLocation(), doc.getType(), doc.getLanguage());

		emptyDoc.setTimestamp(doc.getTimestamp());
		emptyDoc.setSize(doc.getSize());
		emptyDoc.setData(" ", 1);

#ifdef DEBUG
		cout << "FilterWrapper::filterDocument: unsupported type " << doc.getType() << endl;
#endif
		fedFilter = FilterUtils::feedFilter(emptyDoc, pFilter);
	}

	if (fedFilter == false)
	{
		delete pFilter;

		return false;
	}

	while (pFilter->has_documents() == true)
	{
		string actualType(originalType);

		if (pFilter->next_document() == false)
		{
			break;
		}

		Document filteredDoc(doc.getTitle(), doc.getLocation(), "text/plain", doc.getLanguage());

		filteredDoc.setTimestamp(doc.getTimestamp());
		filteredDoc.setSize(doc.getSize());

		if (FilterUtils::populateDocument(filteredDoc, pFilter) == false)
		{
			continue;
		}

		// Is this a nested document ?
		if (filteredDoc.getLocation().length() > doc.getLocation().length())
		{
			actualType = filteredDoc.getType();
#ifdef DEBUG
			cout << "FilterWrapper::filterDocument: nested document of type " << actualType << endl;
#endif
		}

		// Pass it down to another filter ?
		if ((filteredDoc.getType().length() >= 10) &&
			(filteredDoc.getType().substr(0, 10) == "text/plain"))
		{
			// No, it's been reduced to plain text
			filteredDoc.setType(actualType);

			Tokenizer tokens(&filteredDoc);
			if (doUpdate == false)
			{
				success = index.indexDocument(tokens, labels, docId);
			}
			else
			{
				success = index.updateDocument(docId, tokens);
			}
		}
		else
		{
			success = filterDocument(index, filteredDoc, originalType, labels, docId, doUpdate);
			delete pFilter;

			return success;
		}
	}

	delete pFilter;

#ifdef DEBUG
	if (success == false)
	{
		cout << "FilterWrapper::filterDocument: didn't index " << doc.getLocation() << endl;
	}
#endif

	return success;
}
开发者ID:BackupTheBerlios,项目名称:pinot-svn,代码行数:100,代码来源:FilterWrapper.cpp

示例7: PLATFORM

bool V8Proxy::isEnabled()
{
    Settings* settings = m_frame->settings();
    if (!settings)
        return false;

    // In the common case, JavaScript is enabled and we're done.
    if (settings->isJavaScriptEnabled())
        return true;

    // If JavaScript has been disabled, we need to look at the frame to tell
    // whether this script came from the web or the embedder. Scripts from the
    // embedder are safe to run, but scripts from the other sources are
    // disallowed.
    Document* document = m_frame->document();
    if (!document)
        return false;

    SecurityOrigin* origin = document->securityOrigin();
    if (origin->protocol().isEmpty())
        return false; // Uninitialized document

    if (origin->protocol() == "http" || origin->protocol() == "https")
        return false; // Web site

    // FIXME: the following are application decisions, and they should
    // not be made at this layer. instead, we should bridge out to the
    // embedder to allow them to override policy here.

#if PLATFORM(CHROMIUM)
    // TODO(andreip): ChromeBridge->BrowserBridge?
    if (origin->protocol() == ChromiumBridge::uiResourceProtocol())
        return true;   // Embedder's scripts are ok to run
#endif

    // If the scheme is ftp: or file:, an empty file name indicates a directory
    // listing, which requires JavaScript to function properly.
    const char* kDirProtocols[] = { "ftp", "file" };
#if PLATFORM(ANDROID)
    // TODO(andreip): Port arraysize function to Android. There's one in Gears.
    for (size_t i = 0; i < 2; ++i) {
#else
    for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
#endif
        if (origin->protocol() == kDirProtocols[i]) {
            const KURL& url = document->url();
            return url.pathAfterLastSlash() == url.pathEnd();
        }
    }

    return false; // Other protocols fall through to here
}

void V8Proxy::updateDocumentWrapper(v8::Handle<v8::Value> wrapper)
{
    clearDocumentWrapper();

    ASSERT(m_document.IsEmpty());
    m_document = v8::Persistent<v8::Value>::New(wrapper);
#ifndef NDEBUG
    V8GCController::registerGlobalHandle(PROXY, this, m_document);
#endif
}
开发者ID:boyliang,项目名称:ComponentSuperAccessor,代码行数:63,代码来源:V8Proxy.cpp

示例8: resolve

bool CrossRefPlugin::resolve (Document &doc)
{
	/*
	 * Prompt for username and password if needed
	 */
	if (_global_prefs->getCrossRefUsername ().empty ()) {
		Glib::ustring message = 
			String::ucompose (
				"<b><big>%1</big></b>\n\n%2\n",
				_("CrossRef credentials not found"),
				_("To use the CrossRef service, a free account is needed.  "
				  "Login information may be set in Preferences, or the CrossRef plugin "
				  "may be disabled.")
				);

		Gtk::MessageDialog dialog(message, true, Gtk::MESSAGE_WARNING,
				          Gtk::BUTTONS_NONE, true);

		dialog.add_button (Gtk::Stock::CANCEL,     0);
		dialog.add_button (_("_Preferences"),      1);
		dialog.add_button (_("_Disable CrossRef"), 2);

		do {
			int response = dialog.run ();
			if (response == 1) {
				// Preferences
				doConfigure ();
				if (!_global_prefs->getCrossRefUsername ().empty ())
					break;
				// if they didn't give us one then we loop around
				// else we go ahead
			} else if (response == 2) {
				// Disable
				_global_prefs->disablePlugin (this);
				return false;
			} else {
				// Cancel
				return false;
			}
		} while (1);
	}

	Glib::ustring messagetext =
		String::ucompose (
			"<b><big>%1</big></b>\n\n%2\n",
			_("Downloading metadata"),
			String::ucompose (
				_("Contacting crossref.org to retrieve metadata for '%1'"),
				doc.getField("doi"))
		);

	Glib::ustring const username = _global_prefs->getCrossRefUsername ();
	Glib::ustring const password = _global_prefs->getCrossRefPassword ();

	Glib::ustring const url = 
		  Glib::ustring("http://www.crossref.org/openurl/?pid=")
		+ username
		+ (password.empty() ? "" : ":")
		+ password 
		+ Glib::ustring("&id=doi:")
		+ Gnome::Vfs::escape_string(doc.getField("doi"))
		+ Glib::ustring ("&noredirect=true");

	DEBUG ("CrossRefPlugin::resolve: using url '%1'", url);

	// FIXME: even if we don't get any metadata, 
	// an exceptionless download+parse is considered
	// a success.
	// Nobody notices as long as crossref is the last resort
	bool success = true;

	try {
		Glib::ustring &xml = Transfer::readRemoteFile (
			_("Downloading Metadata"), messagetext, url);

		DEBUG (xml);

		// XXX
		// Test for "Missing WWW-Authenticate header" for bad username/password
		// Test for "No DOI found" for bad DOI

		CrossRefParser parser (doc.getBibData());
		Glib::Markup::ParseContext context (parser);
		try {
			context.parse (xml);
			context.end_parse ();
		} catch (Glib::MarkupError const ex) {
			DEBUG ("Markuperror while parsing:\n'''%1\n'''", xml);
			//Utility::exceptionDialog (&ex, _("Parsing CrossRef XML.  The DOI could be invalid, or not known to crossref.org"));
			success = false;
		}
	} catch (Transfer::Exception ex) {
		//Utility::exceptionDialog (&ex, _("Downloading metadata"));
		success = false;
	}

	DEBUG ("resolve returning %1", success);
	return success;
}
开发者ID:egroeper,项目名称:referencer,代码行数:99,代码来源:CrossRefPlugin.C

示例9: readNode

        virtual ReadResult readNode(std::istream& fin, const Options* options) const
        {
            Document document;
            document.setOptions(options);

            // option string and parent pools
            if (options)
            {
                const char readerMsg[] = "flt reader option: ";
                
                document.setReplaceClampWithClampToEdge((options->getOptionString().find("clampToEdge")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "clampToEdge=" << document.getReplaceClampWithClampToEdge() << std::endl;

                document.setKeepExternalReferences((options->getOptionString().find("keepExternalReferences")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "keepExternalReferences=" << document.getKeepExternalReferences() << std::endl;

                document.setPreserveFace((options->getOptionString().find("preserveFace")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "preserveFace=" << document.getPreserveFace() << std::endl;

                document.setPreserveObject((options->getOptionString().find("preserveObject")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "preserveObject=" << document.getPreserveObject() << std::endl;

                document.setDefaultDOFAnimationState((options->getOptionString().find("dofAnimation")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "dofAnimation=" << document.getDefaultDOFAnimationState() << std::endl;

                document.setUseBillboardCenter((options->getOptionString().find("billboardCenter")!=std::string::npos));
                osg::notify(osg::DEBUG_INFO) << readerMsg << "billboardCenter=" << document.getUseBillboardCenter() << std::endl;

                document.setUseTextureAlphaForTransparancyBinning(options->getOptionString().find("noTextureAlphaForTransparancyBinning")==std::string::npos);
                osg::notify(osg::DEBUG_INFO) << readerMsg << "noTextureAlphaForTransparancyBinning=" << !document.getUseTextureAlphaForTransparancyBinning() << std::endl;

                document.setReadObjectRecordData(options->getOptionString().find("readObjectRecordData")==std::string::npos);
                osg::notify(osg::DEBUG_INFO) << readerMsg << "readObjectRecordData=" << !document.getReadObjectRecordData() << std::endl;

                document.setDoUnitsConversion((options->getOptionString().find("noUnitsConversion")==std::string::npos)); // default to true, unless noUnitsConversion is specified.
                osg::notify(osg::DEBUG_INFO) << readerMsg << "noUnitsConversion=" << !document.getDoUnitsConversion() << std::endl;

                if (document.getDoUnitsConversion())
                {
                    if (options->getOptionString().find("convertToFeet")!=std::string::npos)
                        document.setDesiredUnits(FEET);
                    else if (options->getOptionString().find("convertToInches")!=std::string::npos)
                        document.setDesiredUnits(INCHES);
                    else if (options->getOptionString().find("convertToMeters")!=std::string::npos)
                        document.setDesiredUnits(METERS);
                    else if (options->getOptionString().find("convertToKilometers")!=std::string::npos)
                        document.setDesiredUnits(KILOMETERS);
                    else if (options->getOptionString().find("convertToNauticalMiles")!=std::string::npos)
                        document.setDesiredUnits(NAUTICAL_MILES);
                }

                const ParentPools* pools = dynamic_cast<const ParentPools*>( options->getUserData() );
                if (pools)
                {
                    // This file is an external reference. The individual pools will
                    // be non-NULL if the parent is overriding the ext ref model's pools.
                    if (pools->getColorPool())
                        document.setColorPool( pools->getColorPool(), true );
                    if (pools->getTexturePool())
                        document.setTexturePool( pools->getTexturePool(), true );
                    if (pools->getMaterialPool())
                        document.setMaterialPool( pools->getMaterialPool(), true );
                    if (pools->getLightSourcePool())
                        document.setLightSourcePool( pools->getLightSourcePool(), true );
                    if (pools->getLPAppearancePool())
                        document.setLightPointAppearancePool( pools->getLPAppearancePool(), true );
                    if (pools->getLPAnimationPool())
                        document.setLightPointAnimationPool( pools->getLPAnimationPool(), true );
                    if (pools->getShaderPool())
                        document.setShaderPool( pools->getShaderPool(), true );
                }
            }

            const int RECORD_HEADER_SIZE = 4;
            opcode_type continuationOpcode = INVALID_OP;
            std::string continuationBuffer;

            while (fin.good() && !document.done())
            {
                // The continuation record complicates things a bit.

                // Get current read position in stream.
                std::istream::pos_type pos = fin.tellg();

                // get opcode and size
                flt::DataInputStream dataStream(fin.rdbuf());
                opcode_type opcode = (opcode_type)dataStream.readUInt16();
                size_type   size   = (size_type)dataStream.readUInt16();

                // If size == 0, an EOF has probably been reached, i.e. there is nothing 
                // more to read so we must return.
                if (size==0)
                {
                    // If a header was read, we return it.
                    // This allows us handle files with empty hierarchies.
                    if (document.getHeaderNode())
                    {
                        return document.getHeaderNode();
                    }
                    else // (no valid header)
//.........这里部分代码省略.........
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:101,代码来源:ReaderWriterFLT.cpp

示例10: document

const ListHashSet<RefPtr<FontFace> >& FontFaceSet::cssConnectedFontFaceList() const
{
    Document* d = document();
    d->ensureStyleResolver(); // Flush pending style changes.
    return d->styleEngine()->fontSelector()->fontFaceCache()->cssConnectedFontFaces();
}
开发者ID:esprehn,项目名称:mojo,代码行数:6,代码来源:FontFaceSet.cpp

示例11: preferHiddenVolumeControls

static bool preferHiddenVolumeControls(const Document& document)
{
    return !document.settings() || document.settings()->preferHiddenVolumeControls();
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:4,代码来源:MediaControls.cpp

示例12: USE

void XMLDocumentParser::insertErrorMessageBlock()
{
#if USE(QXMLSTREAM)
    if (m_parsingFragment)
        return;
#endif
    // One or more errors occurred during parsing of the code. Display an error block to the user above
    // the normal content (the DOM tree is created manually and includes line/col info regarding
    // where the errors are located)

    // Create elements for display
    ExceptionCode ec = 0;
    Document* document = this->document();
    RefPtr<Element> documentElement = document->documentElement();
    if (!documentElement) {
        RefPtr<Element> rootElement = document->createElement(htmlTag, false);
        document->appendChild(rootElement, ec);
        RefPtr<Element> body = document->createElement(bodyTag, false);
        rootElement->appendChild(body, ec);
        documentElement = body.get();
    }
#if ENABLE(SVG)
    else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) {
        RefPtr<Element> rootElement = document->createElement(htmlTag, false);
        RefPtr<Element> body = document->createElement(bodyTag, false);
        rootElement->appendChild(body, ec);
        body->appendChild(documentElement, ec);
        document->appendChild(rootElement.get(), ec);
        documentElement = body.get();
    }
#endif
    RefPtr<Element> reportElement = createXHTMLParserErrorHeader(document, m_errorMessages);
    documentElement->insertBefore(reportElement, documentElement->firstChild(), ec);
#if ENABLE(XSLT)
    if (document->transformSourceDocument()) {
        RefPtr<Element> paragraph = document->createElement(pTag, false);
        paragraph->setAttribute(styleAttr, "white-space: normal");
        paragraph->appendChild(document->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), ec);
        reportElement->appendChild(paragraph.release(), ec);
    }
#endif
    document->updateStyleIfNeeded();
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:43,代码来源:XMLDocumentParser.cpp

示例13: ResourceRequest

void ImageLoader::updateFromElement()
{
    // If we're not making renderers for the page, then don't load images.  We don't want to slow
    // down the raw HTML parsing case by loading images we don't intend to display.
    Document* document = m_element->document();
    if (!document->renderer())
        return;

    AtomicString attr = m_element->getAttribute(m_element->imageSourceAttributeName());

    if (attr == m_failedLoadURL)
        return;

    // Do not load any image if the 'src' attribute is missing or if it is
    // an empty string.
    CachedImage* newImage = 0;
    if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) {
        ResourceRequest request = ResourceRequest(document->completeURL(sourceURI(attr)));

        String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
        if (!crossOriginMode.isNull()) {
            StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
            updateRequestForAccessControl(request, document->securityOrigin(), allowCredentials);
        }

        if (m_loadManually) {
            bool autoLoadOtherImages = document->cachedResourceLoader()->autoLoadImages();
            document->cachedResourceLoader()->setAutoLoadImages(false);
            newImage = new CachedImage(request);
            newImage->setLoading(true);
            newImage->setOwningCachedResourceLoader(document->cachedResourceLoader());
            document->cachedResourceLoader()->m_documentResources.set(newImage->url(), newImage);
            document->cachedResourceLoader()->setAutoLoadImages(autoLoadOtherImages);
        } else
            newImage = document->cachedResourceLoader()->requestImage(request);

        // If we do not have an image here, it means that a cross-site
        // violation occurred.
        m_failedLoadURL = !newImage ? attr : AtomicString();
    } else if (!attr.isNull()) // Fire an error event if the url is empty.
        m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
    
    CachedImage* oldImage = m_image.get();
    if (newImage != oldImage) {
        if (!m_firedBeforeLoad)
            beforeLoadEventSender().cancelEvent(this);
        if (!m_firedLoad)
            loadEventSender().cancelEvent(this);

        m_image = newImage;
        m_firedBeforeLoad = !newImage;
        m_firedLoad = !newImage;
        m_imageComplete = !newImage;

        if (newImage) {
            if (!m_element->document()->hasListenerType(Document::BEFORELOAD_LISTENER))
                dispatchPendingBeforeLoadEvent();
            else
                beforeLoadEventSender().dispatchEventSoon(this);

            // If newImage is cached, addClient() will result in the load event
            // being queued to fire. Ensure this happens after beforeload is
            // dispatched.
            newImage->addClient(this);
        }
        if (oldImage)
            oldImage->removeClient(this);
    }

    if (RenderImageResource* imageResource = renderImageResource())
        imageResource->resetAnimation();
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:72,代码来源:ImageLoader.cpp

示例14: element

TreeResolver::Parent::Parent(Document& document, Change change)
    : element(nullptr)
    , style(*document.renderStyle())
    , change(change)
{
}
开发者ID:edcwconan,项目名称:webkit,代码行数:6,代码来源:StyleTreeResolver.cpp

示例15: count

void UseCounter::count(const Document& document, Feature feature)
{
    count(document.frame(), feature);
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:4,代码来源:UseCounter.cpp


注:本文中的Document类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。