Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Side by Side Diff: Source/core/dom/ViewportArguments.cpp

Issue 22908011: Change viewport error messages in preparation for use with @viewport rule (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 else if (keyString == "target-densitydpi") { 389 else if (keyString == "target-densitydpi") {
390 arguments->deprecatedTargetDensityDPI = findTargetDensityDPIValue(keyStr ing, valueString, document); 390 arguments->deprecatedTargetDensityDPI = findTargetDensityDPIValue(keyStr ing, valueString, document);
391 reportViewportWarning(document, TargetDensityDpiUnsupported, String(), S tring()); 391 reportViewportWarning(document, TargetDensityDpiUnsupported, String(), S tring());
392 } else 392 } else
393 reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, ke yString, String()); 393 reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, ke yString, String());
394 } 394 }
395 395
396 static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode) 396 static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
397 { 397 {
398 static const char* const errors[] = { 398 static const char* const errors[] = {
399 "Viewport argument key \"%replacement1\" not recognized and ignored.", 399 "Note that ';' is not a key-value pair separator. The list should be com ma-separated.",
400 "Viewport argument value \"%replacement1\" for key \"%replacement2\" is invalid, and has been ignored.", 400 "The key \"%replacement1\" is not recognized and ignored.",
401 "Viewport argument value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.", 401 "The value \"%replacement1\" for key \"%replacement2\" is invalid, and h as been ignored.",
402 "Viewport maximum-scale cannot be larger than 10.0. The maximum-scale wi ll be set to 10.0.", 402 "The value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.",
403 "Viewport target-densitydpi is not supported.", 403 "The value for key \"maximum-scale\" is out of bounds and the value has been clamped.",
404 "The key \"target-densitydpi\" is not supported.",
404 }; 405 };
405 406
406 return errors[errorCode]; 407 return errors[errorCode];
407 } 408 }
408 409
409 static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode) 410 static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode)
410 { 411 {
411 switch (errorCode) { 412 switch (errorCode) {
412 case TruncatedViewportArgumentValueError: 413 case TruncatedViewportArgumentValueError:
413 case TargetDensityDpiUnsupported: 414 case TargetDensityDpiUnsupported:
(...skipping 13 matching lines...) Expand all
427 Frame* frame = document->frame(); 428 Frame* frame = document->frame();
428 if (!frame) 429 if (!frame)
429 return; 430 return;
430 431
431 String message = viewportErrorMessageTemplate(errorCode); 432 String message = viewportErrorMessageTemplate(errorCode);
432 if (!replacement1.isNull()) 433 if (!replacement1.isNull())
433 message.replace("%replacement1", replacement1); 434 message.replace("%replacement1", replacement1);
434 if (!replacement2.isNull()) 435 if (!replacement2.isNull())
435 message.replace("%replacement2", replacement2); 436 message.replace("%replacement2", replacement2);
436 437
437 if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == Tru ncatedViewportArgumentValueError) && replacement1.find(';') != WTF::notFound)
438 message.append(" Note that ';' is not a separator in viewport values. Th e list should be comma-separated.");
439
440 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. 438 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists.
441 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message); 439 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message);
442 } 440 }
443 441
444 } // namespace WebCore 442 } // namespace WebCore
OLDNEW
« Source/core/dom/Document.cpp ('K') | « Source/core/dom/ViewportArguments.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698