Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch graphcss Excluding Merge-Ins
This is equivalent to a diff from 8e44cf6f4d to aaa0e6d149
2015-05-09
| ||
12:42 | Improvements to graph rendering to make it much more configurable using CSS. ... (check-in: ca869aabe2 user: drh tags: trunk) | |
2015-05-08
| ||
03:22 | Reimplement timeline-circle-nodes and timeline-arrowheads skin options. ... (Closed-Leaf check-in: aaa0e6d149 user: joel tags: graphcss) | |
2015-05-07
| ||
12:31 | Change the built-in SQLite to version 3.8.10. ... (check-in: abc38398eb user: drh tags: trunk) | |
2015-05-06
| ||
23:29 | Add logic for generating SVG pie-charts based on SQL query results. ... (check-in: 6ebd853cb4 user: drh tags: piechart) | |
21:28 | Use round() instead of ceil() on element dimension calculations. ... (check-in: 05045a476d user: joel tags: graphcss) | |
20:55 | Allow the timeline graph to be customized using CSS. ... (check-in: 1f1e199a20 user: joel tags: graphcss) | |
12:35 | Record files added by merge using mlink.pid=-1. Improve the web interface to better indicate files added by merge. ... (check-in: 8e44cf6f4d user: drh tags: trunk) | |
2015-05-05
| ||
18:59 | Update the built-in SQLite to the second beta of 3.8.10. ... (Closed-Leaf check-in: 7d2ac84598 user: drh tags: show-add-by-merge) | |
06:49 | Now really update the built-in SQLite to the first 3.8.10 beta, not only the command line shell. ... (check-in: acd670f251 user: jan.nijtmans tags: trunk) | |
Changes to skins/eagle/css.txt.
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 | font-family: "courier new"; border-collapse: collapse; } tr.timelineSelected { background-color: #7EA2D9; } /* Side-by-side diff */ table.sbsdiff { background-color: #485D7B; font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace; font-size: 8pt; border-collapse:collapse; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | font-family: "courier new"; border-collapse: collapse; } tr.timelineSelected { background-color: #7EA2D9; } /* commit node */ .tl-node { width: 10px; height: 10px; border: 1px solid #fff; background: #485D7B; cursor: pointer; } /* leaf commit marker */ .tl-node.leaf:after { content: ''; position: absolute; top: 3px; left: 3px; width: 4px; height: 4px; background: #fff; } /* up arrow */ .tl-arrow.u { margin-top: -1px; border-width: 0 3px; border-bottom: 7px solid #fff; } /* small up arrow */ .tl-arrow.u.sm { border-bottom: 5px solid #fff; } /* line */ .tl-line { background: #fff; width: 2px; } /* left merge arrow */ .tl-arrow.merge.l { border-right: 3px solid #fff; } /* right merge arrow */ .tl-arrow.merge.r { border-left: 3px solid #fff; } /* Side-by-side diff */ table.sbsdiff { background-color: #485D7B; font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace; font-size: 8pt; border-collapse:collapse; |
︙ | ︙ | |||
262 263 264 265 266 267 268 | } /* line numbers in a diff */ span.diffln { color: white; } | < < < < | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | } /* line numbers in a diff */ span.diffln { color: white; } .fileage tr:hover { background-color: #7EA2D9; } .fileage td { font-family: "courier new"; } |
︙ | ︙ |
Changes to skins/xekri/css.txt.
︙ | ︙ | |||
698 699 700 701 702 703 704 | } /************************************** * Timeline */ | < < < < < | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | } /************************************** * Timeline */ div.divider { color: #ee0; font-size: 1.2rem; font-weight: bold; margin-top: 1rem; white-space: nowrap; } |
︙ | ︙ |
Changes to src/finfo.c.
︙ | ︙ | |||
401 402 403 404 405 406 407 | blob_appendf(&title, "History of files named "); hyperlinked_path(zFilename, &title, 0, "tree", ""); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } @ <h2>%b(&title)</h2> blob_reset(&title); pGraph = graph_init(); | < < | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | blob_appendf(&title, "History of files named "); hyperlinked_path(zFilename, &title, 0, "tree", ""); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } @ <h2>%b(&title)</h2> blob_reset(&title); pGraph = graph_init(); @ <table id="timelineTable" class="timelineTable"> while( db_step(&q)==SQLITE_ROW ){ const char *zDate = db_column_text(&q, 0); const char *zCom = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); int fpid = db_column_int(&q, 3); int frid = db_column_int(&q, 4); |
︙ | ︙ | |||
457 458 459 460 461 462 463 | @ <div class="divider timelineDate">%s(zPrevDate)</div> @ </td><td></td><td></td></tr> } memcpy(zTime, &zDate[11], 5); zTime[5] = 0; @ <tr><td class="timelineTime"> @ %z(href("%R/timeline?c=%t",zDate))%s(zTime)</a></td> | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | @ <div class="divider timelineDate">%s(zPrevDate)</div> @ </td><td></td><td></td></tr> } memcpy(zTime, &zDate[11], 5); zTime[5] = 0; @ <tr><td class="timelineTime"> @ %z(href("%R/timeline?c=%t",zDate))%s(zTime)</a></td> @ <td class="timelineGraph"><div id="m%d(gidx)" class="tl-nodemark"></div></td> if( zBgClr && zBgClr[0] ){ @ <td class="timelineTableCell" style="background-color: %h(zBgClr);"> }else{ @ <td class="timelineTableCell"> } if( zUuid ){ if( nParent==0 ){ |
︙ | ︙ | |||
534 535 536 537 538 539 540 | db_finalize(&q); if( pGraph ){ graph_finish(pGraph, 1); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ | < < < | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | db_finalize(&q); if( pGraph ){ graph_finish(pGraph, 1); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom"><td></td><td></td><td></td></tr> } } @ </table> timeline_output_graph_javascript(pGraph, 0, 1); style_footer(); } |
Changes to src/graph.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 | int idxTop; /* Direct descendent highest up on the graph */ GraphRow *pChild; /* Child immediately above this node */ u8 isDup; /* True if this is duplicate of a prior entry */ u8 isLeaf; /* True if this is a leaf node */ u8 timeWarp; /* Child is earlier in time */ u8 bDescender; /* True if riser from bottom of graph to here. */ i8 iRail; /* Which rail this check-in appears on. 0-based.*/ | | < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | int idxTop; /* Direct descendent highest up on the graph */ GraphRow *pChild; /* Child immediately above this node */ u8 isDup; /* True if this is duplicate of a prior entry */ u8 isLeaf; /* True if this is a leaf node */ u8 timeWarp; /* Child is earlier in time */ u8 bDescender; /* True if riser from bottom of graph to here. */ i8 iRail; /* Which rail this check-in appears on. 0-based.*/ i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */ u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */ int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */ int mergeUpto; /* Draw the mergeOut rail up to this level */ u64 mergeDown; /* Draw merge lines up from bottom of graph */ u64 railInUse; /* Mask of occupied rails at this row */ }; /* Context while building a graph */ struct GraphContext { int nErr; /* Number of errors encountered */ int mxRail; /* Number of rails required to render the graph */ GraphRow *pFirst; /* First row in the list */ GraphRow *pLast; /* Last row in the list */ int nBranch; /* Number of distinct branches */ char **azBranch; /* Names of the branches */ int nRow; /* Number of rows */ int nHash; /* Number of slots in apHash[] */ GraphRow **apHash; /* Hash table of GraphRow objects. Key: rid */ |
︙ | ︙ | |||
292 293 294 295 296 297 298 | if( pParent->mergeOut<0 ){ u = pParent->aiRiser[pParent->iRail]; if( u>=0 && u<pChild->idx ){ /* The thick arrow up to the next primary child of pDesc goes ** further up than the thin merge arrow riser, so draw them both ** on the same rail. */ | | < | | | | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | if( pParent->mergeOut<0 ){ u = pParent->aiRiser[pParent->iRail]; if( u>=0 && u<pChild->idx ){ /* The thick arrow up to the next primary child of pDesc goes ** further up than the thin merge arrow riser, so draw them both ** on the same rail. */ pParent->mergeOut = pParent->iRail; pParent->mergeUpto = pChild->idx; }else{ /* The thin merge arrow riser is taller than the thick primary ** child riser, so use separate rails. */ int iTarget = pParent->iRail; pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1, 0, iTarget); pParent->mergeUpto = pChild->idx; mask = BIT(pParent->mergeOut); for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } } pChild->mergeIn[pParent->mergeOut] = 1; } /* ** Compute the maximum rail number. */ static void find_max_rail(GraphContext *p){ GraphRow *pRow; p->mxRail = 0; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->iRail>p->mxRail ) p->mxRail = pRow->iRail; if( pRow->mergeOut>p->mxRail ) p->mxRail = pRow->mergeOut; while( p->mxRail<GR_MAX_RAIL && pRow->mergeDown>(BIT(p->mxRail+1)-1) ){ p->mxRail++; } } } |
︙ | ︙ | |||
538 539 540 541 542 543 544 | int parentRid = pRow->aParent[i]; pDesc = hashFind(p, parentRid); if( pDesc==0 ){ /* Merge from a node that is off-screen */ int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0, 0); if( p->mxRail>=GR_MAX_RAIL ) return; mask = BIT(iMrail); | | | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | int parentRid = pRow->aParent[i]; pDesc = hashFind(p, parentRid); if( pDesc==0 ){ /* Merge from a node that is off-screen */ int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0, 0); if( p->mxRail>=GR_MAX_RAIL ) return; mask = BIT(iMrail); pRow->mergeIn[iMrail] = 1; pRow->mergeDown |= mask; for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } }else{ /* Merge from an on-screen node */ createMergeRiser(p, pDesc, pRow); |
︙ | ︙ | |||
567 568 569 570 571 572 573 | if( p->mxRail>=GR_MAX_RAIL ) return; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( !pRow->isDup ) continue; pRow->iRail = dupRail; pDesc = hashFind(p, pRow->rid); assert( pDesc!=0 && pDesc!=pRow ); createMergeRiser(p, pDesc, pRow); | | < < < < < | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | if( p->mxRail>=GR_MAX_RAIL ) return; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( !pRow->isDup ) continue; pRow->iRail = dupRail; pDesc = hashFind(p, pRow->rid); assert( pDesc!=0 && pDesc!=pRow ); createMergeRiser(p, pDesc, pRow); if( pDesc->mergeOut>mxRail ) mxRail = pDesc->mergeOut; } if( dupRail<=mxRail ){ dupRail = mxRail+1; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->isDup ) pRow->iRail = dupRail; } } if( mxRail>=GR_MAX_RAIL ) return; } /* ** Find the maximum rail number. */ find_max_rail(p); p->nErr = 0; } |
Changes to src/style.c.
︙ | ︙ | |||
699 700 701 702 703 704 705 | { "td.timelineTime", "the format for the timeline time display", @ vertical-align: top; @ text-align: right; @ white-space: nowrap; }, { "td.timelineGraph", | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | { "td.timelineTime", "the format for the timeline time display", @ vertical-align: top; @ text-align: right; @ white-space: nowrap; }, { "td.timelineGraph", "the format for the graph placeholder cells in timelines", @ width: 20px; @ text-align: left; @ vertical-align: top; }, { ".tl-canvas", "timeline graph canvas", @ margin: 0 6px 0 10px; }, { ".tl-rail", "maximum rail spacing", @ width: 18px; }, { ".tl-mergeoffset", "maximum spacing between merge risers and primary child risers", @ width: 2px; }, { ".tl-nodemark", "adjusts the vertical position of graph nodes", @ margin-top: 5px; }, { ".tl-node", "commit node", @ width: 10px; @ height: 10px; @ border: 1px solid #000; @ background: #fff; @ cursor: pointer; }, { ".tl-node.leaf:after", "leaf commit marker", @ content: ''; @ position: absolute; @ top: 3px; @ left: 3px; @ width: 4px; @ height: 4px; @ background: #000; }, { ".tl-node.sel:after", "selected commit node marker", @ content: ''; @ position: absolute; @ top: 2px; @ left: 2px; @ width: 6px; @ height: 6px; @ background: red; }, { ".tl-arrow", "arrow", @ width: 0; @ height: 0; @ transform: scale(.999); @ border: 0 solid transparent; }, { ".tl-arrow.u", "up arrow", @ margin-top: -1px; @ border-width: 0 3px; @ border-bottom: 7px solid #000; }, { ".tl-arrow.u.sm", "small up arrow", @ border-bottom: 5px solid #000; }, { ".tl-line", "line", @ background: #000; @ width: 2px; }, { ".tl-arrow.merge", "merge arrow", @ height: 1px; @ border-width: 2px 0; }, { ".tl-arrow.merge.l", "left merge arrow", @ border-right: 3px solid #000; }, { ".tl-arrow.merge.r", "right merge arrow", @ border-left: 3px solid #000; }, { ".tl-line.merge", "merge line", @ width: 1px; }, { ".tl-arrow.warp", "timewarp arrow", @ margin-left: 1px; @ border-width: 3px 0; @ border-left: 7px solid #600000; }, { ".tl-line.warp", "timewarp line", @ background: #600000; }, { "a.tagLink", "the format for the tag links", @ }, { "span.tagDsp", "the format for the tag display(no history permission!)", @ font-weight: bold; |
︙ | ︙ | |||
1224 1225 1226 1227 1228 1229 1230 | "odd table row color", @ /* Use default */ }, { "#usetupEditCapability", "format for capabilities string, mentioned on the user edit page", @ font-weight: bold; }, | < < < < | 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | "odd table row color", @ /* Use default */ }, { "#usetupEditCapability", "format for capabilities string, mentioned on the user edit page", @ font-weight: bold; }, { "table.adminLogTable", "Class for the /admin_log table", @ text-align: left; }, { ".adminLogTable .adminTime", "Class for the /admin_log table", @ text-align: left; |
︙ | ︙ | |||
1334 1335 1336 1337 1338 1339 1340 | cssDefaultList[i].value ); } } } /* | | < | > | | < | | > < > > > > > > > > > > > > > > > > > > > > > | | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 | cssDefaultList[i].value ); } } } /* ** Search string zCss for zSelector. ** ** Return true if found. Return false if not found */ static int containsSelector(const char *zCss, const char *zSelector){ char *z; int n; int selectorLen = (int)strlen(zSelector); for( z=zCss; *z; z+=selectorLen ){ z = strstr(z, zSelector); if( z==0 ) return 0; if( z!=zCss ){ for( n=-1; z+n!=zCss && fossil_isspace(z[n]); n--); if( z+n!=zCss && z[n]!=',' && z[n]!= '}' && z[n]!='/' ) continue; } for( n=selectorLen; z[n] && fossil_isspace(z[n]); n++ ); if( z[n]==',' || z[n]=='{' || z[n]=='/' ) return 1; } return 0; } /* ** COMMAND: test-contains-selector ** ** Usage: %fossil test-contains-selector FILENAME SELECTOR ** ** Determine if the CSS stylesheet FILENAME contains SELECTOR. */ void contains_selector_cmd(void){ int found; char *zSelector; Blob css; if( g.argc!=4 ) usage("FILENAME SELECTOR"); blob_read_from_file(&css, g.argv[2]); zSelector = g.argv[3]; found = containsSelector(blob_str(&css), zSelector); fossil_print("%s %s\n", zSelector, found ? "found" : "not found"); blob_reset(&css); } /* ** WEBPAGE: style.css ** ** Return the style sheet. */ void page_style_css(void){ Blob css; int i; cgi_set_content_type("text/css"); blob_init(&css,skin_get("css"),-1); /* add special missing definitions */ for(i=1; cssDefaultList[i].elementClass; i++){ char *z = blob_str(&css); if( !containsSelector(z, cssDefaultList[i].elementClass) ){ blob_appendf(&css, "/* %s */\n%s {\n%s}\n", cssDefaultList[i].comment, cssDefaultList[i].elementClass, cssDefaultList[i].value); } } |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
239 240 241 242 243 244 245 | zPrevDate[0] = 0; mxWikiLen = db_get_int("timeline-max-comment", 0); dateFormat = db_get_int("timeline-date-format", 0); zDateFmt = P("datefmt"); if( zDateFmt ) dateFormat = atoi(zDateFmt); if( tmFlags & TIMELINE_GRAPH ){ pGraph = graph_init(); | < < < < < | < | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | zPrevDate[0] = 0; mxWikiLen = db_get_int("timeline-max-comment", 0); dateFormat = db_get_int("timeline-date-format", 0); zDateFmt = P("datefmt"); if( zDateFmt ) dateFormat = atoi(zDateFmt); if( tmFlags & TIMELINE_GRAPH ){ pGraph = graph_init(); } db_static_prepare(&qbranch, "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", TAG_BRANCH ); @ <table id="timelineTable" class="timelineTable"> blob_zero(&comment); while( db_step(pQuery)==SQLITE_ROW ){ int rid = db_column_int(pQuery, 0); const char *zUuid = db_column_text(pQuery, 1); int isLeaf = db_column_int(pQuery, 5); const char *zBgClr = db_column_text(pQuery, 6); const char *zDate = db_column_text(pQuery, 2); |
︙ | ︙ | |||
389 390 391 392 393 394 395 | while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){ aParent[nParent++] = db_column_int(&qparent, 0); } db_reset(&qparent); gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr, zUuid, isLeaf); db_reset(&qbranch); | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){ aParent[nParent++] = db_column_int(&qparent, 0); } db_reset(&qparent); gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr, zUuid, isLeaf); db_reset(&qbranch); @ <div id="m%d(gidx)" class="tl-nodemark"></div> } @</td> if( zBgClr && zBgClr[0] && rid!=selectedRid ){ @ <td class="timelineTableCell" style="background-color: %h(zBgClr);"> }else{ @ <td class="timelineTableCell"> } |
︙ | ︙ | |||
587 588 589 590 591 592 593 | } if( pGraph ){ graph_finish(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ | < < < < < | < < | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | } if( pGraph ){ graph_finish(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom"><td></td><td></td><td></td></tr> } } @ </table> if( fchngQueryInit ) db_finalize(&fchngQuery); timeline_output_graph_javascript(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0, 0); } |
︙ | ︙ | |||
646 647 648 649 650 651 652 | int omitDescenders, /* True to omit descenders */ int fileDiff /* True for file diff. False for check-in diff */ ){ if( pGraph && pGraph->nErr==0 && pGraph->nRow>0 ){ GraphRow *pRow; int i; char cSep; | < | | | | < < | > | > | < | > > > > > | | | | < < < < < < < < < < < < | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | int omitDescenders, /* True to omit descenders */ int fileDiff /* True for file diff. False for check-in diff */ ){ if( pGraph && pGraph->nErr==0 && pGraph->nRow>0 ){ GraphRow *pRow; int i; char cSep; int iRailPitch; /* Pixels between consecutive rails */ int showArrowheads; /* True to draw arrowheads. False to omit. */ int circleNodes; /* True for circle nodes. False for square nodes */ int colorGraph; /* Use colors for graph lines */ iRailPitch = atoi(PD("railpitch","0")); showArrowheads = skin_detail_boolean("timeline-arrowheads"); circleNodes = skin_detail_boolean("timeline-circle-nodes"); colorGraph = skin_detail_boolean("timeline-color-graph-lines"); @ <script>(function(){ @ "use strict"; @ var css = ""; if( circleNodes ){ @ css += ".tl-node, .tl-node:after { border-radius: 50%%; }"; } if( !showArrowheads ){ @ css += ".tl-arrow.u { display: none; }"; } @ if( css!=="" ){ @ var style = document.createElement("style"); @ style.textContent = css; @ document.querySelector("head").appendChild(style); @ } /* the rowinfo[] array contains all the information needed to generate ** the graph. Each entry contains information for a single row: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node ** is 1 and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: True if there is a "descender" - an arrow coming from the bottom ** of the page straight up to this node. ** mo: "merge-out". If non-negative, this is the rail position ** for the upward portion of a merge arrow. The merge arrow goes up ** to the row identified by mu:. If this value is negative then ** node has no merge children and no merge-out line is drawn. ** mu: The id of the row which is the top of the merge-out arrow. ** u: Draw a thick child-line out of the top of this node and up to ** the node with an id equal to this value. 0 if it is straight to ** the top of the page, -1 if there is no thick-line riser. ** f: 0x01: a leaf node. ** au: An array of integers that define thick-line risers for branches. ** The integers are in pairs. For each pair, the first integer is ** is the rail on which the riser should run and the second integer ** is the id of the node upto which the riser should run. ** mi: "merge-in". An array of integer rail positions from which ** merge arrows should be drawn into this node. If the value is ** negative, then the rail position is the absolute value of mi[] ** and a thin merge-arrow descender is drawn to the bottom of ** the screen. ** h: The SHA1 hash of the object being graphed */ cgi_printf("var rowinfo = [\n"); for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ cgi_printf("{id:%d,bg:\"%s\",r:%d,d:%d,mo:%d,mu:%d,u:%d,f:%d,au:", pRow->idx, /* id */ pRow->zBgClr, /* bg */ pRow->iRail, /* r */ pRow->bDescender, /* d */ pRow->mergeOut, /* mo */ pRow->mergeUpto, /* mu */ pRow->aiRiser[pRow->iRail], /* u */ pRow->isLeaf ? 1 : 0 /* f */ ); /* u */ cSep = '['; for(i=0; i<GR_MAX_RAIL; i++){ |
︙ | ︙ | |||
741 742 743 744 745 746 747 | cgi_printf("fg:\"%s\",", bg_to_fg(pRow->zBgClr)); } /* mi */ cgi_printf("mi:"); cSep = '['; for(i=0; i<GR_MAX_RAIL; i++){ if( pRow->mergeIn[i] ){ | | < < | | | | > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | | < | | | > | | < < | < < < < < < < < | < | < | | | < < < | < < < < < < < < | | | < | | | < | | < < < | | | | | | | | | | | | | | > | | | < | < < | > | | > > | | > > > > | | | | < < < < < < < | | | > | < < | | > | > > | > > | | | | < | | | > > > > > > | | | | | | < | | < < < | | < < < < < < < | < | | < | < < < < | < < | | | < < < < < < < < | < < < < < < < < | < > | > | | | | | | | | | < | < < | < < < < < < | > | > | < < < < > > < < < > > | | | > | | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | cgi_printf("fg:\"%s\",", bg_to_fg(pRow->zBgClr)); } /* mi */ cgi_printf("mi:"); cSep = '['; for(i=0; i<GR_MAX_RAIL; i++){ if( pRow->mergeIn[i] ){ int mi = i; if( pRow->mergeDown & (1<<i) ) mi = -mi; cgi_printf("%c%d", cSep, mi); cSep = ','; } } if( cSep=='[' ) cgi_printf("["); cgi_printf("],h:\"%s\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "];\n"); } cgi_printf("var nrail = %d\n", pGraph->mxRail+1); graph_free(pGraph); @ var canvasDiv; @ var railPitch; @ var mergeOffset; @ var node, arrow, arrowSmall, line, mArrow, mLine, wArrow, wLine; @ function initGraph(){ @ var parent = gebi("timelineTable").rows[0].cells[1]; @ parent.style.verticalAlign = "top"; @ canvasDiv = document.createElement("div"); @ canvasDiv.className = "tl-canvas"; @ canvasDiv.style.position = "absolute"; @ parent.appendChild(canvasDiv); @ @ var elems = {}; @ var elemClasses = [ @ "rail", "mergeoffset", "node", "arrow u", "arrow u sm", "line", @ "arrow merge r", "line merge", "arrow warp", "line warp" @ ]; @ for( var i=0; i<elemClasses.length; i++ ){ @ var cls = elemClasses[i]; @ var elem = document.createElement("div"); @ elem.className = "tl-" + cls; @ if( cls.indexOf("line")==0 ) elem.className += " v"; @ canvasDiv.appendChild(elem); @ var k = cls.replace(/\s/g, "_"); @ var r = elem.getBoundingClientRect(); @ var w = Math.round(r.right - r.left); @ var h = Math.round(r.bottom - r.top); @ elems[k] = {w: w, h: h, cls: cls}; @ } @ node = elems.node; @ arrow = elems.arrow_u; @ arrowSmall = elems.arrow_u_sm; @ line = elems.line; @ mArrow = elems.arrow_merge_r; @ mLine = elems.line_merge; @ wArrow = elems.arrow_warp; @ wLine = elems.line_warp; @ @ var minRailPitch = Math.ceil((node.w+line.w)/2 + mArrow.w + 1); if( iRailPitch ){ @ railPitch = %d(iRailPitch); }else{ @ railPitch = elems.rail.w; @ railPitch -= Math.floor((nrail-1)*(railPitch-minRailPitch)/21); } @ railPitch = Math.max(railPitch, minRailPitch); @ if( PB("nomo") ){ @ mergeOffset = 0; }else{ @ mergeOffset = railPitch-minRailPitch-mLine.w; @ mergeOffset = Math.min(mergeOffset, elems.mergeoffset.w); @ mergeOffset = mergeOffset>0 ? mergeOffset + line.w/2 : 0; } @ @ var canvasWidth = (nrail-1)*railPitch + node.w; @ canvasDiv.style.width = canvasWidth + "px"; @ canvasDiv.style.position = "relative"; @ } @ function drawBox(cls,color,x0,y0,x1,y1){ @ var n = document.createElement("div"); @ x0 = Math.floor(x0); @ y0 = Math.floor(y0); @ x1 = x1 || x1===0 ? Math.floor(x1) : x0; @ y1 = y1 || y1===0 ? Math.floor(y1) : y0; @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; } @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; } @ var w = x1-x0; @ var h = y1-y0; @ n.style.position = "absolute"; @ n.style.left = x0+"px"; @ n.style.top = y0+"px"; @ if( w ) n.style.width = w+"px"; @ if( h ) n.style.height = h+"px"; @ if( color ) n.style.backgroundColor = color; @ n.className = "tl-"+cls; @ canvasDiv.appendChild(n); @ return n; @ } @ function absoluteY(obj){ @ var top = 0; @ if( obj.offsetParent ){ @ do{ @ top += obj.offsetTop; @ }while( obj = obj.offsetParent ); @ } @ return top; @ } @ function miLineY(p){ @ return p.y + node.h - mLine.w - 1; @ } @ function drawLine(elem,color,x0,y0,x1,y1){ @ var cls = elem.cls + " "; @ if( x1===null ){ @ x1 = x0+elem.w; @ cls += "v"; @ }else{ @ y1 = y0+elem.w; @ cls += "h"; @ } @ drawBox(cls,color,x0,y0,x1,y1); @ } @ function drawUpArrow(from,to,color){ @ var y = to.y + node.h; @ var arrowSpace = from.y - y + (!from.id || from.r!=to.r ? node.h/2 : 0); @ var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; @ var x = to.x + (node.w-line.w)/2; @ var y0 = from.y + node.h/2; @ var y1 = Math.ceil(to.y + node.h + arw.h/2); @ drawLine(line,color,x,y0,null,y1); @ x = to.x + (node.w-arw.w)/2; @ var n = drawBox(arw.cls,null,x,y); @ n.style.borderBottomColor = color; @ } @ function drawMergeLine(x0,y0,x1,y1){ @ drawLine(mLine,null,x0,y0,x1,y1); @ } @ function drawMergeArrow(p,rail){ @ var x0 = rail*railPitch + node.w/2; @ if( rail in mergeLines ){ @ x0 += mergeLines[rail]; @ if( p.r<rail ) x0 += mLine.w; @ }else{ @ x0 += (p.r<rail ? -1 : 1)*line.w/2; @ } @ var x1 = mArrow.w ? mArrow.w/2 : -node.w/2; @ x1 = p.x + (p.r<rail ? node.w + Math.ceil(x1) : -x1); @ var y = miLineY(p); @ drawMergeLine(x0,y,x1,null); @ var x = p.x + (p.r<rail ? node.w : -mArrow.w); @ var cls = "arrow merge " + (p.r<rail ? "l" : "r"); @ drawBox(cls,null,x,y+(mLine.w-mArrow.h)/2); @ } @ function drawNode(p, btm){ @ if( p.u>0 ) drawUpArrow(p,rowinfo[p.u-1],p.fg); @ var cls = node.cls; @ if( p.mi.length ) cls += " merge"; @ if( p.f&1 ) cls += " leaf"; @ var n = drawBox(cls,p.bg,p.x,p.y); @ n.id = "tln"+p.id; @ n.onclick = clickOnNode; @ n.style.zIndex = 10; if( !omitDescenders ){ @ if( p.u==0 ) drawUpArrow(p,{x: p.x, y: -node.h},p.fg); @ if( p.d ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); } @ if( p.mo>=0 ){ @ var x0 = p.x + node.w/2; @ var x1 = p.mo*railPitch + node.w/2; @ var u = rowinfo[p.mu-1]; @ var y1 = miLineY(u); @ if( p.u<0 || p.mo!=p.r ){ @ x1 += mergeLines[p.mo] = -mLine.w/2; @ var y0 = p.y+2; @ if( p.r!=p.mo ) drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); @ drawMergeLine(x1,y0+mLine.w,null,y1); @ }else if( mergeOffset ){ @ mergeLines[p.mo] = u.r<p.r ? -mergeOffset-mLine.w : mergeOffset; @ x1 += mergeLines[p.mo]; @ drawMergeLine(x1,p.y+node.h/2,null,y1); @ }else{ @ delete mergeLines[p.mo]; @ } @ } @ for( var i=0; i<p.au.length; i+=2 ){ @ var rail = p.au[i]; @ var x0 = p.x + node.w/2; @ var x1 = rail*railPitch + (node.w-line.w)/2; @ if( x0<x1 ){ @ x0 = Math.ceil(x0); @ x1 += line.w; @ } @ var y0 = p.y + (node.h-line.w)/2; @ var u = rowinfo[p.au[i+1]-1]; @ if( u.id<p.id ){ @ drawLine(line,u.fg,x0,y0,x1,null); @ drawUpArrow(p,u,u.fg); @ }else{ @ var y1 = u.y + (node.h-line.w)/2; @ drawLine(wLine,u.fg,x0,y0,x1,null); @ drawLine(wLine,u.fg,x1-line.w,y0,null,y1+line.w); @ drawLine(wLine,u.fg,x1,y1,u.x-wArrow.w/2,null); @ var x = u.x-wArrow.w; @ var y = u.y+(node.h-wArrow.h)/2; @ var n = drawBox(wArrow.cls,null,x,y); @ if( u.fg ) n.style.borderLeftColor = u.fg; @ } @ } @ for( var i=0; i<p.mi.length; i++ ){ @ var rail = p.mi[i]; @ if( rail<0 ){ @ rail = -rail; @ mergeLines[rail] = -mLine.w/2; @ var x = rail*railPitch + (node.w-mLine.w)/2; @ drawMergeLine(x,miLineY(p),null,btm); @ } @ drawMergeArrow(p,rail); @ } @ } @ var mergeLines; @ function renderGraph(){ @ mergeLines = {}; @ canvasDiv.innerHTML = ""; @ var canvasY = absoluteY(canvasDiv); @ for( var i=0; i<rowinfo.length; i++ ){ @ rowinfo[i].y = absoluteY(gebi("m"+rowinfo[i].id)) - canvasY; @ rowinfo[i].x = rowinfo[i].r*railPitch; @ } @ var tlBtm = document.querySelector(".timelineBottom"); @ if( tlBtm.offsetHeight<node.h ){ @ tlBtm.style.height = node.h + "px"; @ } @ var btm = absoluteY(tlBtm) - canvasY + tlBtm.offsetHeight; @ for( var i=rowinfo.length-1; i>=0; i-- ){ @ drawNode(rowinfo[i], btm); @ } @ } @ var selRow; @ function clickOnNode(){ @ var p = rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-1]; @ if( !selRow ){ @ selRow = p; @ this.className += " sel"; @ canvasDiv.className += " sel"; @ }else if( selRow==p ){ @ selRow = null; @ this.className = this.className.replace(" sel", ""); @ canvasDiv.className = canvasDiv.className.replace(" sel", ""); @ }else{ if( fileDiff ){ @ location.href="%R/fdiff?v1="+selRow.h+"&v2="+p.h+"&sbs=1"; }else{ if( db_get_boolean("show-version-diffs", 0)==0 ){ @ location.href="%R/vdiff?from="+selRow.h+"&to="+p.h+"&sbs=0"; }else{ @ location.href="%R/vdiff?from="+selRow.h+"&to="+p.h+"&sbs=1"; } } @ } @ } @ var lastRow = gebi("m"+rowinfo[rowinfo.length-1].id); @ var lastY = 0; @ function checkHeight(){ @ var h = absoluteY(lastRow); @ if( h!=lastY ){ @ renderGraph(); @ lastY = h; @ } @ setTimeout(checkHeight, 1000); @ } @ initGraph(); @ checkHeight(); @ }())</script> } } /* ** Create a temporary table suitable for storing timeline data. */ static void timeline_temp_table(void){ |
︙ | ︙ |
Added test/contains-selector.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # # Copyright (c) 2015 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the Simplified BSD License (also # known as the "2-Clause License" or "FreeBSD License".) # # This program is distributed in the hope that it will be useful, # but without any warranty; without even the implied warranty of # merchantability or fitness for a particular purpose. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # ############################################################################ # # Test containsSelector() function in src/style.c # proc contains-selector {testId css selectorResultMap} { set css [string trim $css] set filename [file join $::tempPath compare-selector.css] set fh [open $filename w] puts -nonewline $fh $css close $fh foreach {selector found} $selectorResultMap { set expected "$selector [expr {$found ? "found" : "not found"}]" set result [fossil test-contains-selector $filename $selector] test "contains-selector $testId $selector" {$result eq $expected} } file delete $filename } contains-selector 1 { .a.b {} .c .de {} /* comment */ .c .d, .e /* comment */ {} } { .a 0 .b 0 .a.b 1 .c 0 .d 0 {.c.d} 0 {.c .d} 1 .e 1 } |