Exemple #1
0
String HTMLAnchorElement::origin() const
{
    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href());
    return origin->toString();
}
Exemple #2
0
void HTMLAnchorElement::setProtocol(const String& value)
{
    URL url = href();
    url.setProtocol(value);
    setHref(url.string());
}
Exemple #3
0
String HTMLAnchorElement::search() const
{
    String query = href().query();
    return query.isEmpty() ? emptyString() : "?" + query;
}
Exemple #4
0
/*
** WEBPAGE:  sitemap
**
** Show an incomplete list of web pages offered by the Fossil web engine.
*/
void sitemap_page(void){
  login_check_credentials();
  style_header("Site Map");
  style_adunit_config(ADUNIT_RIGHT_OK);
  cgi_printf("<p>\n"
         "The following links are just a few of the many web-pages available for\n"
         "this Fossil repository:\n"
         "</p>\n"
         "\n"
         "<ul>\n"
         "<li>%zHome Page</a>\n"
         "  <ul>\n"
         "  <li>%zSearch Project Documentation</a></li>\n"
         "  </ul></li>\n"
         "<li>%zFile Browser</a></li>\n"
         "  <ul>\n"
         "  <li>%zTree-view,\n"
         "       Trunk Check-in</a></li>\n"
         "  <li>%zFlat-view</a></li>\n"
         "  <li>%zFile ages for Trunk</a></li>\n"
         "</ul>\n"
         "<li>%zProject Timeline</a></li>\n"
         "<ul>\n"
         "  <li>%zFirst 10 \n"
         "       check-ins</a></li>\n"
         "  <li>%zAll check-ins with file name\n"
         "       changes</a></li>\n"
         "  <li>%zActivity Reports</a></li>\n"
         "</ul>\n"
         "<li>%zBranches</a></li>\n"
         "<ul>\n"
         "  <li>%zLeaf Check-ins</a></li>\n"
         "  <li>%zList of Tags</a></li>\n"
         "</ul>\n"
         "</li>\n"
         "<li>%zWiki</a>\n"
         "  <ul>\n"
         "    <li>%zWiki Search</a></li>\n"
         "    <li>%zList of Wiki Pages</a></li>\n"
         "    <li>%zRecent activity</a></li>\n"
         "    <li>%zWiki Formatting Rules</a></li>\n"
         "    <li>%zMarkdown Formatting Rules</a></li>\n"
         "    <li>%zSandbox</a></li>\n"
         "    <li>%zList of Attachments</a></li>\n"
         "  </ul>\n"
         "</li>\n"
         "<li>%zTickets</a>\n"
         "  <ul>\n"
         "  <li>%zTicket Search</a></li>\n"
         "  <li>%zRecent activity</a></li>\n"
         "  <li>%zList of Attachments</a></li>\n"
         "  </ul>\n"
         "</li>\n"
         "<li>%zFull-Text Search</a></li>\n"
         "<li>%zLogin/Logout/Change Password</a></li>\n"
         "<li>%zRepository Status</a>\n"
         "  <ul>\n"
         "  <li>%zCollisions on SHA1 hash\n"
         "      prefixes</a></li>\n"
         "  <li>%zList of URLs used to access\n"
         "      this repository</a></li>\n"
         "  <li>%zList of Artifacts</a></li>\n"
         "  </ul></li>\n"
         "<li>On-line Documentation\n"
         "  <ul>\n"
         "  <li>%zList of All Commands and Web Pages</a></li>\n"
         "  <li>%zAll \"help\" text on a single page</a></li>\n"
         "  <li>%zFilename suffix to mimetype map</a></li>\n"
         "  </ul></li>\n"
         "<li>%zAdministration Pages</a>\n"
         "  <ul>\n"
         "  <li>%zPending Moderation Requests</a></li>\n"
         "  <li>%zAdmin log</a></li>\n"
         "  <li>%zStatus of the web-page cache</a></li>\n"
         "  </ul></li>\n"
         "<li>Test Pages\n"
         "  <ul>\n"
         "  <li>%zCGI Environment Test</a></li>\n"
         "  <li>%zList of \"Timewarp\" Check-ins</a></li>\n"
         "  <li>%zList of file renames</a></li>\n"
         "  <li>%zPage to experiment with the automatic\n"
         "      colors assigned to branch names</a>\n"
         "  </ul></li>\n"
         "</ul></li>\n",(href("%R/home")),(href("%R/docsrc")),(href("%R/tree")),(href("%R/tree?type=tree&ci=trunk")),(href("%R/tree?type=flat")),(href("%R/fileage?name=trunk")),(href("%R/timeline?n=200")),(href("%R/timeline?a=1970-01-01&y=ci&n=10")),(href("%R/timeline?n=all&namechng")),(href("%R/reports")),(href("%R/brlist")),(href("%R/leaves")),(href("%R/taglist")),(href("%R/wikihelp")),(href("%R/wikisrch")),(href("%R/wcontent")),(href("%R/timeline?y=w")),(href("%R/wiki_rules")),(href("%R/md_rules")),(href("%R/wiki?name=Sandbox")),(href("%R/attachlist")),(href("%R/reportlist")),(href("%R/tktsrch")),(href("%R/timeline?y=t")),(href("%R/attachlist")),(href("%R/search")),(href("%R/login")),(href("%R/stat")),(href("%R/hash-collisions")),(href("%R/urllist")),(href("%R/bloblist")),(href("%R/help")),(href("%R/test-all-help")),(href("%R/mimetype_list")),(href("%R/setup")),(href("%R/modreq")),(href("%R/admin_log")),(href("%R/cachestat")),(href("%R/test_env")),(href("%R/test_timewarps")),(href("%R/test-rename-list")),(href("%R/hash-color-test")));
  style_footer();
}
Exemple #5
0
String HTMLAnchorElement::protocol() const
{
    return href().protocol() + ":";
}
Exemple #6
0
/****************************************************************************
PARAMETERS:
URL - New URL for the page to load

RETURNS:
True if page loaded successfully, false if not

REMARKS:
Remove an applet from the manager. Called during applet destruction
****************************************************************************/
bool wxHtmlAppletWindow::LoadPage(
    const wxString& link)
{
    wxString href(link);

    if (link.GetChar(0) == '?'){
        wxString cmd = link.BeforeFirst('=');
        wxString cmdValue = link.AfterFirst('=');

        // Launches the default Internet browser for the system.
        if(!(cmd.CmpNoCase("?EXTERNAL"))) {
            return wxSpawnBrowser(this, cmdValue.c_str());
            }

        // Launches an external program on the system.
        if (!(cmd.CmpNoCase("?EXECUTE"))) {
            int waitflag = P_NOWAIT;
            bool ret;
            wxString currentdir;
            wxString filename, path, ext;

            // Parse the params sent to the execute command. For now the only
            // parm is "wait". wait will cause spawn wait, default is nowait.
            // Since we only need one param for now I am not going to make this
            // any smater then it needs to be. If we need more params later i'll
            // fix it.
            int i = cmdValue.Find('(');
            if (i != -1) {
                wxString param = cmdValue.AfterFirst('(');
                cmdValue.Truncate(i);
                if (!param.CmpNoCase("wait)"))
                    waitflag = P_WAIT;
                }

            currentdir = wxGetCwd();
            //we don't want to change the path of the virtual file system so we have to use these
            //functions rather than the filesystem
            wxSplitPath(cmdValue, &path, &filename, &ext);
            if (path.CmpNoCase("") != 0) wxSetWorkingDirectory(path);

            ret = !spawnl( waitflag, cmdValue , NULL );
            //HACK should use wxExecute
            //ret = wxExecute(filename, bool sync = FALSE, wxProcess *callback = NULL)
            wxSetWorkingDirectory(currentdir);

            return ret;
            }

        // Looks for a href in a variable stored as a cookie. The href can be
        // changed on the fly.
        if (!(cmd.CmpNoCase("?VIRTUAL"))){
            wxObject *obj = FindCookie(cmdValue);
            VirtualData *virtData = wxDynamicCast(obj,VirtualData);
            if (virtData) {
                // recurse and loadpage, just in case the link is like another
                // ? link
                return LoadPage(virtData->GetHref());
                }
            else {
#ifdef CHECKED
                wxLogError(_T("VIRTUAL LINK ERROR: '%s' does not exist."), cmdValue.c_str());
#endif
                return true;
                }
            }

        // This launches a qlet - It is like an applet but is more generic in that it
        // can be of any wxWin type so it then has the freedom to do more stuff.
        if (!(cmd.CmpNoCase("?WXPLUGIN"))){
            if (!cmdValue.IsNull()) {
                // TODO: We are going to need to add code to parse the command line
                //       parameters string in here in the future...
                wxString cmdLine = link.AfterFirst('(');
                cmdLine = cmdLine.BeforeLast(')');
                if (!CreatePlugIn(cmdValue,cmdLine)) {
#ifdef CHECKED
                    wxLogError(_T("Launch PlugIn ERROR: '%s' does not exist."), cmdValue.c_str());
#endif
                    }
                }
             return true;
            }

        // This used in a link or href will take you back in the history.
        if (!(cmd.CmpNoCase("?BACK"))){
            HistoryBack();
            return true;
            }

        // This used in a link or href will take you forward in the history
        if (!(cmd.CmpNoCase("?FORWARD"))){
            HistoryForward();
            return true;
            }
        }

    // Inform all the applets that the new page is being loaded
    for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
        (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
    Show(false);

    m_openedlast = href;
    bool stat = wxHtmlWindow::LoadPage(href);
    Show(true);

    // Enable/Dis the navbar tools
    if (m_NavBarEnabled) {
        m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
        m_NavBar->EnableTool(m_NavBackId,HistoryCanBack());
        }
    return stat;
}
void SVGScriptElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
    SVGElement::addSubresourceAttributeURLs(urls);

    addSubresourceURL(urls, document()->completeURL(href()));
}
String HTMLAnchorElement::hash() const
{
    String fragmentIdentifier = href().fragmentIdentifier();
    return fragmentIdentifier.isEmpty() ? emptyString() : "#" + fragmentIdentifier;
}
//Watch out that some of the indices are reversed from Kwon--
//this is to make the updates a bit more convienent.
void Backflow_pf_wf::calcLap(Sample_point * sample)
{

  //cout <<"Start Backflow_pf_wf::calcLap"<<endl;
  int tote=nelectrons(0)+nelectrons(1);
  Array3 <doublevar> temp_der;
  Array2 <doublevar> temp_lap;
  Array3 <doublevar> moVal_gradonly;
  moVal_gradonly.Resize(3,tote,updatedMoVal.GetDim(0)); 
  for(int e=0; e< tote; e++) { 
    //int s=spin(e);
    sample->updateEIDist();
    parent->bfwrapper.updateLap(sample,jast,e,0,updatedMoVal,
				temp_der, temp_lap);
    
    for(int i=0; i< updatedMoVal.GetDim(0); i++) {
      for(int d=0; d< 10; d++) { 
        moVal(d,e,i)=updatedMoVal(i,d);
	if(d>0 && d<4)
	  moVal_gradonly(d-1,e,i)=moVal(d,e,i);
      }
    }

    
    for(int i=0; i< tote; i++) { 
      for(int a=0; a< 3; a++) {
	for(int b=0; b < 3; b++) { 
	  coor_grad(e,i,a,b)=temp_der(i,a,b);
	}
	coor_lap(e,i,a)=temp_lap(i,a);
      }
    }
  } 
     
  //cout << "doing pfaffian " << endl;
  for (int pf=0;pf<npf;pf++){
    FillPfaffianMatrix( mopfaff_tot(pf),
                        moVal, 
                        parent->pfkeeper.occupation_pos,
                        parent->pfkeeper.npairs,
                        parent->pfkeeper.order_in_pfaffian(pf),
                        parent->pfkeeper.tripletorbuu, 
                        parent->pfkeeper.tripletorbdd,
                        parent->pfkeeper.singletorb,
                        parent->pfkeeper.unpairedorb,
                        parent->pfkeeper.normalization,
                        coef_eps
                        );
    pfaffVal(pf) = PfaffianInverseMatrix(mopfaff_tot(pf), inverse(pf));
    //cout << "Pfaffian value:             "<< pfaffVal(pf) << endl;
  }
  //cout << "done pfaffian" << endl;


  gradlap=0;
  Array1 <doublevar> gradmod2(tote);
  Array1 <Array3 <doublevar> > F(npf); 
  Array1 <Array4 <doublevar> > H(npf);
  doublevar funcval=0;
  gradmod2=0;
  Array2 <doublevar> grad(tote,ndim);
  Array1 < Array1 < Array1 < Array1 <doublevar> >  > > mopfaff_row;
  Array1 < Array1 < Array1 < Array2 <doublevar> >  > > mopfaff_row_hess;
  mopfaff_row.Resize(npf);
  mopfaff_row_hess.Resize(npf);

  //cout <<"Getting all pairing orbital derivatives"<<endl;
  for(int pf=0;pf<npf;pf++){
    mopfaff_row(pf).Resize(tote);
    mopfaff_row_hess(pf).Resize(tote);
    for(int i=0; i<tote; i++) {
      UpdatePfaffianRowLap(mopfaff_row(pf)(i), 
			   i,  
			   moVal, 
			   parent->pfkeeper.occupation_pos,
			   parent->pfkeeper.npairs,
			   parent->pfkeeper.order_in_pfaffian(pf),
			   parent->pfkeeper.tripletorbuu, 
			   parent->pfkeeper.tripletorbdd,
			   parent->pfkeeper.singletorb,
			   parent->pfkeeper.unpairedorb,
			   parent->pfkeeper.normalization,
                           coef_eps
			   );
      
      UpdatePfaffianRowHess(mopfaff_row_hess(pf)(i), 
			   i,  
			   moVal_gradonly, 
			   parent->pfkeeper.occupation_pos,
			   parent->pfkeeper.npairs,
			   parent->pfkeeper.order_in_pfaffian(pf),
			   parent->pfkeeper.tripletorbuu, 
			   parent->pfkeeper.tripletorbdd,
			   parent->pfkeeper.singletorb,
			   parent->pfkeeper.unpairedorb,
                           parent->pfkeeper.normalization,
                           coef_eps
			   );	

      //  for(int k=0;k<mopfaff_row(pf)(i).GetSize();k++){
      //     cout<<"i and k "<<i<<" "<<k<<endl;
      //     for(int a=0;a<mopfaff_row(pf)(i)(k).GetDim(0);a++){
      //  for(int b=0;b<mopfaff_row_hess(pf)(i)(k).GetDim(0);b++)
      //       cout << mopfaff_row(pf)(i)(k)(a) <<"  ";
      //       cout <<endl;
      //     }
      //}
    }
  }
  //cout <<"Done getting all pairing orbital derivatives"<<endl;

  for(int pf=0;pf<npf;pf++){
    grad=0;
    //cout << "pfaffVal "<<pfaffVal(det,0)<<"  "<<pfaffVal(det,1)<<endl;
    funcval+=parent->pfkeeper.pfwt(pf)*pfaffVal(pf);
    F(pf).Resize(tote,tote,ndim);
    F(pf)=0;
    H(pf).Resize(tote,tote,ndim,ndim);
    H(pf)=0;

    if(pfaffVal(pf)!=0){
      Array3 <doublevar> & fref(F(pf));
      Array4 <doublevar> & href(H(pf));

      for(int i=0; i<tote; i++)
	for(int j=0; j< tote; j++) {
	  for(int k=0; k< npairs; k++){
	    for(int a=0;a < ndim; a++) { 
	      fref(i,j,a)+=mopfaff_row(pf)(j)(k)(a+1)*inverse(pf)(k,i);
	      for(int l=0; l< npairs; l++){
		for(int b=0;b < ndim; b++) { 
		  href(i,j,a,b)+=mopfaff_row(pf)(i)(k)(a+1)*mopfaff_row(pf)(j)(l)(b+1)*inverse(pf)(k,l);
		}
	      }
	    }
	  }
	}

      //for(int i=0; i<tote; i++)
      //	for(int j=0; j< tote; j++) {
      //  cout <<i<<" "<<j<<endl;
      //  for(int a=0;a < ndim; a++)
      //    for(int b=0;b < ndim; b++) 
      //      cout <<href(i,j,a,b)<<endl;
      //}
      
      for(int i=0; i< tote; i++) { 
	for(int j=0; j< tote; j++) { 
	  for(int a=0; a< ndim; a++) { 
	    for(int b=0; b< ndim; b++) { 
	      grad(i,a)+=fref(j,j,b)*coor_grad(j,i,a,b);
	    }
	  }
	}
	for(int a=0; a< ndim; a++) {
	  doublevar weight=1.0;
	  if(npf >1) 
	    weight=parent->pfkeeper.pfwt(pf)*pfaffVal(pf);
	  gradmod2(i)+=grad(i,a)*grad(i,a)*weight;
	  gradlap(i,a)+=grad(i,a)*weight;
	}
      }
    }  
  }//pf
  
  for(int i=0; i< tote; i++) { 
    for(int a=0; a< ndim; a++) { 
      if(funcval==0)
	gradlap(i,a)=0;
      else if(npf>1)
	gradlap(i,a)*=1/funcval;
    }
    if(funcval==0)
      gradmod2(i)=0;
    else if(npf>1)
      gradmod2(i)*=1/funcval;
  }


  
  //Hessian lookup for MO's
  Array2 <int> hess_lookup(3,3);
  hess_lookup(0,0)=4;
  hess_lookup(1,1)=5;
  hess_lookup(2,2)=6;
  hess_lookup(0,1)=hess_lookup(1,0)=7;
  hess_lookup(0,2)=hess_lookup(2,0)=8;
  hess_lookup(1,2)=hess_lookup(2,1)=9;


  //Laplacian
  for(int i=0; i< tote; i++) { //coordinate whose lap we're taking
    for(int pf=0;pf<npf;pf++){
      Array3 <doublevar> & fref(F(pf));
      Array4 <doublevar> & href(H(pf));
      Array2 <doublevar> & invref(inverse(pf)); 
      
      doublevar lap=0;
      if(pfaffVal(pf)!=0){
	for(int j=0; j< tote; j++) { 
	  for(int a=0; a< ndim; a++) { 
	    lap+=fref(j,j,a)*coor_lap(j,i,a);
	  }
	}
	//cout << "i= " << i << endl;
	//doublevar lap1=lap;
	//cout << "lap1 " << lap << endl;
	
	for(int j=0; j < tote; j++) { 
	  for(int k=0; k < npairs; k++) {
	    for(int a=0; a< ndim; a++) { 
	      for(int b=0; b< ndim; b++) { 
		for(int g=0; g< ndim; g++) { 
		  if(k<tote){
		    lap-=coor_grad(j,i,a,b)*coor_grad(k,i,a,g)*
		      (fref(k,j,b)*fref(j,k,g)-
		       (href(j,k,b,g)+mopfaff_row_hess(pf)(j)(k)(b,g))*invref(k,j));
		  }
		  lap+=coor_grad(j,i,a,b)*coor_grad(j,i,a,g)
		    *invref(k,j)*mopfaff_row(pf)(j)(k)(hess_lookup(b,g));
		    //if(fabs(coor_grad(i,j,a,b)) > 1e-16 
		    //   && fabs(coor_grad(i,k,a,g)) > 1e-16 ) 
		    //cout << "j " << j << " k " << k << " a " << a 
		    //     << " b " << b << " g " << g << " cijab " << coor_grad(i,j,a,b)
		    //     << " cikag " << coor_grad(i,k,a,g) 
		    //     << " fkjb " << fref(kr,jr,b) << " fjkg " << fref(jr,kr,g)
		    //     << endl;
		}
	      }
	    }
	  }
	}
      }
      if(npf>1)
	lap*=parent->pfkeeper.pfwt(pf)*pfaffVal(pf);
      gradlap(i,3)+=lap;
    }//pf

    //cout <<"gradlap(i,3) "<<gradlap(i,3)<<endl;
    
    if(funcval==0)
      gradlap(i,3)=0;
    else if(npf>1)
      gradlap(i,3)*=1/funcval;
    
    gradlap(i,3)+=gradmod2(i);
    //cout <<"After grad correction: gradlap(i,3) "<<gradlap(i,3)<<endl;
    if(isnan(gradlap(i,3))) { 
      cout << "NAN! " << "gradmod2 " << gradmod2(i) <<endl;
      //<< " lap1 " << lap1 << " lap2 " << lap2 
      //<< " lap3 " << lap3 << endl;
    }
  }//i-th electron

  //cout << "done " << endl;
  

}
void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
    addSubresourceURL(urls, document()->completeURL(href()));
}
Exemple #11
0
void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowRoot)
{
    String id = SVGURIReference::getTarget(href());
    Element* targetElement = document()->getElementById(id);
    if (!targetElement) {
        // The only time we should get here is when the use element has not been
        // given a resource to target.
        ASSERT(m_resourceId.isEmpty());
        return;
    }

    // Do not build the shadow/instance tree for <use> elements living in a shadow tree.
    // The will be expanded soon anyway - see expandUseElementsInShadowTree().
    Node* parent = parentNode();
    while (parent) {
        if (parent->isShadowNode())
            return;

        parent = parent->parentNode();
    }
 
    SVGElement* target = 0;
    if (targetElement && targetElement->isSVGElement())
        target = static_cast<SVGElement*>(targetElement);

    if (m_targetElementInstance)
        m_targetElementInstance = 0;

    // Do not allow self-referencing.
    // 'target' may be null, if it's a non SVG namespaced element.
    if (!target || target == this)
        return;

    // Why a seperated instance/shadow tree? SVG demands it:
    // The instance tree is accesable from JavaScript, and has to
    // expose a 1:1 copy of the referenced tree, whereas internally we need
    // to alter the tree for correct "use-on-symbol", "use-on-svg" support.  
 
    // Build instance tree. Create root SVGElementInstance object for the first sub-tree node.
    //
    // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a
    // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object
    // is the SVGRectElement that corresponds to the referenced 'rect' element.
    m_targetElementInstance = SVGElementInstance::create(this, target);

    // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children
    bool foundProblem = false;
    buildInstanceTree(target, m_targetElementInstance.get(), foundProblem);

    // SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it!
    // Non-appearing <use> content is easier to debug, then half-appearing content.
    if (foundProblem) {
        m_targetElementInstance = 0;
        return;
    }

    // Assure instance tree building was successfull
    ASSERT(m_targetElementInstance);
    ASSERT(!m_targetElementInstance->shadowTreeElement());
    ASSERT(m_targetElementInstance->correspondingUseElement() == this);
    ASSERT(m_targetElementInstance->correspondingElement() == target);

    // Build shadow tree from instance tree
    // This also handles the special cases: <use> on <symbol>, <use> on <svg>.
    buildShadowTree(shadowRoot, target, m_targetElementInstance.get());

#if ENABLE(SVG) && ENABLE(SVG_USE)
    // Expand all <use> elements in the shadow tree.
    // Expand means: replace the actual <use> element by what it references.
    expandUseElementsInShadowTree(shadowRoot, shadowRoot);

    // Expand all <symbol> elements in the shadow tree.
    // Expand means: replace the actual <symbol> element by the <svg> element.
    expandSymbolElementsInShadowTree(shadowRoot, shadowRoot);
#endif

    // Now that the shadow tree is completly expanded, we can associate
    // shadow tree elements <-> instances in the instance tree.
    associateInstancesWithShadowTreeElements(shadowRoot->firstChild(), m_targetElementInstance.get());

    // If no shadow tree element is present, this means that the reference root
    // element was removed, as it is disallowed (ie. <use> on <foreignObject>)
    // Do NOT leave an inconsistent instance tree around, instead destruct it.
    if (!m_targetElementInstance->shadowTreeElement()) {
        shadowRoot->removeAllChildren();
        m_targetElementInstance = 0;
        return;
    }

    // Consistency checks - this is assumed in updateContainerOffset().
    ASSERT(m_targetElementInstance->shadowTreeElement()->parentNode() == shadowRoot);

    // Eventually dump instance tree
#ifdef DUMP_INSTANCE_TREE
    String text;
    unsigned int depth = 0;

    dumpInstanceTree(depth, text, m_targetElementInstance.get());
    fprintf(stderr, "\nDumping <use> instance tree:\n%s\n", text.latin1().data());
#endif

    // Eventually dump shadow tree
#ifdef DUMP_SHADOW_TREE
    ExceptionCode ec = 0;

    PassRefPtr<XMLSerializer> serializer = XMLSerializer::create();

    String markup = serializer->serializeToString(shadowRoot, ec);
    ASSERT(!ec);

    fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().data());
