当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLDocument::ScrollToDefaultAnchor方法代码示例

本文整理汇总了C++中HTMLDocument::ScrollToDefaultAnchor方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument::ScrollToDefaultAnchor方法的具体用法?C++ HTMLDocument::ScrollToDefaultAnchor怎么用?C++ HTMLDocument::ScrollToDefaultAnchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLDocument的用法示例。


在下文中一共展示了HTMLDocument::ScrollToDefaultAnchor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Format


//.........这里部分代码省略.........
			// check to see if we just need to update positioned child formatting
			if (mFlowFlags & (FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                  FD_FLAG_LOCAL_STYLE_MODIFIED|
			                  FD_FLAG_PARENT_STYLE_MODIFIED))
			{
				DISPLAY_INT iContentWidth;
				MarginContext margin (marginLeftValue + paddingLeftValue,
				                      viewportWidth - (marginRightValue + paddingRightValue) - 1, this);

				// Format the flow content
				miContentHeight = FormatFlowContent (&margin,
				                                     marginLeftValue + paddingLeftValue,
				                                     marginTopValue + paddingTopValue, &iContentWidth);

				// update miContentHeight to include anything in the margins
				DISPLAY_INT topPad = marginTopValue + paddingTopValue;
				DISPLAY_INT clearedHeight = margin.ClearAll(topPad + miContentHeight) - topPad;
				if (clearedHeight > miContentHeight)
				{
					miContentHeight = clearedHeight;
				}

				// set this element's height
				UpdateHeight(0, 0);
			}

			// Format positioned elements
			FormatContextFactory childContextFactory;

			if (mPositionedChildFormatContext)
			{
				WebRect oldRect;

				mPositionedChildFormatContext->getContainingBlock(&oldRect);

				if (!oldRect.Equals(&rect) ||
				    miContentHeight != mPositionedChildFormatContext->getAutoIndentTop())
				{
					mPositionedChildFormatContext->release();
					mPositionedChildFormatContext = 0;
				}
			}

			WEBC_BOOL reformatPositionedChildren = (mFlowFlags & FD_FLAG_POS_CHILD_STYLE_MODIFIED) != 0;

			if (!mPositionedChildFormatContext)
			{
				mPositionedChildFormatContext = childContextFactory.newPositioned (
						&rect,            // containingBlock,
						WEBC_FALSE,       // parentHeightIsAuto,
						TU_DIR_LTR,       // textDirection,
						0,                // parentBorderLeft,
						0,                // parentBorderTop,
						0,                // parentBorderRight,
						0,                // parentBorderBottom,
						marginLeftValue,  // autoIndentLeft,
						miContentHeight,  // autoIndentTop,
						marginRightValue  // autoIndentRight
					);

				reformatPositionedChildren = (mPositionedChildFormatContext != WEBC_NULL);
			}

			if (reformatPositionedChildren)
			{
				HTMLFlowDisplayFormatContext formatCtx;

				BeginFormatPositionedChildren(&formatCtx);

				FormatPositionedChildren (
						mPositionedChildFormatContext,
						mPositionedChildFormatContext,
						&childContextFactory
					);

				EndFormatPositionedChildren(&formatCtx);
			}

			mFlowFlags &= ~(FD_FLAG_POS_CHILD_STYLE_MODIFIED|
			                FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                FD_FLAG_LOCAL_STYLE_MODIFIED|
							FD_FLAG_PARENT_STYLE_MODIFIED);
		}

		WEBC_ASSERT(!NeedsFormat());

		// handles the case where HTMLDocument::ScrollToAnchor is called before the
		//  document's content has been formatted.
		if (mpHtmlElement)
		{
			HTMLDocument* document = mpHtmlElement->GetDocument();
			if (document)
			{
				document->ScrollToDefaultAnchor();
				document->SetQueuedFocus();
			}
		}
		WEBC_DEBUG_LOG_TIME_EXIT(TimeInside,"HTMLBodyDisplay::Format", " ")
	}
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:101,代码来源:dhbody.cpp


注:本文中的HTMLDocument::ScrollToDefaultAnchor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。