本文整理汇总了C++中LayoutBox类的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBox类的具体用法?C++ LayoutBox怎么用?C++ LayoutBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayoutBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isOutOfFlowPositioned
void LayoutImage::computeIntrinsicSizingInfo(
IntrinsicSizingInfo& intrinsicSizingInfo) const {
LayoutReplaced::computeIntrinsicSizingInfo(intrinsicSizingInfo);
// Our intrinsicSize is empty if we're laying out generated images with
// relative width/height. Figure out the right intrinsic size to use.
if (intrinsicSizingInfo.size.isEmpty() &&
m_imageResource->imageHasRelativeSize()) {
LayoutObject* containingBlock =
isOutOfFlowPositioned() ? container() : this->containingBlock();
if (containingBlock->isBox()) {
LayoutBox* box = toLayoutBox(containingBlock);
intrinsicSizingInfo.size.setWidth(box->availableLogicalWidth().toFloat());
intrinsicSizingInfo.size.setHeight(
box->availableLogicalHeight(IncludeMarginBorderPadding).toFloat());
}
}
// Don't compute an intrinsic ratio to preserve historical WebKit behavior if
// we're painting alt text and/or a broken image.
// Video is excluded from this behavior because video elements have a default
// aspect ratio that a failed poster image load should not override.
if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) {
intrinsicSizingInfo.aspectRatio = FloatSize(1, 1);
return;
}
}
示例2: determineBackgroundBleedAvoidance
BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(const LayoutBox& layoutBox)
{
if (layoutBox.isDocumentElement())
return BackgroundBleedNone;
if (!hasBackground)
return BackgroundBleedNone;
const ComputedStyle& boxStyle = layoutBox.styleRef();
const bool hasBorderRadius = boxStyle.hasBorderRadius();
if (!hasBorderDecoration || !hasBorderRadius || layoutBox.canRenderBorderImage()) {
if (layoutBox.backgroundShouldAlwaysBeClipped())
return BackgroundBleedClipOnly;
// Border radius clipping may require layer bleed avoidance if we are going to draw
// an image over something else, because we do not want the antialiasing to lead to bleeding
if (boxStyle.hasBackgroundImage() && hasBorderRadius) {
// But if the top layer is opaque for the purposes of background painting, we do not
// need the bleed avoidance because we will not paint anything behind the top layer.
// But only if we need to draw something underneath.
const FillLayer& fillLayer = layoutBox.style()->backgroundLayers();
if ((backgroundColor.alpha() || fillLayer.next()) && !BoxPainter::isFillLayerOpaque(fillLayer, layoutBox))
return BackgroundBleedClipLayer;
}
return BackgroundBleedNone;
}
if (borderObscuresBackgroundEdge(boxStyle))
return BackgroundBleedShrinkBackground;
return BackgroundBleedClipLayer;
}
示例3: ASSERT
void LayoutMultiColumnFlowThread::skipColumnSpanner(LayoutBox* layoutObject, LayoutUnit logicalTopInFlowThread)
{
ASSERT(layoutObject->isColumnSpanAll());
LayoutMultiColumnSpannerPlaceholder* placeholder = layoutObject->spannerPlaceholder();
LayoutBox* previousColumnBox = placeholder->previousSiblingMultiColumnBox();
if (previousColumnBox && previousColumnBox->isLayoutMultiColumnSet()) {
LayoutMultiColumnSet* columnSet = toLayoutMultiColumnSet(previousColumnBox);
if (logicalTopInFlowThread < columnSet->logicalTopInFlowThread())
logicalTopInFlowThread = columnSet->logicalTopInFlowThread(); // Negative margins may cause this.
columnSet->endFlow(logicalTopInFlowThread);
}
LayoutBox* nextColumnBox = placeholder->nextSiblingMultiColumnBox();
if (nextColumnBox && nextColumnBox->isLayoutMultiColumnSet()) {
LayoutMultiColumnSet* nextSet = toLayoutMultiColumnSet(nextColumnBox);
m_lastSetWorkedOn = nextSet;
nextSet->beginFlow(logicalTopInFlowThread);
}
// We'll lay out of spanners after flow thread layout has finished (during layout of the spanner
// placeholders). There may be containing blocks for out-of-flow positioned descendants of the
// spanner in the flow thread, so that out-of-flow objects inside the spanner will be laid out
// as part of flow thread layout (even if the spanner itself won't). We need to add such
// out-of-flow positioned objects to their containing blocks now, or they'll never get laid
// out. Since it's non-trivial to determine if we need this, and where such out-of-flow objects
// might be, just go through the whole subtree.
for (LayoutObject* descendant = layoutObject->slowFirstChild(); descendant; descendant = descendant->nextInPreOrder()) {
if (descendant->isBox() && descendant->isOutOfFlowPositioned())
descendant->containingBlock()->insertPositionedObject(toLayoutBox(descendant));
}
}
示例4: enclosingFragmentationContext
void LayoutMultiColumnFlowThread::layoutColumns(SubtreeLayoutScope& layoutScope)
{
// Since we ended up here, it means that the multicol container (our parent) needed
// layout. Since contents of the multicol container are diverted to the flow thread, the flow
// thread needs layout as well.
layoutScope.setChildNeedsLayout(this);
m_blockOffsetInEnclosingFragmentationContext = enclosingFragmentationContext() ? multiColumnBlockFlow()->offsetFromLogicalTopOfFirstPage() : LayoutUnit();
for (LayoutBox* columnBox = firstMultiColumnBox(); columnBox; columnBox = columnBox->nextSiblingMultiColumnBox()) {
if (!columnBox->isLayoutMultiColumnSet()) {
ASSERT(columnBox->isLayoutMultiColumnSpannerPlaceholder()); // no other type is expected.
continue;
}
LayoutMultiColumnSet* columnSet = toLayoutMultiColumnSet(columnBox);
layoutScope.setChildNeedsLayout(columnSet);
if (!m_columnHeightsChanged) {
// This is the initial layout pass. We need to reset the column height, because contents
// typically have changed.
columnSet->resetColumnHeight();
}
// Since column sets are regular block flow objects, and their position is changed in
// regular block layout code (with no means for the multicol code to notice unless we add
// hooks there), store the previous position now. If it changes in the imminent layout
// pass, we may have to rebalance its columns.
columnSet->storeOldPosition();
}
m_columnHeightsChanged = false;
invalidateColumnSets();
layout();
validateColumnSets();
}
示例5: ASSERT
void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
{
ASSERT(style()->display() == TABLE_ROW);
LayoutBox::styleDidChange(diff, oldStyle);
propagateStyleToAnonymousChildren();
if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHeight())
section()->rowLogicalHeightChanged(this);
// If border was changed, notify table.
if (parent()) {
LayoutTable* table = this->table();
if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
table->invalidateCollapsedBorders();
if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->collapseBorders() && borderWidthChanged(oldStyle, style())) {
// If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
// This only happens when borders are collapsed, since they end up affecting the border sides of the cell
// itself.
for (LayoutBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
if (!childBox->isTableCell())
continue;
childBox->setChildNeedsLayout();
}
}
}
}
示例6: innerEditorElement
void LayoutTextControlSingleLine::autoscroll(const IntPoint& position) {
LayoutBox* layoutObject = innerEditorElement()->layoutBox();
if (!layoutObject)
return;
layoutObject->autoscroll(position);
}
示例7: canvas
void CanvasRenderingContext2D::scrollPathIntoViewInternal(const Path& path) {
if (!state().isTransformInvertible() || path.isEmpty())
return;
canvas()->document().updateStyleAndLayoutIgnorePendingStylesheets();
LayoutObject* renderer = canvas()->layoutObject();
LayoutBox* layoutBox = canvas()->layoutBox();
if (!renderer || !layoutBox)
return;
// Apply transformation and get the bounding rect
Path transformedPath = path;
transformedPath.transform(state().transform());
FloatRect boundingRect = transformedPath.boundingRect();
// Offset by the canvas rect
LayoutRect pathRect(boundingRect);
IntRect canvasRect = layoutBox->absoluteContentBox();
pathRect.moveBy(canvasRect.location());
renderer->scrollRectToVisible(pathRect, ScrollAlignment::alignCenterAlways,
ScrollAlignment::alignTopAlways);
// TODO: should implement "inform the user" that the caret and/or
// selection the specified rectangle of the canvas. See
// http://crbug.com/357987
}
示例8: TEST_F
TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv)
{
registerMockedHttpURLLoad("fractional-scroll-div.html");
navigateTo(m_baseURL + "fractional-scroll-div.html");
forceFullCompositingUpdate();
Document* document = frame()->document();
Element* scrollableElement = document->getElementById("scroller");
ASSERT(scrollableElement);
scrollableElement->setScrollTop(1.0);
scrollableElement->setScrollLeft(1.0);
forceFullCompositingUpdate();
// Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated
// to compositor.
scrollableElement->setScrollTop(1.2);
scrollableElement->setScrollLeft(1.2);
forceFullCompositingUpdate();
LayoutObject* layoutObject = scrollableElement->layoutObject();
ASSERT_TRUE(layoutObject->isBox());
LayoutBox* box = toLayoutBox(layoutObject);
ASSERT_TRUE(box->usesCompositedScrolling());
CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
ASSERT(compositedLayerMapping->scrollingContentsLayer());
WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
ASSERT_TRUE(webScrollLayer);
ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01);
ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01);
}
示例9: LayoutRect
void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (m_layoutFieldset.style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
return;
LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size());
LayoutBox* legend = m_layoutFieldset.findInFlowLegend();
if (!legend)
return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset);
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutFieldset, paintInfo.phase, paintOffset))
return;
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit() : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
paintRect.expand(LayoutUnit(), -yOff);
paintRect.move(LayoutUnit(), yOff);
} else {
LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit() : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
paintRect.expand(-xOff, LayoutUnit());
paintRect.move(xOff, LayoutUnit());
}
LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, paintInfo.phase, paintRect, paintOffset);
BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect);
}
示例10: LayoutBox
LayoutBox* LayoutBox::create() {
LayoutBox* ret = new LayoutBox();
if (ret->init())
return ret;
else
return NULL;
}
示例11: ASSERT
HTMLAreaElement* HitTestResult::imageAreaForImage() const
{
ASSERT(m_innerNode);
HTMLImageElement* imageElement = nullptr;
if (isHTMLImageElement(m_innerNode)) {
imageElement = toHTMLImageElement(m_innerNode);
} else if (m_innerNode->isInShadowTree()) {
if (m_innerNode->containingShadowRoot()->type() == ShadowRootType::UserAgent) {
if (isHTMLImageElement(m_innerNode->shadowHost()))
imageElement = toHTMLImageElement(m_innerNode->shadowHost());
}
}
if (!imageElement || !imageElement->layoutObject() || !imageElement->layoutObject()->isBox())
return nullptr;
HTMLMapElement* map = imageElement->treeScope().getImageMap(imageElement->fastGetAttribute(usemapAttr));
if (!map)
return nullptr;
LayoutBox* box = toLayoutBox(imageElement->layoutObject());
LayoutRect contentBox = box->contentBoxRect();
float scaleFactor = 1 / box->style()->effectiveZoom();
LayoutPoint location = localPoint();
location.scale(scaleFactor, scaleFactor);
return map->areaForPoint(location, contentBox.size());
}
示例12: perspectiveOrigin
static FloatPoint perspectiveOrigin(const LayoutBox& box) {
const ComputedStyle& style = box.styleRef();
FloatSize borderBoxSize(box.size());
return FloatPoint(
floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()),
floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height()));
}
示例13: Init
bool Init() override
{
m_commonGUIStyle = g_commonGUIStyle;
m_canvas = Utility::MakeRef(new Canvas());
// Load textures for song select
m_style = SongSelectStyle::Get(g_application);
// Split between statistics and selection wheel (in percentage)
const float screenSplit = 0.4f;
// Statistics window
m_statisticsWindow = Ref<SongStatistics>(new SongStatistics(m_style));
Canvas::Slot* statisticsSlot = m_canvas->Add(m_statisticsWindow.As<GUIElementBase>());
statisticsSlot->anchor = Anchor(0, 0, screenSplit, 1.0f);
statisticsSlot->SetZOrder(2);
// Background
Panel* background = new Panel();
background->imageFillMode = FillMode::Fill;
background->texture = g_application->LoadTexture("bg.png");
background->color = Color(0.5f);
Canvas::Slot* bgSlot = m_canvas->Add(background->MakeShared());
bgSlot->anchor = Anchors::Full;
bgSlot->SetZOrder(-2);
LayoutBox* box = new LayoutBox();
Canvas::Slot* boxSlot = m_canvas->Add(box->MakeShared());
boxSlot->anchor = Anchor(screenSplit, 0, 1.0f, 1.0f);
box->layoutDirection = LayoutBox::Vertical;
{
m_searchField = Ref<TextInputField>(new TextInputField(m_commonGUIStyle));
LayoutBox::Slot* searchFieldSlot = box->Add(m_searchField.As<GUIElementBase>());
searchFieldSlot->fillX = true;
m_searchField->OnTextUpdated.Add(this, &SongSelect_Impl::OnSearchTermChanged);
m_selectionWheel = Ref<SelectionWheel>(new SelectionWheel(m_style));
LayoutBox::Slot* selectionSlot = box->Add(m_selectionWheel.As<GUIElementBase>());
selectionSlot->fillY = true;
m_selectionWheel->OnMapSelected.Add(this, &SongSelect_Impl::OnMapSelected);
m_selectionWheel->OnDifficultySelected.Add(this, &SongSelect_Impl::OnDifficultySelected);
}
// Select interface sound
m_selectSound = g_audio->CreateSample("audio/menu_click.wav");
// Setup the map database
m_mapDatabase.AddSearchPath(g_gameConfig.GetString(GameConfigKeys::SongFolder));
m_mapDatabase.OnMapsAdded.Add(m_selectionWheel.GetData(), &SelectionWheel::OnMapsAdded);
m_mapDatabase.OnMapsUpdated.Add(m_selectionWheel.GetData(), &SelectionWheel::OnMapsUpdated);
m_mapDatabase.OnMapsRemoved.Add(m_selectionWheel.GetData(), &SelectionWheel::OnMapsRemoved);
m_mapDatabase.OnMapsCleared.Add(m_selectionWheel.GetData(), &SelectionWheel::OnMapsCleared);
m_mapDatabase.StartSearching();
m_selectionWheel->SelectRandom();
return true;
}
示例14: getShapeImageMarginRect
static LayoutRect getShapeImageMarginRect(const LayoutBox& layoutBox, const LayoutSize& referenceBoxLogicalSize)
{
LayoutPoint marginBoxOrigin(-layoutBox.marginLogicalLeft() - layoutBox.borderAndPaddingLogicalLeft(), -layoutBox.marginBefore() - layoutBox.borderBefore() - layoutBox.paddingBefore());
LayoutSize marginBoxSizeDelta(layoutBox.marginLogicalWidth() + layoutBox.borderAndPaddingLogicalWidth(), layoutBox.marginLogicalHeight() + layoutBox.borderAndPaddingLogicalHeight());
LayoutSize marginRectSize(referenceBoxLogicalSize + marginBoxSizeDelta);
marginRectSize.clampNegativeToZero();
return LayoutRect(marginBoxOrigin, marginRectSize);
}
示例15: transformOrigin
static FloatPoint3D transformOrigin(const LayoutBox& box) {
const ComputedStyle& style = box.styleRef();
FloatSize borderBoxSize(box.size());
return FloatPoint3D(
floatValueForLength(style.transformOriginX(), borderBoxSize.width()),
floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
style.transformOriginZ());
}