#endif

    // Transfer event listeners assigned to the referenced element to our shadow tree elements.
    transferEventListenersToShadowTree(m_targetElementInstance.get());

    // Update container offset/size
    updateContainerOffsets();
    updateContainerSizes();
}
String HTMLAnchorElement::origin() const
{
    return SecurityOrigin::create(href()).get().toString();
}
Exemple #13
0
void SVGUseElement::buildPendingResource()
{
    String id = SVGURIReference::getTarget(href());
    Element* targetElement = document()->getElementById(id);

    if (!targetElement) {
        // TODO: We want to deregister as pending resource, if our href() changed!
        // TODO: Move to svgAttributeChanged, once we're fixing use & the new dynamic update concept.
        document()->accessSVGExtensions()->addPendingResource(id, this);
        return;
    }

    // Do not build the shadow/instance tree for <use> elements living in a shadow tree.
    // The will be expanded soon anyway - see expandUseElementsInShadowTree().
    Node* parent = parentNode();
    while (parent) {
        if (parent->isShadowNode())
            return;

        parent = parent->parentNode();
    }
 
    SVGElement* target = 0;
    if (targetElement && targetElement->isSVGElement())
        target = static_cast<SVGElement*>(targetElement);

    // Do not allow self-referencing.
    // 'target' may be null, if it's a non SVG namespaced element.
    if (!target || target == this) {
        m_targetElementInstance = 0;
        m_shadowTreeRootElement = 0;
        return;
    }

    // Why a seperated instance/shadow tree? SVG demands it:
    // The instance tree is accesable from JavaScript, and has to
    // expose a 1:1 copy of the referenced tree, whereas internally we need
    // to alter the tree for correct "use-on-symbol", "use-on-svg" support.  
 
    // Build instance tree. Create root SVGElementInstance object for the first sub-tree node.
    //
    // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a
    // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object
    // is the SVGRectElement that corresponds to the referenced 'rect' element.
    m_targetElementInstance = new SVGElementInstance(this, target);

    // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children
    bool foundProblem = false;
    buildInstanceTree(target, m_targetElementInstance.get(), foundProblem);

    // SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it!
    // Non-appearing <use> content is easier to debug, then half-appearing content.
    if (foundProblem) {
        m_targetElementInstance = 0;
        m_shadowTreeRootElement = 0;
        return;
    }

    // Assure instance tree building was successfull
    ASSERT(m_targetElementInstance);
    ASSERT(m_targetElementInstance->correspondingUseElement() == this);

    // Setup shadow tree root node
    m_shadowTreeRootElement = new SVGGElement(SVGNames::gTag, document());
    m_shadowTreeRootElement->setInDocument();
    m_shadowTreeRootElement->setShadowParentNode(this);

    // Spec: An additional transformation translate(x,y) is appended to the end
    // (i.e., right-side) of the transform attribute on the generated 'g', where x
    // and y represent the values of the x and y attributes on the 'use' element. 
    if (x().value() != 0.0 || y().value() != 0.0) {
        String transformString = String::format("translate(%f, %f)", x().value(), y().value());
        m_shadowTreeRootElement->setAttribute(SVGNames::transformAttr, transformString);
    }

    // Build shadow tree from instance tree
    // This also handles the special cases: <use> on <symbol>, <use> on <svg>.
    buildShadowTree(target, m_targetElementInstance.get());

#if ENABLE(SVG) && ENABLE(SVG_USE)
    // Expand all <use> elements in the shadow tree.
    // Expand means: replace the actual <use> element by what it references.
    expandUseElementsInShadowTree(m_shadowTreeRootElement.get());

    // Expand all <symbol> elements in the shadow tree.
    // Expand means: replace the actual <symbol> element by the <svg> element.
    expandSymbolElementsInShadowTree(m_shadowTreeRootElement.get());

#endif

    // Now that the shadow tree is completly expanded, we can associate
    // shadow tree elements <-> instances in the instance tree.
    associateInstancesWithShadowTreeElements(m_shadowTreeRootElement->firstChild(), m_targetElementInstance.get());

    // Eventually dump instance tree
#ifdef DUMP_INSTANCE_TREE
    String text;
    unsigned int depth = 0;

    dumpInstanceTree(depth, text, m_targetElementInstance.get());
    fprintf(stderr, "\nDumping <use> instance tree:\n%s\n", text.latin1().data());
#endif

    // Eventually dump shadow tree
#ifdef DUMP_SHADOW_TREE
    ExceptionCode ec = 0;

    PassRefPtr<XMLSerializer> serializer = XMLSerializer::create();

    String markup = serializer->serializeToString(m_shadowTreeRootElement.get(), ec);
    ASSERT(ec == 0);

    fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().data());
