void LayoutSVGInline::absoluteQuads(Vector<FloatQuad>& quads) const { const LayoutSVGText* textRoot = LayoutSVGText::locateLayoutSVGTextAncestor(this); if (!textRoot) return; FloatRect textBoundingBox = textRoot->strokeBoundingBox(); for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) quads.append( localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x().toFloat(), textBoundingBox.y() + box->y().toFloat(), box->logicalWidth().toFloat(), box->logicalHeight().toFloat()), false)); }
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) { RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this); if (!object) return; FloatRect textBoundingBox = object->strokeBoundingBox(); for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), false, wasFixed)); }
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const { auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this); if (!textAncestor) return; FloatRect textBoundingBox = textAncestor->strokeBoundingBox(); for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), UseTransforms, wasFixed)); }
void SnapToLinesLayouter::layout() { // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings // Step 13, "If cue's text track cue snap-to-lines flag is set". InlineFlowBox* firstLineBox = findFirstLineBox(); if (!firstLineBox) return; // Steps 1-3 skipped. // 4. Horizontal: Let step be the height of the first line box in boxes. // Vertical: Let step be the width of the first line box in boxes. LayoutUnit step = firstLineBox->logicalHeight(); // 5. If step is zero, then jump to the step labeled done positioning below. if (!step) return; // Steps 6-11. LayoutUnit positionAdjustment = computeInitialPositionAdjustment(step); // 12. Move all boxes in boxes ... // Horizontal: ... down by the distance given by position // Vertical: ... right by the distance given by position moveBoxesBy(positionAdjustment); // 13. Remember the position of all the boxes in boxes as their specified // position. m_specifiedPosition = m_cueBox.location(); // 14. Let best position be null. It will hold a position for boxes, much // like specified position in the previous step. // 15. Let best position score be null. // 16. Let switched be false. bool switched = false; // Step 17 skipped. (margin == 0; title area == video area) // 18. Step loop: If none of the boxes in boxes would overlap any of the // boxes in output, and all of the boxes in output are entirely within the // title area box, then jump to the step labeled done positioning below. while (isOutside() || isOverlapping()) { // 19. Let current position score be the percentage of the area of the // bounding box of the boxes in boxes that is outside the title area // box. // 20. If best position is null (i.e. this is the first run through // this loop, switched is still false, the boxes in boxes are at their // specified position, and best position score is still null), or if // current position score is a lower percentage than that in best // position score, then remember the position of all the boxes in boxes // as their best position, and set best position score to current // position score. if (!shouldSwitchDirection(firstLineBox, step)) { // 22. Horizontal: Move all the boxes in boxes down by the distance // given by step. (If step is negative, then this will actually // result in an upwards movement of the boxes in absolute terms.) // Vertical: Move all the boxes in boxes right by the distance // given by step. (If step is negative, then this will actually // result in a leftwards movement of the boxes in absolute terms.) moveBoxesBy(step); // 23. Jump back to the step labeled step loop. continue; } // 24. Switch direction: If switched is true, then move all the boxes in // boxes back to their best position, and jump to the step labeled done // positioning below. // 25. Otherwise, move all the boxes in boxes back to their specified // position as determined in the earlier step. m_cueBox.setLocation(m_specifiedPosition); // XX. If switched is true, jump to the step labeled done // positioning below. if (switched) break; // 26. Negate step. step = -step; // 27. Set switched to true. switched = true; // 28. Jump back to the step labeled step loop. } }