这篇教程C++ toLayoutBoxModelObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toLayoutBoxModelObject函数的典型用法代码示例。如果您正苦于以下问题:C++ toLayoutBoxModelObject函数的具体用法?C++ toLayoutBoxModelObject怎么用?C++ toLayoutBoxModelObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toLayoutBoxModelObject函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERTvoid InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& cullRect){ ASSERT(paintInfo.phase == PaintPhaseForeground); if (m_inlineFlowBox.lineLayoutItem().style()->visibility() != VISIBLE) return; // You can use p::first-line to specify a background. If so, the root line boxes for // a line may actually have to paint a background. LayoutObject* inlineFlowBoxLayoutObject = LineLayoutAPIShim::layoutObjectFrom(m_inlineFlowBox.lineLayoutItem()); const ComputedStyle* styleToUse = m_inlineFlowBox.lineLayoutItem().style(m_inlineFlowBox.isFirstLineStyle()); bool shouldPaintBoxDecorationBackground; if (m_inlineFlowBox.parent()) shouldPaintBoxDecorationBackground = inlineFlowBoxLayoutObject->hasBoxDecorationBackground(); else shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.lineLayoutItem().style(); if (!shouldPaintBoxDecorationBackground) return; if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground)) return; DrawingRecorder recorder(paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(cullRect)); LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); // Move x/y to our coordinates. LayoutRect localRect(frameRect); m_inlineFlowBox.flipForWritingMode(localRect); LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.size()); IntRect adjustedClipRect; BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect, adjustedClipRect); // Shadow comes first and is behind the background and border. if (!m_inlineFlowBox.boxModelObject().boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, &m_inlineFlowBox)) paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); Color backgroundColor = inlineFlowBoxLayoutObject->resolveColor(*styleToUse, CSSPropertyBackgroundColor); paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(), adjustedFrameRect); paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); switch (borderPaintingType) { case DontPaintBorders: break; case PaintBordersWithoutClip: BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutAPIShim::layoutObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, adjustedFrameRect, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()), BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge()); break; case PaintBordersWithClip: // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, // but it isn't even clear how this should work at all. LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOffset, frameRect.size(), LTR); GraphicsContextStateSaver stateSaver(paintInfo.context); paintInfo.context.clip(adjustedClipRect); BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutAPIShim::layoutObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, imageStripPaintRect, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle())); break; }}
开发者ID:mtucker6784,项目名称:chromium,代码行数:60,
示例2: TEST_FTEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromotedOnStyleChange) { RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); setBodyInnerHTML( "<style>" "#scroller { overflow: scroll; height: 200px; width: 200px; background: " "rgba(255,255,255,0.5) local content-box; }" "#scrolled { height: 300px; }" "</style>" "<div id=/"scroller/"><div id=/"scrolled/"></div></div>"); document().view()->updateAllLifecyclePhases(); EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); Element* scroller = document().getElementById("scroller"); PaintLayer* paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer(); ASSERT_TRUE(paintLayer); EXPECT_FALSE(paintLayer->needsCompositedScrolling()); // Change the background to transparent scroller->setAttribute(HTMLNames::styleAttr, "background: white local content-box;"); document().view()->updateAllLifecyclePhases(); paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer(); ASSERT_TRUE(paintLayer); EXPECT_TRUE(paintLayer->needsCompositedScrolling()); EXPECT_TRUE(paintLayer->graphicsLayerBacking()); ASSERT_TRUE(paintLayer->graphicsLayerBackingForScrolling()); EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());}
开发者ID:ollie314,项目名称:chromium,代码行数:30,
示例3: PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObject& layoutObject) const{ if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfPaintingLayer()) return *toLayoutBoxModelObject(layoutObject).layer(); return m_enclosingSelfPaintingLayer;}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:7,
示例4: deriveBorderBoxFromContainerContextstatic void deriveBorderBoxFromContainerContext(const LayoutObject& object, PaintPropertyTreeBuilderContext& context){ if (!object.isBoxModelObject()) return; const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); // TODO(trchen): There is some insanity going on with tables. Double check results. switch (object.styleRef().position()) { case StaticPosition: break; case RelativePosition: context.paintOffset += boxModelObject.offsetForInFlowPosition(); break; case AbsolutePosition: context.currentTransform = context.transformForOutOfFlowPositioned; context.paintOffset = context.paintOffsetForOutOfFlowPositioned; context.currentClip = context.clipForOutOfFlowPositioned; break; case StickyPosition: context.paintOffset += boxModelObject.offsetForInFlowPosition(); break; case FixedPosition: context.currentTransform = context.transformForFixedPositioned; context.paintOffset = context.paintOffsetForFixedPositioned; context.currentClip = context.clipForFixedPositioned; break; default: ASSERT_NOT_REACHED(); } if (boxModelObject.isBox()) context.paintOffset += toLayoutBox(boxModelObject).locationOffset();}
开发者ID:mtucker6784,项目名称:chromium,代码行数:33,
示例5: enclosingBoxModelObjectstatic LayoutBoxModelObject* enclosingBoxModelObject(LayoutObject* object) { while (object && !object->isBoxModelObject()) object = object->parent(); if (!object) return nullptr; return toLayoutBoxModelObject(object);}
开发者ID:mirror,项目名称:chromium,代码行数:7,
示例6: toLayoutBoxModelObjectvoid PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context){ if (object.isBoxModelObject()) { // TODO(trchen): Eliminate PaintLayer dependency. PaintLayer* layer = toLayoutBoxModelObject(object).layer(); if (!layer || !layer->paintsWithTransform(GlobalPaintNormalPhase)) return; } if (context.paintOffset == LayoutPoint()) return; // We should use the same subpixel paint offset values for snapping regardless of whether a // transform is present. If there is a transform we round the paint offset but keep around // the residual fractional component for the transformed content to paint with. // In spv1 this was called "subpixel accumulation". For more information, see // PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentByApplyingTransform. IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset); LayoutPoint fractionalPaintOffset = LayoutPoint(context.paintOffset - roundedPaintOffset); RefPtr<TransformPaintPropertyNode> paintOffsetTranslation = TransformPaintPropertyNode::create( TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y()), FloatPoint3D(), context.currentTransform); context.currentTransform = paintOffsetTranslation.get(); context.paintOffset = fractionalPaintOffset; object.getMutableForPainting().ensureObjectPaintProperties().setPaintOffsetTranslation(paintOffsetTranslation.release());}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:27,
示例7: ASSERTbool CompositorAnimations::startAnimationOnCompositor(const Element& element, int group, double startTime, double timeOffset, const Timing& timing, const AnimationPlayer& player, const AnimationEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate){ ASSERT(startedAnimationIds.isEmpty()); ASSERT(isCandidateForAnimationOnCompositor(timing, element, &player, effect, playerPlaybackRate)); ASSERT(canStartAnimationOnCompositor(element)); const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect); DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer(); ASSERT(layer); Vector<OwnPtr<WebCompositorAnimation>> animations; CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, playerPlaybackRate); ASSERT(!animations.isEmpty()); for (auto& animation : animations) { int id = animation->id(); if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer(); ASSERT(compositorPlayer); compositorPlayer->addAnimation(animation.leakPtr()); } else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(animation.release())) { // FIXME: We should know ahead of time whether these animations can be started. for (int startedAnimationId : startedAnimationIds) cancelAnimationOnCompositor(element, player, startedAnimationId); startedAnimationIds.clear(); return false; } startedAnimationIds.append(id); } ASSERT(!startedAnimationIds.isEmpty()); return true;}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:32,
示例8: TEST_FTEST_F(PaintControllerPaintTestForSlimmingPaintV2, CompositingFold) { setBodyInnerHTML( "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" " <div style='width: 100px; height: 100px; background-color: " "blue'></div>" "</div>"); PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject()) ->layer(); LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); LayoutObject& subDiv = *div.firstChild(); EXPECT_DISPLAY_LIST( rootPaintController().getDisplayItemList(), 8, TestDisplayItem(layoutView(), DisplayItem::kClipFrameToVisibleContentRect), TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence), TestDisplayItem(layoutView(), documentBackgroundType), TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), // The begin and end compositing display items have been folded into this // one. TestDisplayItem(subDiv, backgroundType), TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence), TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence), TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType( DisplayItem::kClipFrameToVisibleContentRect)));}
开发者ID:mirror,项目名称:chromium,代码行数:28,
示例9: toLayoutBoxModelObject// staticbool InspectorHighlight::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxModel>& model){ LayoutObject* layoutObject = node->layoutObject(); FrameView* view = node->document().view(); if (!layoutObject || !view) return false; FloatQuad content, padding, border, margin; if (!buildNodeQuads(node, &content, &padding, &border, &margin)) return false; IntRect boundingBox = view->contentsToRootFrame(layoutObject->absoluteBoundingBoxRect()); LayoutBoxModelObject* modelObject = layoutObject->isBoxModelObject() ? toLayoutBoxModelObject(layoutObject) : nullptr; model = TypeBuilder::DOM::BoxModel::create() .setContent(buildArrayForQuad(content)) .setPadding(buildArrayForQuad(padding)) .setBorder(buildArrayForQuad(border)) .setMargin(buildArrayForQuad(margin)) .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width()) .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height()); Shape::DisplayPaths paths; FloatQuad boundsQuad; if (const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &paths, &boundsQuad)) { RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeTypeBuilder = TypeBuilder::DOM::ShapeOutsideInfo::create() .setBounds(buildArrayForQuad(boundsQuad)) .setShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape)) .setMarginShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape)); model->setShapeOutside(shapeTypeBuilder); } return true;}
开发者ID:howardroark2018,项目名称:chromium,代码行数:35,
示例10: addPDFURLRectsForInlineChildrenRecursivelystatic void addPDFURLRectsForInlineChildrenRecursively(const LayoutObject& layoutObject, const PaintInfo& paintInfo, const LayoutPoint& paintOffset){ for (LayoutObject* child = layoutObject.slowFirstChild(); child; child = child->nextSibling()) { if (!child->isLayoutInline() || toLayoutBoxModelObject(child)->hasSelfPaintingLayer()) continue; ObjectPainter(*child).addPDFURLRectIfNeeded(paintInfo, paintOffset); addPDFURLRectsForInlineChildrenRecursively(*child, paintInfo, paintOffset); }}
开发者ID:mtucker6784,项目名称:chromium,代码行数:9,
示例11: ASSERTvoid IntersectionObservation::initializeGeometry(IntersectionGeometry& geometry){ ASSERT(m_target); LayoutObject* targetLayoutObject = target()->layoutObject(); if (targetLayoutObject->isBoxModelObject()) geometry.targetRect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); else geometry.targetRect = toLayoutText(targetLayoutObject)->visualOverflowRect(); geometry.intersectionRect = geometry.targetRect;}
开发者ID:mtucker6784,项目名称:chromium,代码行数:10,
示例12: ifvoid PaintPropertyTreeBuilder::updatePaintOffsetTranslation( const LayoutObject& object, PaintPropertyTreeBuilderContext& context) { bool usesPaintOffsetTranslation = false; if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && object.isLayoutView()) { // Root layer scrolling always creates a translation node for LayoutView to // ensure fixed and absolute contexts use the correct transform space. usesPaintOffsetTranslation = true; } else if (object.isBoxModelObject() && context.current.paintOffset != LayoutPoint()) { // TODO(trchen): Eliminate PaintLayer dependency. PaintLayer* layer = toLayoutBoxModelObject(object).layer(); if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) usesPaintOffsetTranslation = true; } // We should use the same subpixel paint offset values for snapping // regardless of whether a transform is present. If there is a transform // we round the paint offset but keep around the residual fractional // component for the transformed content to paint with. In spv1 this was // called "subpixel accumulation". For more information, see // PaintLayer::subpixelAccumulation() and // PaintLayerPainter::paintFragmentByApplyingTransform. IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); LayoutPoint fractionalPaintOffset = LayoutPoint(context.current.paintOffset - roundedPaintOffset); if (usesPaintOffsetTranslation) { object.getMutableForPainting() .ensurePaintProperties() .updatePaintOffsetTranslation( context.current.transform, TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y()), FloatPoint3D(), context.current.shouldFlattenInheritedTransform, context.current.renderingContextID); } else { if (auto* properties = object.getMutableForPainting().paintProperties()) properties->clearPaintOffsetTranslation(); } const auto* properties = object.paintProperties(); if (properties && properties->paintOffsetTranslation()) { context.current.transform = properties->paintOffsetTranslation(); context.current.paintOffset = fractionalPaintOffset; if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && object.isLayoutView()) { context.absolutePosition.transform = properties->paintOffsetTranslation(); context.fixedPosition.transform = properties->paintOffsetTranslation(); context.absolutePosition.paintOffset = LayoutPoint(); context.fixedPosition.paintOffset = LayoutPoint(); } }}
开发者ID:mirror,项目名称:chromium,代码行数:55,
示例13: deriveBorderBoxFromContainerContextstatic void deriveBorderBoxFromContainerContext(const LayoutObject& object, PaintPropertyTreeBuilderContext& context){ if (!object.isBoxModelObject()) return; const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); switch (object.styleRef().position()) { case StaticPosition: break; case RelativePosition: context.paintOffset += boxModelObject.offsetForInFlowPosition(); break; case AbsolutePosition: { context.currentTransform = context.transformForAbsolutePosition; context.paintOffset = context.paintOffsetForAbsolutePosition; // Absolutely positioned content in an inline should be positioned relative to the inline. const LayoutObject* container = context.containerForAbsolutePosition; if (container && container->isInFlowPositioned() && container->isLayoutInline()) { DCHECK(object.isBox()); context.paintOffset += toLayoutInline(container)->offsetForInFlowPositionedInline(toLayoutBox(object)); } context.currentClip = context.clipForAbsolutePosition; break; } case StickyPosition: context.paintOffset += boxModelObject.offsetForInFlowPosition(); break; case FixedPosition: context.currentTransform = context.transformForFixedPosition; context.paintOffset = context.paintOffsetForFixedPosition; context.currentClip = context.clipForFixedPosition; break; default: ASSERT_NOT_REACHED(); } if (boxModelObject.isBox() && (!boxModelObject.isSVG() || boxModelObject.isSVGRoot())) { // TODO(pdr): Several calls in this function walk back up the tree to calculate containers // (e.g., topLeftLocation, offsetForInFlowPosition*). The containing block and other // containers can be stored on PaintPropertyTreeBuilderContext instead of recomputing them. context.paintOffset.moveBy(toLayoutBox(boxModelObject).topLeftLocation()); // This is a weird quirk that table cells paint as children of table rows, // but their location have the row's location baked-in. // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). if (boxModelObject.isTableCell()) { LayoutObject* parentRow = boxModelObject.parent(); ASSERT(parentRow && parentRow->isTableRow()); context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation()); } }}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:53,
示例14: DCHECK_IS_ONvoid PaintLayerStackingNode::rebuildZOrderLists() {#if DCHECK_IS_ON() DCHECK(m_layerListMutationAllowed);#endif DCHECK(isDirtyStackingContext()); for (PaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) child->stackingNode()->collectLayers(m_posZOrderList, m_negZOrderList); // Sort the two lists. if (m_posZOrderList) std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compareZIndex); if (m_negZOrderList) std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compareZIndex); // Append layers for top layer elements after normal layer collection, to // ensure they are on top regardless of z-indexes. The layoutObjects of top // layer elements are children of the view, sorted in top layer stacking // order. if (layer()->isRootLayer()) { LayoutBlockFlow* rootBlock = layoutObject()->view(); // If the viewport is paginated, everything (including "top-layer" elements) // gets redirected to the flow thread. So that's where we have to look, in // that case. if (LayoutBlockFlow* multiColumnFlowThread = rootBlock->multiColumnFlowThread()) rootBlock = multiColumnFlowThread; for (LayoutObject* child = rootBlock->firstChild(); child; child = child->nextSibling()) { Element* childElement = (child->node() && child->node()->isElementNode()) ? toElement(child->node()) : 0; if (childElement && childElement->isInTopLayer()) { PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); // Create the buffer if it doesn't exist yet. if (!m_posZOrderList) m_posZOrderList = wrapUnique(new Vector<PaintLayerStackingNode*>); m_posZOrderList->append(layer->stackingNode()); } } }#if ENABLE(ASSERT) updateStackingParentForZOrderLists(this);#endif m_zOrderListsDirty = false;}
开发者ID:mirror,项目名称:chromium,代码行数:52,
示例15: mappingFromElementstatic CompositedLayerMapping* mappingFromElement(Element* element) { if (!element) return nullptr; LayoutObject* layoutObject = element->layoutObject(); if (!layoutObject || !layoutObject->isBoxModelObject()) return nullptr; PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); if (!layer) return nullptr; if (!layer->hasCompositedLayerMapping()) return nullptr; return layer->compositedLayerMapping();}
开发者ID:mirror,项目名称:chromium,代码行数:13,
示例16: TEST_FTEST_F(PaintLayerTest, PaintingExtentReflectionWithTransform) { setBodyInnerHTML( "<div id='target' style='background-color: blue; position: absolute;" " width: 110px; height: 120px; top: 40px; left: 60px;" " -webkit-box-reflect: below 3px; transform: translateX(30px)'>" "</div>"); PaintLayer* layer = toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); EXPECT_EQ( LayoutRect(90, 40, 110, 243), layer->paintingExtent(document().layoutView()->layer(), LayoutSize(), 0));}
开发者ID:ollie314,项目名称:chromium,代码行数:13,
示例17: createScrollTranslationIfNeededstatic PassRefPtr<TransformPaintPropertyNode> createScrollTranslationIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context){ if (!object.isBoxModelObject() || !object.hasOverflowClip()) return nullptr; PaintLayer* layer = toLayoutBoxModelObject(object).layer(); ASSERT(layer); DoubleSize scrollOffset = layer->scrollableArea()->scrollOffset(); if (scrollOffset.isZero() && !layer->scrollsOverflow()) return nullptr; RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = TransformPaintPropertyNode::create( TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height()), FloatPoint3D(), context.currentTransform); context.currentTransform = newTransformNodeForScrollTranslation.get(); return newTransformNodeForScrollTranslation.release();}
开发者ID:mtucker6784,项目名称:chromium,代码行数:17,
示例18: targetvoid MouseRelatedEvent::computeRelativePosition(){ Node* targetNode = target() ? target()->toNode() : nullptr; if (!targetNode) return; // Compute coordinates that are based on the target. m_layerLocation = m_pageLocation; m_offsetLocation = m_pageLocation; // Must have an updated layout tree for this math to work correctly. targetNode->document().updateLayoutIgnorePendingStylesheets(); // Adjust offsetLocation to be relative to the target's padding box. if (LayoutObject* r = targetNode->layoutObject()) { FloatPoint localPos = r->absoluteToLocal(FloatPoint(absoluteLocation()), UseTransforms); // Adding this here to address crbug.com/570666. Basically we'd like to // find the local coordinates relative to the padding box not the border box. if (r->isBoxModelObject()) { LayoutBoxModelObject* layoutBox = toLayoutBoxModelObject(r); localPos.move(-layoutBox->borderLeft(), -layoutBox->borderTop()); } m_offsetLocation = roundedLayoutPoint(localPos); float scaleFactor = 1 / pageZoomFactor(this); if (scaleFactor != 1.0f) m_offsetLocation.scale(scaleFactor, scaleFactor); } // Adjust layerLocation to be relative to the layer. // FIXME: event.layerX and event.layerY are poorly defined, // and probably don't always correspond to PaintLayer offsets. // https://bugs.webkit.org/show_bug.cgi?id=21868 Node* n = targetNode; while (n && !n->layoutObject()) n = n->parentNode(); if (n) { // FIXME: This logic is a wrong implementation of convertToLayerCoords. for (PaintLayer* layer = n->layoutObject()->enclosingLayer(); layer; layer = layer->parent()) m_layerLocation -= toLayoutSize(layer->location()); } m_hasCachedRelativePosition = true;}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:46,
注:本文中的toLayoutBoxModelObject函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toLayoutSize函数代码示例 C++ toLayoutBox函数代码示例 |