#endif

    // The DOM side is setup properly. Now we have to attach the root shadow
    // tree element manually - using attach() won't work for "shadow nodes".
    attachShadowTree();
}
Exemple #14
0
/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket
*/
void tkthistory_page(void){
  Stmt q;
  char *zTitle;
  const char *zUuid;
  int tagid;
  int nChng = 0;

  login_check_credentials();
  if( !g.perm.Hyperlink || !g.perm.RdTkt ){ login_needed(); return; }
  zUuid = PD("name","");
  zTitle = mprintf("History Of Ticket %h", zUuid);
  style_submenu_element("Status", "Status",
    "%s/info/%s", g.zTop, zUuid);
  style_submenu_element("Check-ins", "Check-ins",
    "%s/tkttimeline?name=%s&y=ci", g.zTop, zUuid);
  style_submenu_element("Timeline", "Timeline",
    "%s/tkttimeline?name=%s", g.zTop, zUuid);
  if( P("plaintext")!=0 ){
    style_submenu_element("Formatted", "Formatted",
                          "%R/tkthistory/%S", zUuid);
  }else{
    style_submenu_element("Plaintext", "Plaintext",
                          "%R/tkthistory/%S?plaintext", zUuid);
  }
  style_header(zTitle);
  free(zTitle);

  tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
  if( tagid==0 ){
    cgi_printf("No such ticket: %h\n",(zUuid));
    style_footer();
    return;
  }
  db_prepare(&q,
    "SELECT datetime(mtime%s), objid, uuid, NULL, NULL, NULL"
    "  FROM event, blob"
    " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
    "   AND blob.rid=event.objid"
    " UNION "
    "SELECT datetime(mtime%s), attachid, uuid, src, filename, user"
    "  FROM attachment, blob"
    " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
    "   AND blob.rid=attachid"
    " ORDER BY 1",
    timeline_utc(), tagid, timeline_utc(), tagid
  );
  while( db_step(&q)==SQLITE_ROW ){
    Manifest *pTicket;
    char zShort[12];
    const char *zDate = db_column_text(&q, 0);
    int rid = db_column_int(&q, 1);
    const char *zChngUuid = db_column_text(&q, 2);
    const char *zFile = db_column_text(&q, 4);
    memcpy(zShort, zChngUuid, 10);
    zShort[10] = 0;
    if( nChng==0 ){
      cgi_printf("<ol>\n");
    }
    nChng++;
    if( zFile!=0 ){
      const char *zSrc = db_column_text(&q, 3);
      const char *zUser = db_column_text(&q, 5);
      if( zSrc==0 || zSrc[0]==0 ){
        cgi_printf("\n"
               "<li><p>Delete attachment \"%h\"\n",(zFile));
      }else{
        cgi_printf("\n"
               "<li><p>Add attachment\n"
               "\"%z%s</a>\"\n",(href("%R/artifact/%S",zSrc)),(zFile));
      }
      cgi_printf("[%z%s</a>]\n"
             "(rid %d) by\n",(href("%R/artifact/%T",zChngUuid)),(zShort),(rid));
      hyperlink_to_user(zUser,zDate," on");
      hyperlink_to_date(zDate, ".</p>");
    }else{
      pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
      if( pTicket ){
        cgi_printf("\n"
               "<li><p>Ticket change\n"
               "[%z%s</a>]\n"
               "(rid %d) by\n",(href("%R/artifact/%T",zChngUuid)),(zShort),(rid));
        hyperlink_to_user(pTicket->zUser,zDate," on");
        hyperlink_to_date(zDate, ":");
        cgi_printf("</p>\n");
        ticket_output_change_artifact(pTicket, "a");
      }
      manifest_destroy(pTicket);
    }
  }
  db_finalize(&q);
  if( nChng ){
    cgi_printf("</ol>\n");
  }
  style_footer();
}
Exemple #15
0
String HTMLAnchorElement::toString() const
{
    return href().string();
}
void SVGImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
    SVGStyledTransformableElement::addSubresourceAttributeURLs(urls);

    addSubresourceURL(urls, document()->completeURL(href()));
}
bool SVGScriptElement::hasSourceAttribute() const
{
    return href()->isSpecified();
}
Exemple #18
0
String HTMLAnchorElement::hostname() const
{
    return href().host();
}
Exemple #19
0
void SVGScriptElement::getSubresourceAttributeStrings(Vector<String>& urls) const
{
    urls.append(href());
}
Exemple #20
0
String HTMLAnchorElement::pathname() const
{
    return href().path();
}
String SVGScriptElement::sourceAttributeValue() const
{
    return href();
}
void SVGTRefElement::updateReferencedText()
{
    Element* targetElement = ownerDocument()->getElementById(SVGURIReference::getTarget(href()));
    SVGElement* target = svg_dynamic_cast(targetElement);
    if (target) {
        ExceptionCode ignore = 0;
        setTextContent(target->textContent(), ignore);
    }
}