本文整理汇总了C++中LayoutObject::isBox方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutObject::isBox方法的具体用法?C++ LayoutObject::isBox怎么用?C++ LayoutObject::isBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutObject
的用法示例。
在下文中一共展示了LayoutObject::isBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAutoscrollLayoutObject
void AutoscrollController::updateAutoscrollLayoutObject() {
if (!m_autoscrollLayoutObject)
return;
LayoutObject* layoutObject = m_autoscrollLayoutObject;
if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) {
HitTestResult hitTest =
layoutObject->frame()->eventHandler().hitTestResultAtPoint(
m_middleClickAutoscrollStartPos,
HitTestRequest::ReadOnly | HitTestRequest::Active);
if (Node* nodeAtPoint = hitTest.innerNode())
layoutObject = nodeAtPoint->layoutObject();
}
while (layoutObject &&
!(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll()))
layoutObject = layoutObject->parent();
m_autoscrollLayoutObject = layoutObject && layoutObject->isBox()
? toLayoutBox(layoutObject)
: nullptr;
if (m_autoscrollType != NoAutoscroll && !m_autoscrollLayoutObject)
m_autoscrollType = NoAutoscroll;
}
示例2: registerMockedHttpURLLoad
TEST_F(ScrollingCoordinatorTest, overflowHidden)
{
registerMockedHttpURLLoad("overflow-hidden.html");
navigateTo(m_baseURL + "overflow-hidden.html");
forceFullCompositingUpdate();
// Verify the properties of the accelerated scrolling element starting from the LayoutObject
// all the way to the WebLayer.
Element* overflowElement = frame()->document()->getElementById("unscrollable-y");
ASSERT(overflowElement);
LayoutObject* layoutObject = overflowElement->layoutObject();
ASSERT_TRUE(layoutObject->isBox());
ASSERT_TRUE(layoutObject->hasLayer());
LayoutBox* box = toLayoutBox(layoutObject);
ASSERT_TRUE(box->usesCompositedScrolling());
ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
ASSERT(compositedLayerMapping->scrollingContentsLayer());
GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
ASSERT_TRUE(webScrollLayer->scrollable());
ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
ASSERT_FALSE(webScrollLayer->userScrollableVertical());
overflowElement = frame()->document()->getElementById("unscrollable-x");
ASSERT(overflowElement);
layoutObject = overflowElement->layoutObject();
ASSERT_TRUE(layoutObject->isBox());
ASSERT_TRUE(layoutObject->hasLayer());
box = toLayoutBox(layoutObject);
ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling());
ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
compositedLayerMapping = box->layer()->compositedLayerMapping();
ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
ASSERT(compositedLayerMapping->scrollingContentsLayer());
graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
ASSERT_TRUE(webScrollLayer->scrollable());
ASSERT_FALSE(webScrollLayer->userScrollableHorizontal());
ASSERT_TRUE(webScrollLayer->userScrollableVertical());
}
示例3: computeIntrinsicSizingInfo
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;
}
}
示例4: updateOverflowClip
void PaintPropertyTreeBuilder::updateOverflowClip(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isBox())
return;
const LayoutBox& box = toLayoutBox(object);
// The <input> elements can't have contents thus CSS overflow property doesn't apply.
// However for layout purposes we do generate child layout objects for them, e.g. button label.
// We should clip the overflow from those children. This is called control clip and we
// technically treat them like overflow clip.
LayoutRect clipRect;
if (box.hasControlClip())
clipRect = box.controlClipRect(context.paintOffset);
else if (box.hasOverflowClip())
clipRect = box.overflowClipRect(context.paintOffset);
else
return;
RefPtr<ClipPaintPropertyNode> borderRadiusClip;
if (box.styleRef().hasBorderRadius()) {
auto innerBorder = box.styleRef().getRoundedInnerBorderFor(
LayoutRect(context.paintOffset, box.size()));
borderRadiusClip = ClipPaintPropertyNode::create(
context.currentTransform, innerBorder, context.currentClip);
}
RefPtr<ClipPaintPropertyNode> overflowClip = ClipPaintPropertyNode::create(
context.currentTransform,
FloatRoundedRect(FloatRect(clipRect)),
borderRadiusClip ? borderRadiusClip.release() : context.currentClip);
context.currentClip = overflowClip.get();
object.getMutableForPainting().ensureObjectPaintProperties().setOverflowClip(overflowClip.release());
}
示例5: if
static PassRefPtr<ClipPaintPropertyNode> createOverflowClipIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isBox())
return nullptr;
const LayoutBox& box = toLayoutBox(object);
// The <input> elements can't have contents thus CSS overflow property doesn't apply.
// However for layout purposes we do generate child layout objects for them, e.g. button label.
// We should clip the overflow from those children. This is called control clip and we
// technically treat them like overflow clip.
LayoutRect clipRect;
if (box.hasControlClip())
clipRect = box.controlClipRect(context.paintOffset);
else if (box.hasOverflowClip())
clipRect = box.overflowClipRect(context.paintOffset);
else
return nullptr;
RefPtr<ClipPaintPropertyNode> newClipNodeForBorderRadiusClip;
const ComputedStyle& style = box.styleRef();
if (style.hasBorderRadius()) {
newClipNodeForBorderRadiusClip = ClipPaintPropertyNode::create(
context.currentTransform,
style.getRoundedInnerBorderFor(LayoutRect(context.paintOffset, box.size())),
context.currentClip);
}
RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = ClipPaintPropertyNode::create(
context.currentTransform,
FloatRoundedRect(FloatRect(clipRect)),
newClipNodeForBorderRadiusClip ? newClipNodeForBorderRadiusClip.release() : context.currentClip);
context.currentClip = newClipNodeForOverflowClip.get();
return newClipNodeForOverflowClip.release();
}
示例6: skipColumnSpanner
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));
}
}
示例7: updatePerspective
void PaintPropertyTreeBuilder::updatePerspective(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
const ComputedStyle& style = object.styleRef();
if (object.isBox() && style.hasPerspective()) {
// The perspective node must not flatten (else nothing will get
// perspective), but it should still extend the rendering context as
// most transform nodes do.
TransformationMatrix matrix =
TransformationMatrix().applyPerspective(style.perspective());
FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) +
toLayoutSize(context.current.paintOffset);
object.getMutableForPainting().ensurePaintProperties().updatePerspective(
context.current.transform, matrix, origin,
context.current.shouldFlattenInheritedTransform,
context.current.renderingContextID);
} else {
if (auto* properties = object.getMutableForPainting().paintProperties())
properties->clearPerspective();
}
const auto* properties = object.paintProperties();
if (properties && properties->perspective()) {
context.current.transform = properties->perspective();
context.current.shouldFlattenInheritedTransform = false;
}
}
示例8: showInternal
bool ExternalPopupMenu::showInternal()
{
// Blink core reuses the PopupMenu of an element. For simplicity, we do
// recreate the actual external popup everytime.
if (m_webExternalPopupMenu) {
m_webExternalPopupMenu->close();
m_webExternalPopupMenu = 0;
}
WebPopupMenuInfo info;
getPopupMenuInfo(info, *m_ownerElement);
if (info.items.isEmpty())
return false;
WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(m_localFrame.get());
m_webExternalPopupMenu = webframe->client()->createExternalPopupMenu(info, this);
if (m_webExternalPopupMenu) {
LayoutObject* layoutObject = m_ownerElement->layoutObject();
if (!layoutObject || !layoutObject->isBox())
return false;
FloatQuad quad(toLayoutBox(layoutObject)->localToAbsoluteQuad(FloatQuad(toLayoutBox(layoutObject)->borderBoundingBox())));
IntRect rect(quad.enclosingBoundingBox());
IntRect rectInViewport = m_localFrame->view()->soonToBeRemovedContentsToUnscaledViewport(rect);
// TODO(tkent): If the anchor rectangle is not visible, we should not
// show a popup.
m_webExternalPopupMenu->show(rectInViewport);
m_shownDOMTreeVersion = m_ownerElement->document().domTreeVersion();
return true;
} else {
// The client might refuse to create a popup (when there is already one pending to be shown for example).
didCancel();
return false;
}
}
示例9: createTransformIfNeeded
static PassRefPtr<TransformPaintPropertyNode> createTransformIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (object.isSVG() && !object.isSVGRoot()) {
const AffineTransform& transform = object.localToParentTransform();
if (transform.isIdentity())
return nullptr;
// SVG's transform origin is baked into the localToParentTransform.
RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = TransformPaintPropertyNode::create(
transform, FloatPoint3D(0, 0, 0), context.currentTransform);
context.currentTransform = newTransformNodeForTransform.get();
return newTransformNodeForTransform.release();
}
const ComputedStyle& style = object.styleRef();
if (!object.isBox() || !style.hasTransform())
return nullptr;
ASSERT(context.paintOffset == LayoutPoint());
TransformationMatrix matrix;
style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::ExcludeTransformOrigin,
ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = TransformPaintPropertyNode::create(
matrix, transformOrigin(toLayoutBox(object)), context.currentTransform);
context.currentTransform = newTransformNodeForTransform.get();
return newTransformNodeForTransform.release();
}
示例10: updateTransform
void PaintPropertyTreeBuilder::updateTransform(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (object.isSVG() && !object.isSVGRoot()) {
// SVG does not use paint offset internally.
DCHECK(context.paintOffset == LayoutPoint());
// FIXME(pdr): Check for the presence of a transform instead of the value. Checking for an
// identity matrix will cause the property tree structure to change during animations if
// the animation passes through the identity matrix.
// FIXME(pdr): Refactor this so all non-root SVG objects use the same transform function.
const AffineTransform& transform = object.isSVGForeignObject() ? object.localSVGTransform() : object.localToSVGParentTransform();
if (transform.isIdentity())
return;
// The origin is included in the local transform, so use an empty origin.
RefPtr<TransformPaintPropertyNode> svgTransform = TransformPaintPropertyNode::create(
transform, FloatPoint3D(0, 0, 0), context.currentTransform);
context.currentTransform = svgTransform.get();
object.getMutableForPainting().ensureObjectPaintProperties().setTransform(svgTransform.release());
return;
}
const ComputedStyle& style = object.styleRef();
if (!object.isBox() || !style.hasTransform())
return;
TransformationMatrix matrix;
style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::ExcludeTransformOrigin,
ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
RefPtr<TransformPaintPropertyNode> transformNode = TransformPaintPropertyNode::create(
matrix, transformOrigin(toLayoutBox(object)), context.currentTransform);
context.currentTransform = transformNode.get();
object.getMutableForPainting().ensureObjectPaintProperties().setTransform(transformNode.release());
}
示例11: getParentOfFirstLineBox
static LayoutObject* getParentOfFirstLineBox(LayoutBlockFlow* curr, LayoutObject* marker)
{
LayoutObject* firstChild = curr->firstChild();
if (!firstChild)
return nullptr;
bool inQuirksMode = curr->document().inQuirksMode();
for (LayoutObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) {
if (currChild == marker)
continue;
if (currChild->isInline() && (!currChild->isLayoutInline() || curr->generatesLineBoxesForInlineChild(currChild)))
return curr;
if (currChild->isFloating() || currChild->isOutOfFlowPositioned())
continue;
if (!currChild->isLayoutBlockFlow() || (currChild->isBox() && toLayoutBox(currChild)->isWritingModeRoot()))
break;
if (curr->isListItem() && inQuirksMode && currChild->node()
&& (isHTMLUListElement(*currChild->node()) || isHTMLOListElement(*currChild->node())))
break;
LayoutObject* lineBox = getParentOfFirstLineBox(toLayoutBlockFlow(currChild), marker);
if (lineBox)
return lineBox;
}
return nullptr;
}
示例12: toLayoutBox
static inline bool fullyClipsContents(Node* node)
{
LayoutObject* renderer = node->layoutObject();
if (!renderer || !renderer->isBox() || !renderer->hasOverflowClip())
return false;
return toLayoutBox(renderer)->size().isEmpty();
}
示例13: firstLineBoxBaseline
int LayoutTextControl::firstLineBoxBaseline() const {
int result = LayoutBlock::firstLineBoxBaseline();
if (result != -1)
return result;
// When the text is empty, |LayoutBlock::firstLineBoxBaseline()| cannot
// compute the baseline because lineboxes do not exist.
Element* innerEditor = innerEditorElement();
if (!innerEditor || !innerEditor->layoutObject())
return -1;
LayoutBlock* innerEditorLayoutObject =
toLayoutBlock(innerEditor->layoutObject());
const SimpleFontData* fontData =
innerEditorLayoutObject->style(true)->font().primaryFont();
DCHECK(fontData);
if (!fontData)
return -1;
LayoutUnit baseline(fontData->getFontMetrics().ascent(AlphabeticBaseline));
for (LayoutObject* box = innerEditorLayoutObject; box && box != this;
box = box->parent()) {
if (box->isBox())
baseline += toLayoutBox(box)->logicalTop();
}
return baseline.toInt();
}
示例14: paintMenuList
bool ThemePainterDefault::paintMenuList(const LayoutObject& o,
const PaintInfo& i,
const IntRect& rect) {
if (!o.isBox())
return false;
WebThemeEngine::ExtraParams extraParams;
const LayoutBox& box = toLayoutBox(o);
// Match Chromium Win behaviour of showing all borders if any are shown.
extraParams.menuList.hasBorder = box.borderRight() || box.borderLeft() ||
box.borderTop() || box.borderBottom();
extraParams.menuList.hasBorderRadius = o.styleRef().hasBorderRadius();
// Fallback to transparent if the specified color object is invalid.
Color backgroundColor(Color::transparent);
if (o.styleRef().hasBackground())
backgroundColor = o.resolveColor(CSSPropertyBackgroundColor);
extraParams.menuList.backgroundColor = backgroundColor.rgb();
// If we have a background image, don't fill the content area to expose the
// parent's background. Also, we shouldn't fill the content area if the
// alpha of the color is 0. The API of Windows GDI ignores the alpha.
// FIXME: the normal Aura theme doesn't care about this, so we should
// investigate if we really need fillContentArea.
extraParams.menuList.fillContentArea =
!o.styleRef().hasBackgroundImage() && backgroundColor.alpha();
setupMenuListArrow(box, rect, extraParams);
WebCanvas* canvas = i.context.canvas();
Platform::current()->themeEngine()->paint(
canvas, WebThemeEngine::PartMenuList, getWebThemeState(o), WebRect(rect),
&extraParams);
return false;
}
示例15: didEnterFullscreenForElement
void Fullscreen::didEnterFullscreenForElement(Element* element) {
DCHECK(element);
if (!document()->isActive())
return;
if (m_fullScreenLayoutObject)
m_fullScreenLayoutObject->unwrapLayoutObject();
m_currentFullScreenElement = element;
// Create a placeholder block for a the full-screen element, to keep the page
// from reflowing when the element is removed from the normal flow. Only do
// this for a LayoutBox, as only a box will have a frameRect. The placeholder
// will be created in setFullScreenLayoutObject() during layout.
LayoutObject* layoutObject = m_currentFullScreenElement->layoutObject();
bool shouldCreatePlaceholder = layoutObject && layoutObject->isBox();
if (shouldCreatePlaceholder) {
m_savedPlaceholderFrameRect = toLayoutBox(layoutObject)->frameRect();
m_savedPlaceholderComputedStyle =
ComputedStyle::clone(layoutObject->styleRef());
}
// TODO(alexmos): When |m_forCrossProcessDescendant| is true, some of
// this layout work has already been done in another process, so it should
// not be necessary to repeat it here.
if (m_currentFullScreenElement != document()->documentElement())
LayoutFullScreen::wrapLayoutObject(
layoutObject, layoutObject ? layoutObject->parent() : 0, document());
// When |m_forCrossProcessDescendant| is true, m_currentFullScreenElement
// corresponds to the HTMLFrameOwnerElement for the out-of-process iframe
// that contains the actual fullscreen element. Hence, it must also set
// the ContainsFullScreenElement flag (so that it gains the
// -webkit-full-screen-ancestor style).
if (m_forCrossProcessDescendant) {
DCHECK(m_currentFullScreenElement->isFrameOwnerElement());
DCHECK(toHTMLFrameOwnerElement(m_currentFullScreenElement)
->contentFrame()
->isRemoteFrame());
m_currentFullScreenElement->setContainsFullScreenElement(true);
}
m_currentFullScreenElement
->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
document()->styleEngine().ensureFullscreenUAStyle();
m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen);
// FIXME: This should not call updateStyleAndLayoutTree.
document()->updateStyleAndLayoutTree();
m_currentFullScreenElement->didBecomeFullscreenElement();
if (document()->frame())
document()->frame()->eventHandler().scheduleHoverStateUpdate();
m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE);
}