本文整理汇总了C++中webcore::IntPoint::y方法的典型用法代码示例。如果您正苦于以下问题:C++ IntPoint::y方法的具体用法?C++ IntPoint::y怎么用?C++ IntPoint::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::IntPoint
的用法示例。
在下文中一共展示了IntPoint::y方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectionEndCaretRect
WebCore::IntRect SelectionHandler::selectionEndCaretRect()
{
if (!m_selectionActive)
return IntRect();
ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());
WebCore::IntRect caretLocation(m_webPage->focusedOrMainFrame()->selection()->selection().visibleEnd().absoluteCaretBounds());
SelectionController nextCaretSelection;
nextCaretSelection.setSelection(VisibleSelection(m_webPage->focusedOrMainFrame()->selection()->selection().visibleEnd()));
nextCaretSelection.modify(SelectionController::AlterationMove, SelectionController::DirectionForward, CharacterGranularity);
WebCore::IntRect nextCaretLocation(nextCaretSelection.selection().visibleStart().absoluteCaretBounds());
if (nextCaretLocation.y() == caretLocation.y()) {
// The next caret position is on this line, use the middle of the character
// as the active selection point.
caretLocation.move((nextCaretLocation.x() - caretLocation.x()) / 2, 0);
} else {
// Caret position is at the end of a line, advance 1 pixel to ensure
// overlap with character.
caretLocation.move(1, 0);
}
if (m_webPage->focusedOrMainFrame()->ownerRenderer()) {
WebCore::IntPoint frameOffset = m_webPage->focusedOrMainFrame()->ownerRenderer()->absoluteContentBox().location();
caretLocation.move(frameOffset.x(), frameOffset.y());
}
return caretLocation;
}
示例2: screenToWindow
WebCore::IntPoint ChromeClient::screenToWindow(const WebCore::IntPoint& screePoint) const
{
HWND hwnd = m_webView ? m_webView->hostWindow() : NULL;
if (!IsWindow(hwnd))
return screePoint;
POINT tempPoint = { screePoint.x(), screePoint.y() };
ScreenToClient(hwnd, &tempPoint);
WebCore::IntPoint windowPoint(tempPoint.x, tempPoint.y);
return windowPoint;
}
示例3: selectionStartCaretRect
WebCore::IntRect SelectionHandler::selectionStartCaretRect()
{
if (!m_selectionActive)
return IntRect();
ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());
WebCore::IntRect caretLocation(m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds());
if (m_webPage->focusedOrMainFrame()->ownerRenderer()) {
WebCore::IntPoint frameOffset = m_webPage->focusedOrMainFrame()->ownerRenderer()->absoluteContentBox().location();
caretLocation.move(frameOffset.x(), frameOffset.y());
}
return caretLocation;
}
示例4: selectObject
void SelectionHandler::selectObject(WebCore::IntPoint& location, TextGranularity granularity)
{
m_selectionActive = true;
ASSERT(m_webPage && m_webPage->mainFrame() && m_webPage->mainFrame()->selection());
Frame* frame = m_webPage->mainFrame();
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::selectWord adjusted points %d, %d", location.x(), location.y());
#endif
expandSelectionToGranularity(frame, location.x(), location.y(), granularity, m_webPage->m_inputHandler->isInputMode());
// Need to manually trigger notification as response to change.
selectionPositionChanged();
}
示例5: paintContents
void SelectionOverlay::paintContents(const GraphicsLayer* layer, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& inClip)
{
if (!layer->platformLayer()->superlayer())
return;
Selection::iterator it = m_selection.find(layer->platformLayer()->superlayer()->owner());
if (it == m_selection.end())
return;
const Vector<WebCore::FloatQuad>& quads = it->value;
GraphicsLayer* parent = it->key;
IntRect clip(inClip);
clip.move(parent->offsetFromRenderer().width(), parent->offsetFromRenderer().height());
c.save();
c.translate(-parent->offsetFromRenderer().width(), -parent->offsetFromRenderer().height());
Color color = RenderTheme::defaultTheme()->activeSelectionBackgroundColor();
c.setFillColor(color, ColorSpaceDeviceRGB);
for (unsigned i = 0; i < quads.size(); ++i) {
FloatRect rectToPaint = quads[i].boundingBox();
// Selection on non-composited sub-frames need to be adjusted.
if (!m_page->focusedOrMainFrame()->contentRenderer()->isComposited()) {
WebCore::IntPoint framePosition = m_page->frameOffset(m_page->focusedOrMainFrame());
rectToPaint.move(framePosition.x(), framePosition.y());
}
rectToPaint.intersect(clip);
if (rectToPaint.isEmpty())
continue;
c.fillRect(rectToPaint);
}
c.restore();
}
示例6: JumpToNearestElement
bool ViewNavigationDelegate::JumpToNearestElement(EA::WebKit::JumpDirection direction, bool scrollIfElementNotFound)
{
// Note by Arpit Baldeva:
// We have a problem here. mpModalInputClient object is supposed to be used for Modal input only however the only class using this object
// is html SELECT element(implemented as a popup). But in reality, html SELECT element is NOT modal. So it is little ill-conceived.
// For example, in all the browsers, if you scroll the mouse wheel on the frame, the SELECT element disappears and the actual frame scrolls.
// For any modal input needs on a web page, the users are advised to use the Z-layer technique with Javascript/CSS - http://jqueryui.com/demos/dialog/#modal-confirmation.
// The problem we want to solve here is have the SELECT element respond to the controller input correctly(select element one by one).
// But the button event information is lost by the time we are in the EA::WebKit::View. For the foreseeable future, there is no candidate
// other than html SELECT element which is implemented as a modal popup inside EAWebKit. So inside EA::WebKit::View, we create a dummy
// button event from the Jump direction and make SELECT respond to it. If any other object starts using the modal input, this would need to be
// revisited. But then, we'll need to solve a plethora of issues. So we do minimum work here to not break other things.
IOverlayInputClient* pOverlayInputClient = mView->GetOverlayInputClient();
bool handledByOverlayInputClient = false;
if(pOverlayInputClient)
{
EA::WebKit::ButtonEvent btnEvent;
switch(direction)
{
/*
case EA::WebKit::JumpLeft:
{
btnEvent.mID = EA::WebKit::kButton0;
handledByOverlayInputClient = pOverlayInputClient->OnButtonEvent(btnEvent);
}
*/
case EA::WebKit::JumpUp:
{
btnEvent.mID = EA::WebKit::kButton1;
handledByOverlayInputClient = pOverlayInputClient->OnButtonEvent(btnEvent);
break;
}
/*
case EA::WebKit::JumpRight:
{
btnEvent.mID = EA::WebKit::kButton2;
handledByOverlayInputClient = pOverlayInputClient->OnButtonEvent(btnEvent);
}
*/
case EA::WebKit::JumpDown:
{
btnEvent.mID = EA::WebKit::kButton3;
handledByOverlayInputClient = pOverlayInputClient->OnButtonEvent(btnEvent);
break;
}
default:
// We don't return and allow any other button press to go to the main View. At the same time, we make the SELECT element lose focus.
{
pOverlayInputClient->OnFocusChangeEvent(false);
break;
}
}
}
if(handledByOverlayInputClient)
return true;
int lastX, lastY;
mView->GetCursorPosition(lastX, lastY);
// Following is a shortcut to drive navigation from a page.
switch (direction)
{
case EA::WebKit::JumpRight:
if (GetFixedString(mCachedNavigationRightId)->compare(""))
{
if (!GetFixedString(mCachedNavigationRightId)->compare("ignore"))
{
return false;
}
if (JumpToId(GetFixedString(mCachedNavigationRightId)->c_str()))
{
return true;
}
}
break;
case EA::WebKit::JumpDown:
if (GetFixedString(mCachedNavigationDownId)->compare(""))
{
if (!GetFixedString(mCachedNavigationDownId)->compare("ignore"))
{
return false;
}
if (JumpToId(GetFixedString(mCachedNavigationDownId)->c_str()))
{
return true;
}
}
break;
case EA::WebKit::JumpLeft:
if (GetFixedString(mCachedNavigationLeftId)->compare(""))
//.........这里部分代码省略.........
示例7: MoveMouseCursorToNode
void ViewNavigationDelegate::MoveMouseCursorToNode(WebCore::Node* node, bool scrollIfNecessary)
{
if (node)
{
WebCore::HTMLElement* element = (WebCore::HTMLElement*)node;
WebCore::IntRect rect = element->getRect();
WebCore::IntPoint frameOffset;
WebCore::IntPoint scrollOffset;
WebCore::FrameView* pFrameView = element->document()->view(); //Can be NULL
if(pFrameView)
{
//Use move here instead of setX/setY as it results in 1 call instead of two and takes advantage that ctor sets x,y to 0.
frameOffset.move(pFrameView->x(), pFrameView->y());
scrollOffset.move(pFrameView->scrollOffset().width(), pFrameView->scrollOffset().height());
}
int width = mView->GetSize().mWidth;
int height = mView->GetSize().mHeight;
// This will be true if this function is called from anywhere except JumpToNearestElement(). This enables us to not lose the cursor during
// arbitrary jumping of elements from either code or webpage using the Navigation APIs.
if(scrollIfNecessary)
{
int cursorX, cursorY;
mView->GetCursorPosition(cursorX, cursorY);
WebCore::IntPoint targetCursorLocation(frameOffset.x()+rect.x()+rect.width()/2 - scrollOffset.x(), frameOffset.y()+rect.y()+rect.height()/2 - scrollOffset.y());
// Added 1 in all the line delta below resulting in a better visual behavior when the element happens to be at the edge.
if(targetCursorLocation.y() > height)
{
float numLinesDelta = (((targetCursorLocation.y() - cursorY)/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(true, -120, numLinesDelta);
}
if(targetCursorLocation.y()< 0.0f)
{
float numLinesDelta = (((cursorY - targetCursorLocation.y())/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(true, 120, numLinesDelta);
}
if(targetCursorLocation.x() > width)
{
float numLinesDelta = (((targetCursorLocation.x() - cursorX)/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(false, -120, numLinesDelta);
}
if(targetCursorLocation.x()< 0.0f)
{
float numLinesDelta = (((cursorX - targetCursorLocation.x())/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(false, 120, numLinesDelta);
}
// Read the scroll offset again as it may have changed.
if(pFrameView)
{
scrollOffset.setX(pFrameView->scrollOffset().width());
scrollOffset.setY(pFrameView->scrollOffset().height());
}
}
mBestNodeFrame = element->document()->frame(); //Can be NULL
mBestNodeX = frameOffset.x() + rect.x();
mBestNodeY = frameOffset.y() + rect.y();
mBestNodeWidth = rect.width();
mBestNodeHeight = rect.height();
int lastX, lastY;
mView->GetCursorPosition(lastX, lastY);
int newX = mBestNodeX + rect.width()/2 - scrollOffset.x();
int newY = mBestNodeY + rect.height()/2 - scrollOffset.y();
EA::WebKit::MouseMoveEvent moveEvent;
memset( &moveEvent, 0, sizeof(moveEvent) );
const int cursorInset = 5;// Make cursor stay inside 5 pixels from boundaries. No known issues but added this as a safety measure so that we do not lose cursor ever.
moveEvent.mX = Clamp( cursorInset, newX, width - cursorInset );
moveEvent.mY = Clamp( cursorInset, newY, height - cursorInset );
mView->OnMouseMoveEvent( moveEvent );
if(EAWebKitClient* const pClient = GetEAWebKitClient())
{
CursorMovedInfo cmInfo(mView, mView->GetUserData(), moveEvent.mX, moveEvent.mY);
pClient->CursorMoved(cmInfo);
}
UpdateCachedHints(node);
}
}
示例8: setSelection
void SelectionHandler::setSelection(WebCore::IntPoint start, WebCore::IntPoint end)
{
m_selectionActive = true;
ASSERT(m_webPage && m_webPage->mainFrame() && m_webPage->mainFrame()->selection());
Frame* frame = m_webPage->mainFrame();
ASSERT(frame);
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y());
#endif
bool selectionIsValid = true;
VisibleSelection newSelection(frame->visiblePositionForPoint(start), frame->visiblePositionForPoint(end));
// Validate the new points to avoid crossing frame or editing boundaries.
if (m_webPage->mainFrame() != m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->ownerRenderer()) {
// Current focus frame is not the main frame, it must be a subframe.
WebCore::IntRect subframeRect = m_webPage->focusedOrMainFrame()->ownerRenderer()->absoluteContentBox();
if (!subframeRect.contains(start) || !subframeRect.contains(end)) {
// Requested selection points are outside of current frame.
selectionIsValid = false;
}
}
// Check whether selection is occurring inside of an input field. Do not handle as
// an else if, an input field may be active inside of a subframe.
if (m_webPage->m_inputHandler->isInputMode() && !selectionIsContainedByAnchorNode(newSelection)) {
// Requested selection points are not contained within the anchor node (input field).
selectionIsValid = false;
}
if (selectionIsValid) {
frame->selection()->setSelection(newSelection);
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated");
#endif
}
// Need to manually trigger notification as response to change.
// This needs to be set even if no selection change occurs to ensure client has accurate
// selection points.
selectionPositionChanged();
}