void MultiColumnFragmentainerGroup::columnIntervalForVisualRect( const LayoutRect& rect, unsigned& firstColumn, unsigned& lastColumn) const { bool isColumnProgressionInline = m_columnSet.multiColumnFlowThread()->progressionIsInline(); bool isFlippedColumnProgression = !m_columnSet.style()->isLeftToRightDirection() && isColumnProgressionInline; if (m_columnSet.isHorizontalWritingMode() == isColumnProgressionInline) { if (isFlippedColumnProgression) { firstColumn = columnIndexAtVisualPoint(rect.maxXMinYCorner()); lastColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); } else { firstColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); lastColumn = columnIndexAtVisualPoint(rect.maxXMinYCorner()); } } else { if (isFlippedColumnProgression) { firstColumn = columnIndexAtVisualPoint(rect.minXMaxYCorner()); lastColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); } else { firstColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); lastColumn = columnIndexAtVisualPoint(rect.minXMaxYCorner()); } } ASSERT(firstColumn <= lastColumn); }
static LayoutPoint cornerPointOfRect(LayoutRect rect, Corner whichCorner) { switch (whichCorner) { case Corner::TopLeft: return rect.minXMinYCorner(); case Corner::TopRight: return rect.maxXMinYCorner(); } ASSERT_NOT_REACHED(); return LayoutPoint(); }
LayoutRect RenderSnapshottedPlugIn::tryToFitStartLabel(LabelSize size, const LayoutRect& contentBox) const { Image* labelImage = startLabelImage(size); if (!labelImage) return LayoutRect(); // Assume that the labelImage has been provided to match our device scale. float scaleFactor = 1; if (document()->page()) scaleFactor = document()->page()->deviceScaleFactor(); IntSize labelImageSize = labelImage->size(); labelImageSize.scale(1 / (scaleFactor ? scaleFactor : 1)); LayoutSize labelSize = labelImageSize - LayoutSize(2 * startLabelInset, 2 * startLabelInset); LayoutRect candidateRect(contentBox.maxXMinYCorner() + LayoutSize(-startLabelPadding, startLabelPadding) + LayoutSize(-labelSize.width(), 0), labelSize); // The minimum allowed content box size is the label image placed in the center of the box, surrounded by startLabelPadding. if (candidateRect.x() < startLabelPadding || candidateRect.maxY() > contentBox.height() - startLabelPadding) return LayoutRect(); return candidateRect; }