Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index c60757b86f7d6b1a778b03c8b206ae65457884ed..645ef274bb6006499362a4838b47d6fced2e80a9 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -161,7 +161,6 @@ |
#include <cmath> // for std::pow |
using namespace WebCore; |
-using namespace std; |
// The following constants control parameters for automated scaling of webpages |
// (such as due to a double tap gesture or find in page etc.). These are |
@@ -661,7 +660,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
case WebInputEvent::GestureTapCancel: |
case WebInputEvent::GestureTap: |
case WebInputEvent::GestureLongPress: |
- for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
+ for (std::size_t i = 0; i < m_linkHighlights.size(); ++i) |
m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
break; |
default: |
@@ -700,7 +699,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleTargets(scaledEvent, goodTargets)) { |
if (settingsImpl()->gestureTapHighlightEnabled()) |
enableTapHighlights(highlightNodes); |
- for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
+ for (std::size_t i = 0; i < m_linkHighlights.size(); ++i) |
m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
eventSwallowed = true; |
eventCancelled = true; |
@@ -1065,13 +1064,13 @@ WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target |
const int absoluteSourceX = source.x + scrollOffset.width(); |
if (leftMargin > absoluteSourceX) { |
leftMargin = absoluteSourceX; |
- rightMargin = max(leftMargin, minimumMargin); |
+ rightMargin = std::max(leftMargin, minimumMargin); |
} |
const int maximumRightMargin = maxSize.width - (source.width + absoluteSourceX); |
if (rightMargin > maximumRightMargin) { |
rightMargin = maximumRightMargin; |
- leftMargin = min(leftMargin, max(rightMargin, minimumMargin)); |
+ leftMargin = std::min(leftMargin, std::max(rightMargin, minimumMargin)); |
} |
const int newWidth = source.width + leftMargin + rightMargin; |
@@ -1116,9 +1115,9 @@ void WebViewImpl::computeScaleAndScrollForBlockRect(const WebPoint& hitPoint, co |
static_cast<int>(minimumMargin * rect.width / m_size.width)); |
// Fit block to screen, respecting limits. |
scale = static_cast<float>(m_size.width) / rect.width; |
- scale = min(scale, legibleScale()); |
+ scale = std::min(scale, legibleScale()); |
if (pageScaleFactor() < defaultScaleWhenAlreadyLegible) |
- scale = max(scale, defaultScaleWhenAlreadyLegible); |
+ scale = std::max(scale, defaultScaleWhenAlreadyLegible); |
scale = clampPageScaleFactorToLimits(scale); |
} |
@@ -1221,7 +1220,7 @@ void WebViewImpl::enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node> |
// LinkHighlight reads out layout and compositing state, so we need to make sure that's all up to date. |
layout(); |
- for (size_t i = 0; i < highlightNodes.size(); ++i) { |
+ for (std::size_t i = 0; i < highlightNodes.size(); ++i) { |
Node* node = highlightNodes[i]; |
if (!node || !node->renderer()) |
@@ -1717,7 +1716,7 @@ void WebViewImpl::layout() |
PageWidgetDelegate::layout(m_page.get()); |
updateLayerTreeBackgroundColor(); |
- for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
+ for (std::size_t i = 0; i < m_linkHighlights.size(); ++i) |
m_linkHighlights[i]->updateGeometry(); |
} |
@@ -2066,7 +2065,7 @@ bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe |
return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection); |
} |
-bool WebViewImpl::compositionRange(size_t* location, size_t* length) |
+bool WebViewImpl::compositionRange(std::size_t* location, std::size_t* length) |
{ |
LocalFrame* focused = toLocalFrame(focusedWebCoreFrame()); |
if (!focused || !m_imeAcceptEvents) |
@@ -2335,7 +2334,7 @@ WebVector<WebCompositionUnderline> WebViewImpl::compositionUnderlines() const |
return WebVector<WebCompositionUnderline>(); |
const Vector<CompositionUnderline>& underlines = focused->inputMethodController().customCompositionUnderlines(); |
WebVector<WebCompositionUnderline> results(underlines.size()); |
- for (size_t index = 0; index < underlines.size(); ++index) { |
+ for (std::size_t index = 0; index < underlines.size(); ++index) { |
CompositionUnderline underline = underlines[index]; |
results[index] = WebCompositionUnderline(underline.startOffset, underline.endOffset, static_cast<WebColor>(underline.color.rgb()), underline.thick); |
} |
@@ -2354,7 +2353,7 @@ WebColor WebViewImpl::backgroundColor() const |
return view->documentBackgroundColor().rgb(); |
} |
-bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) |
+bool WebViewImpl::caretOrSelectionRange(std::size_t* location, std::size_t* length) |
{ |
const LocalFrame* focused = toLocalFrame(focusedWebCoreFrame()); |
if (!focused) |
@@ -2606,7 +2605,7 @@ void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, float& |
// onscreen. |
int idealLeftPadding = viewWidth * leftBoxRatio; |
int maxLeftPaddingKeepingBoxOnscreen = viewWidth - textboxRectInDocumentCoordinates.width(); |
- newScroll.setX(textboxRectInDocumentCoordinates.x() - min<int>(idealLeftPadding, maxLeftPaddingKeepingBoxOnscreen)); |
+ newScroll.setX(textboxRectInDocumentCoordinates.x() - std::min<int>(idealLeftPadding, maxLeftPaddingKeepingBoxOnscreen)); |
} else { |
// Field is wider than screen. Try to left-align field, unless caret would |
// be offscreen, in which case right-align the caret. |
@@ -2695,7 +2694,7 @@ void WebViewImpl::fullFramePluginZoomLevelChanged(double zoomLevel) |
if (zoomLevel == m_zoomLevel) |
return; |
- m_zoomLevel = max(min(zoomLevel, m_maximumZoomLevel), m_minimumZoomLevel); |
+ m_zoomLevel = std::max(std::min(zoomLevel, m_maximumZoomLevel), m_minimumZoomLevel); |
m_client->zoomLevelChanged(); |
} |
@@ -3280,11 +3279,9 @@ void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, |
void WebViewImpl::spellingMarkers(WebVector<uint32_t>* markers) |
{ |
Vector<uint32_t> result; |
- for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { |
- if (!frame->isLocalFrame()) |
- continue; |
- const WillBeHeapVector<DocumentMarker*>& documentMarkers = toLocalFrame(frame)->document()->markers().markers(); |
- for (size_t i = 0; i < documentMarkers.size(); ++i) |
+ for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { |
+ const WillBeHeapVector<DocumentMarker*>& documentMarkers = frame->document()->markers().markers(); |
+ for (std::size_t i = 0; i < documentMarkers.size(); ++i) |
result.append(documentMarkers[i]->hash()); |
} |
markers->assign(result); |
@@ -3551,7 +3548,7 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, |
void WebView::injectStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patternsIn, WebView::StyleInjectionTarget injectIn) |
{ |
Vector<String> patterns; |
- for (size_t i = 0; i < patternsIn.size(); ++i) |
+ for (std::size_t i = 0; i < patternsIn.size(); ++i) |
patterns.append(patternsIn[i]); |
InjectedStyleSheets::instance().add(sourceCode, patterns, static_cast<WebCore::StyleInjectionTarget>(injectIn)); |