merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-09-19 12:12:27 +02:00
Родитель 63e75ca24b f6383735e1
Коммит f2e591caf1
51 изменённых файлов: 1179 добавлений и 462 удалений

Просмотреть файл

@ -0,0 +1,473 @@
{
"extends": "../../.eslintrc",
"globals": {
"Components": true,
"dump": true,
"TextDecoder": false,
"TextEncoder": false,
},
"rules": {
// Rules from the mozilla plugin
"mozilla/balanced-listeners": 2,
"mozilla/mark-test-function-used": 1,
"mozilla/no-aArgs": 1,
"mozilla/no-cpows-in-tests": 1,
"mozilla/var-only-at-top-level": 1,
"valid-jsdoc": [2, {
"prefer": {
"return": "returns",
},
"preferType": {
"Boolean": "boolean",
"Number": "number",
"String": "string",
"bool": "boolean",
},
"requireParamDescription": false,
"requireReturn": false,
"requireReturnDescription": false,
}],
// Braces only needed for multi-line arrow function blocks
// "arrow-body-style": [2, "as-needed"],
// Require spacing around =>
"arrow-spacing": 2,
// Always require spacing around a single line block
"block-spacing": 1,
// Forbid spaces inside the square brackets of array literals.
"array-bracket-spacing": [2, "never"],
// Forbid spaces inside the curly brackets of object literals.
"object-curly-spacing": [2, "never"],
// No space padding in parentheses
"space-in-parens": [2, "never"],
// Enforce one true brace style (opening brace on the same line) and avoid
// start and end braces on the same line.
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
// No space before always a space after a comma
"comma-spacing": [2, {"before": false, "after": true}],
// Commas at the end of the line not the start
"comma-style": 2,
// Don't require spaces around computed properties
"computed-property-spacing": [1, "never"],
// Functions are not required to consistently return something or nothing
"consistent-return": 0,
// Require braces around blocks that start a new line
"curly": [2, "all"],
// Always require a trailing EOL
"eol-last": 2,
// Require function* name()
"generator-star-spacing": [2, {"before": false, "after": true}],
// Two space indent
"indent": [2, 2, {"SwitchCase": 1}],
// Space after colon not before in property declarations
"key-spacing": [2, {"beforeColon": false, "afterColon": true, "mode": "minimum"}],
// Require spaces before and after finally, catch, etc.
"keyword-spacing": 2,
// Unix linebreaks
"linebreak-style": [2, "unix"],
// Always require parenthesis for new calls
"new-parens": 2,
// Use [] instead of Array()
"no-array-constructor": 2,
// No duplicate arguments in function declarations
"no-dupe-args": 2,
// No duplicate keys in object declarations
"no-dupe-keys": 2,
// No duplicate cases in switch statements
"no-duplicate-case": 2,
// If an if block ends with a return no need for an else block
// "no-else-return": 2,
// Disallow empty statements. This will report an error for:
// try { something(); } catch (e) {}
// but will not report it for:
// try { something(); } catch (e) { /* Silencing the error because ...*/ }
// which is a valid use case.
"no-empty": 2,
// No empty character classes in regex
"no-empty-character-class": 2,
// Disallow empty destructuring
"no-empty-pattern": 2,
// No assiging to exception variable
"no-ex-assign": 2,
// No using !! where casting to boolean is already happening
"no-extra-boolean-cast": 1,
// No double semicolon
"no-extra-semi": 2,
// No overwriting defined functions
"no-func-assign": 2,
// No invalid regular expresions
"no-invalid-regexp": 2,
// No odd whitespace characters
"no-irregular-whitespace": 2,
// No single if block inside an else block
"no-lonely-if": 1,
// No mixing spaces and tabs in indent
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
// Disallow use of multiple spaces (sometimes used to align const values,
// array or object items, etc.). It's hard to maintain and doesn't add that
// much benefit.
"no-multi-spaces": 1,
// No reassigning native JS objects
"no-native-reassign": 2,
// No (!foo in bar)
"no-negated-in-lhs": 2,
// Nested ternary statements are confusing
"no-nested-ternary": 2,
// Use {} instead of new Object()
"no-new-object": 2,
// No Math() or JSON()
"no-obj-calls": 2,
// No octal literals
"no-octal": 2,
// No redeclaring variables
"no-redeclare": 2,
// No unnecessary comparisons
"no-self-compare": 2,
// No spaces between function name and parentheses
"no-spaced-func": 1,
// No trailing whitespace
"no-trailing-spaces": 2,
// Error on newline where a semicolon is needed
"no-unexpected-multiline": 2,
// No unreachable statements
"no-unreachable": 2,
// No expressions where a statement is expected
"no-unused-expressions": 2,
// No declaring variables that are never used
"no-unused-vars": [2, {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
// No using variables before defined
"no-use-before-define": 2,
// No using with
"no-with": 2,
// Always require semicolon at end of statement
"semi": [2, "always"],
// Require space before blocks
"space-before-blocks": 2,
// Never use spaces before function parentheses
"space-before-function-paren": [2, {"anonymous": "never", "named": "never"}],
// Require spaces around operators, except for a|0.
"space-infix-ops": [2, {"int32Hint": true}],
// ++ and -- should not need spacing
"space-unary-ops": [1, {"nonwords": false}],
// No comparisons to NaN
"use-isnan": 2,
// Only check typeof against valid results
"valid-typeof": 2,
// Disallow using variables outside the blocks they are defined (especially
// since only let and const are used, see "no-var").
"block-scoped-var": 2,
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": [2, "always-multiline"],
// Warn about cyclomatic complexity in functions.
"complexity": 1,
// Don't warn for inconsistent naming when capturing this (not so important
// with auto-binding fat arrow functions).
// "consistent-this": [2, "self"],
// Don't require a default case in switch statements. Avoid being forced to
// add a bogus default when you know all possible cases are handled.
"default-case": 0,
// Enforce dots on the next line with property name.
"dot-location": [2, "property"],
// Encourage the use of dot notation whenever possible.
"dot-notation": 2,
// Allow using == instead of ===, in the interest of landing something since
// the devtools codebase is split on convention here.
"eqeqeq": 0,
// Don't require function expressions to have a name.
// This makes the code more verbose and hard to read. Our engine already
// does a fantastic job assigning a name to the function, which includes
// the enclosing function name, and worst case you have a line number that
// you can just look up.
"func-names": 0,
// Allow use of function declarations and expressions.
"func-style": 0,
// Don't enforce the maximum depth that blocks can be nested. The complexity
// rule is a better rule to check this.
"max-depth": 0,
// Maximum length of a line.
// Disabled because we exceed this in too many places.
"max-len": [0, 80],
// Maximum depth callbacks can be nested.
"max-nested-callbacks": [2, 4],
// Don't limit the number of parameters that can be used in a function.
"max-params": 0,
// Don't limit the maximum number of statement allowed in a function. We
// already have the complexity rule that's a better measurement.
"max-statements": 0,
// Don't require a capital letter for constructors, only check if all new
// operators are followed by a capital letter. Don't warn when capitalized
// functions are used without the new operator.
"new-cap": [0, {"capIsNew": false}],
// Allow use of bitwise operators.
"no-bitwise": 0,
// Disallow use of arguments.caller or arguments.callee.
"no-caller": 2,
// Disallow the catch clause parameter name being the same as a variable in
// the outer scope, to avoid confusion.
"no-catch-shadow": 0,
// Disallow assignment in conditional expressions.
"no-cond-assign": 2,
// Disallow using the console API.
"no-console": 2,
// Allow using constant expressions in conditions like while (true)
"no-constant-condition": 0,
// Allow use of the continue statement.
"no-continue": 0,
// Disallow control characters in regular expressions.
"no-control-regex": 2,
// Disallow use of debugger.
"no-debugger": 2,
// Disallow deletion of variables (deleting properties is fine).
"no-delete-var": 2,
// Allow division operators explicitly at beginning of regular expression.
"no-div-regex": 0,
// Disallow use of eval(). We have other APIs to evaluate code in content.
"no-eval": 2,
// Disallow adding to native types
"no-extend-native": 2,
// Disallow unnecessary function binding.
"no-extra-bind": 2,
// Allow unnecessary parentheses, as they may make the code more readable.
"no-extra-parens": 0,
// Disallow fallthrough of case statements, except if there is a comment.
"no-fallthrough": 2,
// Allow the use of leading or trailing decimal points in numeric literals.
"no-floating-decimal": 0,
// Allow comments inline after code.
"no-inline-comments": 0,
// Disallow use of labels for anything other then loops and switches.
"no-labels": [2, { "allowLoop": true }],
// Disallow use of multiline strings (use template strings instead).
"no-multi-str": 1,
// Disallow multiple empty lines.
"no-multiple-empty-lines": [1, {"max": 2}],
// Allow reassignment of function parameters.
"no-param-reassign": 0,
// Allow string concatenation with __dirname and __filename (not a node env).
"no-path-concat": 0,
// Allow use of unary operators, ++ and --.
"no-plusplus": 0,
// Allow using process.env (not a node environment).
"no-process-env": 0,
// Allow using process.exit (not a node environment).
"no-process-exit": 0,
// Disallow usage of __proto__ property.
"no-proto": 2,
// Disallow multiple spaces in a regular expression literal.
"no-regex-spaces": 2,
// Allow reserved words being used as object literal keys.
"no-reserved-keys": 0,
// Don't restrict usage of specified node modules (not a node environment).
"no-restricted-modules": 0,
// Disallow use of assignment in return statement. It is preferable for a
// single line of code to have only one easily predictable effect.
"no-return-assign": 2,
// Don't warn about declaration of variables already declared in the outer scope.
"no-shadow": 0,
// Disallow shadowing of names such as arguments.
"no-shadow-restricted-names": 2,
// Allow use of synchronous methods (not a node environment).
"no-sync": 0,
// Allow the use of ternary operators.
"no-ternary": 0,
// Disallow throwing literals (eg. throw "error" instead of
// throw new Error("error")).
"no-throw-literal": 2,
// Disallow use of undeclared variables unless mentioned in a /* global */
// block. Note that globals from head.js are automatically imported in tests
// by the import-headjs-globals rule form the mozilla eslint plugin.
"no-undef": 2,
// Allow dangling underscores in identifiers (for privates).
"no-underscore-dangle": 0,
// Allow use of undefined variable.
"no-undefined": 0,
// Disallow the use of Boolean literals in conditional expressions.
"no-unneeded-ternary": 2,
// We use var-only-at-top-level instead of no-var as we allow top level
// vars.
"no-var": 0,
// Allow using TODO/FIXME comments.
"no-warning-comments": 0,
// Don't require method and property shorthand syntax for object literals.
// We use this in the code a lot, but not consistently, and this seems more
// like something to check at code review time.
"object-shorthand": 0,
// Allow more than one variable declaration per function.
"one-var": 0,
// Disallow padding within blocks.
"padded-blocks": [1, "never"],
// Don't require quotes around object literal property names.
"quote-props": 0,
// Double quotes should be used.
"quotes": [1, "double", {"avoidEscape": true, "allowTemplateLiterals": true}],
// Require use of the second argument for parseInt().
"radix": 2,
// Enforce spacing after semicolons.
"semi-spacing": [2, {"before": false, "after": true}],
// Don't require to sort variables within the same declaration block.
// Anyway, one-var is disabled.
"sort-vars": 0,
// Require a space immediately following the // in a line comment.
"spaced-comment": [2, "always"],
// Require "use strict" to be defined globally in the script.
"strict": [2, "global"],
// Allow vars to be declared anywhere in the scope.
"vars-on-top": 0,
// Don't require immediate function invocation to be wrapped in parentheses.
"wrap-iife": 0,
// Don't require regex literals to be wrapped in parentheses (which
// supposedly prevent them from being mistaken for division operators).
"wrap-regex": 0,
// Disallow Yoda conditions (where literal value comes first).
"yoda": 2,
// disallow use of eval()-like methods
"no-implied-eval": 2,
// Disallow function or variable declarations in nested blocks
"no-inner-declarations": 2,
// Disallow usage of __iterator__ property
"no-iterator": 2,
// Disallow labels that share a name with a variable
"no-label-var": 2,
// Disallow creating new instances of String, Number, and Boolean
"no-new-wrappers": 2,
}
}

12
browser/extensions/formautofill/bootstrap.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported startup, shutdown, install, uninstall */
function startup() {}
function shutdown() {}
function install() {}
function uninstall() {}

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
#filter substitution
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>formautofill@mozilla.org</em:id>
<em:version>1.0</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<!-- Target Application this extension can install into,
with minimum and maximum supported versions. -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Form Autofill</em:name>
<em:description>Autofill forms with saved profiles</em:description>
</Description>
</RDF>

Просмотреть файл

@ -0,0 +1,18 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
FINAL_TARGET_FILES.features['formautofill@mozilla.org'] += [
'bootstrap.js'
]
FINAL_TARGET_PP_FILES.features['formautofill@mozilla.org'] += [
'install.rdf.in'
]
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']

Просмотреть файл

@ -0,0 +1,5 @@
{
"extends": [
"../../../../../testing/mochitest/browser.eslintrc"
]
}

Просмотреть файл

@ -0,0 +1,3 @@
[DEFAULT]
[browser_check_installed.js]

Просмотреть файл

@ -0,0 +1,14 @@
"use strict";
add_task(function* test_enabled() {
let addon = yield new Promise(
resolve => AddonManager.getAddonByID("formautofill@mozilla.org", resolve)
);
isnot(addon, null, "Check addon exists");
is(addon.version, "1.0", "Check version");
is(addon.name, "Form Autofill", "Check name");
ok(addon.isCompatible, "Check application compatibility");
ok(!addon.appDisabled, "Check not app disabled");
ok(addon.isActive, "Check addon is active");
is(addon.type, "extension", "Check type is 'extension'");
});

Просмотреть файл

@ -15,4 +15,5 @@ DIRS += [
if 'a' in CONFIG['GRE_MILESTONE']:
DIRS += [
'flyweb',
'formautofill',
]

Просмотреть файл

@ -1,3 +1,3 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.5.464
Current extension version is: 1.5.476

Просмотреть файл

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.5.464';
var pdfjsBuild = '834a7ff';
var pdfjsVersion = '1.5.476';
var pdfjsBuild = 'c0e82db';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -114,6 +114,28 @@ var AnnotationFlag = {
LOCKEDCONTENTS: 0x200
};
var AnnotationFieldFlag = {
READONLY: 1,
REQUIRED: 2,
NOEXPORT: 3,
MULTILINE: 13,
PASSWORD: 14,
NOTOGGLETOOFF: 15,
RADIO: 16,
PUSHBUTTON: 17,
COMBO: 18,
EDIT: 19,
SORT: 20,
FILESELECT: 21,
MULTISELECT: 22,
DONOTSPELLCHECK: 23,
DONOTSCROLL: 24,
COMB: 25,
RICHTEXT: 26,
RADIOSINUNISON: 26,
COMMITONSELCHANGE: 27,
};
var AnnotationBorderStyleType = {
SOLID: 1,
DASHED: 2,
@ -1405,6 +1427,7 @@ exports.OPS = OPS;
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFieldFlag = AnnotationFieldFlag;
exports.AnnotationFlag = AnnotationFlag;
exports.AnnotationType = AnnotationType;
exports.FontType = FontType;
@ -2295,7 +2318,9 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
*/
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
function WidgetAnnotationElement(parameters) {
AnnotationElement.call(this, parameters, true);
var isRenderable = parameters.renderInteractiveForms ||
(!parameters.data.hasAppearance && !!parameters.data.fieldValue);
AnnotationElement.call(this, parameters, isRenderable);
}
Util.inherit(WidgetAnnotationElement, AnnotationElement, {
@ -2340,9 +2365,15 @@ var TextWidgetAnnotationElement = (
var element = null;
if (this.renderInteractiveForms) {
element = document.createElement('input');
element.type = 'text';
if (this.data.multiLine) {
element = document.createElement('textarea');
} else {
element = document.createElement('input');
element.type = 'text';
}
element.value = this.data.fieldValue;
element.disabled = this.data.readOnly;
if (this.data.maxLen !== null) {
element.maxLength = this.data.maxLen;
@ -7270,6 +7301,9 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* calling of PDFPage.getViewport method.
* @property {string} intent - Rendering intent, can be 'display' or 'print'
* (default value is 'display').
* @property {boolean} renderInteractiveForms - (optional) Whether or not
* interactive form elements are rendered in the display
* layer. If so, we do not render them on canvas as well.
* @property {Array} transform - (optional) Additional transform, applied
* just before viewport transform.
* @property {Object} imageLayer - (optional) An object that has beginLayout,
@ -7378,6 +7412,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
this.pendingCleanup = false;
var renderingIntent = (params.intent === 'print' ? 'print' : 'display');
var renderInteractiveForms = (params.renderInteractiveForms === true ?
true : /* Default */ false);
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null);
@ -7398,7 +7434,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
this.stats.time('Page Request');
this.transport.messageHandler.send('RenderPageRequest', {
pageIndex: this.pageNumber - 1,
intent: renderingIntent
intent: renderingIntent,
renderInteractiveForms: renderInteractiveForms,
});
}
@ -8932,13 +8969,6 @@ exports._UnsupportedManager = _UnsupportedManager;
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
true : PDFJS.isEvalSupported);
/**
* Renders interactive form elements.
* @var {boolean}
*/
PDFJS.renderInteractiveForms = (PDFJS.renderInteractiveForms === undefined ?
false : PDFJS.renderInteractiveForms);
PDFJS.getDocument = displayAPI.getDocument;
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;

Просмотреть файл

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.5.464';
var pdfjsBuild = '834a7ff';
var pdfjsVersion = '1.5.476';
var pdfjsBuild = 'c0e82db';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -1100,6 +1100,28 @@ var AnnotationFlag = {
LOCKEDCONTENTS: 0x200
};
var AnnotationFieldFlag = {
READONLY: 1,
REQUIRED: 2,
NOEXPORT: 3,
MULTILINE: 13,
PASSWORD: 14,
NOTOGGLETOOFF: 15,
RADIO: 16,
PUSHBUTTON: 17,
COMBO: 18,
EDIT: 19,
SORT: 20,
FILESELECT: 21,
MULTISELECT: 22,
DONOTSPELLCHECK: 23,
DONOTSCROLL: 24,
COMB: 25,
RICHTEXT: 26,
RADIOSINUNISON: 26,
COMMITONSELCHANGE: 27,
};
var AnnotationBorderStyleType = {
SOLID: 1,
DASHED: 2,
@ -2391,6 +2413,7 @@ exports.OPS = OPS;
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFieldFlag = AnnotationFieldFlag;
exports.AnnotationFlag = AnnotationFlag;
exports.AnnotationType = AnnotationType;
exports.FontType = FontType;
@ -27015,6 +27038,30 @@ function adjustWidths(properties) {
properties.defaultWidth *= scale;
}
function adjustToUnicode(properties, builtInEncoding) {
if (properties.hasIncludedToUnicodeMap) {
return; // The font dictionary has a `ToUnicode` entry.
}
if (properties.hasEncoding) {
return; // The font dictionary has an `Encoding` entry.
}
if (builtInEncoding === properties.defaultEncoding) {
return; // No point in trying to adjust `toUnicode` if the encodings match.
}
if (properties.toUnicode instanceof IdentityToUnicodeMap) {
return;
}
var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
for (var charCode in builtInEncoding) {
var glyphName = builtInEncoding[charCode];
var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
toUnicode[charCode] = String.fromCharCode(unicode);
}
}
properties.toUnicode.amend(toUnicode);
}
function getFontType(type, subtype) {
switch (type) {
case 'Type1':
@ -27113,7 +27160,13 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {
charCodeOf: function(v) {
return this._map.indexOf(v);
}
},
amend: function (map) {
for (var charCode in map) {
this._map[charCode] = map[charCode];
}
},
};
return ToUnicodeMap;
@ -27149,7 +27202,11 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
charCodeOf: function (v) {
return (isInt(v) && v >= this.firstChar && v <= this.lastChar) ? v : -1;
}
},
amend: function (map) {
error('Should not call amend()');
},
};
return IdentityToUnicodeMap;
@ -27550,6 +27607,7 @@ var Font = (function FontClosure() {
this.fontMatrix = properties.fontMatrix;
this.widths = properties.widths;
this.defaultWidth = properties.defaultWidth;
this.toUnicode = properties.toUnicode;
this.encoding = properties.baseEncoding;
this.seacMap = properties.seacMap;
@ -29171,10 +29229,8 @@ var Font = (function FontClosure() {
} else {
// Most of the following logic in this code branch is based on the
// 9.6.6.4 of the PDF spec.
var hasEncoding =
properties.differences.length > 0 || !!properties.baseEncodingName;
var cmapTable =
readCmapTable(tables['cmap'], font, this.isSymbolicFont, hasEncoding);
var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont,
properties.hasEncoding);
var cmapPlatformId = cmapTable.platformId;
var cmapEncodingId = cmapTable.encodingId;
var cmapMappings = cmapTable.mappings;
@ -29183,7 +29239,7 @@ var Font = (function FontClosure() {
// The spec seems to imply that if the font is symbolic the encoding
// should be ignored, this doesn't appear to work for 'preistabelle.pdf'
// where the the font is symbolic and it has an encoding.
if (hasEncoding &&
if (properties.hasEncoding &&
(cmapPlatformId === 3 && cmapEncodingId === 1 ||
cmapPlatformId === 1 && cmapEncodingId === 0) ||
(cmapPlatformId === -1 && cmapEncodingId === -1 && // Temporary hack
@ -29347,6 +29403,12 @@ var Font = (function FontClosure() {
// TODO: Check the charstring widths to determine this.
properties.fixedPitch = false;
if (properties.builtInEncoding) {
// For Type1 fonts that do not include either `ToUnicode` or `Encoding`
// data, attempt to use the `builtInEncoding` to improve text selection.
adjustToUnicode(properties, properties.builtInEncoding);
}
var mapping = font.getGlyphMapping(properties);
var newMapping = adjustMapping(mapping, properties);
this.toFontChar = newMapping.toFontChar;
@ -37623,6 +37685,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
properties.differences = differences;
properties.baseEncodingName = baseEncodingName;
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
properties.dict = dict;
return toUnicodePromise.then(function(toUnicode) {
properties.toUnicode = toUnicode;
@ -37640,8 +37703,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
* {ToUnicodeMap|IdentityToUnicodeMap} object.
*/
buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
properties.hasIncludedToUnicodeMap =
!!properties.toUnicode && properties.toUnicode.length > 0;
// Section 9.10.2 Mapping Character Codes to Unicode Values
if (properties.toUnicode && properties.toUnicode.length !== 0) {
if (properties.hasIncludedToUnicodeMap) {
return Promise.resolve(properties.toUnicode);
}
// According to the spec if the font is a simple font we should only map
@ -39186,6 +39251,7 @@ exports.PartialEvaluator = PartialEvaluator;
coreColorSpace, coreObj, coreEvaluator) {
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
var AnnotationFlag = sharedUtil.AnnotationFlag;
var AnnotationType = sharedUtil.AnnotationType;
var OPS = sharedUtil.OPS;
@ -39218,10 +39284,14 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
/**
* @param {XRef} xref
* @param {Object} ref
* @param {string} uniquePrefix
* @param {Object} idCounters
* @param {boolean} renderInteractiveForms
* @returns {Annotation}
*/
create: function AnnotationFactory_create(xref, ref,
uniquePrefix, idCounters) {
uniquePrefix, idCounters,
renderInteractiveForms) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
@ -39240,6 +39310,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
ref: isRef(ref) ? ref : null,
subtype: subtype,
id: id,
renderInteractiveForms: renderInteractiveForms,
};
switch (subtype) {
@ -39774,9 +39845,13 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
var fieldType = Util.getInheritableProperty(dict, 'FT');
data.fieldType = isName(fieldType) ? fieldType.name : null;
data.fieldFlags = Util.getInheritableProperty(dict, 'Ff') || 0;
this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
data.fieldFlags = 0;
}
// Hide signatures because we cannot validate them.
if (data.fieldType === 'Sig') {
this.setFlags(AnnotationFlag.HIDDEN);
@ -39815,7 +39890,22 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
data.fullName = fieldName.join('.');
}
Util.inherit(WidgetAnnotation, Annotation, {});
Util.inherit(WidgetAnnotation, Annotation, {
/**
* Check if a provided field flag is set.
*
* @public
* @memberof WidgetAnnotation
* @param {number} flag - Bit position, numbered from one instead of
* zero, to check
* @return {boolean}
* @see {@link shared/util.js}
*/
hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
var mask = 1 << (flag - 1);
return !!(this.data.fieldFlags & mask);
},
});
return WidgetAnnotation;
})();
@ -39824,6 +39914,8 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
function TextWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
this.renderInteractiveForms = params.renderInteractiveForms;
// Determine the alignment of text in the field.
var alignment = Util.getInheritableProperty(params.dict, 'Q');
if (!isInt(alignment) || alignment < 0 || alignment > 2) {
@ -39837,29 +39929,38 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
maximumLength = null;
}
this.data.maxLen = maximumLength;
// Process field flags for the display layer.
this.data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
}
Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator,
task) {
var operatorList = new OperatorList();
// Do not render form elements on the canvas when interactive forms are
// enabled. The display layer is responsible for rendering them instead.
if (this.renderInteractiveForms) {
return Promise.resolve(operatorList);
}
if (this.appearance) {
return Annotation.prototype.getOperatorList.call(this, evaluator, task);
}
var opList = new OperatorList();
var data = this.data;
// Even if there is an appearance stream, ignore it. This is the
// behaviour used by Adobe Reader.
if (!data.defaultAppearance) {
return Promise.resolve(opList);
if (!this.data.defaultAppearance) {
return Promise.resolve(operatorList);
}
var stream = new Stream(stringToBytes(data.defaultAppearance));
return evaluator.getOperatorList(stream, task,
this.fieldResources, opList).
var stream = new Stream(stringToBytes(this.data.defaultAppearance));
return evaluator.getOperatorList(stream, task, this.fieldResources,
operatorList).
then(function () {
return opList;
return operatorList;
});
}
});
@ -40306,7 +40407,8 @@ var Page = (function PageClosure() {
}.bind(this));
},
getOperatorList: function Page_getOperatorList(handler, task, intent) {
getOperatorList: function Page_getOperatorList(handler, task, intent,
renderInteractiveForms) {
var self = this;
var pdfManager = this.pdfManager;
@ -40346,6 +40448,8 @@ var Page = (function PageClosure() {
});
});
this.renderInteractiveForms = renderInteractiveForms;
var annotationsPromise = pdfManager.ensure(this, 'annotations');
return Promise.all([pageListPromise, annotationsPromise]).then(
function(datas) {
@ -40429,7 +40533,8 @@ var Page = (function PageClosure() {
var annotationRef = annotationRefs[i];
var annotation = annotationFactory.create(this.xref, annotationRef,
this.uniquePrefix,
this.idCounters);
this.idCounters,
this.renderInteractiveForms);
if (annotation) {
annotations.push(annotation);
}
@ -41616,7 +41721,8 @@ var WorkerMessageHandler = {
var pageNum = pageIndex + 1;
var start = Date.now();
// Pre compile the pdf page and fetch the fonts/images.
page.getOperatorList(handler, task, data.intent).then(
page.getOperatorList(handler, task, data.intent,
data.renderInteractiveForms).then(
function(operatorList) {
finishWorkerTask(task);

Просмотреть файл

@ -101,7 +101,8 @@
cursor: pointer;
}
.annotationLayer .textWidgetAnnotation input {
.annotationLayer .textWidgetAnnotation input,
.annotationLayer .textWidgetAnnotation textarea {
background-color: rgba(0, 54, 255, 0.13);
border: 1px solid transparent;
box-sizing: border-box;
@ -112,11 +113,26 @@
width: 100%;
}
.annotationLayer .textWidgetAnnotation input:hover {
.annotationLayer .textWidgetAnnotation textarea {
font: message-box;
font-size: 9px;
resize: none;
}
.annotationLayer .textWidgetAnnotation input[disabled],
.annotationLayer .textWidgetAnnotation textarea[disabled] {
background: none;
border: 1px solid transparent;
cursor: not-allowed;
}
.annotationLayer .textWidgetAnnotation input:hover,
.annotationLayer .textWidgetAnnotation textarea:hover {
border: 1px solid #000;
}
.annotationLayer .textWidgetAnnotation input:focus {
.annotationLayer .textWidgetAnnotation input:focus,
.annotationLayer .textWidgetAnnotation textarea:focus {
background: none;
border: 1px solid transparent;
}

Просмотреть файл

@ -5054,6 +5054,8 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
* @property {IPDFAnnotationLayerFactory} annotationLayerFactory
* @property {boolean} enhanceTextSelection - Turns on the text selection
* enhancement. The default is `false`.
* @property {boolean} renderInteractiveForms - Turns on rendering of
* interactive form elements. The default is `false`.
*/
/**
@ -5074,6 +5076,7 @@ var PDFPageView = (function PDFPageViewClosure() {
var textLayerFactory = options.textLayerFactory;
var annotationLayerFactory = options.annotationLayerFactory;
var enhanceTextSelection = options.enhanceTextSelection || false;
var renderInteractiveForms = options.renderInteractiveForms || false;
this.id = id;
this.renderingId = 'page' + id;
@ -5084,6 +5087,7 @@ var PDFPageView = (function PDFPageViewClosure() {
this.pdfPageRotate = defaultViewport.rotation;
this.hasRestrictedScaling = false;
this.enhanceTextSelection = enhanceTextSelection;
this.renderInteractiveForms = renderInteractiveForms;
this.eventBus = options.eventBus || domEvents.getGlobalEventBus();
this.renderingQueue = renderingQueue;
@ -5498,6 +5502,7 @@ var PDFPageView = (function PDFPageViewClosure() {
canvasContext: ctx,
transform: transform,
viewport: this.viewport,
renderInteractiveForms: this.renderInteractiveForms,
// intent: 'default', // === 'display'
};
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
@ -5523,7 +5528,8 @@ var PDFPageView = (function PDFPageViewClosure() {
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.
createAnnotationLayerBuilder(div, this.pdfPage);
createAnnotationLayerBuilder(div, this.pdfPage,
this.renderInteractiveForms);
}
this.annotationLayer.render(this.viewport, 'display');
}
@ -6164,6 +6170,7 @@ var SimpleLinkService = pdfLinkService.SimpleLinkService;
* @typedef {Object} AnnotationLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
* @property {PDFPage} pdfPage
* @property {boolean} renderInteractiveForms
* @property {IPDFLinkService} linkService
* @property {DownloadManager} downloadManager
*/
@ -6179,6 +6186,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
function AnnotationLayerBuilder(options) {
this.pageDiv = options.pageDiv;
this.pdfPage = options.pdfPage;
this.renderInteractiveForms = options.renderInteractiveForms;
this.linkService = options.linkService;
this.downloadManager = options.downloadManager;
@ -6205,9 +6213,9 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
div: self.div,
annotations: annotations,
page: self.pdfPage,
renderInteractiveForms: self.renderInteractiveForms,
linkService: self.linkService,
downloadManager: self.downloadManager,
renderInteractiveForms: pdfjsLib.PDFJS.renderInteractiveForms,
};
if (self.div) {
@ -6254,12 +6262,15 @@ DefaultAnnotationLayerFactory.prototype = {
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @param {boolean} renderInteractiveForms
* @returns {AnnotationLayerBuilder}
*/
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
createAnnotationLayerBuilder: function (pageDiv, pdfPage,
renderInteractiveForms) {
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
renderInteractiveForms: renderInteractiveForms,
linkService: new SimpleLinkService(),
});
}
@ -6321,6 +6332,8 @@ var DEFAULT_CACHE_SIZE = 10;
* around the pages. The default is false.
* @property {boolean} enhanceTextSelection - (optional) Enables the improved
* text selection behaviour. The default is `false`.
* @property {boolean} renderInteractiveForms - (optional) Enables rendering of
* interactive form elements. The default is `false`.
*/
/**
@ -6373,6 +6386,7 @@ var PDFViewer = (function pdfViewer() {
this.downloadManager = options.downloadManager || null;
this.removePageBorders = options.removePageBorders || false;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
@ -6600,6 +6614,7 @@ var PDFViewer = (function pdfViewer() {
textLayerFactory: textLayerFactory,
annotationLayerFactory: this,
enhanceTextSelection: this.enhanceTextSelection,
renderInteractiveForms: this.renderInteractiveForms,
});
bindOnAfterAndBeforeDraw(pageView);
this._pages.push(pageView);
@ -7086,12 +7101,15 @@ var PDFViewer = (function pdfViewer() {
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @param {boolean} renderInteractiveForms
* @returns {AnnotationLayerBuilder}
*/
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
createAnnotationLayerBuilder: function (pageDiv, pdfPage,
renderInteractiveForms) {
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
renderInteractiveForms: renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager
});
@ -7272,6 +7290,7 @@ var PDFViewerApplication = {
linkService: pdfLinkService,
downloadManager: downloadManager,
enhanceTextSelection: false,
renderInteractiveForms: false,
});
pdfRenderingQueue.setViewer(this.pdfViewer);
pdfLinkService.setViewer(this.pdfViewer);
@ -7432,7 +7451,10 @@ var PDFViewerApplication = {
PDFJS.externalLinkTarget = value;
}),
Preferences.get('renderInteractiveForms').then(function resolved(value) {
PDFJS.renderInteractiveForms = value;
// TODO: Like the `enhanceTextSelection` preference, move the
// initialization and fetching of `Preferences` to occur
// before the various viewer components are initialized.
self.pdfViewer.renderInteractiveForms = value;
}),
// TODO move more preferences and other async stuff here
]).catch(function (reason) { });

Просмотреть файл

@ -15,7 +15,7 @@
<em:bootstrap>true</em:bootstrap>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<!-- Target Application this theme can install into,
<!-- Target Application this extension can install into,
with minimum and maximum supported versions. -->
<em:targetApplication>
<Description>

Просмотреть файл

@ -23,7 +23,7 @@ const LONG_TEXT_ROTATE_LIMIT = 3;
/**
* An instance of EditingSession tracks changes that have been made during the
* modification of box model values. All of these changes can be reverted by
* calling revert. The main parameter is the LayoutView that created it.
* calling revert. The main parameter is the BoxModelView that created it.
*
* @param inspector The inspector panel.
* @param doc A DOM document that can be used to test style rules.
@ -183,27 +183,27 @@ EditingSession.prototype = {
};
/**
* The layout-view panel
* The box model view
* @param {InspectorPanel} inspector
* An instance of the inspector-panel currently loaded in the toolbox
* @param {Document} document
* The document that will contain the layout view.
* The document that will contain the box model view.
*/
function LayoutView(inspector, document) {
function BoxModelView(inspector, document) {
this.inspector = inspector;
this.doc = document;
this.wrapper = this.doc.getElementById("layout-wrapper");
this.container = this.doc.getElementById("layout-container");
this.expander = this.doc.getElementById("layout-expander");
this.sizeLabel = this.doc.querySelector(".layout-size > span");
this.sizeHeadingLabel = this.doc.getElementById("layout-element-size");
this.wrapper = this.doc.getElementById("boxmodel-wrapper");
this.container = this.doc.getElementById("boxmodel-container");
this.expander = this.doc.getElementById("boxmodel-expander");
this.sizeLabel = this.doc.querySelector(".boxmodel-size > span");
this.sizeHeadingLabel = this.doc.getElementById("boxmodel-element-size");
this._geometryEditorHighlighter = null;
this._cssProperties = getCssProperties(inspector.toolbox);
this.init();
}
LayoutView.prototype = {
BoxModelView.prototype = {
init: function () {
this.update = this.update.bind(this);
@ -218,7 +218,7 @@ LayoutView.prototype = {
this.onToggleExpander = this.onToggleExpander.bind(this);
this.expander.addEventListener("click", this.onToggleExpander);
let header = this.doc.getElementById("layout-header");
let header = this.doc.getElementById("boxmodel-header");
header.addEventListener("dblclick", this.onToggleExpander);
this.onFilterComputedView = this.onFilterComputedView.bind(this);
@ -233,72 +233,72 @@ LayoutView.prototype = {
this.initBoxModelHighlighter();
// Store for the different dimensions of the node.
// 'selector' refers to the element that holds the value in view.xhtml;
// 'selector' refers to the element that holds the value;
// 'property' is what we are measuring;
// 'value' is the computed dimension, computed in update().
this.map = {
position: {
selector: "#layout-element-position",
selector: "#boxmodel-element-position",
property: "position",
value: undefined
},
marginTop: {
selector: ".layout-margin.layout-top > span",
selector: ".boxmodel-margin.boxmodel-top > span",
property: "margin-top",
value: undefined
},
marginBottom: {
selector: ".layout-margin.layout-bottom > span",
selector: ".boxmodel-margin.boxmodel-bottom > span",
property: "margin-bottom",
value: undefined
},
marginLeft: {
selector: ".layout-margin.layout-left > span",
selector: ".boxmodel-margin.boxmodel-left > span",
property: "margin-left",
value: undefined
},
marginRight: {
selector: ".layout-margin.layout-right > span",
selector: ".boxmodel-margin.boxmodel-right > span",
property: "margin-right",
value: undefined
},
paddingTop: {
selector: ".layout-padding.layout-top > span",
selector: ".boxmodel-padding.boxmodel-top > span",
property: "padding-top",
value: undefined
},
paddingBottom: {
selector: ".layout-padding.layout-bottom > span",
selector: ".boxmodel-padding.boxmodel-bottom > span",
property: "padding-bottom",
value: undefined
},
paddingLeft: {
selector: ".layout-padding.layout-left > span",
selector: ".boxmodel-padding.boxmodel-left > span",
property: "padding-left",
value: undefined
},
paddingRight: {
selector: ".layout-padding.layout-right > span",
selector: ".boxmodel-padding.boxmodel-right > span",
property: "padding-right",
value: undefined
},
borderTop: {
selector: ".layout-border.layout-top > span",
selector: ".boxmodel-border.boxmodel-top > span",
property: "border-top-width",
value: undefined
},
borderBottom: {
selector: ".layout-border.layout-bottom > span",
selector: ".boxmodel-border.boxmodel-bottom > span",
property: "border-bottom-width",
value: undefined
},
borderLeft: {
selector: ".layout-border.layout-left > span",
selector: ".boxmodel-border.boxmodel-left > span",
property: "border-left-width",
value: undefined
},
borderRight: {
selector: ".layout-border.layout-right > span",
selector: ".boxmodel-border.boxmodel-right > span",
property: "border-right-width",
value: undefined
}
@ -326,7 +326,7 @@ LayoutView.prototype = {
},
initBoxModelHighlighter: function () {
let highlightElts = this.doc.querySelectorAll("#layout-container *[title]");
let highlightElts = this.doc.querySelectorAll("#boxmodel-container *[title]");
this.onHighlightMouseOver = this.onHighlightMouseOver.bind(this);
this.onHighlightMouseOut = this.onHighlightMouseOut.bind(this);
@ -367,7 +367,7 @@ LayoutView.prototype = {
},
/**
* Called when the user clicks on one of the editable values in the layoutview
* Called when the user clicks on one of the editable values in the box model view
*/
initEditor: function (element, event, dimension) {
let { property } = dimension;
@ -382,7 +382,7 @@ LayoutView.prototype = {
name: dimension.property
},
start: self => {
self.elt.parentNode.classList.add("layout-editing");
self.elt.parentNode.classList.add("boxmodel-editing");
},
change: value => {
@ -406,7 +406,7 @@ LayoutView.prototype = {
},
done: (value, commit) => {
editor.elt.parentNode.classList.remove("layout-editing");
editor.elt.parentNode.classList.remove("boxmodel-editing");
if (!commit) {
session.revert().then(() => {
session.destroy();
@ -418,7 +418,7 @@ LayoutView.prototype = {
},
/**
* Is the layoutview visible in the sidebar.
* Is the BoxModelView visible in the sidebar.
* @return {Boolean}
*/
isViewVisible: function () {
@ -427,7 +427,7 @@ LayoutView.prototype = {
},
/**
* Is the layoutview visible in the sidebar and is the current node valid to
* Is the BoxModelView visible in the sidebar and is the current node valid to
* be displayed in the view.
* @return {Boolean}
*/
@ -441,7 +441,7 @@ LayoutView.prototype = {
* Destroy the nodes. Remove listeners.
*/
destroy: function () {
let highlightElts = this.doc.querySelectorAll("#layout-container *[title]");
let highlightElts = this.doc.querySelectorAll("#boxmodel-container *[title]");
for (let element of highlightElts) {
element.removeEventListener("mouseover", this.onHighlightMouseOver, true);
@ -449,7 +449,7 @@ LayoutView.prototype = {
}
this.expander.removeEventListener("click", this.onToggleExpander);
let header = this.doc.getElementById("layout-header");
let header = this.doc.getElementById("boxmodel-header");
header.removeEventListener("dblclick", this.onToggleExpander);
let nodeGeometry = this.doc.getElementById("layout-geometry-editor");
@ -458,7 +458,7 @@ LayoutView.prototype = {
this.inspector.off("picker-started", this.onPickerStarted);
// Inspector Panel will destroy `markup` object on "will-navigate" event,
// therefore we have to check if it's still available in case LayoutView
// therefore we have to check if it's still available in case BoxModelView
// is destroyed immediately after.
if (this.inspector.markup) {
this.inspector.markup.off("leave", this.onMarkupViewLeave);
@ -571,7 +571,7 @@ LayoutView.prototype = {
* Event handler that responds to the computed view being filtered
* @param {String} reason
* @param {Boolean} hidden
* Whether or not to hide the layout wrapper
* Whether or not to hide the box model wrapper
*/
onFilterComputedView: function (reason, hidden) {
this.wrapper.hidden = hidden;
@ -579,7 +579,7 @@ LayoutView.prototype = {
/**
* Stop tracking reflows and hide all values when no node is selected or the
* layout-view is hidden, otherwise track reflows and show values.
* box model view is hidden, otherwise track reflows and show values.
* @param {Boolean} isActive
*/
setActive: function (isActive) {
@ -604,7 +604,7 @@ LayoutView.prototype = {
let lastRequest = Task.spawn((function* () {
if (!this.isViewVisibleAndNodeValid()) {
this.wrapper.hidden = true;
this.inspector.emit("layoutview-updated");
this.inspector.emit("boxmodel-view-updated");
return null;
}
@ -689,7 +689,7 @@ LayoutView.prototype = {
this.wrapper.hidden = false;
this.inspector.emit("layoutview-updated");
this.inspector.emit("boxmodel-view-updated");
return null;
}).bind(this)).catch(console.error);
@ -831,12 +831,12 @@ LayoutView.prototype = {
manageOverflowingText: function (span) {
let classList = span.parentNode.classList;
if (classList.contains("layout-left") ||
classList.contains("layout-right")) {
if (classList.contains("boxmodel-left") ||
classList.contains("boxmodel-right")) {
let force = span.textContent.length > LONG_TEXT_ROTATE_LIMIT;
classList.toggle("layout-rotate", force);
classList.toggle("boxmodel-rotate", force);
}
}
};
exports.LayoutView = LayoutView;
exports.BoxModelView = BoxModelView;

Просмотреть файл

@ -5,6 +5,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'box-model.js',
'inspector-tab-panel.css',
'inspector-tab-panel.js',
)
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

Просмотреть файл

@ -0,0 +1,29 @@
[DEFAULT]
tags = devtools
subsuite = devtools
support-files =
doc_boxmodel_iframe1.html
doc_boxmodel_iframe2.html
head.js
!/devtools/client/commandline/test/helpers.js
!/devtools/client/framework/test/shared-head.js
!/devtools/client/inspector/test/head.js
!/devtools/client/inspector/test/shared-head.js
!/devtools/client/shared/test/test-actor.js
!/devtools/client/shared/test/test-actor-registry.js
[browser_boxmodel.js]
[browser_boxmodel_editablemodel.js]
# [browser_boxmodel_editablemodel_allproperties.js]
# Disabled for too many intermittent failures (bug 1009322)
[browser_boxmodel_editablemodel_bluronclick.js]
[browser_boxmodel_editablemodel_border.js]
[browser_boxmodel_editablemodel_stylerules.js]
[browser_boxmodel_guides.js]
[browser_boxmodel_rotate-labels-on-sides.js]
[browser_boxmodel_sync.js]
[browser_boxmodel_tooltips.js]
[browser_boxmodel_update-after-navigation.js]
[browser_boxmodel_update-after-reload.js]
# [browser_boxmodel_update-in-iframes.js]
# Bug 1020038 boxmodel-view updates for iframe elements changes

Просмотреть файл

@ -4,124 +4,124 @@
"use strict";
// Test that the layout-view displays the right values and that it updates when
// Test that the box model displays the right values and that it updates when
// the node's style is changed
// Expected values:
var res1 = [
{
selector: "#layout-element-size",
selector: "#boxmodel-element-size",
value: "160" + "\u00D7" + "160.117"
},
{
selector: ".layout-size > span",
selector: ".boxmodel-size > span",
value: "100" + "\u00D7" + "100.117"
},
{
selector: ".layout-margin.layout-top > span",
selector: ".boxmodel-margin.boxmodel-top > span",
value: 30
},
{
selector: ".layout-margin.layout-left > span",
selector: ".boxmodel-margin.boxmodel-left > span",
value: "auto"
},
{
selector: ".layout-margin.layout-bottom > span",
selector: ".boxmodel-margin.boxmodel-bottom > span",
value: 30
},
{
selector: ".layout-margin.layout-right > span",
selector: ".boxmodel-margin.boxmodel-right > span",
value: "auto"
},
{
selector: ".layout-padding.layout-top > span",
selector: ".boxmodel-padding.boxmodel-top > span",
value: 20
},
{
selector: ".layout-padding.layout-left > span",
selector: ".boxmodel-padding.boxmodel-left > span",
value: 20
},
{
selector: ".layout-padding.layout-bottom > span",
selector: ".boxmodel-padding.boxmodel-bottom > span",
value: 20
},
{
selector: ".layout-padding.layout-right > span",
selector: ".boxmodel-padding.boxmodel-right > span",
value: 20
},
{
selector: ".layout-border.layout-top > span",
selector: ".boxmodel-border.boxmodel-top > span",
value: 10
},
{
selector: ".layout-border.layout-left > span",
selector: ".boxmodel-border.boxmodel-left > span",
value: 10
},
{
selector: ".layout-border.layout-bottom > span",
selector: ".boxmodel-border.boxmodel-bottom > span",
value: 10
},
{
selector: ".layout-border.layout-right > span",
selector: ".boxmodel-border.boxmodel-right > span",
value: 10
},
];
var res2 = [
{
selector: "#layout-element-size",
selector: "#boxmodel-element-size",
value: "190" + "\u00D7" + "210"
},
{
selector: ".layout-size > span",
selector: ".boxmodel-size > span",
value: "100" + "\u00D7" + "150"
},
{
selector: ".layout-margin.layout-top > span",
selector: ".boxmodel-margin.boxmodel-top > span",
value: 30
},
{
selector: ".layout-margin.layout-left > span",
selector: ".boxmodel-margin.boxmodel-left > span",
value: "auto"
},
{
selector: ".layout-margin.layout-bottom > span",
selector: ".boxmodel-margin.boxmodel-bottom > span",
value: 30
},
{
selector: ".layout-margin.layout-right > span",
selector: ".boxmodel-margin.boxmodel-right > span",
value: "auto"
},
{
selector: ".layout-padding.layout-top > span",
selector: ".boxmodel-padding.boxmodel-top > span",
value: 20
},
{
selector: ".layout-padding.layout-left > span",
selector: ".boxmodel-padding.boxmodel-left > span",
value: 20
},
{
selector: ".layout-padding.layout-bottom > span",
selector: ".boxmodel-padding.boxmodel-bottom > span",
value: 20
},
{
selector: ".layout-padding.layout-right > span",
selector: ".boxmodel-padding.boxmodel-right > span",
value: 50
},
{
selector: ".layout-border.layout-top > span",
selector: ".boxmodel-border.boxmodel-top > span",
value: 10
},
{
selector: ".layout-border.layout-left > span",
selector: ".boxmodel-border.boxmodel-left > span",
value: 10
},
{
selector: ".layout-border.layout-bottom > span",
selector: ".boxmodel-border.boxmodel-bottom > span",
value: 10
},
{
selector: ".layout-border.layout-right > span",
selector: ".boxmodel-border.boxmodel-right > span",
value: 10
},
];
@ -133,7 +133,7 @@ add_task(function* () {
let html = "<style>" + style + "</style><div></div>";
yield addTab("data:text/html," + encodeURIComponent(html));
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
yield selectNode("div", inspector);
yield testInitialValues(inspector, view);

Просмотреть файл

@ -19,7 +19,7 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
yield testEditingMargins(inspector, view, testActor);
yield testKeyBindings(inspector, view, testActor);
@ -36,7 +36,7 @@ function* testEditingMargins(inspector, view, testActor) {
"Should be no margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-top > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -66,7 +66,7 @@ function* testKeyBindings(inspector, view, testActor) {
"Should be no margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-left > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-left > span");
is(span.textContent, 10, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -109,7 +109,7 @@ function* testEscapeToUndo(inspector, view, testActor) {
"Should be the right margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-left > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-left > span");
is(span.textContent, 20, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -140,7 +140,7 @@ function* testDeletingValue(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-margin.layout-right > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-right > span");
is(span.textContent, 15, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -167,7 +167,7 @@ function* testRefocusingOnClick(inspector, view, testActor) {
yield selectNode("#div4", inspector);
let span = view.doc.querySelector(".layout-margin.layout-top > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 1, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);

Просмотреть файл

@ -16,7 +16,7 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
yield testEditing(inspector, view, testActor);
yield testEditingAndCanceling(inspector, view, testActor);
@ -32,7 +32,7 @@ function* testEditing(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-bottom > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-bottom > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -63,7 +63,7 @@ function* testEditingAndCanceling(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -91,7 +91,7 @@ function* testDeleting(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -122,7 +122,7 @@ function* testDeletingAndCanceling(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-left > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);

Просмотреть файл

@ -16,11 +16,12 @@ const TEST_URI =
<div id="div1"></div>`;
add_task(function* () {
// Make sure the toolbox is tall enough to have empty space below the layout-container.
// Make sure the toolbox is tall enough to have empty space below the
// boxmodel-container.
yield pushPref("devtools.toolbox.footer.height", 500);
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openLayoutView();
let {inspector, view} = yield openBoxModelView();
yield selectNode("#div1", inspector);
yield testClickingOutsideEditor(view);
@ -29,7 +30,7 @@ add_task(function* () {
function* testClickingOutsideEditor(view) {
info("Test that clicking outside the editor blurs it");
let span = view.doc.querySelector(".layout-margin.layout-top > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 10, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -49,18 +50,18 @@ function* testClickingOutsideEditor(view) {
function* testClickingBelowContainer(view) {
info("Test that clicking below the box-model container blurs it");
let span = view.doc.querySelector(".layout-margin.layout-top > span");
let span = view.doc.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 10, "Should have the right value in the box model.");
info("Test that clicking below the layout-container blurs the opened editor");
info("Test that clicking below the boxmodel-container blurs the opened editor");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
let editor = view.doc.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
let onBlur = once(editor, "blur");
let container = view.doc.querySelector("#layout-container");
let container = view.doc.querySelector("#boxmodel-container");
// Using getBoxQuads here because getBoundingClientRect (and therefore synthesizeMouse)
// use an erroneous height of ~50px for the layout container.
// use an erroneous height of ~50px for the boxmodel-container.
let bounds = container.getBoxQuads({relativeTo: view.doc})[0].bounds;
EventUtils.synthesizeMouseAtPoint(
bounds.left + 10,

Просмотреть файл

@ -16,7 +16,7 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
is((yield getStyle(testActor, "#div1", "border-top-width")), "",
"Should have the right border");
@ -24,7 +24,7 @@ add_task(function* () {
"Should have the right border");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-border.layout-top > span");
let span = view.doc.querySelector(".boxmodel-border.boxmodel-top > span");
is(span.textContent, 0, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);

Просмотреть файл

@ -17,7 +17,7 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
yield testUnits(inspector, view, testActor);
yield testValueComesFromStyleRule(inspector, view, testActor);
@ -31,7 +31,7 @@ function* testUnits(inspector, view, testActor) {
"Should have the right padding");
yield selectNode("#div1", inspector);
let span = view.doc.querySelector(".layout-padding.layout-top > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-top > span");
is(span.textContent, 3, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -68,7 +68,7 @@ function* testValueComesFromStyleRule(inspector, view, testActor) {
"Should have the right border-bottom-width");
yield selectNode("#div2", inspector);
let span = view.doc.querySelector(".layout-border.layout-bottom > span");
let span = view.doc.querySelector(".boxmodel-border.boxmodel-bottom > span");
is(span.textContent, 16, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
@ -97,7 +97,7 @@ function* testShorthandsAreParsed(inspector, view, testActor) {
"Should have the right padding");
yield selectNode("#div3", inspector);
let span = view.doc.querySelector(".layout-padding.layout-right > span");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-right > span");
is(span.textContent, 32, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);

Просмотреть файл

@ -7,7 +7,7 @@
// the right options.
// Tests that actually check the highlighter is displayed and correct are in the
// devtools/inspector/test folder. This test only cares about checking that the
// layout-view does call the highlighter, and it does so by mocking it.
// box model view does call the highlighter, and it does so by mocking it.
const STYLE = "div { position: absolute; top: 50px; left: 50px; " +
"height: 10px; width: 10px; border: 10px solid black; " +
@ -19,7 +19,7 @@ var highlightedNodeFront, highlighterOptions;
add_task(function* () {
yield addTab(TEST_URL);
let {toolbox, inspector, view} = yield openLayoutView();
let {toolbox, inspector, view} = yield openBoxModelView();
yield selectNode("div", inspector);
// Mock the highlighter by replacing the showBoxModel method.
@ -28,21 +28,21 @@ add_task(function* () {
highlighterOptions = options;
};
let elt = view.doc.getElementById("layout-margins");
let elt = view.doc.getElementById("boxmodel-margins");
yield testGuideOnLayoutHover(elt, "margin", inspector, view);
elt = view.doc.getElementById("layout-borders");
elt = view.doc.getElementById("boxmodel-borders");
yield testGuideOnLayoutHover(elt, "border", inspector, view);
elt = view.doc.getElementById("layout-padding");
elt = view.doc.getElementById("boxmodel-padding");
yield testGuideOnLayoutHover(elt, "padding", inspector, view);
elt = view.doc.getElementById("layout-content");
elt = view.doc.getElementById("boxmodel-content");
yield testGuideOnLayoutHover(elt, "content", inspector, view);
});
function* testGuideOnLayoutHover(elt, expectedRegion, inspector) {
info("Synthesizing mouseover on the layout-view");
info("Synthesizing mouseover on the boxmodel-view");
EventUtils.synthesizeMouse(elt, 2, 2, {type: "mouseover"},
elt.ownerDocument.defaultView);

Просмотреть файл

@ -0,0 +1,49 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that longer values are rotated on the side
const res1 = [
{selector: ".boxmodel-margin.boxmodel-top > span", value: 30},
{selector: ".boxmodel-margin.boxmodel-left > span", value: "auto"},
{selector: ".boxmodel-margin.boxmodel-bottom > span", value: 30},
{selector: ".boxmodel-margin.boxmodel-right > span", value: "auto"},
{selector: ".boxmodel-padding.boxmodel-top > span", value: 20},
{selector: ".boxmodel-padding.boxmodel-left > span", value: 2000000},
{selector: ".boxmodel-padding.boxmodel-bottom > span", value: 20},
{selector: ".boxmodel-padding.boxmodel-right > span", value: 20},
{selector: ".boxmodel-border.boxmodel-top > span", value: 10},
{selector: ".boxmodel-border.boxmodel-left > span", value: 10},
{selector: ".boxmodel-border.boxmodel-bottom > span", value: 10},
{selector: ".boxmodel-border.boxmodel-right > span", value: 10},
];
const TEST_URI = encodeURIComponent([
"<style>",
"div { border:10px solid black; padding: 20px 20px 20px 2000000px; " +
"margin: 30px auto; }",
"</style>",
"<div></div>"
].join(""));
const LONG_TEXT_ROTATE_LIMIT = 3;
add_task(function* () {
yield addTab("data:text/html," + TEST_URI);
let {inspector, view} = yield openBoxModelView();
yield selectNode("div", inspector);
for (let i = 0; i < res1.length; i++) {
let elt = view.doc.querySelector(res1[i].selector);
let isLong = elt.textContent.length > LONG_TEXT_ROTATE_LIMIT;
let classList = elt.parentNode.classList;
let canBeRotated = classList.contains("boxmodel-left") ||
classList.contains("boxmodel-right");
let isRotated = classList.contains("boxmodel-rotate");
is(canBeRotated && isLong,
isRotated, res1[i].selector + " correctly rotated.");
}
});

Просмотреть файл

@ -10,14 +10,14 @@ const TEST_URI = "<p>hello</p>";
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openLayoutView();
let {inspector, view} = yield openBoxModelView();
info("When a property is edited, it should sync in the rule view");
yield selectNode("p", inspector);
info("Modify padding-bottom in layout view");
let span = view.doc.querySelector(".layout-padding.layout-bottom > span");
info("Modify padding-bottom in box model view");
let span = view.doc.querySelector(".boxmodel-padding.boxmodel-bottom > span");
EventUtils.synthesizeMouseAtCenter(span, {}, view.doc.defaultView);
let editor = view.doc.querySelector(".styleinspector-propertyeditor");

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
// Test that the regions in the layout-view have tooltips, and that individual
// Test that the regions in the box model view have tooltips, and that individual
// values too. Also test that values that are set from a css rule have tooltips
// referencing the rule.
@ -72,28 +72,28 @@ const VALUES_TEST_DATA = [{
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openLayoutView();
let {inspector, view} = yield openBoxModelView();
info("Checking the regions tooltips");
ok(view.doc.querySelector("#layout-margins").hasAttribute("title"),
ok(view.doc.querySelector("#boxmodel-margins").hasAttribute("title"),
"The margin region has a tooltip");
is(view.doc.querySelector("#layout-margins").getAttribute("title"), "margin",
is(view.doc.querySelector("#boxmodel-margins").getAttribute("title"), "margin",
"The margin region has the correct tooltip content");
ok(view.doc.querySelector("#layout-borders").hasAttribute("title"),
ok(view.doc.querySelector("#boxmodel-borders").hasAttribute("title"),
"The border region has a tooltip");
is(view.doc.querySelector("#layout-borders").getAttribute("title"), "border",
is(view.doc.querySelector("#boxmodel-borders").getAttribute("title"), "border",
"The border region has the correct tooltip content");
ok(view.doc.querySelector("#layout-padding").hasAttribute("title"),
ok(view.doc.querySelector("#boxmodel-padding").hasAttribute("title"),
"The padding region has a tooltip");
is(view.doc.querySelector("#layout-padding").getAttribute("title"), "padding",
is(view.doc.querySelector("#boxmodel-padding").getAttribute("title"), "padding",
"The padding region has the correct tooltip content");
ok(view.doc.querySelector("#layout-content").hasAttribute("title"),
ok(view.doc.querySelector("#boxmodel-content").hasAttribute("title"),
"The content region has a tooltip");
is(view.doc.querySelector("#layout-content").getAttribute("title"), "content",
is(view.doc.querySelector("#boxmodel-content").getAttribute("title"), "content",
"The content region has the correct tooltip content");
for (let {selector, values} of VALUES_TEST_DATA) {

Просмотреть файл

@ -4,15 +4,15 @@
"use strict";
// Test that the layout-view continues to work after a page navigation and that
// Test that the box model view continues to work after a page navigation and that
// it also works after going back
const IFRAME1 = URL_ROOT + "doc_layout_iframe1.html";
const IFRAME2 = URL_ROOT + "doc_layout_iframe2.html";
const IFRAME1 = URL_ROOT + "doc_boxmodel_iframe1.html";
const IFRAME2 = URL_ROOT + "doc_boxmodel_iframe2.html";
add_task(function* () {
yield addTab(IFRAME1);
let {inspector, view, testActor} = yield openLayoutView();
let {inspector, view, testActor} = yield openBoxModelView();
yield testFirstPage(inspector, view, testActor);
@ -30,62 +30,62 @@ add_task(function* () {
});
function* testFirstPage(inspector, view, testActor) {
info("Test that the layout-view works on the first page");
info("Test that the box model view works on the first page");
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value");
let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span");
info("Checking that the box model view shows the right value");
let paddingElt = view.doc.querySelector(".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "50");
info("Listening for layout-view changes and modifying the padding");
info("Listening for box model view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
yield setStyle(testActor, "p", "padding", "20px");
yield onUpdated;
ok(true, "Layout-view got updated");
ok(true, "Box model view got updated");
info("Checking that the layout-view shows the right value after update");
info("Checking that the box model view shows the right value after update");
is(paddingElt.textContent, "20");
}
function* testSecondPage(inspector, view, testActor) {
info("Test that the layout-view works on the second page");
info("Test that the box model view works on the second page");
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value");
let sizeElt = view.doc.querySelector(".layout-size > span");
info("Checking that the box model view shows the right value");
let sizeElt = view.doc.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "100" + "\u00D7" + "100");
info("Listening for layout-view changes and modifying the size");
info("Listening for box model view changes and modifying the size");
let onUpdated = waitForUpdate(inspector);
yield setStyle(testActor, "p", "width", "200px");
yield onUpdated;
ok(true, "Layout-view got updated");
ok(true, "Box model view got updated");
info("Checking that the layout-view shows the right value after update");
info("Checking that the box model view shows the right value after update");
is(sizeElt.textContent, "200" + "\u00D7" + "100");
}
function* testBackToFirstPage(inspector, view, testActor) {
info("Test that the layout-view works on the first page after going back");
info("Test that the box model view works on the first page after going back");
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value, which is the" +
info("Checking that the box model view shows the right value, which is the" +
"modified value from step one because of the bfcache");
let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span");
let paddingElt = view.doc.querySelector(".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "20");
info("Listening for layout-view changes and modifying the padding");
info("Listening for box model view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
yield setStyle(testActor, "p", "padding", "100px");
yield onUpdated;
ok(true, "Layout-view got updated");
ok(true, "Box model view got updated");
info("Checking that the layout-view shows the right value after update");
info("Checking that the box model view shows the right value after update");
is(paddingElt.textContent, "100");
}

Просмотреть файл

@ -0,0 +1,40 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that the box model view continues to work after the page is reloaded
add_task(function* () {
yield addTab(URL_ROOT + "doc_boxmodel_iframe1.html");
let {inspector, view, testActor} = yield openBoxModelView();
info("Test that the box model view works on the first page");
yield assertBoxModelView(inspector, view, testActor);
info("Reload the page");
yield testActor.reload();
yield inspector.once("markuploaded");
info("Test that the box model view works on the reloaded page");
yield assertBoxModelView(inspector, view, testActor);
});
function* assertBoxModelView(inspector, view, testActor) {
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the box model view shows the right value");
let paddingElt = view.doc.querySelector(".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "50");
info("Listening for box model view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
yield setStyle(testActor, "p", "padding", "20px");
yield onUpdated;
ok(true, "Box model view got updated");
info("Checking that the box model view shows the right value after update");
is(paddingElt.textContent, "20");
}

Просмотреть файл

@ -4,12 +4,12 @@
"use strict";
// Test that the layout-view for elements within iframes also updates when they
// Test that the box model view for elements within iframes also updates when they
// change
add_task(function* () {
yield addTab(URL_ROOT + "doc_layout_iframe1.html");
let {inspector, view, testActor} = yield openLayoutView();
yield addTab(URL_ROOT + "doc_boxmodel_iframe1.html");
let {inspector, view, testActor} = yield openBoxModelView();
yield testResizingInIframe(inspector, view, testActor);
yield testReflowsAfterIframeDeletion(inspector, view, testActor);
@ -21,22 +21,22 @@ function* testResizingInIframe(inspector, view, testActor) {
info("Selecting the nested test node");
yield selectNodeInIframe2("div", inspector);
info("Checking that the layout-view shows the right value");
let sizeElt = view.doc.querySelector(".layout-size > span");
info("Checking that the box model view shows the right value");
let sizeElt = view.doc.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "400\u00D7200");
info("Listening for layout-view changes and modifying its size");
info("Listening for box model view changes and modifying its size");
let onUpdated = waitForUpdate(inspector);
yield setStyleInIframe2(testActor, "div", "width", "200px");
yield onUpdated;
ok(true, "Layout-view got updated");
ok(true, "Box model view got updated");
info("Checking that the layout-view shows the right value after update");
info("Checking that the box model view shows the right value after update");
is(sizeElt.textContent, "200\u00D7200");
}
function* testReflowsAfterIframeDeletion(inspector, view, testActor) {
info("Test reflows are still sent to the layout-view after deleting an " +
info("Test reflows are still sent to the box model view after deleting an " +
"iframe");
info("Deleting the iframe2");
@ -46,17 +46,17 @@ function* testReflowsAfterIframeDeletion(inspector, view, testActor) {
info("Selecting the test node in iframe1");
yield selectNodeInIframe1("p", inspector);
info("Checking that the layout-view shows the right value");
let sizeElt = view.doc.querySelector(".layout-size > span");
info("Checking that the box model view shows the right value");
let sizeElt = view.doc.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "100\u00D7100");
info("Listening for layout-view changes and modifying its size");
info("Listening for box model view changes and modifying its size");
let onUpdated = waitForUpdate(inspector);
yield setStyleInIframe1(testActor, "p", "width", "200px");
yield onUpdated;
ok(true, "Layout-view got updated");
ok(true, "Box model view got updated");
info("Checking that the layout-view shows the right value after update");
info("Checking that the box model view shows the right value after update");
is(sizeElt.textContent, "200\u00D7100");
}

Просмотреть файл

@ -1,3 +1,3 @@
<!DOCTYPE html>
<p style="padding:50px;color:#f06;">Root page</p>
<iframe src="doc_layout_iframe2.html"></iframe>
<iframe src="doc_boxmodel_iframe2.html"></iframe>

Просмотреть файл

@ -20,7 +20,7 @@ registerCleanupFunction(() => {
* Simple DOM node accesor function that takes either a node or a string css
* selector as argument and returns the corresponding node
* FIXME: Delete this function and use inspector/test/head.js' getNode instead,
* and fix all layout-view tests to use nodeFronts instead of CPOWs.
* and fix all box model view tests to use nodeFronts instead of CPOWs.
* @param {String|DOMNode} nodeOrSelector
* @return {DOMNode}
*/
@ -49,14 +49,14 @@ function selectAndHighlightNode(nodeOrSelector, inspector) {
}
/**
* Open the toolbox, with the inspector tool visible, and the layout-view
* sidebar tab selected.
* @return a promise that resolves when the inspector is ready and the layout
* Open the toolbox, with the inspector tool visible, and the computed view
* sidebar tab selected to display the box model view.
* @return a promise that resolves when the inspector is ready and the box model
* view is visible and ready
*/
function openLayoutView() {
function openBoxModelView() {
return openInspectorSidebarTab("computedview").then(data => {
// The actual highligher show/hide methods are mocked in layoutview tests.
// The actual highligher show/hide methods are mocked in box model tests.
// The highlighter is tested in devtools/inspector/test.
function mockHighlighter({highlighter}) {
highlighter.showBoxModel = function () {
@ -71,18 +71,18 @@ function openLayoutView() {
return {
toolbox: data.toolbox,
inspector: data.inspector,
view: data.inspector.computedview.layoutView,
view: data.inspector.computedview.boxModelView,
testActor: data.testActor
};
});
}
/**
* Wait for the layoutview-updated event.
* Wait for the boxmodel-view-updated event.
* @return a promise
*/
function waitForUpdate(inspector) {
return inspector.once("layoutview-updated");
return inspector.once("boxmodel-view-updated");
}
function getStyle(testActor, selector, propertyName) {

Просмотреть файл

@ -23,7 +23,7 @@ const {getCssProperties} = require("devtools/shared/fronts/css-properties");
const overlays = require("devtools/client/inspector/shared/style-inspector-overlays");
const StyleInspectorMenu = require("devtools/client/inspector/shared/style-inspector-menu");
const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
const {LayoutView} = require("devtools/client/inspector/layout/layout");
const {BoxModelView} = require("devtools/client/inspector/components/box-model");
const clipboardHelper = require("devtools/shared/platform/clipboard");
const STYLE_INSPECTOR_PROPERTIES = "devtools-shared/locale/styleinspector.properties";
@ -1394,7 +1394,7 @@ function ComputedViewTool(inspector, window) {
this.computedView = new CssComputedView(this.inspector, this.document,
this.inspector.pageStyle);
this.layoutView = new LayoutView(this.inspector, this.document);
this.boxModelView = new BoxModelView(this.inspector, this.document);
this.onSelected = this.onSelected.bind(this);
this.refresh = this.refresh.bind(this);
@ -1503,9 +1503,9 @@ ComputedViewTool.prototype = {
}
this.computedView.destroy();
this.layoutView.destroy();
this.boxModelView.destroy();
this.computedView = this.layoutView = this.document = this.inspector = null;
this.computedView = this.boxModelView = this.document = this.inspector = null;
}
};

Просмотреть файл

@ -34,7 +34,7 @@ function* testToggleDefaultStyles(inspector, computedView) {
function* testAddTextInFilter(inspector, computedView) {
info("setting filter text to \"color\"");
let doc = computedView.styleDocument;
let layoutWrapper = doc.querySelector("#layout-wrapper");
let boxModelWrapper = doc.querySelector("#boxmodel-wrapper");
let searchField = computedView.searchField;
let onRefreshed = inspector.once("computed-view-refreshed");
let win = computedView.styleWindow;
@ -53,7 +53,7 @@ function* testAddTextInFilter(inspector, computedView) {
synthesizeKeys("color", win);
yield onRefreshed;
ok(layoutWrapper.hidden, "Layout view is hidden");
ok(boxModelWrapper.hidden, "Box model is hidden");
info("check that the correct properties are visible");

Просмотреть файл

@ -50,7 +50,7 @@ function* testClearSearchFilter(inspector, computedView) {
let win = computedView.styleWindow;
let doc = computedView.styleDocument;
let layoutWrapper = doc.querySelector("#layout-wrapper");
let boxModelWrapper = doc.querySelector("#boxmodel-wrapper");
let propertyViews = computedView.propertyViews;
let searchField = computedView.searchField;
let searchClearButton = computedView.searchClearButton;
@ -59,7 +59,7 @@ function* testClearSearchFilter(inspector, computedView) {
EventUtils.synthesizeMouseAtCenter(searchClearButton, {}, win);
yield onRefreshed;
ok(!layoutWrapper.hidden, "Layout view is displayed");
ok(!boxModelWrapper.hidden, "Box model is displayed");
info("Check that the correct properties are visible");

Просмотреть файл

@ -38,7 +38,7 @@ const TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties"
/**
* Represents an open instance of the Inspector for a tab.
* The inspector controls the breadcrumbs, the markup view, and the sidebar
* (computed view, rule view, font view and layout view).
* (computed view, rule view, font view and animation inspector).
*
* Events:
* - ready
@ -52,8 +52,8 @@ const TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties"
* Fired when the markup-view frame has loaded
* - breadcrumbs-updated
* Fired when the breadcrumb widget updates to a new node
* - layoutview-updated
* Fired when the layoutview (box model) updates to a new node
* - boxmodel-view-updated
* Fired when the box model updates to a new node
* - markupmutation
* Fired after markup mutations have been processed by the markup-view
* - computed-view-refreshed

Просмотреть файл

@ -9,7 +9,7 @@
<?xml-stylesheet href="chrome://devtools/skin/rules.css" type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/computed.css" type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/fonts.css" type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/layout.css" type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/boxmodel.css" type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/animationinspector.css" type="text/css"?>
<?xml-stylesheet href="resource://devtools/client/shared/components/sidebar-toggle.css" type="text/css"?>
<?xml-stylesheet href="resource://devtools/client/shared/components/tabs/tabs.css" type="text/css"?>
@ -116,54 +116,54 @@
<html:div id="computedview-container">
<html:div id="computedview-container-focusable" tabindex="-1">
<html:div id="layout-wrapper" tabindex="0">
<html:div id="layout-header">
<html:div id="layout-expander" class="expander theme-twisty expandable" open=""></html:div>
<html:div id="boxmodel-wrapper" tabindex="0">
<html:div id="boxmodel-header">
<html:div id="boxmodel-expander" class="expander theme-twisty expandable" open=""></html:div>
<html:span>&layoutViewTitle;</html:span>
</html:div>
<html:div id="layout-container">
<html:div id="layout-main">
<html:span class="layout-legend" data-box="margin" title="&margin.tooltip;">&margin.tooltip;</html:span>
<html:div id="layout-margins" data-box="margin" title="&margin.tooltip;">
<html:span class="layout-legend" data-box="border" title="&border.tooltip;">&border.tooltip;</html:span>
<html:div id="layout-borders" data-box="border" title="&border.tooltip;">
<html:span class="layout-legend" data-box="padding" title="&padding.tooltip;">&padding.tooltip;</html:span>
<html:div id="layout-padding" data-box="padding" title="&padding.tooltip;">
<html:div id="layout-content" data-box="content" title="&content.tooltip;">
<html:div id="boxmodel-container">
<html:div id="boxmodel-main">
<html:span class="boxmodel-legend" data-box="margin" title="&margin.tooltip;">&margin.tooltip;</html:span>
<html:div id="boxmodel-margins" data-box="margin" title="&margin.tooltip;">
<html:span class="boxmodel-legend" data-box="border" title="&border.tooltip;">&border.tooltip;</html:span>
<html:div id="boxmodel-borders" data-box="border" title="&border.tooltip;">
<html:span class="boxmodel-legend" data-box="padding" title="&padding.tooltip;">&padding.tooltip;</html:span>
<html:div id="boxmodel-padding" data-box="padding" title="&padding.tooltip;">
<html:div id="boxmodel-content" data-box="content" title="&content.tooltip;">
</html:div>
</html:div>
</html:div>
</html:div>
<html:p class="layout-margin layout-top"><html:span data-box="margin" class="layout-editable" title="margin-top"></html:span></html:p>
<html:p class="layout-margin layout-right"><html:span data-box="margin" class="layout-editable" title="margin-right"></html:span></html:p>
<html:p class="layout-margin layout-bottom"><html:span data-box="margin" class="layout-editable" title="margin-bottom"></html:span></html:p>
<html:p class="layout-margin layout-left"><html:span data-box="margin" class="layout-editable" title="margin-left"></html:span></html:p>
<html:p class="boxmodel-margin boxmodel-top"><html:span data-box="margin" class="boxmodel-editable" title="margin-top"></html:span></html:p>
<html:p class="boxmodel-margin boxmodel-right"><html:span data-box="margin" class="boxmodel-editable" title="margin-right"></html:span></html:p>
<html:p class="boxmodel-margin boxmodel-bottom"><html:span data-box="margin" class="boxmodel-editable" title="margin-bottom"></html:span></html:p>
<html:p class="boxmodel-margin boxmodel-left"><html:span data-box="margin" class="boxmodel-editable" title="margin-left"></html:span></html:p>
<html:p class="layout-border layout-top"><html:span data-box="border" class="layout-editable" title="border-top"></html:span></html:p>
<html:p class="layout-border layout-right"><html:span data-box="border" class="layout-editable" title="border-right"></html:span></html:p>
<html:p class="layout-border layout-bottom"><html:span data-box="border" class="layout-editable" title="border-bottom"></html:span></html:p>
<html:p class="layout-border layout-left"><html:span data-box="border" class="layout-editable" title="border-left"></html:span></html:p>
<html:p class="boxmodel-border boxmodel-top"><html:span data-box="border" class="boxmodel-editable" title="border-top"></html:span></html:p>
<html:p class="boxmodel-border boxmodel-right"><html:span data-box="border" class="boxmodel-editable" title="border-right"></html:span></html:p>
<html:p class="boxmodel-border boxmodel-bottom"><html:span data-box="border" class="boxmodel-editable" title="border-bottom"></html:span></html:p>
<html:p class="boxmodel-border boxmodel-left"><html:span data-box="border" class="boxmodel-editable" title="border-left"></html:span></html:p>
<html:p class="layout-padding layout-top"><html:span data-box="padding" class="layout-editable" title="padding-top"></html:span></html:p>
<html:p class="layout-padding layout-right"><html:span data-box="padding" class="layout-editable" title="padding-right"></html:span></html:p>
<html:p class="layout-padding layout-bottom"><html:span data-box="padding" class="layout-editable" title="padding-bottom"></html:span></html:p>
<html:p class="layout-padding layout-left"><html:span data-box="padding" class="layout-editable" title="padding-left"></html:span></html:p>
<html:p class="boxmodel-padding boxmodel-top"><html:span data-box="padding" class="boxmodel-editable" title="padding-top"></html:span></html:p>
<html:p class="boxmodel-padding boxmodel-right"><html:span data-box="padding" class="boxmodel-editable" title="padding-right"></html:span></html:p>
<html:p class="boxmodel-padding boxmodel-bottom"><html:span data-box="padding" class="boxmodel-editable" title="padding-bottom"></html:span></html:p>
<html:p class="boxmodel-padding boxmodel-left"><html:span data-box="padding" class="boxmodel-editable" title="padding-left"></html:span></html:p>
<html:p class="layout-size"><html:span data-box="content" title="&content.tooltip;"></html:span></html:p>
<html:p class="boxmodel-size"><html:span data-box="content" title="&content.tooltip;"></html:span></html:p>
</html:div>
<html:div id="layout-info">
<html:span id="layout-element-size"></html:span>
<html:section id="layout-position-group">
<html:div id="boxmodel-info">
<html:span id="boxmodel-element-size"></html:span>
<html:section id="boxmodel-position-group">
<html:button class="devtools-button" id="layout-geometry-editor" title="&geometry.button.tooltip;"></html:button>
<html:span id="layout-element-position"></html:span>
<html:span id="boxmodel-element-position"></html:span>
</html:section>
</html:div>
<html:div style="display: none">
<html:p id="layout-dummy"></html:p>
<html:p id="boxmodel-dummy"></html:p>
</html:div>
</html:div>
</html:div>

Просмотреть файл

@ -1,11 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'layout.js',
)
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

Просмотреть файл

@ -1,29 +0,0 @@
[DEFAULT]
tags = devtools
subsuite = devtools
support-files =
doc_layout_iframe1.html
doc_layout_iframe2.html
head.js
!/devtools/client/commandline/test/helpers.js
!/devtools/client/framework/test/shared-head.js
!/devtools/client/inspector/test/head.js
!/devtools/client/inspector/test/shared-head.js
!/devtools/client/shared/test/test-actor.js
!/devtools/client/shared/test/test-actor-registry.js
[browser_layout.js]
[browser_layout_editablemodel.js]
# [browser_layout_editablemodel_allproperties.js]
# Disabled for too many intermittent failures (bug 1009322)
[browser_layout_editablemodel_bluronclick.js]
[browser_layout_editablemodel_border.js]
[browser_layout_editablemodel_stylerules.js]
[browser_layout_guides.js]
[browser_layout_rotate-labels-on-sides.js]
[browser_layout_sync.js]
[browser_layout_tooltips.js]
[browser_layout_update-after-navigation.js]
[browser_layout_update-after-reload.js]
# [browser_layout_update-in-iframes.js]
# Bug 1020038 layout-view updates for iframe elements changes

Просмотреть файл

@ -1,49 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that longer values are rotated on the side
const res1 = [
{selector: ".layout-margin.layout-top > span", value: 30},
{selector: ".layout-margin.layout-left > span", value: "auto"},
{selector: ".layout-margin.layout-bottom > span", value: 30},
{selector: ".layout-margin.layout-right > span", value: "auto"},
{selector: ".layout-padding.layout-top > span", value: 20},
{selector: ".layout-padding.layout-left > span", value: 2000000},
{selector: ".layout-padding.layout-bottom > span", value: 20},
{selector: ".layout-padding.layout-right > span", value: 20},
{selector: ".layout-border.layout-top > span", value: 10},
{selector: ".layout-border.layout-left > span", value: 10},
{selector: ".layout-border.layout-bottom > span", value: 10},
{selector: ".layout-border.layout-right > span", value: 10},
];
const TEST_URI = encodeURIComponent([
"<style>",
"div { border:10px solid black; padding: 20px 20px 20px 2000000px; " +
"margin: 30px auto; }",
"</style>",
"<div></div>"
].join(""));
const LONG_TEXT_ROTATE_LIMIT = 3;
add_task(function* () {
yield addTab("data:text/html," + TEST_URI);
let {inspector, view} = yield openLayoutView();
yield selectNode("div", inspector);
for (let i = 0; i < res1.length; i++) {
let elt = view.doc.querySelector(res1[i].selector);
let isLong = elt.textContent.length > LONG_TEXT_ROTATE_LIMIT;
let classList = elt.parentNode.classList;
let canBeRotated = classList.contains("layout-left") ||
classList.contains("layout-right");
let isRotated = classList.contains("layout-rotate");
is(canBeRotated && isLong,
isRotated, res1[i].selector + " correctly rotated.");
}
});

Просмотреть файл

@ -1,40 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that the layout-view continues to work after the page is reloaded
add_task(function* () {
yield addTab(URL_ROOT + "doc_layout_iframe1.html");
let {inspector, view, testActor} = yield openLayoutView();
info("Test that the layout-view works on the first page");
yield assertLayoutView(inspector, view, testActor);
info("Reload the page");
yield testActor.reload();
yield inspector.once("markuploaded");
info("Test that the layout-view works on the reloaded page");
yield assertLayoutView(inspector, view, testActor);
});
function* assertLayoutView(inspector, view, testActor) {
info("Selecting the test node");
yield selectNode("p", inspector);
info("Checking that the layout-view shows the right value");
let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span");
is(paddingElt.textContent, "50");
info("Listening for layout-view changes and modifying the padding");
let onUpdated = waitForUpdate(inspector);
yield setStyle(testActor, "p", "padding", "20px");
yield onUpdated;
ok(true, "Layout-view got updated");
info("Checking that the layout-view shows the right value after update");
is(paddingElt.textContent, "20");
}

Просмотреть файл

@ -6,7 +6,6 @@ DIRS += [
'components',
'computed',
'fonts',
'layout',
'markup',
'rules',
'shared'

Просмотреть файл

@ -26,7 +26,6 @@ devtools.jar:
content/styleeditor/styleeditor.xul (styleeditor/styleeditor.xul)
content/storage/storage.xul (storage/storage.xul)
content/inspector/fonts/fonts.js (inspector/fonts/fonts.js)
content/inspector/layout/layout.js (inspector/layout/layout.js)
content/inspector/markup/markup.xhtml (inspector/markup/markup.xhtml)
content/animationinspector/animation-controller.js (animationinspector/animation-controller.js)
content/animationinspector/animation-panel.js (animationinspector/animation-panel.js)
@ -212,7 +211,7 @@ devtools.jar:
skin/images/itemArrow-ltr.svg (themes/images/itemArrow-ltr.svg)
skin/images/noise.png (themes/images/noise.png)
skin/images/dropmarker.svg (themes/images/dropmarker.svg)
skin/layout.css (themes/layout.css)
skin/boxmodel.css (themes/boxmodel.css)
skin/images/geometry-editor.svg (themes/images/geometry-editor.svg)
skin/images/pause.svg (themes/images/pause.svg)
skin/images/play.svg (themes/images/play.svg)

Просмотреть файл

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/ */
#layout-wrapper {
#boxmodel-wrapper {
border-bottom-style: solid;
border-bottom-width: 1px;
border-color: var(--theme-splitter-color);
}
#layout-container {
#boxmodel-container {
/* The view will grow bigger as the window gets resized, until 400px */
max-width: 400px;
margin: 0px auto;
@ -17,8 +17,8 @@
/* Header */
#layout-header,
#layout-info {
#boxmodel-header,
#boxmodel-info {
display: flex;
align-items: center;
padding: 4px 17px;
@ -34,7 +34,7 @@
/* Main: contains the box-model regions */
#layout-main {
#boxmodel-main {
position: relative;
box-sizing: border-box;
/* The regions are semi-transparent, so the white background is partly
@ -46,192 +46,192 @@
width: calc(100% - 2 * 14px);
}
.layout-margin,
.layout-size {
.boxmodel-margin,
.boxmodel-size {
color: var(--theme-highlight-blue);
}
/* Regions are 3 nested elements with wide borders and outlines */
#layout-content {
#boxmodel-content {
height: 18px;
}
#layout-margins,
#layout-borders,
#layout-padding {
#boxmodel-margins,
#boxmodel-borders,
#boxmodel-padding {
border-color: hsla(210,100%,85%,0.2);
border-width: 18px;
border-style: solid;
outline: dotted 1px hsl(210,100%,85%);
}
#layout-margins {
#boxmodel-margins {
/* This opacity applies to all of the regions, since they are nested */
opacity: .8;
}
/* Regions colors */
#layout-margins {
#boxmodel-margins {
border-color: #edff64;
}
#layout-borders {
#boxmodel-borders {
border-color: #444444;
}
#layout-padding {
#boxmodel-padding {
border-color: #6a5acd;
}
#layout-content {
#boxmodel-content {
background-color: #87ceeb;
}
.theme-firebug #layout-main,
.theme-firebug #layout-borders,
.theme-firebug #layout-content {
.theme-firebug #boxmodel-main,
.theme-firebug #boxmodel-borders,
.theme-firebug #boxmodel-content {
border-style: solid;
}
.theme-firebug #layout-main,
.theme-firebug #layout-header {
.theme-firebug #boxmodel-main,
.theme-firebug #boxmodel-header {
font-family: var(--proportional-font-family);
}
.theme-firebug #layout-main {
.theme-firebug #boxmodel-main {
color: var(--theme-body-color);
font-size: var(--theme-toolbar-font-size);
}
.theme-firebug #layout-header {
.theme-firebug #boxmodel-header {
font-size: var(--theme-toolbar-font-size);
}
/* Editable region sizes are contained in absolutely positioned <p> */
#layout-main > p {
#boxmodel-main > p {
position: absolute;
pointer-events: none;
margin: 0;
text-align: center;
}
#layout-main > p > span,
#layout-main > p > input {
#boxmodel-main > p > span,
#boxmodel-main > p > input {
vertical-align: middle;
pointer-events: auto;
}
/* Coordinates for the region sizes */
.layout-top,
.layout-bottom {
.boxmodel-top,
.boxmodel-bottom {
width: calc(100% - 2px);
text-align: center;
}
.layout-padding.layout-top {
.boxmodel-padding.boxmodel-top {
top: 37px;
}
.layout-padding.layout-bottom {
.boxmodel-padding.boxmodel-bottom {
bottom: 38px;
}
.layout-border.layout-top {
.boxmodel-border.boxmodel-top {
top: 19px;
}
.layout-border.layout-bottom {
.boxmodel-border.boxmodel-bottom {
bottom: 20px;
}
.layout-margin.layout-top {
.boxmodel-margin.boxmodel-top {
top: 1px;
}
.layout-margin.layout-bottom {
.boxmodel-margin.boxmodel-bottom {
bottom: 2px;
}
.layout-size,
.layout-margin.layout-left,
.layout-margin.layout-right,
.layout-border.layout-left,
.layout-border.layout-right,
.layout-padding.layout-left,
.layout-padding.layout-right {
.boxmodel-size,
.boxmodel-margin.boxmodel-left,
.boxmodel-margin.boxmodel-right,
.boxmodel-border.boxmodel-left,
.boxmodel-border.boxmodel-right,
.boxmodel-padding.boxmodel-left,
.boxmodel-padding.boxmodel-right {
top: 22px;
line-height: 80px;
}
.layout-size {
.boxmodel-size {
width: calc(100% - 2px);
}
.layout-margin.layout-right,
.layout-margin.layout-left,
.layout-border.layout-left,
.layout-border.layout-right,
.layout-padding.layout-right,
.layout-padding.layout-left {
.boxmodel-margin.boxmodel-right,
.boxmodel-margin.boxmodel-left,
.boxmodel-border.boxmodel-left,
.boxmodel-border.boxmodel-right,
.boxmodel-padding.boxmodel-right,
.boxmodel-padding.boxmodel-left {
width: 21px;
}
.layout-padding.layout-left {
.boxmodel-padding.boxmodel-left {
left: 35px;
}
.layout-padding.layout-right {
.boxmodel-padding.boxmodel-right {
right: 35px;
}
.layout-border.layout-left {
.boxmodel-border.boxmodel-left {
left: 16px;
}
.layout-border.layout-right {
.boxmodel-border.boxmodel-right {
right: 17px;
}
.layout-margin.layout-right {
.boxmodel-margin.boxmodel-right {
right: 0;
}
.layout-margin.layout-left {
.boxmodel-margin.boxmodel-left {
left: 0;
}
.layout-rotate.layout-left:not(.layout-editing) {
.boxmodel-rotate.boxmodel-left:not(.boxmodel-editing) {
transform: rotate(-90deg);
}
.layout-rotate.layout-right:not(.layout-editing) {
.boxmodel-rotate.boxmodel-right:not(.boxmodel-editing) {
transform: rotate(90deg);
}
/* Legend: displayed inside regions */
.layout-legend {
.boxmodel-legend {
position: absolute;
margin: 2px 6px;
z-index: 1;
}
.layout-legend[data-box="margin"] {
.boxmodel-legend[data-box="margin"] {
color: var(--theme-highlight-blue);
}
/* Editable fields */
.layout-editable {
.boxmodel-editable {
border: 1px dashed transparent;
-moz-user-select: text;
}
.layout-editable:hover {
.boxmodel-editable:hover {
border-bottom-color: hsl(0, 0%, 50%);
}
@ -242,17 +242,17 @@
/* Make sure the content size doesn't appear as editable like the other sizes */
.layout-size > span {
.boxmodel-size > span {
cursor: default;
}
/* Layout info: contains the position and size of the element */
/* Box Model Info: contains the position and size of the element */
#layout-element-size {
#boxmodel-element-size {
flex: 1;
}
#layout-position-group {
#boxmodel-position-group {
display: flex;
align-items: center;
}

Просмотреть файл

@ -72,7 +72,7 @@ exports.register = register;
* The InspectorActor will always return the same instance of
* HighlighterActor if asked several times and this instance is used in the
* toolbox to highlighter elements's box-model from the markup-view,
* layout-view, console, debugger, ... as well as select elements with the
* box model view, console, debugger, ... as well as select elements with the
* pointer (pick).
*
* Other types of highlighter actors exist and can be accessed via the

Просмотреть файл

@ -2653,7 +2653,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
* The same instance will always be returned by this method when called
* several times.
* The highlighter actor returned here is used to highlighter elements's
* box-models from the markup-view, layout-view, console, debugger, ... as
* box-models from the markup-view, box model, console, debugger, ... as
* well as select elements with the pointer (pick).
*
* @param {Boolean} autohide Optionally autohide the highlighter after an

Просмотреть файл

@ -760,7 +760,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
let layout = {};
// First, we update the first part of the layout view, with
// First, we update the first part of the box model view, with
// the size of the element.
let clientRect = node.rawNode.getBoundingClientRect();

Просмотреть файл

@ -3,23 +3,16 @@
// Send these sites a custom user-agent. Bugs should be included with an entry.
// NOTE: trailing commas are not valid JSON and will prevent the CDN from syncing.
{
// bug 117898, yahoo.co.jp properties
// bug 1177298, yahoo.co.jp properties
"www.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
// send override to m. in addition to www. to prevent infinite 302 loop
"m.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"auctions.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"finance.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"news.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"shopping.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"sports.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"travel.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
"weather.yahoo.co.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
// bug 117898, lohaco.jp
// bug 1177298, lohaco.jp
"lohaco.jp": "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36",
// bug 117898, www.nhk.or.jp
// bug 1177298, www.nhk.or.jp
"nhk.or.jp": "\\)\\s# AppleWebKit ",
// bug 1177298, uniqlo.com
"uniqlo.com": "\\)\\s#) Mobile Safari ",
// bug 1177298, mixi.jp
"mixi.jp": "\\)\\s#) Mobile Safari "
"uniqlo.com": "\\)\\s#) Mobile Safari "
}

Просмотреть файл

@ -8,6 +8,7 @@
"{firefox}\\browser\\omni.ja": {"mincount": 0, "maxcount": 28, "minbytes": 0, "maxbytes": 1835008},
"{firefox}\\browser\\features\\e10srollout@mozilla.org.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},
"{firefox}\\browser\\features\\flyweb@mozilla.org.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},
"{firefox}\\browser\\features\\formautofill@mozilla.org.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},
"{firefox}\\browser\\features\\loop@mozilla.org.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},
"{firefox}\\browser\\features\\firefox@getpocket.com.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},
"{firefox}\\browser\\features\\webcompat@mozilla.org.xpi": {"mincount": 0, "maxcount": 100, "minbytes": 0, "maxbytes": 10000000},