Exemplo n.º 1
0
CSSInlineLayoutAlignLine::CSSInlineLayoutAlignLine(CSSInlineLayout *layout, CSSInlineGeneratedBox *line, CSSLayoutGraphics *graphics, CSSResourceCache *resources, bool last_line)
	: graphics(graphics), resources(resources)
{
	segments_width = line->last_child->x + line->last_child->width - line->first_child->x;
	extra_total = max(0, line->width - segments_width);
	offset_x = 0;
	word_count = 0;
	word_index = 0;
	if (layout->get_element_node()->computed_values.get_text_inherit().text_align.type == CSSValueTextAlign::type_right)
	{
		offset_x = extra_total;
	}
	else if (layout->get_element_node()->computed_values.get_text_inherit().text_align.type == CSSValueTextAlign::type_center)
	{
		offset_x = extra_total / 2;
	}
	else if (layout->get_element_node()->computed_values.get_text_inherit().text_align.type == CSSValueTextAlign::type_justify && !last_line)
	{
		word_count = find_word_count(line);
	}

	start_of_line = true;
	prev_space = true;
	baseline_y = line->y + (line->height - line->ascent - line->descent) / 2 + line->ascent;
}
Exemplo n.º 2
0
void log_ioa(const struct io_activity *ioa)
{
        int i;
        LOG("%s, bytes to transfer: %d, delta count: %d", ioa->rw? "W" : "R", ioa->data_size, ioa->delta_count);

        for (i = 0; i < ioa->delta_count; ++i) {
                int count;
                struct block_delta *delta = &ioa->deltas[i];
                LOG("bv #%d: len %d, offset %d, %d sectors (%d..%d) or %d blocks (%d..%d)",
                    i, delta->size, delta->offset,
                    get_sectors_count(delta), delta->start_sector, delta->end_sector,
                    get_blocks_count(delta), get_start_block(delta), get_end_block(delta));
                count = find_word_count("DAMN", delta->data, delta->size);
                if (count > 0) LOG("Found DAMN from deltas %d times", count);
        }
}
Exemplo n.º 3
0
static int fill_delta(struct block_delta *delta, const struct bio *bio, bvec_iter iter, const int start_sector)
{
    int count;
    int next_sector;
    char *data;

    delta->start_sector = start_sector;
    delta->size = bio_iter_len(bio, iter);
    next_sector = get_next_sector(delta);
    delta->end_sector = next_sector - 1;
    delta->offset = bio_iter_offset(bio, iter);

    data = kmap(bio_iter_page(bio, iter));
    count = find_word_count("DAMN", data, PAGE_SIZE);
    if (count > 0) LOG("Found DAMN from page %d times", count);
    delta->data = vmalloc(delta->size);
    if (delta->data != NULL) memcpy(delta->data, data + delta->offset, delta->size);

    kunmap(bio_iter_page(bio, iter));
    return (delta->data != NULL)? next_sector : -1;
}