Update linux and linux_64 reference builds to r194818.

BUG=136110
TEST=Ran a single Telemetry benchmark on linux

git-svn-id: http://src.chromium.org/svn/trunk/deps/reference_builds/chrome_linux64@195859 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/chrome b/chrome
index ed741b1..b5f514f 100755
--- a/chrome
+++ b/chrome
Binary files differ
diff --git a/chrome.pak b/chrome.pak
index 1dd854d..e5a1e81 100644
--- a/chrome.pak
+++ b/chrome.pak
Binary files differ
diff --git a/chrome_100_percent.pak b/chrome_100_percent.pak
index aec13a3..e0d197f 100644
--- a/chrome_100_percent.pak
+++ b/chrome_100_percent.pak
Binary files differ
diff --git a/chrome_sandbox b/chrome_sandbox
index 4cb04fe..c5e3609 100755
--- a/chrome_sandbox
+++ b/chrome_sandbox
Binary files differ
diff --git a/locales/am.pak b/locales/am.pak
index 481ba13..15a46a8 100644
--- a/locales/am.pak
+++ b/locales/am.pak
Binary files differ
diff --git a/locales/ar.pak b/locales/ar.pak
index a696b42..2db4051 100644
--- a/locales/ar.pak
+++ b/locales/ar.pak
Binary files differ
diff --git a/locales/bg.pak b/locales/bg.pak
index 01551e2..65145d1 100644
--- a/locales/bg.pak
+++ b/locales/bg.pak
Binary files differ
diff --git a/locales/bn.pak b/locales/bn.pak
index 4cf158e..cff47fd 100644
--- a/locales/bn.pak
+++ b/locales/bn.pak
Binary files differ
diff --git a/locales/ca.pak b/locales/ca.pak
index c7a730b..4fee13c 100644
--- a/locales/ca.pak
+++ b/locales/ca.pak
Binary files differ
diff --git a/locales/cs.pak b/locales/cs.pak
index da43bb8..03d6e40 100644
--- a/locales/cs.pak
+++ b/locales/cs.pak
Binary files differ
diff --git a/locales/da.pak b/locales/da.pak
index a99b146..cc867ac 100644
--- a/locales/da.pak
+++ b/locales/da.pak
Binary files differ
diff --git a/locales/de.pak b/locales/de.pak
index 6b5e868..5571af9 100644
--- a/locales/de.pak
+++ b/locales/de.pak
Binary files differ
diff --git a/locales/el.pak b/locales/el.pak
index 8bf3cb9..99778b4 100644
--- a/locales/el.pak
+++ b/locales/el.pak
Binary files differ
diff --git a/locales/en-GB.pak b/locales/en-GB.pak
index f0839aa..cdbbd64 100644
--- a/locales/en-GB.pak
+++ b/locales/en-GB.pak
Binary files differ
diff --git a/locales/en-US.pak b/locales/en-US.pak
index 732bb80..da14f77 100644
--- a/locales/en-US.pak
+++ b/locales/en-US.pak
Binary files differ
diff --git a/locales/es-419.pak b/locales/es-419.pak
index 654668d..47bd800 100644
--- a/locales/es-419.pak
+++ b/locales/es-419.pak
Binary files differ
diff --git a/locales/es.pak b/locales/es.pak
index 21a9c18..5fe816a 100644
--- a/locales/es.pak
+++ b/locales/es.pak
Binary files differ
diff --git a/locales/et.pak b/locales/et.pak
index 9d2917d..eb5385f 100644
--- a/locales/et.pak
+++ b/locales/et.pak
Binary files differ
diff --git a/locales/fa.pak b/locales/fa.pak
index 876f5ce..a1337d1 100644
--- a/locales/fa.pak
+++ b/locales/fa.pak
Binary files differ
diff --git a/locales/fi.pak b/locales/fi.pak
index c3fb2f5..e08e87a 100644
--- a/locales/fi.pak
+++ b/locales/fi.pak
Binary files differ
diff --git a/locales/fil.pak b/locales/fil.pak
index 0f4c54f..2fbc3f0 100644
--- a/locales/fil.pak
+++ b/locales/fil.pak
Binary files differ
diff --git a/locales/fr.pak b/locales/fr.pak
index 303d1d9..d5d4e0f 100644
--- a/locales/fr.pak
+++ b/locales/fr.pak
Binary files differ
diff --git a/locales/gu.pak b/locales/gu.pak
index aa29192..83ccb76 100644
--- a/locales/gu.pak
+++ b/locales/gu.pak
Binary files differ
diff --git a/locales/he.pak b/locales/he.pak
index fcba852..f74494f 100644
--- a/locales/he.pak
+++ b/locales/he.pak
Binary files differ
diff --git a/locales/hi.pak b/locales/hi.pak
index 8ea5755..f4326ab 100644
--- a/locales/hi.pak
+++ b/locales/hi.pak
Binary files differ
diff --git a/locales/hr.pak b/locales/hr.pak
index 9ab71f2..441e55b 100644
--- a/locales/hr.pak
+++ b/locales/hr.pak
Binary files differ
diff --git a/locales/hu.pak b/locales/hu.pak
index df435c2..93585e8 100644
--- a/locales/hu.pak
+++ b/locales/hu.pak
Binary files differ
diff --git a/locales/id.pak b/locales/id.pak
index 16e5bb5..5834520 100644
--- a/locales/id.pak
+++ b/locales/id.pak
Binary files differ
diff --git a/locales/it.pak b/locales/it.pak
index 1fbbd1c..a732568 100644
--- a/locales/it.pak
+++ b/locales/it.pak
Binary files differ
diff --git a/locales/ja.pak b/locales/ja.pak
index 4a3c205..28221e4 100644
--- a/locales/ja.pak
+++ b/locales/ja.pak
Binary files differ
diff --git a/locales/kn.pak b/locales/kn.pak
index 4e7bc1e..34387b3 100644
--- a/locales/kn.pak
+++ b/locales/kn.pak
Binary files differ
diff --git a/locales/ko.pak b/locales/ko.pak
index 0b4701c..c5950dd 100644
--- a/locales/ko.pak
+++ b/locales/ko.pak
Binary files differ
diff --git a/locales/lt.pak b/locales/lt.pak
index b56a792..3599c78 100644
--- a/locales/lt.pak
+++ b/locales/lt.pak
Binary files differ
diff --git a/locales/lv.pak b/locales/lv.pak
index 03f0718..0207358 100644
--- a/locales/lv.pak
+++ b/locales/lv.pak
Binary files differ
diff --git a/locales/ml.pak b/locales/ml.pak
index 3b514e3..a44e05b 100644
--- a/locales/ml.pak
+++ b/locales/ml.pak
Binary files differ
diff --git a/locales/mr.pak b/locales/mr.pak
index f28a11f..3f02619 100644
--- a/locales/mr.pak
+++ b/locales/mr.pak
Binary files differ
diff --git a/locales/ms.pak b/locales/ms.pak
index 3070b62..64a8ee1 100644
--- a/locales/ms.pak
+++ b/locales/ms.pak
Binary files differ
diff --git a/locales/nb.pak b/locales/nb.pak
index 57f23e6..7d46b90 100644
--- a/locales/nb.pak
+++ b/locales/nb.pak
Binary files differ
diff --git a/locales/nl.pak b/locales/nl.pak
index fcb80be..54d507b 100644
--- a/locales/nl.pak
+++ b/locales/nl.pak
Binary files differ
diff --git a/locales/pl.pak b/locales/pl.pak
index 71fee3b..b603811 100644
--- a/locales/pl.pak
+++ b/locales/pl.pak
Binary files differ
diff --git a/locales/pt-BR.pak b/locales/pt-BR.pak
index 3b41fa6..d2a36ec 100644
--- a/locales/pt-BR.pak
+++ b/locales/pt-BR.pak
Binary files differ
diff --git a/locales/pt-PT.pak b/locales/pt-PT.pak
index 8de4e98..35b4433 100644
--- a/locales/pt-PT.pak
+++ b/locales/pt-PT.pak
Binary files differ
diff --git a/locales/ro.pak b/locales/ro.pak
index b83f5bd..866b259 100644
--- a/locales/ro.pak
+++ b/locales/ro.pak
Binary files differ
diff --git a/locales/ru.pak b/locales/ru.pak
index 086f92b..f33f434 100644
--- a/locales/ru.pak
+++ b/locales/ru.pak
Binary files differ
diff --git a/locales/sk.pak b/locales/sk.pak
index 2f7ca9d..1def494 100644
--- a/locales/sk.pak
+++ b/locales/sk.pak
Binary files differ
diff --git a/locales/sl.pak b/locales/sl.pak
index 5a262e5..f933d3b 100644
--- a/locales/sl.pak
+++ b/locales/sl.pak
Binary files differ
diff --git a/locales/sr.pak b/locales/sr.pak
index c3520cb..4884610 100644
--- a/locales/sr.pak
+++ b/locales/sr.pak
Binary files differ
diff --git a/locales/sv.pak b/locales/sv.pak
index 9265c07..b23d180 100644
--- a/locales/sv.pak
+++ b/locales/sv.pak
Binary files differ
diff --git a/locales/sw.pak b/locales/sw.pak
index 2e80518..1c08ef0 100644
--- a/locales/sw.pak
+++ b/locales/sw.pak
Binary files differ
diff --git a/locales/ta.pak b/locales/ta.pak
index b86a624..e42568e 100644
--- a/locales/ta.pak
+++ b/locales/ta.pak
Binary files differ
diff --git a/locales/te.pak b/locales/te.pak
index cb8b405..d59d320 100644
--- a/locales/te.pak
+++ b/locales/te.pak
Binary files differ
diff --git a/locales/th.pak b/locales/th.pak
index f486a82..cc630a6 100644
--- a/locales/th.pak
+++ b/locales/th.pak
Binary files differ
diff --git a/locales/tr.pak b/locales/tr.pak
index 14068a1..ebd2b95 100644
--- a/locales/tr.pak
+++ b/locales/tr.pak
Binary files differ
diff --git a/locales/uk.pak b/locales/uk.pak
index d6b9413..3e137bb 100644
--- a/locales/uk.pak
+++ b/locales/uk.pak
Binary files differ
diff --git a/locales/vi.pak b/locales/vi.pak
index d06fef4..4759259 100644
--- a/locales/vi.pak
+++ b/locales/vi.pak
Binary files differ
diff --git a/locales/zh-CN.pak b/locales/zh-CN.pak
index e6ea075..c59ebec 100644
--- a/locales/zh-CN.pak
+++ b/locales/zh-CN.pak
Binary files differ
diff --git a/locales/zh-TW.pak b/locales/zh-TW.pak
index f08008a..f3d0fce 100644
--- a/locales/zh-TW.pak
+++ b/locales/zh-TW.pak
Binary files differ
diff --git a/nacl_helper b/nacl_helper
index e8ef502..0a83d8c 100755
--- a/nacl_helper
+++ b/nacl_helper
Binary files differ
diff --git a/nacl_helper_bootstrap b/nacl_helper_bootstrap
index cdce09b..cc5805f 100755
--- a/nacl_helper_bootstrap
+++ b/nacl_helper_bootstrap
Binary files differ
diff --git a/nacl_irt_srpc_x86_64.nexe b/nacl_irt_srpc_x86_64.nexe
deleted file mode 100755
index 78b0faa..0000000
--- a/nacl_irt_srpc_x86_64.nexe
+++ /dev/null
Binary files differ
diff --git a/nacl_irt_x86_64.nexe b/nacl_irt_x86_64.nexe
index d07531f..cfa41ad 100644
--- a/nacl_irt_x86_64.nexe
+++ b/nacl_irt_x86_64.nexe
Binary files differ
diff --git a/pyautolib.py b/pyautolib.py
deleted file mode 100644
index 7d60688..0000000
--- a/pyautolib.py
+++ /dev/null
@@ -1,1381 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.40
-#
-# Do not make changes to this file unless you know what you are doing--modify
-# the SWIG interface file instead.
-# This file is compatible with both classic and new-style classes.
-
-"""
-Python interface to Automation Proxy.
-"""
-
-from sys import version_info
-if version_info >= (2,6,0):
-    def swig_import_helper():
-        from os.path import dirname
-        import imp
-        fp = None
-        try:
-            fp, pathname, description = imp.find_module('_pyautolib', [dirname(__file__)])
-        except ImportError:
-            import _pyautolib
-            return _pyautolib
-        if fp is not None:
-            try:
-                _mod = imp.load_module('_pyautolib', fp, pathname, description)
-            finally:
-                fp.close()
-            return _mod
-    _pyautolib = swig_import_helper()
-    del swig_import_helper
-else:
-    import _pyautolib
-del version_info
-try:
-    _swig_property = property
-except NameError:
-    pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
-    if (name == "thisown"): return self.this.own(value)
-    if (name == "this"):
-        if type(value).__name__ == 'SwigPyObject':
-            self.__dict__[name] = value
-            return
-    method = class_type.__swig_setmethods__.get(name,None)
-    if method: return method(self,value)
-    if (not static) or hasattr(self,name):
-        self.__dict__[name] = value
-    else:
-        raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
-    return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
-    if (name == "thisown"): return self.this.own()
-    method = class_type.__swig_getmethods__.get(name,None)
-    if method: return method(self)
-    raise AttributeError(name)
-
-def _swig_repr(self):
-    try: strthis = "proxy of " + self.this.__repr__()
-    except: strthis = ""
-    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-try:
-    _object = object
-    _newclass = 1
-except AttributeError:
-    class _object : pass
-    _newclass = 0
-
-
-IDC_MinimumLabelValue = _pyautolib.IDC_MinimumLabelValue
-IDC_Messages = _pyautolib.IDC_Messages
-IDC_MessagesAll = _pyautolib.IDC_MessagesAll
-IDC_MessagesNone = _pyautolib.IDC_MessagesNone
-IDC_BACK = _pyautolib.IDC_BACK
-IDC_FORWARD = _pyautolib.IDC_FORWARD
-IDC_RELOAD = _pyautolib.IDC_RELOAD
-IDC_HOME = _pyautolib.IDC_HOME
-IDC_OPEN_CURRENT_URL = _pyautolib.IDC_OPEN_CURRENT_URL
-IDC_STOP = _pyautolib.IDC_STOP
-IDC_RELOAD_IGNORING_CACHE = _pyautolib.IDC_RELOAD_IGNORING_CACHE
-IDC_LOAD_NEW_TAB_PAGE = _pyautolib.IDC_LOAD_NEW_TAB_PAGE
-IDC_RELOAD_CLEARING_CACHE = _pyautolib.IDC_RELOAD_CLEARING_CACHE
-IDC_NEW_WINDOW = _pyautolib.IDC_NEW_WINDOW
-IDC_NEW_INCOGNITO_WINDOW = _pyautolib.IDC_NEW_INCOGNITO_WINDOW
-IDC_PIN_TO_START_SCREEN = _pyautolib.IDC_PIN_TO_START_SCREEN
-IDC_CLOSE_WINDOW = _pyautolib.IDC_CLOSE_WINDOW
-IDC_ALWAYS_ON_TOP = _pyautolib.IDC_ALWAYS_ON_TOP
-IDC_NEW_TAB = _pyautolib.IDC_NEW_TAB
-IDC_CLOSE_TAB = _pyautolib.IDC_CLOSE_TAB
-IDC_SELECT_NEXT_TAB = _pyautolib.IDC_SELECT_NEXT_TAB
-IDC_SELECT_PREVIOUS_TAB = _pyautolib.IDC_SELECT_PREVIOUS_TAB
-IDC_SELECT_TAB_0 = _pyautolib.IDC_SELECT_TAB_0
-IDC_SELECT_TAB_1 = _pyautolib.IDC_SELECT_TAB_1
-IDC_SELECT_TAB_2 = _pyautolib.IDC_SELECT_TAB_2
-IDC_SELECT_TAB_3 = _pyautolib.IDC_SELECT_TAB_3
-IDC_SELECT_TAB_4 = _pyautolib.IDC_SELECT_TAB_4
-IDC_SELECT_TAB_5 = _pyautolib.IDC_SELECT_TAB_5
-IDC_SELECT_TAB_6 = _pyautolib.IDC_SELECT_TAB_6
-IDC_SELECT_TAB_7 = _pyautolib.IDC_SELECT_TAB_7
-IDC_SELECT_LAST_TAB = _pyautolib.IDC_SELECT_LAST_TAB
-IDC_DUPLICATE_TAB = _pyautolib.IDC_DUPLICATE_TAB
-IDC_RESTORE_TAB = _pyautolib.IDC_RESTORE_TAB
-IDC_SHOW_AS_TAB = _pyautolib.IDC_SHOW_AS_TAB
-IDC_FULLSCREEN = _pyautolib.IDC_FULLSCREEN
-IDC_EXIT = _pyautolib.IDC_EXIT
-IDC_MOVE_TAB_NEXT = _pyautolib.IDC_MOVE_TAB_NEXT
-IDC_MOVE_TAB_PREVIOUS = _pyautolib.IDC_MOVE_TAB_PREVIOUS
-IDC_SEARCH = _pyautolib.IDC_SEARCH
-IDC_TABPOSE = _pyautolib.IDC_TABPOSE
-IDC_DEBUG_FRAME_TOGGLE = _pyautolib.IDC_DEBUG_FRAME_TOGGLE
-IDC_PRESENTATION_MODE = _pyautolib.IDC_PRESENTATION_MODE
-IDC_METRO_SNAP_ENABLE = _pyautolib.IDC_METRO_SNAP_ENABLE
-IDC_METRO_SNAP_DISABLE = _pyautolib.IDC_METRO_SNAP_DISABLE
-IDC_WIN8_DESKTOP_RESTART = _pyautolib.IDC_WIN8_DESKTOP_RESTART
-IDC_WIN8_METRO_RESTART = _pyautolib.IDC_WIN8_METRO_RESTART
-IDC_TOGGLE_ASH_DESKTOP = _pyautolib.IDC_TOGGLE_ASH_DESKTOP
-IDC_BOOKMARK_PAGE = _pyautolib.IDC_BOOKMARK_PAGE
-IDC_BOOKMARK_ALL_TABS = _pyautolib.IDC_BOOKMARK_ALL_TABS
-IDC_VIEW_SOURCE = _pyautolib.IDC_VIEW_SOURCE
-IDC_PRINT = _pyautolib.IDC_PRINT
-IDC_SAVE_PAGE = _pyautolib.IDC_SAVE_PAGE
-IDC_ENCODING_MENU = _pyautolib.IDC_ENCODING_MENU
-IDC_EMAIL_PAGE_LOCATION = _pyautolib.IDC_EMAIL_PAGE_LOCATION
-IDC_ADVANCED_PRINT = _pyautolib.IDC_ADVANCED_PRINT
-IDC_CHROME_TO_MOBILE_PAGE = _pyautolib.IDC_CHROME_TO_MOBILE_PAGE
-IDC_PRINT_TO_DESTINATION = _pyautolib.IDC_PRINT_TO_DESTINATION
-IDC_BOOKMARK_PAGE_FROM_STAR = _pyautolib.IDC_BOOKMARK_PAGE_FROM_STAR
-IDC_ENCODING_AUTO_DETECT = _pyautolib.IDC_ENCODING_AUTO_DETECT
-IDC_ENCODING_UTF8 = _pyautolib.IDC_ENCODING_UTF8
-IDC_ENCODING_UTF16LE = _pyautolib.IDC_ENCODING_UTF16LE
-IDC_ENCODING_ISO88591 = _pyautolib.IDC_ENCODING_ISO88591
-IDC_ENCODING_WINDOWS1252 = _pyautolib.IDC_ENCODING_WINDOWS1252
-IDC_ENCODING_GBK = _pyautolib.IDC_ENCODING_GBK
-IDC_ENCODING_GB18030 = _pyautolib.IDC_ENCODING_GB18030
-IDC_ENCODING_BIG5 = _pyautolib.IDC_ENCODING_BIG5
-IDC_ENCODING_BIG5HKSCS = _pyautolib.IDC_ENCODING_BIG5HKSCS
-IDC_ENCODING_KOREAN = _pyautolib.IDC_ENCODING_KOREAN
-IDC_ENCODING_SHIFTJIS = _pyautolib.IDC_ENCODING_SHIFTJIS
-IDC_ENCODING_ISO2022JP = _pyautolib.IDC_ENCODING_ISO2022JP
-IDC_ENCODING_EUCJP = _pyautolib.IDC_ENCODING_EUCJP
-IDC_ENCODING_THAI = _pyautolib.IDC_ENCODING_THAI
-IDC_ENCODING_ISO885915 = _pyautolib.IDC_ENCODING_ISO885915
-IDC_ENCODING_MACINTOSH = _pyautolib.IDC_ENCODING_MACINTOSH
-IDC_ENCODING_ISO88592 = _pyautolib.IDC_ENCODING_ISO88592
-IDC_ENCODING_WINDOWS1250 = _pyautolib.IDC_ENCODING_WINDOWS1250
-IDC_ENCODING_ISO88595 = _pyautolib.IDC_ENCODING_ISO88595
-IDC_ENCODING_WINDOWS1251 = _pyautolib.IDC_ENCODING_WINDOWS1251
-IDC_ENCODING_KOI8R = _pyautolib.IDC_ENCODING_KOI8R
-IDC_ENCODING_KOI8U = _pyautolib.IDC_ENCODING_KOI8U
-IDC_ENCODING_ISO88597 = _pyautolib.IDC_ENCODING_ISO88597
-IDC_ENCODING_WINDOWS1253 = _pyautolib.IDC_ENCODING_WINDOWS1253
-IDC_ENCODING_ISO88594 = _pyautolib.IDC_ENCODING_ISO88594
-IDC_ENCODING_ISO885913 = _pyautolib.IDC_ENCODING_ISO885913
-IDC_ENCODING_WINDOWS1257 = _pyautolib.IDC_ENCODING_WINDOWS1257
-IDC_ENCODING_ISO88593 = _pyautolib.IDC_ENCODING_ISO88593
-IDC_ENCODING_ISO885910 = _pyautolib.IDC_ENCODING_ISO885910
-IDC_ENCODING_ISO885914 = _pyautolib.IDC_ENCODING_ISO885914
-IDC_ENCODING_ISO885916 = _pyautolib.IDC_ENCODING_ISO885916
-IDC_ENCODING_WINDOWS1254 = _pyautolib.IDC_ENCODING_WINDOWS1254
-IDC_ENCODING_ISO88596 = _pyautolib.IDC_ENCODING_ISO88596
-IDC_ENCODING_WINDOWS1256 = _pyautolib.IDC_ENCODING_WINDOWS1256
-IDC_ENCODING_ISO88598 = _pyautolib.IDC_ENCODING_ISO88598
-IDC_ENCODING_WINDOWS1255 = _pyautolib.IDC_ENCODING_WINDOWS1255
-IDC_ENCODING_WINDOWS1258 = _pyautolib.IDC_ENCODING_WINDOWS1258
-IDC_ENCODING_ISO88598I = _pyautolib.IDC_ENCODING_ISO88598I
-IDC_CUT = _pyautolib.IDC_CUT
-IDC_COPY = _pyautolib.IDC_COPY
-IDC_COPY_URL = _pyautolib.IDC_COPY_URL
-IDC_PASTE = _pyautolib.IDC_PASTE
-IDC_EDIT_MENU = _pyautolib.IDC_EDIT_MENU
-IDC_FIND = _pyautolib.IDC_FIND
-IDC_FIND_NEXT = _pyautolib.IDC_FIND_NEXT
-IDC_FIND_PREVIOUS = _pyautolib.IDC_FIND_PREVIOUS
-IDC_ZOOM_MENU = _pyautolib.IDC_ZOOM_MENU
-IDC_ZOOM_PLUS = _pyautolib.IDC_ZOOM_PLUS
-IDC_ZOOM_NORMAL = _pyautolib.IDC_ZOOM_NORMAL
-IDC_ZOOM_MINUS = _pyautolib.IDC_ZOOM_MINUS
-IDC_ZOOM_PERCENT_DISPLAY = _pyautolib.IDC_ZOOM_PERCENT_DISPLAY
-IDC_FOCUS_TOOLBAR = _pyautolib.IDC_FOCUS_TOOLBAR
-IDC_FOCUS_LOCATION = _pyautolib.IDC_FOCUS_LOCATION
-IDC_FOCUS_SEARCH = _pyautolib.IDC_FOCUS_SEARCH
-IDC_FOCUS_MENU_BAR = _pyautolib.IDC_FOCUS_MENU_BAR
-IDC_FOCUS_NEXT_PANE = _pyautolib.IDC_FOCUS_NEXT_PANE
-IDC_FOCUS_PREVIOUS_PANE = _pyautolib.IDC_FOCUS_PREVIOUS_PANE
-IDC_FOCUS_BOOKMARKS = _pyautolib.IDC_FOCUS_BOOKMARKS
-IDC_OPEN_FILE = _pyautolib.IDC_OPEN_FILE
-IDC_CREATE_SHORTCUTS = _pyautolib.IDC_CREATE_SHORTCUTS
-IDC_DEVELOPER_MENU = _pyautolib.IDC_DEVELOPER_MENU
-IDC_DEV_TOOLS = _pyautolib.IDC_DEV_TOOLS
-IDC_DEV_TOOLS_CONSOLE = _pyautolib.IDC_DEV_TOOLS_CONSOLE
-IDC_TASK_MANAGER = _pyautolib.IDC_TASK_MANAGER
-IDC_FEEDBACK = _pyautolib.IDC_FEEDBACK
-IDC_SHOW_BOOKMARK_BAR = _pyautolib.IDC_SHOW_BOOKMARK_BAR
-IDC_SHOW_HISTORY = _pyautolib.IDC_SHOW_HISTORY
-IDC_SHOW_BOOKMARK_MANAGER = _pyautolib.IDC_SHOW_BOOKMARK_MANAGER
-IDC_SHOW_DOWNLOADS = _pyautolib.IDC_SHOW_DOWNLOADS
-IDC_CLEAR_BROWSING_DATA = _pyautolib.IDC_CLEAR_BROWSING_DATA
-IDC_IMPORT_SETTINGS = _pyautolib.IDC_IMPORT_SETTINGS
-IDC_OPTIONS = _pyautolib.IDC_OPTIONS
-IDC_EDIT_SEARCH_ENGINES = _pyautolib.IDC_EDIT_SEARCH_ENGINES
-IDC_VIEW_PASSWORDS = _pyautolib.IDC_VIEW_PASSWORDS
-IDC_ABOUT = _pyautolib.IDC_ABOUT
-IDC_HELP_PAGE_VIA_KEYBOARD = _pyautolib.IDC_HELP_PAGE_VIA_KEYBOARD
-IDC_HELP_PAGE_VIA_MENU = _pyautolib.IDC_HELP_PAGE_VIA_MENU
-IDC_SHOW_APP_MENU = _pyautolib.IDC_SHOW_APP_MENU
-IDC_MANAGE_EXTENSIONS = _pyautolib.IDC_MANAGE_EXTENSIONS
-IDC_DEV_TOOLS_INSPECT = _pyautolib.IDC_DEV_TOOLS_INSPECT
-IDC_UPGRADE_DIALOG = _pyautolib.IDC_UPGRADE_DIALOG
-IDC_VIEW_INCOMPATIBILITIES = _pyautolib.IDC_VIEW_INCOMPATIBILITIES
-IDC_VIEW_BACKGROUND_PAGES = _pyautolib.IDC_VIEW_BACKGROUND_PAGES
-IDC_SHOW_KEYBOARD_OVERLAY = _pyautolib.IDC_SHOW_KEYBOARD_OVERLAY
-IDC_PROFILING_ENABLED = _pyautolib.IDC_PROFILING_ENABLED
-IDC_BOOKMARKS_MENU = _pyautolib.IDC_BOOKMARKS_MENU
-IDC_SHOW_SYNC_SETUP = _pyautolib.IDC_SHOW_SYNC_SETUP
-IDC_EXTENSION_ERRORS = _pyautolib.IDC_EXTENSION_ERRORS
-IDC_SHOW_SYNC_ERROR = _pyautolib.IDC_SHOW_SYNC_ERROR
-IDC_SHOW_SETTINGS_CHANGE_FIRST = _pyautolib.IDC_SHOW_SETTINGS_CHANGE_FIRST
-IDC_SHOW_SETTINGS_CHANGE_LAST = _pyautolib.IDC_SHOW_SETTINGS_CHANGE_LAST
-IDC_SHOW_AVATAR_MENU = _pyautolib.IDC_SHOW_AVATAR_MENU
-IDC_EXTENSION_DISABLED_FIRST = _pyautolib.IDC_EXTENSION_DISABLED_FIRST
-IDC_EXTENSION_DISABLED_LAST = _pyautolib.IDC_EXTENSION_DISABLED_LAST
-IDC_TOGGLE_REQUEST_TABLET_SITE = _pyautolib.IDC_TOGGLE_REQUEST_TABLET_SITE
-IDC_DEV_TOOLS_TOGGLE = _pyautolib.IDC_DEV_TOOLS_TOGGLE
-IDC_EXTERNAL_EXTENSION_ALERT = _pyautolib.IDC_EXTERNAL_EXTENSION_ALERT
-IDC_RECENT_TABS_MENU = _pyautolib.IDC_RECENT_TABS_MENU
-IDC_RECENT_TABS_NO_DEVICE_TABS = _pyautolib.IDC_RECENT_TABS_NO_DEVICE_TABS
-IDC_SPELLCHECK_SUGGESTION_0 = _pyautolib.IDC_SPELLCHECK_SUGGESTION_0
-IDC_SPELLCHECK_SUGGESTION_1 = _pyautolib.IDC_SPELLCHECK_SUGGESTION_1
-IDC_SPELLCHECK_SUGGESTION_2 = _pyautolib.IDC_SPELLCHECK_SUGGESTION_2
-IDC_SPELLCHECK_SUGGESTION_3 = _pyautolib.IDC_SPELLCHECK_SUGGESTION_3
-IDC_SPELLCHECK_SUGGESTION_4 = _pyautolib.IDC_SPELLCHECK_SUGGESTION_4
-IDC_SPELLCHECK_SUGGESTION_LAST = _pyautolib.IDC_SPELLCHECK_SUGGESTION_LAST
-IDC_SPELLCHECK_MENU = _pyautolib.IDC_SPELLCHECK_MENU
-IDC_SPELLCHECK_LANGUAGES_FIRST = _pyautolib.IDC_SPELLCHECK_LANGUAGES_FIRST
-IDC_SPELLCHECK_LANGUAGES_LAST = _pyautolib.IDC_SPELLCHECK_LANGUAGES_LAST
-IDC_CHECK_SPELLING_WHILE_TYPING = _pyautolib.IDC_CHECK_SPELLING_WHILE_TYPING
-IDC_SPELLPANEL_TOGGLE = _pyautolib.IDC_SPELLPANEL_TOGGLE
-IDC_SPELLCHECK_ADD_TO_DICTIONARY = _pyautolib.IDC_SPELLCHECK_ADD_TO_DICTIONARY
-IDC_WRITING_DIRECTION_MENU = _pyautolib.IDC_WRITING_DIRECTION_MENU
-IDC_WRITING_DIRECTION_DEFAULT = _pyautolib.IDC_WRITING_DIRECTION_DEFAULT
-IDC_WRITING_DIRECTION_LTR = _pyautolib.IDC_WRITING_DIRECTION_LTR
-IDC_WRITING_DIRECTION_RTL = _pyautolib.IDC_WRITING_DIRECTION_RTL
-IDC_TRANSLATE_OPTIONS_ALWAYS = _pyautolib.IDC_TRANSLATE_OPTIONS_ALWAYS
-IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG = _pyautolib.IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG
-IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE = _pyautolib.IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE
-IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION = _pyautolib.IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION
-IDC_TRANSLATE_OPTIONS_ABOUT = _pyautolib.IDC_TRANSLATE_OPTIONS_ABOUT
-IDC_TRANSLATE_ORIGINAL_LANGUAGE_BASE = _pyautolib.IDC_TRANSLATE_ORIGINAL_LANGUAGE_BASE
-IDC_TRANSLATE_TARGET_LANGUAGE_BASE = _pyautolib.IDC_TRANSLATE_TARGET_LANGUAGE_BASE
-IDC_TOGGLE_SPEECH_INPUT = _pyautolib.IDC_TOGGLE_SPEECH_INPUT
-IDC_VIEW_MENU = _pyautolib.IDC_VIEW_MENU
-IDC_HISTORY_MENU = _pyautolib.IDC_HISTORY_MENU
-IDC_PROFILE_MAIN_MENU = _pyautolib.IDC_PROFILE_MAIN_MENU
-IDC_INPUT_METHODS_MENU = _pyautolib.IDC_INPUT_METHODS_MENU
-IDC_CONTENT_CONTEXT_CUSTOM_FIRST = _pyautolib.IDC_CONTENT_CONTEXT_CUSTOM_FIRST
-IDC_CONTENT_CONTEXT_CUSTOM_LAST = _pyautolib.IDC_CONTENT_CONTEXT_CUSTOM_LAST
-IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST = _pyautolib.IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST
-IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST = _pyautolib.IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST
-IDC_CONTENT_CONTEXT_OPENLINKNEWTAB = _pyautolib.IDC_CONTENT_CONTEXT_OPENLINKNEWTAB
-IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW = _pyautolib.IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW
-IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD = _pyautolib.IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD
-IDC_CONTENT_CONTEXT_SAVELINKAS = _pyautolib.IDC_CONTENT_CONTEXT_SAVELINKAS
-IDC_CONTENT_CONTEXT_COPYLINKLOCATION = _pyautolib.IDC_CONTENT_CONTEXT_COPYLINKLOCATION
-IDC_CONTENT_CONTEXT_COPYEMAILADDRESS = _pyautolib.IDC_CONTENT_CONTEXT_COPYEMAILADDRESS
-IDC_CONTENT_CONTEXT_OPENLINKWITH = _pyautolib.IDC_CONTENT_CONTEXT_OPENLINKWITH
-IDC_CONTENT_CONTEXT_SAVEIMAGEAS = _pyautolib.IDC_CONTENT_CONTEXT_SAVEIMAGEAS
-IDC_CONTENT_CONTEXT_COPYIMAGELOCATION = _pyautolib.IDC_CONTENT_CONTEXT_COPYIMAGELOCATION
-IDC_CONTENT_CONTEXT_COPYIMAGE = _pyautolib.IDC_CONTENT_CONTEXT_COPYIMAGE
-IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB = _pyautolib.IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB
-IDC_CONTENT_CONTEXT_SAVEAVAS = _pyautolib.IDC_CONTENT_CONTEXT_SAVEAVAS
-IDC_CONTENT_CONTEXT_COPYAVLOCATION = _pyautolib.IDC_CONTENT_CONTEXT_COPYAVLOCATION
-IDC_CONTENT_CONTEXT_OPENAVNEWTAB = _pyautolib.IDC_CONTENT_CONTEXT_OPENAVNEWTAB
-IDC_CONTENT_CONTEXT_PLAYPAUSE = _pyautolib.IDC_CONTENT_CONTEXT_PLAYPAUSE
-IDC_CONTENT_CONTEXT_MUTE = _pyautolib.IDC_CONTENT_CONTEXT_MUTE
-IDC_CONTENT_CONTEXT_LOOP = _pyautolib.IDC_CONTENT_CONTEXT_LOOP
-IDC_CONTENT_CONTEXT_CONTROLS = _pyautolib.IDC_CONTENT_CONTEXT_CONTROLS
-IDC_CONTENT_CONTEXT_ROTATECW = _pyautolib.IDC_CONTENT_CONTEXT_ROTATECW
-IDC_CONTENT_CONTEXT_ROTATECCW = _pyautolib.IDC_CONTENT_CONTEXT_ROTATECCW
-IDC_CONTENT_CONTEXT_COPY = _pyautolib.IDC_CONTENT_CONTEXT_COPY
-IDC_CONTENT_CONTEXT_CUT = _pyautolib.IDC_CONTENT_CONTEXT_CUT
-IDC_CONTENT_CONTEXT_PASTE = _pyautolib.IDC_CONTENT_CONTEXT_PASTE
-IDC_CONTENT_CONTEXT_DELETE = _pyautolib.IDC_CONTENT_CONTEXT_DELETE
-IDC_CONTENT_CONTEXT_UNDO = _pyautolib.IDC_CONTENT_CONTEXT_UNDO
-IDC_CONTENT_CONTEXT_REDO = _pyautolib.IDC_CONTENT_CONTEXT_REDO
-IDC_CONTENT_CONTEXT_SELECTALL = _pyautolib.IDC_CONTENT_CONTEXT_SELECTALL
-IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE = _pyautolib.IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE
-IDC_CONTENT_CONTEXT_TRANSLATE = _pyautolib.IDC_CONTENT_CONTEXT_TRANSLATE
-IDC_CONTENT_CONTEXT_INSPECTELEMENT = _pyautolib.IDC_CONTENT_CONTEXT_INSPECTELEMENT
-IDC_CONTENT_CONTEXT_VIEWPAGEINFO = _pyautolib.IDC_CONTENT_CONTEXT_VIEWPAGEINFO
-IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS = _pyautolib.IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS
-IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY = _pyautolib.IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY
-IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS = _pyautolib.IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS
-IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION = _pyautolib.IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION
-IDC_CONTENT_CONTEXT_SPELLING_TOGGLE = _pyautolib.IDC_CONTENT_CONTEXT_SPELLING_TOGGLE
-IDC_CONTENT_CONTEXT_SPEECH_MENU = _pyautolib.IDC_CONTENT_CONTEXT_SPEECH_MENU
-IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING = _pyautolib.IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING
-IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING = _pyautolib.IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING
-IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE = _pyautolib.IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE
-IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP = _pyautolib.IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP
-IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP = _pyautolib.IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP
-IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE = _pyautolib.IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE
-IDC_CONTENT_CONTEXT_RELOADFRAME = _pyautolib.IDC_CONTENT_CONTEXT_RELOADFRAME
-IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE = _pyautolib.IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE
-IDC_CONTENT_CONTEXT_VIEWFRAMEINFO = _pyautolib.IDC_CONTENT_CONTEXT_VIEWFRAMEINFO
-IDC_CONTENT_CONTEXT_GOTOURL = _pyautolib.IDC_CONTENT_CONTEXT_GOTOURL
-IDC_CONTENT_CONTEXT_SEARCHWEBFOR = _pyautolib.IDC_CONTENT_CONTEXT_SEARCHWEBFOR
-IDC_CONTENT_CONTEXT_ADDSEARCHENGINE = _pyautolib.IDC_CONTENT_CONTEXT_ADDSEARCHENGINE
-IDC_BOOKMARK_BAR_OPEN_ALL = _pyautolib.IDC_BOOKMARK_BAR_OPEN_ALL
-IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW = _pyautolib.IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW
-IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO = _pyautolib.IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO
-IDC_BOOKMARK_BAR_OPEN_INCOGNITO = _pyautolib.IDC_BOOKMARK_BAR_OPEN_INCOGNITO
-IDC_BOOKMARK_BAR_RENAME_FOLDER = _pyautolib.IDC_BOOKMARK_BAR_RENAME_FOLDER
-IDC_BOOKMARK_BAR_EDIT = _pyautolib.IDC_BOOKMARK_BAR_EDIT
-IDC_BOOKMARK_BAR_REMOVE = _pyautolib.IDC_BOOKMARK_BAR_REMOVE
-IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK = _pyautolib.IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK
-IDC_BOOKMARK_BAR_NEW_FOLDER = _pyautolib.IDC_BOOKMARK_BAR_NEW_FOLDER
-IDC_BOOKMARK_MANAGER = _pyautolib.IDC_BOOKMARK_MANAGER
-IDC_BOOKMARK_BAR_ALWAYS_SHOW = _pyautolib.IDC_BOOKMARK_BAR_ALWAYS_SHOW
-IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND = _pyautolib.IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND
-IDC_SPEECH_INPUT_MENU = _pyautolib.IDC_SPEECH_INPUT_MENU
-IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES = _pyautolib.IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES
-IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT = _pyautolib.IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT
-IDC_MEDIA_STREAM_DEVICE_STATUS_TRAY = _pyautolib.IDC_MEDIA_STREAM_DEVICE_STATUS_TRAY
-IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST = _pyautolib.IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST
-IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_LAST = _pyautolib.IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_LAST
-IDC_MEDIA_STREAM_DEVICE_ALWAYS_ALLOW = _pyautolib.IDC_MEDIA_STREAM_DEVICE_ALWAYS_ALLOW
-IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST = _pyautolib.IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST
-IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST = _pyautolib.IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST
-IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS = _pyautolib.IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS
-IDR_MAINFRAME = _pyautolib.IDR_MAINFRAME
-IDR_CHROMEFRAME = _pyautolib.IDR_CHROMEFRAME
-IDI_THROBBER_01 = _pyautolib.IDI_THROBBER_01
-IDI_THROBBER_02 = _pyautolib.IDI_THROBBER_02
-IDI_THROBBER_03 = _pyautolib.IDI_THROBBER_03
-IDI_THROBBER_04 = _pyautolib.IDI_THROBBER_04
-IDI_THROBBER_05 = _pyautolib.IDI_THROBBER_05
-IDI_THROBBER_06 = _pyautolib.IDI_THROBBER_06
-IDI_THROBBER_07 = _pyautolib.IDI_THROBBER_07
-IDI_THROBBER_08 = _pyautolib.IDI_THROBBER_08
-IDI_THROBBER_09 = _pyautolib.IDI_THROBBER_09
-IDI_THROBBER_10 = _pyautolib.IDI_THROBBER_10
-IDI_THROBBER_11 = _pyautolib.IDI_THROBBER_11
-IDI_THROBBER_12 = _pyautolib.IDI_THROBBER_12
-IDI_THROBBER_13 = _pyautolib.IDI_THROBBER_13
-IDI_THROBBER_14 = _pyautolib.IDI_THROBBER_14
-IDI_THROBBER_15 = _pyautolib.IDI_THROBBER_15
-IDI_THROBBER_16 = _pyautolib.IDI_THROBBER_16
-IDI_THROBBER_17 = _pyautolib.IDI_THROBBER_17
-IDI_THROBBER_18 = _pyautolib.IDI_THROBBER_18
-IDI_THROBBER_19 = _pyautolib.IDI_THROBBER_19
-IDI_THROBBER_20 = _pyautolib.IDI_THROBBER_20
-IDI_THROBBER_21 = _pyautolib.IDI_THROBBER_21
-IDI_THROBBER_22 = _pyautolib.IDI_THROBBER_22
-IDI_THROBBER_23 = _pyautolib.IDI_THROBBER_23
-IDI_THROBBER_24 = _pyautolib.IDI_THROBBER_24
-IDR_SXS = _pyautolib.IDR_SXS
-IDD_IPC_SETTINGS = _pyautolib.IDD_IPC_SETTINGS
-kRawKeyDownType = _pyautolib.kRawKeyDownType
-kKeyDownType = _pyautolib.kKeyDownType
-kCharType = _pyautolib.kCharType
-kKeyUpType = _pyautolib.kKeyUpType
-kShiftKeyMask = _pyautolib.kShiftKeyMask
-kControlKeyMask = _pyautolib.kControlKeyMask
-kAltKeyMask = _pyautolib.kAltKeyMask
-kMetaKeyMask = _pyautolib.kMetaKeyMask
-kNumLockKeyMask = _pyautolib.kNumLockKeyMask
-kMouseDown = _pyautolib.kMouseDown
-kMouseUp = _pyautolib.kMouseUp
-kMouseMove = _pyautolib.kMouseMove
-kMouseEnter = _pyautolib.kMouseEnter
-kMouseLeave = _pyautolib.kMouseLeave
-kContextMenu = _pyautolib.kContextMenu
-kLeftButton = _pyautolib.kLeftButton
-kMiddleButton = _pyautolib.kMiddleButton
-kRightButton = _pyautolib.kRightButton
-kNoButton = _pyautolib.kNoButton
-kUnknownError = _pyautolib.kUnknownError
-kNoJavaScriptModalDialogOpen = _pyautolib.kNoJavaScriptModalDialogOpen
-kBlockedByModalDialog = _pyautolib.kBlockedByModalDialog
-kInvalidId = _pyautolib.kInvalidId
-class Error(_object):
-    """Proxy of C++ automation::Error class"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, Error, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, Error, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        """
-        __init__(self) -> Error
-        __init__(self, ErrorCode code) -> Error
-        __init__(self, string error_msg) -> Error
-        __init__(self, ErrorCode code, string error_msg) -> Error
-        """
-        this = _pyautolib.new_Error(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_Error
-    __del__ = lambda self : None;
-    def code(self):
-        """code(self) -> ErrorCode"""
-        return _pyautolib.Error_code(self)
-
-    def message(self):
-        """message(self) -> string"""
-        return _pyautolib.Error_message(self)
-
-Error_swigregister = _pyautolib.Error_swigregister
-Error_swigregister(Error)
-cvar = _pyautolib.cvar
-kJSONProxyAutoconfig = cvar.kJSONProxyAutoconfig
-kJSONProxyNoProxy = cvar.kJSONProxyNoProxy
-kJSONProxyPacUrl = cvar.kJSONProxyPacUrl
-kJSONProxyPacMandatory = cvar.kJSONProxyPacMandatory
-kJSONProxyBypassList = cvar.kJSONProxyBypassList
-kJSONProxyServer = cvar.kJSONProxyServer
-kNamedInterfacePrefix = cvar.kNamedInterfacePrefix
-kSleepTime = cvar.kSleepTime
-kChromeDriverAutomationVersion = cvar.kChromeDriverAutomationVersion
-
-AUTOMATION_LAUNCH_RESULT_INVALID = _pyautolib.AUTOMATION_LAUNCH_RESULT_INVALID
-AUTOMATION_SUCCESS = _pyautolib.AUTOMATION_SUCCESS
-AUTOMATION_TIMEOUT = _pyautolib.AUTOMATION_TIMEOUT
-AUTOMATION_VERSION_MISMATCH = _pyautolib.AUTOMATION_VERSION_MISMATCH
-AUTOMATION_CREATE_TAB_FAILED = _pyautolib.AUTOMATION_CREATE_TAB_FAILED
-AUTOMATION_SERVER_CRASHED = _pyautolib.AUTOMATION_SERVER_CRASHED
-AUTOMATION_CHANNEL_ERROR = _pyautolib.AUTOMATION_CHANNEL_ERROR
-AUTOMATION_MSG_NAVIGATION_ERROR = _pyautolib.AUTOMATION_MSG_NAVIGATION_ERROR
-AUTOMATION_MSG_NAVIGATION_SUCCESS = _pyautolib.AUTOMATION_MSG_NAVIGATION_SUCCESS
-AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED = _pyautolib.AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED
-AUTOMATION_MSG_NAVIGATION_BLOCKED_BY_MODAL_DIALOG = _pyautolib.AUTOMATION_MSG_NAVIGATION_BLOCKED_BY_MODAL_DIALOG
-AUTOMATION_MSG_EXTENSION_ID = _pyautolib.AUTOMATION_MSG_EXTENSION_ID
-AUTOMATION_MSG_EXTENSION_NAME = _pyautolib.AUTOMATION_MSG_EXTENSION_NAME
-AUTOMATION_MSG_EXTENSION_VERSION = _pyautolib.AUTOMATION_MSG_EXTENSION_VERSION
-AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX = _pyautolib.AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX
-SMALLEST_FONT = _pyautolib.SMALLEST_FONT
-SMALL_FONT = _pyautolib.SMALL_FONT
-MEDIUM_FONT = _pyautolib.MEDIUM_FONT
-LARGE_FONT = _pyautolib.LARGE_FONT
-LARGEST_FONT = _pyautolib.LARGEST_FONT
-BACK = _pyautolib.BACK
-FWD = _pyautolib.FWD
-IGNORE_CASE = _pyautolib.IGNORE_CASE
-CASE_SENSITIVE = _pyautolib.CASE_SENSITIVE
-PAGE_TYPE_NORMAL = _pyautolib.PAGE_TYPE_NORMAL
-PAGE_TYPE_ERROR = _pyautolib.PAGE_TYPE_ERROR
-PAGE_TYPE_INTERSTITIAL = _pyautolib.PAGE_TYPE_INTERSTITIAL
-SECURITY_STYLE_UNKNOWN = _pyautolib.SECURITY_STYLE_UNKNOWN
-SECURITY_STYLE_UNAUTHENTICATED = _pyautolib.SECURITY_STYLE_UNAUTHENTICATED
-SECURITY_STYLE_AUTHENTICATION_BROKEN = _pyautolib.SECURITY_STYLE_AUTHENTICATION_BROKEN
-SECURITY_STYLE_AUTHENTICATED = _pyautolib.SECURITY_STYLE_AUTHENTICATED
-
-def IsCertStatusError(*args):
-  """IsCertStatusError(CertStatus status) -> bool"""
-  return _pyautolib.IsCertStatusError(*args)
-
-def IsCertStatusMinorError(*args):
-  """IsCertStatusMinorError(CertStatus cert_status) -> bool"""
-  return _pyautolib.IsCertStatusMinorError(*args)
-
-def MapCertStatusToNetError(*args):
-  """MapCertStatusToNetError(CertStatus cert_status) -> int"""
-  return _pyautolib.MapCertStatusToNetError(*args)
-class GURL(_object):
-    """Represent a URL. Call spec() to get the string."""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, GURL, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, GURL, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        """
-        __init__(self) -> GURL
-        __init__(self, string url_string) -> GURL
-
-        Represent a URL. Call spec() to get the string.
-        """
-        this = _pyautolib.new_GURL(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    def spec(self):
-        """
-        spec(self) -> string
-
-        Get the string representation.
-        """
-        return _pyautolib.GURL_spec(self)
-
-    __swig_destroy__ = _pyautolib.delete_GURL
-    __del__ = lambda self : None;
-GURL_swigregister = _pyautolib.GURL_swigregister
-GURL_swigregister(GURL)
-kDefaultApps = cvar.kDefaultApps
-kDefaultAppsInstalled = cvar.kDefaultAppsInstalled
-kHomePageIsNewTabPage = cvar.kHomePageIsNewTabPage
-kHomePage = cvar.kHomePage
-kHomePageChanged = cvar.kHomePageChanged
-kIsGooglePlusUser = cvar.kIsGooglePlusUser
-kSessionExitedCleanly = cvar.kSessionExitedCleanly
-kSessionExitType = cvar.kSessionExitType
-kRestoreOnStartup = cvar.kRestoreOnStartup
-kURLsToRestoreOnStartup = cvar.kURLsToRestoreOnStartup
-kRestoreOnStartupMigrated = cvar.kRestoreOnStartupMigrated
-kDisableScreenshots = cvar.kDisableScreenshots
-kApplicationLocale = cvar.kApplicationLocale
-kGlobalDefaultCharset = cvar.kGlobalDefaultCharset
-kWebKitGlobalDefaultFontSize = cvar.kWebKitGlobalDefaultFontSize
-kWebKitGlobalDefaultFixedFontSize = cvar.kWebKitGlobalDefaultFixedFontSize
-kWebKitGlobalMinimumFontSize = cvar.kWebKitGlobalMinimumFontSize
-kWebKitGlobalMinimumLogicalFontSize = cvar.kWebKitGlobalMinimumLogicalFontSize
-kWebKitGlobalJavascriptEnabled = cvar.kWebKitGlobalJavascriptEnabled
-kWebKitGlobalJavascriptCanOpenWindowsAutomatically = cvar.kWebKitGlobalJavascriptCanOpenWindowsAutomatically
-kWebKitGlobalLoadsImagesAutomatically = cvar.kWebKitGlobalLoadsImagesAutomatically
-kWebKitGlobalPluginsEnabled = cvar.kWebKitGlobalPluginsEnabled
-kWebKitGlobalStandardFontFamily = cvar.kWebKitGlobalStandardFontFamily
-kWebKitGlobalFixedFontFamily = cvar.kWebKitGlobalFixedFontFamily
-kWebKitGlobalSerifFontFamily = cvar.kWebKitGlobalSerifFontFamily
-kWebKitGlobalSansSerifFontFamily = cvar.kWebKitGlobalSansSerifFontFamily
-kWebKitGlobalCursiveFontFamily = cvar.kWebKitGlobalCursiveFontFamily
-kWebKitGlobalFantasyFontFamily = cvar.kWebKitGlobalFantasyFontFamily
-kWebKitOldStandardFontFamily = cvar.kWebKitOldStandardFontFamily
-kWebKitOldFixedFontFamily = cvar.kWebKitOldFixedFontFamily
-kWebKitOldSerifFontFamily = cvar.kWebKitOldSerifFontFamily
-kWebKitOldSansSerifFontFamily = cvar.kWebKitOldSansSerifFontFamily
-kWebKitOldCursiveFontFamily = cvar.kWebKitOldCursiveFontFamily
-kWebKitOldFantasyFontFamily = cvar.kWebKitOldFantasyFontFamily
-kDefaultCharset = cvar.kDefaultCharset
-kAcceptLanguages = cvar.kAcceptLanguages
-kStaticEncodings = cvar.kStaticEncodings
-kShowBookmarkBar = cvar.kShowBookmarkBar
-kBookmarkEditorExpandedNodes = cvar.kBookmarkEditorExpandedNodes
-kWebKitCommonScript = cvar.kWebKitCommonScript
-kWebKitStandardFontFamily = cvar.kWebKitStandardFontFamily
-kWebKitFixedFontFamily = cvar.kWebKitFixedFontFamily
-kWebKitSerifFontFamily = cvar.kWebKitSerifFontFamily
-kWebKitSansSerifFontFamily = cvar.kWebKitSansSerifFontFamily
-kWebKitCursiveFontFamily = cvar.kWebKitCursiveFontFamily
-kWebKitFantasyFontFamily = cvar.kWebKitFantasyFontFamily
-kWebKitPictographFontFamily = cvar.kWebKitPictographFontFamily
-kWebKitScriptsForFontFamilyMaps = cvar.kWebKitScriptsForFontFamilyMaps
-kWebKitScriptsForFontFamilyMapsLength = cvar.kWebKitScriptsForFontFamilyMapsLength
-kWebKitStandardFontFamilyMap = cvar.kWebKitStandardFontFamilyMap
-kWebKitFixedFontFamilyMap = cvar.kWebKitFixedFontFamilyMap
-kWebKitSerifFontFamilyMap = cvar.kWebKitSerifFontFamilyMap
-kWebKitSansSerifFontFamilyMap = cvar.kWebKitSansSerifFontFamilyMap
-kWebKitCursiveFontFamilyMap = cvar.kWebKitCursiveFontFamilyMap
-kWebKitFantasyFontFamilyMap = cvar.kWebKitFantasyFontFamilyMap
-kWebKitPictographFontFamilyMap = cvar.kWebKitPictographFontFamilyMap
-kWebKitStandardFontFamilyArabic = cvar.kWebKitStandardFontFamilyArabic
-kWebKitFixedFontFamilyArabic = cvar.kWebKitFixedFontFamilyArabic
-kWebKitSerifFontFamilyArabic = cvar.kWebKitSerifFontFamilyArabic
-kWebKitSansSerifFontFamilyArabic = cvar.kWebKitSansSerifFontFamilyArabic
-kWebKitStandardFontFamilyCyrillic = cvar.kWebKitStandardFontFamilyCyrillic
-kWebKitFixedFontFamilyCyrillic = cvar.kWebKitFixedFontFamilyCyrillic
-kWebKitSerifFontFamilyCyrillic = cvar.kWebKitSerifFontFamilyCyrillic
-kWebKitSansSerifFontFamilyCyrillic = cvar.kWebKitSansSerifFontFamilyCyrillic
-kWebKitStandardFontFamilyGreek = cvar.kWebKitStandardFontFamilyGreek
-kWebKitFixedFontFamilyGreek = cvar.kWebKitFixedFontFamilyGreek
-kWebKitSerifFontFamilyGreek = cvar.kWebKitSerifFontFamilyGreek
-kWebKitSansSerifFontFamilyGreek = cvar.kWebKitSansSerifFontFamilyGreek
-kWebKitStandardFontFamilyJapanese = cvar.kWebKitStandardFontFamilyJapanese
-kWebKitFixedFontFamilyJapanese = cvar.kWebKitFixedFontFamilyJapanese
-kWebKitSerifFontFamilyJapanese = cvar.kWebKitSerifFontFamilyJapanese
-kWebKitSansSerifFontFamilyJapanese = cvar.kWebKitSansSerifFontFamilyJapanese
-kWebKitStandardFontFamilyKorean = cvar.kWebKitStandardFontFamilyKorean
-kWebKitFixedFontFamilyKorean = cvar.kWebKitFixedFontFamilyKorean
-kWebKitSerifFontFamilyKorean = cvar.kWebKitSerifFontFamilyKorean
-kWebKitSansSerifFontFamilyKorean = cvar.kWebKitSansSerifFontFamilyKorean
-kWebKitCursiveFontFamilyKorean = cvar.kWebKitCursiveFontFamilyKorean
-kWebKitStandardFontFamilySimplifiedHan = cvar.kWebKitStandardFontFamilySimplifiedHan
-kWebKitFixedFontFamilySimplifiedHan = cvar.kWebKitFixedFontFamilySimplifiedHan
-kWebKitSerifFontFamilySimplifiedHan = cvar.kWebKitSerifFontFamilySimplifiedHan
-kWebKitSansSerifFontFamilySimplifiedHan = cvar.kWebKitSansSerifFontFamilySimplifiedHan
-kWebKitStandardFontFamilyTraditionalHan = cvar.kWebKitStandardFontFamilyTraditionalHan
-kWebKitFixedFontFamilyTraditionalHan = cvar.kWebKitFixedFontFamilyTraditionalHan
-kWebKitSerifFontFamilyTraditionalHan = cvar.kWebKitSerifFontFamilyTraditionalHan
-kWebKitSansSerifFontFamilyTraditionalHan = cvar.kWebKitSansSerifFontFamilyTraditionalHan
-kWebKitDefaultFontSize = cvar.kWebKitDefaultFontSize
-kWebKitDefaultFixedFontSize = cvar.kWebKitDefaultFixedFontSize
-kWebKitMinimumFontSize = cvar.kWebKitMinimumFontSize
-kWebKitMinimumLogicalFontSize = cvar.kWebKitMinimumLogicalFontSize
-kWebKitJavascriptEnabled = cvar.kWebKitJavascriptEnabled
-kWebKitWebSecurityEnabled = cvar.kWebKitWebSecurityEnabled
-kWebKitJavascriptCanOpenWindowsAutomatically = cvar.kWebKitJavascriptCanOpenWindowsAutomatically
-kWebKitLoadsImagesAutomatically = cvar.kWebKitLoadsImagesAutomatically
-kWebKitPluginsEnabled = cvar.kWebKitPluginsEnabled
-kWebKitDomPasteEnabled = cvar.kWebKitDomPasteEnabled
-kWebKitShrinksStandaloneImagesToFit = cvar.kWebKitShrinksStandaloneImagesToFit
-kWebKitInspectorSettings = cvar.kWebKitInspectorSettings
-kWebKitUsesUniversalDetector = cvar.kWebKitUsesUniversalDetector
-kWebKitTextAreasAreResizable = cvar.kWebKitTextAreasAreResizable
-kWebKitJavaEnabled = cvar.kWebKitJavaEnabled
-kWebkitTabsToLinks = cvar.kWebkitTabsToLinks
-kWebKitAllowDisplayingInsecureContent = cvar.kWebKitAllowDisplayingInsecureContent
-kWebKitAllowRunningInsecureContent = cvar.kWebKitAllowRunningInsecureContent
-kPasswordManagerEnabled = cvar.kPasswordManagerEnabled
-kPasswordManagerAllowShowPasswords = cvar.kPasswordManagerAllowShowPasswords
-kPasswordGenerationEnabled = cvar.kPasswordGenerationEnabled
-kAutologinEnabled = cvar.kAutologinEnabled
-kReverseAutologinEnabled = cvar.kReverseAutologinEnabled
-kReverseAutologinRejectedEmailList = cvar.kReverseAutologinRejectedEmailList
-kSafeBrowsingEnabled = cvar.kSafeBrowsingEnabled
-kSafeBrowsingReportingEnabled = cvar.kSafeBrowsingReportingEnabled
-kSafeBrowsingProceedAnywayDisabled = cvar.kSafeBrowsingProceedAnywayDisabled
-kIncognitoModeAvailability = cvar.kIncognitoModeAvailability
-kSearchSuggestEnabled = cvar.kSearchSuggestEnabled
-kConfirmToQuitEnabled = cvar.kConfirmToQuitEnabled
-kCookieBehavior = cvar.kCookieBehavior
-kSyncedDefaultSearchProviderGUID = cvar.kSyncedDefaultSearchProviderGUID
-kDefaultSearchProviderEnabled = cvar.kDefaultSearchProviderEnabled
-kDefaultSearchProviderSearchURL = cvar.kDefaultSearchProviderSearchURL
-kDefaultSearchProviderSuggestURL = cvar.kDefaultSearchProviderSuggestURL
-kDefaultSearchProviderInstantURL = cvar.kDefaultSearchProviderInstantURL
-kDefaultSearchProviderIconURL = cvar.kDefaultSearchProviderIconURL
-kDefaultSearchProviderEncodings = cvar.kDefaultSearchProviderEncodings
-kDefaultSearchProviderName = cvar.kDefaultSearchProviderName
-kDefaultSearchProviderKeyword = cvar.kDefaultSearchProviderKeyword
-kDefaultSearchProviderID = cvar.kDefaultSearchProviderID
-kDefaultSearchProviderPrepopulateID = cvar.kDefaultSearchProviderPrepopulateID
-kDefaultSearchProviderAlternateURLs = cvar.kDefaultSearchProviderAlternateURLs
-kSearchProviderOverrides = cvar.kSearchProviderOverrides
-kSearchProviderOverridesVersion = cvar.kSearchProviderOverridesVersion
-kPromptForDownload = cvar.kPromptForDownload
-kAlternateErrorPagesEnabled = cvar.kAlternateErrorPagesEnabled
-kDnsStartupPrefetchList = cvar.kDnsStartupPrefetchList
-kDnsPrefetchingStartupList = cvar.kDnsPrefetchingStartupList
-kDnsHostReferralList = cvar.kDnsHostReferralList
-kDnsPrefetchingHostReferralList = cvar.kDnsPrefetchingHostReferralList
-kDisableSpdy = cvar.kDisableSpdy
-kHttpServerProperties = cvar.kHttpServerProperties
-kSpdyServers = cvar.kSpdyServers
-kAlternateProtocolServers = cvar.kAlternateProtocolServers
-kDisabledSchemes = cvar.kDisabledSchemes
-kUrlBlacklist = cvar.kUrlBlacklist
-kUrlWhitelist = cvar.kUrlWhitelist
-kInstantConfirmDialogShown = cvar.kInstantConfirmDialogShown
-kInstantEnabled = cvar.kInstantEnabled
-kInstantExtendedEnabled = cvar.kInstantExtendedEnabled
-kInstantUIZeroSuggestUrlPrefix = cvar.kInstantUIZeroSuggestUrlPrefix
-kMultipleProfilePrefMigration = cvar.kMultipleProfilePrefMigration
-kNetworkPredictionEnabled = cvar.kNetworkPredictionEnabled
-kDefaultAppsInstallState = cvar.kDefaultAppsInstallState
-kIpcDisabledMessages = cvar.kIpcDisabledMessages
-kShowHomeButton = cvar.kShowHomeButton
-kRecentlySelectedEncoding = cvar.kRecentlySelectedEncoding
-kDeleteBrowsingHistory = cvar.kDeleteBrowsingHistory
-kDeleteDownloadHistory = cvar.kDeleteDownloadHistory
-kDeleteCache = cvar.kDeleteCache
-kDeleteCookies = cvar.kDeleteCookies
-kDeletePasswords = cvar.kDeletePasswords
-kDeleteFormData = cvar.kDeleteFormData
-kDeleteHostedAppsData = cvar.kDeleteHostedAppsData
-kDeauthorizeContentLicenses = cvar.kDeauthorizeContentLicenses
-kEnableContinuousSpellcheck = cvar.kEnableContinuousSpellcheck
-kSpeechRecognitionFilterProfanities = cvar.kSpeechRecognitionFilterProfanities
-kSpeechRecognitionTrayNotificationShownContexts = cvar.kSpeechRecognitionTrayNotificationShownContexts
-kEnabledLabsExperiments = cvar.kEnabledLabsExperiments
-kEnableAutoSpellCorrect = cvar.kEnableAutoSpellCorrect
-kSavingBrowserHistoryDisabled = cvar.kSavingBrowserHistoryDisabled
-kForceSafeSearch = cvar.kForceSafeSearch
-kDeleteTimePeriod = cvar.kDeleteTimePeriod
-kCurrentThemePackFilename = cvar.kCurrentThemePackFilename
-kCurrentThemeID = cvar.kCurrentThemeID
-kCurrentThemeImages = cvar.kCurrentThemeImages
-kCurrentThemeColors = cvar.kCurrentThemeColors
-kCurrentThemeTints = cvar.kCurrentThemeTints
-kCurrentThemeDisplayProperties = cvar.kCurrentThemeDisplayProperties
-kExtensionsUIDeveloperMode = cvar.kExtensionsUIDeveloperMode
-kExtensionToolbarSize = cvar.kExtensionToolbarSize
-kExtensionCommands = cvar.kExtensionCommands
-kExtensionsSideloadWipeoutBubbleShown = cvar.kExtensionsSideloadWipeoutBubbleShown
-kPluginsLastInternalDirectory = cvar.kPluginsLastInternalDirectory
-kPluginsPluginsList = cvar.kPluginsPluginsList
-kPluginsDisabledPlugins = cvar.kPluginsDisabledPlugins
-kPluginsDisabledPluginsExceptions = cvar.kPluginsDisabledPluginsExceptions
-kPluginsEnabledPlugins = cvar.kPluginsEnabledPlugins
-kPluginsEnabledInternalPDF = cvar.kPluginsEnabledInternalPDF
-kPluginsEnabledNaCl = cvar.kPluginsEnabledNaCl
-kPluginsMigratedToPepperFlash = cvar.kPluginsMigratedToPepperFlash
-kPluginsShowDetails = cvar.kPluginsShowDetails
-kPluginsAllowOutdated = cvar.kPluginsAllowOutdated
-kPluginsAlwaysAuthorize = cvar.kPluginsAlwaysAuthorize
-kCheckDefaultBrowser = cvar.kCheckDefaultBrowser
-kDefaultBrowserSettingEnabled = cvar.kDefaultBrowserSettingEnabled
-kUseCustomChromeFrame = cvar.kUseCustomChromeFrame
-kShowOmniboxSearchHint = cvar.kShowOmniboxSearchHint
-kDesktopNotificationPosition = cvar.kDesktopNotificationPosition
-kDefaultContentSettings = cvar.kDefaultContentSettings
-kContentSettingsClearOnExitMigrated = cvar.kContentSettingsClearOnExitMigrated
-kContentSettingsVersion = cvar.kContentSettingsVersion
-kContentSettingsPatternPairs = cvar.kContentSettingsPatternPairs
-kContentSettingsDefaultWhitelistVersion = cvar.kContentSettingsDefaultWhitelistVersion
-kContentSettingsPluginWhitelist = cvar.kContentSettingsPluginWhitelist
-kBlockThirdPartyCookies = cvar.kBlockThirdPartyCookies
-kClearSiteDataOnExit = cvar.kClearSiteDataOnExit
-kDefaultZoomLevel = cvar.kDefaultZoomLevel
-kPerHostZoomLevels = cvar.kPerHostZoomLevels
-kAutofillEnabled = cvar.kAutofillEnabled
-kAutofillAuxiliaryProfilesEnabled = cvar.kAutofillAuxiliaryProfilesEnabled
-kAutofillPositiveUploadRate = cvar.kAutofillPositiveUploadRate
-kAutofillNegativeUploadRate = cvar.kAutofillNegativeUploadRate
-kAutofillPersonalDataManagerFirstRun = cvar.kAutofillPersonalDataManagerFirstRun
-kEditBookmarksEnabled = cvar.kEditBookmarksEnabled
-kEnableTranslate = cvar.kEnableTranslate
-kPinnedTabs = cvar.kPinnedTabs
-kDisable3DAPIs = cvar.kDisable3DAPIs
-kEnableHyperlinkAuditing = cvar.kEnableHyperlinkAuditing
-kEnableReferrers = cvar.kEnableReferrers
-kEnableDoNotTrack = cvar.kEnableDoNotTrack
-kImportBookmarks = cvar.kImportBookmarks
-kImportHistory = cvar.kImportHistory
-kImportHomepage = cvar.kImportHomepage
-kImportSearchEngine = cvar.kImportSearchEngine
-kImportSavedPasswords = cvar.kImportSavedPasswords
-kEnterpriseWebStoreURL = cvar.kEnterpriseWebStoreURL
-kEnterpriseWebStoreName = cvar.kEnterpriseWebStoreName
-kProfileAvatarIndex = cvar.kProfileAvatarIndex
-kProfileName = cvar.kProfileName
-kProfileIsManaged = cvar.kProfileIsManaged
-kInvertNotificationShown = cvar.kInvertNotificationShown
-kPrintingEnabled = cvar.kPrintingEnabled
-kPrintPreviewDisabled = cvar.kPrintPreviewDisabled
-kDefaultManagedModeFilteringBehavior = cvar.kDefaultManagedModeFilteringBehavior
-kCertRevocationCheckingEnabled = cvar.kCertRevocationCheckingEnabled
-kSSLVersionMin = cvar.kSSLVersionMin
-kSSLVersionMax = cvar.kSSLVersionMax
-kCipherSuiteBlacklist = cvar.kCipherSuiteBlacklist
-kEnableOriginBoundCerts = cvar.kEnableOriginBoundCerts
-kDisableSSLRecordSplitting = cvar.kDisableSSLRecordSplitting
-kEnableMemoryInfo = cvar.kEnableMemoryInfo
-kGLVendorString = cvar.kGLVendorString
-kGLRendererString = cvar.kGLRendererString
-kGLVersionString = cvar.kGLVersionString
-kMetricsClientID = cvar.kMetricsClientID
-kMetricsSessionID = cvar.kMetricsSessionID
-kMetricsLowEntropySource = cvar.kMetricsLowEntropySource
-kMetricsClientIDTimestamp = cvar.kMetricsClientIDTimestamp
-kMetricsReportingEnabled = cvar.kMetricsReportingEnabled
-kMetricsInitialLogsXml = cvar.kMetricsInitialLogsXml
-kMetricsInitialLogsProto = cvar.kMetricsInitialLogsProto
-kMetricsOngoingLogsXml = cvar.kMetricsOngoingLogsXml
-kMetricsOngoingLogsProto = cvar.kMetricsOngoingLogsProto
-kBookmarkPromptEnabled = cvar.kBookmarkPromptEnabled
-kBookmarkPromptImpressionCount = cvar.kBookmarkPromptImpressionCount
-kVariationsSeed = cvar.kVariationsSeed
-kVariationsSeedDate = cvar.kVariationsSeedDate
-kProfileLastUsed = cvar.kProfileLastUsed
-kProfilesLastActive = cvar.kProfilesLastActive
-kProfilesNumCreated = cvar.kProfilesNumCreated
-kProfileInfoCache = cvar.kProfileInfoCache
-kProfileCreatedByVersion = cvar.kProfileCreatedByVersion
-kProfileMetrics = cvar.kProfileMetrics
-kProfilePrefix = cvar.kProfilePrefix
-kStabilityExitedCleanly = cvar.kStabilityExitedCleanly
-kStabilityStatsVersion = cvar.kStabilityStatsVersion
-kStabilityStatsBuildTime = cvar.kStabilityStatsBuildTime
-kStabilitySessionEndCompleted = cvar.kStabilitySessionEndCompleted
-kStabilityLaunchCount = cvar.kStabilityLaunchCount
-kStabilityCrashCount = cvar.kStabilityCrashCount
-kStabilityIncompleteSessionEndCount = cvar.kStabilityIncompleteSessionEndCount
-kStabilityPageLoadCount = cvar.kStabilityPageLoadCount
-kStabilityRendererCrashCount = cvar.kStabilityRendererCrashCount
-kStabilityExtensionRendererCrashCount = cvar.kStabilityExtensionRendererCrashCount
-kStabilityLaunchTimeSec = cvar.kStabilityLaunchTimeSec
-kStabilityLastTimestampSec = cvar.kStabilityLastTimestampSec
-kStabilityRendererHangCount = cvar.kStabilityRendererHangCount
-kStabilityChildProcessCrashCount = cvar.kStabilityChildProcessCrashCount
-kStabilityOtherUserCrashCount = cvar.kStabilityOtherUserCrashCount
-kStabilityKernelCrashCount = cvar.kStabilityKernelCrashCount
-kStabilitySystemUncleanShutdownCount = cvar.kStabilitySystemUncleanShutdownCount
-kStabilityBreakpadRegistrationSuccess = cvar.kStabilityBreakpadRegistrationSuccess
-kStabilityBreakpadRegistrationFail = cvar.kStabilityBreakpadRegistrationFail
-kStabilityDebuggerPresent = cvar.kStabilityDebuggerPresent
-kStabilityDebuggerNotPresent = cvar.kStabilityDebuggerNotPresent
-kStabilityPluginStats = cvar.kStabilityPluginStats
-kStabilityPluginName = cvar.kStabilityPluginName
-kStabilityPluginLaunches = cvar.kStabilityPluginLaunches
-kStabilityPluginInstances = cvar.kStabilityPluginInstances
-kStabilityPluginCrashes = cvar.kStabilityPluginCrashes
-kStabilityPluginLoadingErrors = cvar.kStabilityPluginLoadingErrors
-kUninstallMetricsPageLoadCount = cvar.kUninstallMetricsPageLoadCount
-kUninstallLaunchCount = cvar.kUninstallLaunchCount
-kUninstallMetricsInstallDate = cvar.kUninstallMetricsInstallDate
-kUninstallMetricsUptimeSec = cvar.kUninstallMetricsUptimeSec
-kUninstallLastLaunchTimeSec = cvar.kUninstallLastLaunchTimeSec
-kUninstallLastObservedRunTimeSec = cvar.kUninstallLastObservedRunTimeSec
-kBrowserWindowPlacement = cvar.kBrowserWindowPlacement
-kTaskManagerWindowPlacement = cvar.kTaskManagerWindowPlacement
-kKeywordEditorWindowPlacement = cvar.kKeywordEditorWindowPlacement
-kPreferencesWindowPlacement = cvar.kPreferencesWindowPlacement
-kMemoryCacheSize = cvar.kMemoryCacheSize
-kDownloadDefaultDirectory = cvar.kDownloadDefaultDirectory
-kDownloadExtensionsToOpen = cvar.kDownloadExtensionsToOpen
-kDownloadDirUpgraded = cvar.kDownloadDirUpgraded
-kSaveFileDefaultDirectory = cvar.kSaveFileDefaultDirectory
-kSaveFileType = cvar.kSaveFileType
-kAllowFileSelectionDialogs = cvar.kAllowFileSelectionDialogs
-kDefaultTasksByMimeType = cvar.kDefaultTasksByMimeType
-kDefaultTasksBySuffix = cvar.kDefaultTasksBySuffix
-kSelectFileLastDirectory = cvar.kSelectFileLastDirectory
-kHungPluginDetectFrequency = cvar.kHungPluginDetectFrequency
-kPluginMessageResponseTimeout = cvar.kPluginMessageResponseTimeout
-kSpellCheckDictionary = cvar.kSpellCheckDictionary
-kSpellCheckConfirmDialogShown = cvar.kSpellCheckConfirmDialogShown
-kSpellCheckUseSpellingService = cvar.kSpellCheckUseSpellingService
-kExcludedSchemes = cvar.kExcludedSchemes
-kSafeBrowsingClientKey = cvar.kSafeBrowsingClientKey
-kSafeBrowsingWrappedKey = cvar.kSafeBrowsingWrappedKey
-kOptionsWindowLastTabIndex = cvar.kOptionsWindowLastTabIndex
-kContentSettingsWindowLastTabIndex = cvar.kContentSettingsWindowLastTabIndex
-kCertificateManagerWindowLastTabIndex = cvar.kCertificateManagerWindowLastTabIndex
-kShowFirstRunBubbleOption = cvar.kShowFirstRunBubbleOption
-kShouldShowWelcomePage = cvar.kShouldShowWelcomePage
-kLastKnownGoogleURL = cvar.kLastKnownGoogleURL
-kLastPromptedGoogleURL = cvar.kLastPromptedGoogleURL
-kLastKnownIntranetRedirectOrigin = cvar.kLastKnownIntranetRedirectOrigin
-kCountryIDAtInstall = cvar.kCountryIDAtInstall
-kGeoIDAtInstall = cvar.kGeoIDAtInstall
-kShutdownType = cvar.kShutdownType
-kShutdownNumProcesses = cvar.kShutdownNumProcesses
-kShutdownNumProcessesSlow = cvar.kShutdownNumProcessesSlow
-kRestartLastSessionOnShutdown = cvar.kRestartLastSessionOnShutdown
-kWasRestarted = cvar.kWasRestarted
-kNumBookmarksOnBookmarkBar = cvar.kNumBookmarksOnBookmarkBar
-kNumFoldersOnBookmarkBar = cvar.kNumFoldersOnBookmarkBar
-kNumBookmarksInOtherBookmarkFolder = cvar.kNumBookmarksInOtherBookmarkFolder
-kNumFoldersInOtherBookmarkFolder = cvar.kNumFoldersInOtherBookmarkFolder
-kNumKeywords = cvar.kNumKeywords
-kDisableVideoAndChat = cvar.kDisableVideoAndChat
-kDisableExtensions = cvar.kDisableExtensions
-kDisablePluginFinder = cvar.kDisablePluginFinder
-kBrowserActionContainerWidth = cvar.kBrowserActionContainerWidth
-kLastExtensionsUpdateCheck = cvar.kLastExtensionsUpdateCheck
-kNextExtensionsUpdateCheck = cvar.kNextExtensionsUpdateCheck
-kExtensionAlertsInitializedPref = cvar.kExtensionAlertsInitializedPref
-kExtensionAllowedInstallSites = cvar.kExtensionAllowedInstallSites
-kExtensionAllowedTypes = cvar.kExtensionAllowedTypes
-kExtensionBlacklistUpdateVersion = cvar.kExtensionBlacklistUpdateVersion
-kExtensionInstallAllowList = cvar.kExtensionInstallAllowList
-kExtensionInstallDenyList = cvar.kExtensionInstallDenyList
-kExtensionInstallForceList = cvar.kExtensionInstallForceList
-kExtensionStorageGarbageCollect = cvar.kExtensionStorageGarbageCollect
-kNtpTipsResourceServer = cvar.kNtpTipsResourceServer
-kNtpCollapsedForeignSessions = cvar.kNtpCollapsedForeignSessions
-kNtpMostVisitedURLsBlacklist = cvar.kNtpMostVisitedURLsBlacklist
-kNtpPromoResourceCacheUpdate = cvar.kNtpPromoResourceCacheUpdate
-kNtpDateResourceServer = cvar.kNtpDateResourceServer
-kNtpShownBookmarksFolder = cvar.kNtpShownBookmarksFolder
-kNtpShownPage = cvar.kNtpShownPage
-kNtpPromoDesktopSessionFound = cvar.kNtpPromoDesktopSessionFound
-kNtpWebStoreEnabled = cvar.kNtpWebStoreEnabled
-kNtpAppPageNames = cvar.kNtpAppPageNames
-kDevToolsDisabled = cvar.kDevToolsDisabled
-kDevToolsDockSide = cvar.kDevToolsDockSide
-kDevToolsEditedFiles = cvar.kDevToolsEditedFiles
-kDevToolsHSplitLocation = cvar.kDevToolsHSplitLocation
-kDevToolsOpenDocked = cvar.kDevToolsOpenDocked
-kDevToolsVSplitLocation = cvar.kDevToolsVSplitLocation
-kSyncLastSyncedTime = cvar.kSyncLastSyncedTime
-kSyncHasSetupCompleted = cvar.kSyncHasSetupCompleted
-kSyncKeepEverythingSynced = cvar.kSyncKeepEverythingSynced
-kSyncBookmarks = cvar.kSyncBookmarks
-kSyncPasswords = cvar.kSyncPasswords
-kSyncPreferences = cvar.kSyncPreferences
-kSyncAppNotifications = cvar.kSyncAppNotifications
-kSyncAppSettings = cvar.kSyncAppSettings
-kSyncApps = cvar.kSyncApps
-kSyncAutofill = cvar.kSyncAutofill
-kSyncAutofillProfile = cvar.kSyncAutofillProfile
-kSyncThemes = cvar.kSyncThemes
-kSyncTypedUrls = cvar.kSyncTypedUrls
-kSyncExtensions = cvar.kSyncExtensions
-kSyncExtensionSettings = cvar.kSyncExtensionSettings
-kSyncHistoryDeleteDirectives = cvar.kSyncHistoryDeleteDirectives
-kSyncManaged = cvar.kSyncManaged
-kSyncSearchEngines = cvar.kSyncSearchEngines
-kSyncSessions = cvar.kSyncSessions
-kSyncSuppressStart = cvar.kSyncSuppressStart
-kGoogleServicesLastUsername = cvar.kGoogleServicesLastUsername
-kGoogleServicesUsername = cvar.kGoogleServicesUsername
-kGoogleServicesUsernamePattern = cvar.kGoogleServicesUsernamePattern
-kSyncUsingSecondaryPassphrase = cvar.kSyncUsingSecondaryPassphrase
-kSyncEncryptionBootstrapToken = cvar.kSyncEncryptionBootstrapToken
-kSyncKeystoreEncryptionBootstrapToken = cvar.kSyncKeystoreEncryptionBootstrapToken
-kSyncAcknowledgedSyncTypes = cvar.kSyncAcknowledgedSyncTypes
-kSyncMaxInvalidationVersions = cvar.kSyncMaxInvalidationVersions
-kSyncSessionsGUID = cvar.kSyncSessionsGUID
-kInvalidatorInvalidationState = cvar.kInvalidatorInvalidationState
-kInvalidatorMaxInvalidationVersions = cvar.kInvalidatorMaxInvalidationVersions
-kSyncPromoStartupCount = cvar.kSyncPromoStartupCount
-kSyncPromoViewCount = cvar.kSyncPromoViewCount
-kSyncPromoUserSkipped = cvar.kSyncPromoUserSkipped
-kSyncPromoShowOnFirstRunAllowed = cvar.kSyncPromoShowOnFirstRunAllowed
-kSyncPromoShowNTPBubble = cvar.kSyncPromoShowNTPBubble
-kSyncPromoErrorMessage = cvar.kSyncPromoErrorMessage
-kProfileGAIAInfoUpdateTime = cvar.kProfileGAIAInfoUpdateTime
-kProfileGAIAInfoPictureURL = cvar.kProfileGAIAInfoPictureURL
-kWebAppCreateOnDesktop = cvar.kWebAppCreateOnDesktop
-kWebAppCreateInAppsMenu = cvar.kWebAppCreateInAppsMenu
-kWebAppCreateInQuickLaunchBar = cvar.kWebAppCreateInQuickLaunchBar
-kGeolocationAccessToken = cvar.kGeolocationAccessToken
-kDefaultAudioCaptureDevice = cvar.kDefaultAudioCaptureDevice
-kDefaultVideoCaptureDevice = cvar.kDefaultVideoCaptureDevice
-kRemoteAccessHostFirewallTraversal = cvar.kRemoteAccessHostFirewallTraversal
-kRemoteAccessHostRequireTwoFactor = cvar.kRemoteAccessHostRequireTwoFactor
-kRemoteAccessHostDomain = cvar.kRemoteAccessHostDomain
-kRemoteAccessHostTalkGadgetPrefix = cvar.kRemoteAccessHostTalkGadgetPrefix
-kRemoteAccessHostRequireCurtain = cvar.kRemoteAccessHostRequireCurtain
-kPrintPreviewStickySettings = cvar.kPrintPreviewStickySettings
-kCloudPrintRoot = cvar.kCloudPrintRoot
-kCloudPrintServiceURL = cvar.kCloudPrintServiceURL
-kCloudPrintSigninURL = cvar.kCloudPrintSigninURL
-kCloudPrintDialogWidth = cvar.kCloudPrintDialogWidth
-kCloudPrintDialogHeight = cvar.kCloudPrintDialogHeight
-kCloudPrintSigninDialogWidth = cvar.kCloudPrintSigninDialogWidth
-kCloudPrintSigninDialogHeight = cvar.kCloudPrintSigninDialogHeight
-kCloudPrintProxyEnabled = cvar.kCloudPrintProxyEnabled
-kCloudPrintProxyId = cvar.kCloudPrintProxyId
-kCloudPrintAuthToken = cvar.kCloudPrintAuthToken
-kCloudPrintXMPPAuthToken = cvar.kCloudPrintXMPPAuthToken
-kCloudPrintEmail = cvar.kCloudPrintEmail
-kCloudPrintPrintSystemSettings = cvar.kCloudPrintPrintSystemSettings
-kCloudPrintEnableJobPoll = cvar.kCloudPrintEnableJobPoll
-kCloudPrintRobotRefreshToken = cvar.kCloudPrintRobotRefreshToken
-kCloudPrintRobotEmail = cvar.kCloudPrintRobotEmail
-kCloudPrintConnectNewPrinters = cvar.kCloudPrintConnectNewPrinters
-kCloudPrintXmppPingEnabled = cvar.kCloudPrintXmppPingEnabled
-kCloudPrintXmppPingTimeout = cvar.kCloudPrintXmppPingTimeout
-kCloudPrintPrinterBlacklist = cvar.kCloudPrintPrinterBlacklist
-kCloudPrintSubmitEnabled = cvar.kCloudPrintSubmitEnabled
-kChromeToMobileDeviceList = cvar.kChromeToMobileDeviceList
-kProxy = cvar.kProxy
-kMaxConnectionsPerProxy = cvar.kMaxConnectionsPerProxy
-kManagedDefaultCookiesSetting = cvar.kManagedDefaultCookiesSetting
-kManagedDefaultImagesSetting = cvar.kManagedDefaultImagesSetting
-kManagedDefaultJavaScriptSetting = cvar.kManagedDefaultJavaScriptSetting
-kManagedDefaultPluginsSetting = cvar.kManagedDefaultPluginsSetting
-kManagedDefaultPopupsSetting = cvar.kManagedDefaultPopupsSetting
-kManagedDefaultGeolocationSetting = cvar.kManagedDefaultGeolocationSetting
-kManagedDefaultNotificationsSetting = cvar.kManagedDefaultNotificationsSetting
-kManagedDefaultMediaStreamSetting = cvar.kManagedDefaultMediaStreamSetting
-kManagedCookiesAllowedForUrls = cvar.kManagedCookiesAllowedForUrls
-kManagedCookiesBlockedForUrls = cvar.kManagedCookiesBlockedForUrls
-kManagedCookiesSessionOnlyForUrls = cvar.kManagedCookiesSessionOnlyForUrls
-kManagedImagesAllowedForUrls = cvar.kManagedImagesAllowedForUrls
-kManagedImagesBlockedForUrls = cvar.kManagedImagesBlockedForUrls
-kManagedJavaScriptAllowedForUrls = cvar.kManagedJavaScriptAllowedForUrls
-kManagedJavaScriptBlockedForUrls = cvar.kManagedJavaScriptBlockedForUrls
-kManagedPluginsAllowedForUrls = cvar.kManagedPluginsAllowedForUrls
-kManagedPluginsBlockedForUrls = cvar.kManagedPluginsBlockedForUrls
-kManagedPopupsAllowedForUrls = cvar.kManagedPopupsAllowedForUrls
-kManagedPopupsBlockedForUrls = cvar.kManagedPopupsBlockedForUrls
-kManagedNotificationsAllowedForUrls = cvar.kManagedNotificationsAllowedForUrls
-kManagedNotificationsBlockedForUrls = cvar.kManagedNotificationsBlockedForUrls
-kManagedAutoSelectCertificateForUrls = cvar.kManagedAutoSelectCertificateForUrls
-kAudioCaptureAllowed = cvar.kAudioCaptureAllowed
-kVideoCaptureAllowed = cvar.kVideoCaptureAllowed
-kClearPluginLSODataEnabled = cvar.kClearPluginLSODataEnabled
-kPepperFlashSettingsEnabled = cvar.kPepperFlashSettingsEnabled
-kDiskCacheDir = cvar.kDiskCacheDir
-kDiskCacheSize = cvar.kDiskCacheSize
-kMediaCacheSize = cvar.kMediaCacheSize
-kChromeOsReleaseChannel = cvar.kChromeOsReleaseChannel
-kTabStripLayoutType = cvar.kTabStripLayoutType
-kRegisteredBackgroundContents = cvar.kRegisteredBackgroundContents
-kShownAutoLaunchInfobar = cvar.kShownAutoLaunchInfobar
-kAuthSchemes = cvar.kAuthSchemes
-kDisableAuthNegotiateCnameLookup = cvar.kDisableAuthNegotiateCnameLookup
-kEnableAuthNegotiatePort = cvar.kEnableAuthNegotiatePort
-kAuthServerWhitelist = cvar.kAuthServerWhitelist
-kAuthNegotiateDelegateWhitelist = cvar.kAuthNegotiateDelegateWhitelist
-kGSSAPILibraryName = cvar.kGSSAPILibraryName
-kSpdyProxyOrigin = cvar.kSpdyProxyOrigin
-kAllowCrossOriginAuthPrompt = cvar.kAllowCrossOriginAuthPrompt
-kBuiltInDnsClientEnabled = cvar.kBuiltInDnsClientEnabled
-kHttpReceivedContentLength = cvar.kHttpReceivedContentLength
-kHttpOriginalContentLength = cvar.kHttpOriginalContentLength
-kRegisteredProtocolHandlers = cvar.kRegisteredProtocolHandlers
-kIgnoredProtocolHandlers = cvar.kIgnoredProtocolHandlers
-kCustomHandlersEnabled = cvar.kCustomHandlersEnabled
-kUserCreatedLoginItem = cvar.kUserCreatedLoginItem
-kUserRemovedLoginItem = cvar.kUserRemovedLoginItem
-kBackgroundModeEnabled = cvar.kBackgroundModeEnabled
-kDevicePolicyRefreshRate = cvar.kDevicePolicyRefreshRate
-kUserPolicyRefreshRate = cvar.kUserPolicyRefreshRate
-kLoadCloudPolicyOnSignin = cvar.kLoadCloudPolicyOnSignin
-kFactoryResetRequested = cvar.kFactoryResetRequested
-kRecoveryComponentVersion = cvar.kRecoveryComponentVersion
-kComponentUpdaterState = cvar.kComponentUpdaterState
-kMediaGalleriesUniqueId = cvar.kMediaGalleriesUniqueId
-kMediaGalleriesRememberedGalleries = cvar.kMediaGalleriesRememberedGalleries
-kInManagedMode = cvar.kInManagedMode
-kNetworkProfileWarningsLeft = cvar.kNetworkProfileWarningsLeft
-kNetworkProfileLastWarningTime = cvar.kNetworkProfileLastWarningTime
-kLastPolicyStatisticsUpdate = cvar.kLastPolicyStatisticsUpdate
-CERT_STATUS_ALL_ERRORS = cvar.CERT_STATUS_ALL_ERRORS
-CERT_STATUS_COMMON_NAME_INVALID = cvar.CERT_STATUS_COMMON_NAME_INVALID
-CERT_STATUS_DATE_INVALID = cvar.CERT_STATUS_DATE_INVALID
-CERT_STATUS_AUTHORITY_INVALID = cvar.CERT_STATUS_AUTHORITY_INVALID
-CERT_STATUS_NO_REVOCATION_MECHANISM = cvar.CERT_STATUS_NO_REVOCATION_MECHANISM
-CERT_STATUS_UNABLE_TO_CHECK_REVOCATION = cvar.CERT_STATUS_UNABLE_TO_CHECK_REVOCATION
-CERT_STATUS_REVOKED = cvar.CERT_STATUS_REVOKED
-CERT_STATUS_INVALID = cvar.CERT_STATUS_INVALID
-CERT_STATUS_WEAK_SIGNATURE_ALGORITHM = cvar.CERT_STATUS_WEAK_SIGNATURE_ALGORITHM
-CERT_STATUS_NON_UNIQUE_NAME = cvar.CERT_STATUS_NON_UNIQUE_NAME
-CERT_STATUS_WEAK_KEY = cvar.CERT_STATUS_WEAK_KEY
-CERT_STATUS_IS_EV = cvar.CERT_STATUS_IS_EV
-CERT_STATUS_REV_CHECKING_ENABLED = cvar.CERT_STATUS_REV_CHECKING_ENABLED
-
-class FilePath(_object):
-    """Represent a file path. Call value() to get the string."""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, FilePath, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, FilePath, name)
-    __repr__ = _swig_repr
-    def value(self):
-        """
-        value(self) -> StringType
-
-        Get the string representation.
-        """
-        return _pyautolib.FilePath_value(self)
-
-    def __init__(self, *args): 
-        """
-        __init__(self) -> FilePath
-        __init__(self, StringType path) -> FilePath
-
-        Construct an empty FilePath from a string.
-        """
-        this = _pyautolib.new_FilePath(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_FilePath
-    __del__ = lambda self : None;
-FilePath_swigregister = _pyautolib.FilePath_swigregister
-FilePath_swigregister(FilePath)
-
-class PyUITestSuiteBase(_object):
-    """Proxy of C++ PyUITestSuiteBase class"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, PyUITestSuiteBase, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, PyUITestSuiteBase, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        """
-        __init__(self, int argc) -> PyUITestSuiteBase
-
-        Create the suite.
-        """
-        this = _pyautolib.new_PyUITestSuiteBase(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_PyUITestSuiteBase
-    __del__ = lambda self : None;
-    def InitializeWithPath(self, *args):
-        """
-        InitializeWithPath(self, FilePath browser_dir)
-
-        Initialize from the path to browser dir.
-        """
-        return _pyautolib.PyUITestSuiteBase_InitializeWithPath(self, *args)
-
-    def SetCrSourceRoot(self, *args):
-        """
-        SetCrSourceRoot(self, FilePath path)
-
-        Set chrome source root path, used in some tests
-        """
-        return _pyautolib.PyUITestSuiteBase_SetCrSourceRoot(self, *args)
-
-PyUITestSuiteBase_swigregister = _pyautolib.PyUITestSuiteBase_swigregister
-PyUITestSuiteBase_swigregister(PyUITestSuiteBase)
-
-class PyUITestBase(_object):
-    """Proxy of C++ PyUITestBase class"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, PyUITestBase, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, PyUITestBase, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        """__init__(self, bool clear_profile, wstring homepage) -> PyUITestBase"""
-        this = _pyautolib.new_PyUITestBase(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    def Initialize(self, *args):
-        """
-        Initialize(self, FilePath browser_dir)
-
-        Initialize the entire setup. Should be called before launching the browser. For internal use.
-        """
-        return _pyautolib.PyUITestBase_Initialize(self, *args)
-
-    def AppendBrowserLaunchSwitch(self, *args):
-        """
-        AppendBrowserLaunchSwitch(self, char name)
-        AppendBrowserLaunchSwitch(self, char name, char value)
-
-        Appends a command-line switch (with associated value if given) to the list of switches to be passed to the browser upon launch. Should be called before launching the browser. For internal use only.
-        """
-        return _pyautolib.PyUITestBase_AppendBrowserLaunchSwitch(self, *args)
-
-    def BeginTracing(self, *args):
-        """
-        BeginTracing(self, string categories) -> bool
-
-        Begins tracing with the given category string.
-        """
-        return _pyautolib.PyUITestBase_BeginTracing(self, *args)
-
-    def EndTracing(self):
-        """
-        EndTracing(self) -> string
-
-        Ends tracing and returns the collected events.
-        """
-        return _pyautolib.PyUITestBase_EndTracing(self)
-
-    def UseNamedChannelID(self, *args):
-        """UseNamedChannelID(self, string named_channel_id)"""
-        return _pyautolib.PyUITestBase_UseNamedChannelID(self, *args)
-
-    def SetUp(self):
-        """
-        SetUp(self)
-
-        Fires up the browser and opens a window.
-        """
-        return _pyautolib.PyUITestBase_SetUp(self)
-
-    def TearDown(self):
-        """
-        TearDown(self)
-
-        Closes all windows and destroys the browser.
-        """
-        return _pyautolib.PyUITestBase_TearDown(self)
-
-    def LaunchBrowserAndServer(self):
-        """
-        LaunchBrowserAndServer(self)
-
-        Launches the browser and IPC testing server.
-        """
-        return _pyautolib.PyUITestBase_LaunchBrowserAndServer(self)
-
-    def CloseBrowserAndServer(self):
-        """
-        CloseBrowserAndServer(self)
-
-        Closes the browser and IPC testing server.
-        """
-        return _pyautolib.PyUITestBase_CloseBrowserAndServer(self)
-
-    def get_clear_profile(self):
-        """
-        get_clear_profile(self) -> bool
-
-        Determine if the profile is set to be cleared on next startup.
-        """
-        return _pyautolib.PyUITestBase_get_clear_profile(self)
-
-    def set_clear_profile(self, *args):
-        """
-        set_clear_profile(self, bool clear_profile)
-
-        If False, sets the flag so that the profile is not cleared on next startup. Useful for persisting profile across restarts. By default the state is True, to clear profile.
-        """
-        return _pyautolib.PyUITestBase_set_clear_profile(self, *args)
-
-    def user_data_dir(self):
-        """
-        user_data_dir(self) -> FilePath
-
-        Get the path to profile directory.
-        """
-        return _pyautolib.PyUITestBase_user_data_dir(self)
-
-    def _SendJSONRequest(self, *args):
-        """
-        _SendJSONRequest(self, int window_index, string request, int timeout) -> string
-
-        Send a sync JSON request to Chrome.  Returns a JSON dict as a response.  Given timeout in milliseconds.Internal method.
-        """
-        return _pyautolib.PyUITestBase__SendJSONRequest(self, *args)
-
-    def CheckErrorsAndCrashes(self):
-        """CheckErrorsAndCrashes(self) -> string"""
-        return _pyautolib.PyUITestBase_CheckErrorsAndCrashes(self)
-
-    __swig_destroy__ = _pyautolib.delete_PyUITestBase
-    __del__ = lambda self : None;
-PyUITestBase_swigregister = _pyautolib.PyUITestBase_swigregister
-PyUITestBase_swigregister(PyUITestBase)
-
-class TestServer(_object):
-    """TestServer. Serves files in data dir over a local http server"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, TestServer, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, TestServer, name)
-    __repr__ = _swig_repr
-    TYPE_FTP = _pyautolib.TestServer_TYPE_FTP
-    TYPE_HTTP = _pyautolib.TestServer_TYPE_HTTP
-    TYPE_HTTPS = _pyautolib.TestServer_TYPE_HTTPS
-    TYPE_SYNC = _pyautolib.TestServer_TYPE_SYNC
-    def __init__(self, *args): 
-        """
-        __init__(self, Type type, string host, FilePath document_root) -> TestServer
-        __init__(self, Type type, SSLOptions ssl_options, FilePath document_root) -> TestServer
-        """
-        this = _pyautolib.new_TestServer(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    def Start(self):
-        """
-        Start(self) -> bool
-
-        Start TestServer over an ephemeral port
-        """
-        return _pyautolib.TestServer_Start(self)
-
-    def Stop(self):
-        """
-        Stop(self) -> bool
-
-        Stop TestServer
-        """
-        return _pyautolib.TestServer_Stop(self)
-
-    def document_root(self):
-        """
-        document_root(self) -> FilePath
-
-        Get FilePath to the document root
-        """
-        return _pyautolib.TestServer_document_root(self)
-
-    def GetScheme(self):
-        """GetScheme(self) -> string"""
-        return _pyautolib.TestServer_GetScheme(self)
-
-    def GetURL(self, *args):
-        """
-        GetURL(self, string path) -> GURL
-
-        Get URL for a file path
-        """
-        return _pyautolib.TestServer_GetURL(self, *args)
-
-    def GetPort(self):
-        """
-        GetPort(self) -> int
-
-        Get port number.
-        """
-        return _pyautolib.TestServer_GetPort(self)
-
-    def GetSyncXmppPort(self):
-        """
-        GetSyncXmppPort(self) -> int
-
-        Get xmpp port number in case of sync server.
-        """
-        return _pyautolib.TestServer_GetSyncXmppPort(self)
-
-    __swig_destroy__ = _pyautolib.delete_TestServer
-    __del__ = lambda self : None;
-TestServer_swigregister = _pyautolib.TestServer_swigregister
-TestServer_swigregister(TestServer)
-
-class SSLOptions(_object):
-    """SSLOptions. Sets one of three types of a cert"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, SSLOptions, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, SSLOptions, name)
-    __repr__ = _swig_repr
-    CERT_OK = _pyautolib.SSLOptions_CERT_OK
-    CERT_MISMATCHED_NAME = _pyautolib.SSLOptions_CERT_MISMATCHED_NAME
-    CERT_EXPIRED = _pyautolib.SSLOptions_CERT_EXPIRED
-    def __init__(self, *args): 
-        """
-        __init__(self, ServerCertificate cert) -> SSLOptions
-
-        SSLOptions. Sets one of three types of a cert
-        """
-        this = _pyautolib.new_SSLOptions(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_SSLOptions
-    __del__ = lambda self : None;
-SSLOptions_swigregister = _pyautolib.SSLOptions_swigregister
-SSLOptions_swigregister(SSLOptions)
-
-class int_ptr(_object):
-    """Proxy of C++ int_ptr class"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, int_ptr, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, int_ptr, name)
-    __repr__ = _swig_repr
-    def __init__(self): 
-        """__init__(self) -> int_ptr"""
-        this = _pyautolib.new_int_ptr()
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_int_ptr
-    __del__ = lambda self : None;
-    def assign(self, *args):
-        """assign(self, int value)"""
-        return _pyautolib.int_ptr_assign(self, *args)
-
-    def value(self):
-        """value(self) -> int"""
-        return _pyautolib.int_ptr_value(self)
-
-    def cast(self):
-        """cast(self) -> int"""
-        return _pyautolib.int_ptr_cast(self)
-
-    def frompointer(*args):
-        """frompointer(int t) -> int_ptr"""
-        return _pyautolib.int_ptr_frompointer(*args)
-
-    if _newclass:frompointer = staticmethod(frompointer)
-    __swig_getmethods__["frompointer"] = lambda x: frompointer
-int_ptr_swigregister = _pyautolib.int_ptr_swigregister
-int_ptr_swigregister(int_ptr)
-
-def int_ptr_frompointer(*args):
-  """int_ptr_frompointer(int t) -> int_ptr"""
-  return _pyautolib.int_ptr_frompointer(*args)
-
-class uint32_ptr(_object):
-    """Proxy of C++ uint32_ptr class"""
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, uint32_ptr, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, uint32_ptr, name)
-    __repr__ = _swig_repr
-    def __init__(self): 
-        """__init__(self) -> uint32_ptr"""
-        this = _pyautolib.new_uint32_ptr()
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _pyautolib.delete_uint32_ptr
-    __del__ = lambda self : None;
-    def assign(self, *args):
-        """assign(self, uint32 value)"""
-        return _pyautolib.uint32_ptr_assign(self, *args)
-
-    def value(self):
-        """value(self) -> uint32"""
-        return _pyautolib.uint32_ptr_value(self)
-
-    def cast(self):
-        """cast(self) -> uint32"""
-        return _pyautolib.uint32_ptr_cast(self)
-
-    def frompointer(*args):
-        """frompointer(uint32 t) -> uint32_ptr"""
-        return _pyautolib.uint32_ptr_frompointer(*args)
-
-    if _newclass:frompointer = staticmethod(frompointer)
-    __swig_getmethods__["frompointer"] = lambda x: frompointer
-uint32_ptr_swigregister = _pyautolib.uint32_ptr_swigregister
-uint32_ptr_swigregister(uint32_ptr)
-
-def uint32_ptr_frompointer(*args):
-  """uint32_ptr_frompointer(uint32 t) -> uint32_ptr"""
-  return _pyautolib.uint32_ptr_frompointer(*args)
-
-
-
diff --git a/resources.pak b/resources.pak
index bf846ca..07d6c31 100644
--- a/resources.pak
+++ b/resources.pak
Binary files differ
diff --git a/resources/extension/demo/library.js b/resources/extension/demo/library.js
index 167786a..9e89995 100644
--- a/resources/extension/demo/library.js
+++ b/resources/extension/demo/library.js
@@ -2,4 +2,4 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-var _demo = {};
+var demo = {};
diff --git a/resources/inspector/AuditsPanel.js b/resources/inspector/AuditsPanel.js
index 56b1e5f..69c6472 100644
--- a/resources/inspector/AuditsPanel.js
+++ b/resources/inspector/AuditsPanel.js
@@ -27,11 +27,10 @@
 
 this._constructCategories();
 
-this._launcherView = new WebInspector.AuditLauncherView(this.initiateAudit.bind(this));
+this._auditController = new WebInspector.AuditController(this);
+this._launcherView = new WebInspector.AuditLauncherView(this._auditController);
 for (var id in this.categoriesById)
 this._launcherView.addCategory(this.categoriesById[id]);
-
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._didMainResourceLoad, this);
 }
 
 WebInspector.AuditsPanel.prototype = {
@@ -70,45 +69,7 @@
 },
 
 
-_executeAudit: function(categories, resultCallback)
-{
-this._progress.setTitle(WebInspector.UIString("Running audit"));
-
-function ruleResultReadyCallback(categoryResult, ruleResult)
-{
-if (ruleResult && ruleResult.children)
-categoryResult.addRuleResult(ruleResult);
-
-if (this._progress.isCanceled())
-this._progress.done();
-}
-
-var results = [];
-var mainResourceURL = WebInspector.inspectedPageURL;
-var categoriesDone = 0;
-function categoryDoneCallback()
-{
-if (++categoriesDone !== categories.length)
-return;
-this._progress.done();
-resultCallback(mainResourceURL, results)
-}
-
-var requests = WebInspector.networkLog.requests.slice();
-var compositeProgress = new WebInspector.CompositeProgress(this._progress);
-var subprogresses = [];
-for (var i = 0; i < categories.length; ++i)
-subprogresses.push(compositeProgress.createSubProgress());
-for (var i = 0; i < categories.length; ++i) {
-var category = categories[i];
-var result = new WebInspector.AuditCategoryResult(category);
-results.push(result);
-category.run(requests, ruleResultReadyCallback.bind(this, result), categoryDoneCallback.bind(this), subprogresses[i]);
-}
-},
-
-
-_auditFinishedCallback: function(launcherCallback, mainResourceURL, results)
+auditFinishedCallback: function(mainResourceURL, results)
 {
 var children = this.auditResultsTreeElement.children;
 var ordinal = 1;
@@ -120,49 +81,6 @@
 var resultTreeElement = new WebInspector.AuditResultSidebarTreeElement(this, results, mainResourceURL, ordinal);
 this.auditResultsTreeElement.appendChild(resultTreeElement);
 resultTreeElement.revealAndSelect();
-if (!this._progress.isCanceled())
-launcherCallback();
-},
-
-
-initiateAudit: function(categoryIds, progress, runImmediately, startedCallback, finishedCallback)
-{
-if (!categoryIds || !categoryIds.length)
-return;
-
-this._progress = progress;
-
-var categories = [];
-for (var i = 0; i < categoryIds.length; ++i)
-categories.push(this.categoriesById[categoryIds[i]]);
-
-function startAuditWhenResourcesReady()
-{
-startedCallback();
-this._executeAudit(categories, this._auditFinishedCallback.bind(this, finishedCallback));
-}
-
-if (runImmediately)
-startAuditWhenResourcesReady.call(this);
-else
-this._reloadResources(startAuditWhenResourcesReady.bind(this));
-
-WebInspector.userMetrics.AuditsStarted.record();
-},
-
-_reloadResources: function(callback)
-{
-this._pageReloadCallback = callback;
-PageAgent.reload(false);
-},
-
-_didMainResourceLoad: function()
-{
-if (this._pageReloadCallback) {
-var callback = this._pageReloadCallback;
-delete this._pageReloadCallback;
-callback();
-}
 },
 
 
@@ -527,6 +445,105 @@
 
 
 
+WebInspector.AuditController = function(auditsPanel)
+{
+this._auditsPanel = auditsPanel;
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._didMainResourceLoad, this);
+}
+
+WebInspector.AuditController.prototype = {
+
+_executeAudit: function(categories, resultCallback)
+{
+this._progress.setTitle(WebInspector.UIString("Running audit"));
+
+function ruleResultReadyCallback(categoryResult, ruleResult)
+{
+if (ruleResult && ruleResult.children)
+categoryResult.addRuleResult(ruleResult);
+
+if (this._progress.isCanceled())
+this._progress.done();
+}
+
+var results = [];
+var mainResourceURL = WebInspector.inspectedPageURL;
+var categoriesDone = 0;
+function categoryDoneCallback()
+{
+if (++categoriesDone !== categories.length)
+return;
+this._progress.done();
+resultCallback(mainResourceURL, results)
+}
+
+var requests = WebInspector.networkLog.requests.slice();
+var compositeProgress = new WebInspector.CompositeProgress(this._progress);
+var subprogresses = [];
+for (var i = 0; i < categories.length; ++i)
+subprogresses.push(compositeProgress.createSubProgress());
+for (var i = 0; i < categories.length; ++i) {
+var category = categories[i];
+var result = new WebInspector.AuditCategoryResult(category);
+results.push(result);
+category.run(requests, ruleResultReadyCallback.bind(this, result), categoryDoneCallback.bind(this), subprogresses[i]);
+}
+},
+
+
+_auditFinishedCallback: function(launcherCallback, mainResourceURL, results)
+{
+this._auditsPanel.auditFinishedCallback(mainResourceURL, results);
+if (!this._progress.isCanceled())
+launcherCallback();
+},
+
+
+initiateAudit: function(categoryIds, progress, runImmediately, startedCallback, finishedCallback)
+{
+if (!categoryIds || !categoryIds.length)
+return;
+
+this._progress = progress;
+
+var categories = [];
+for (var i = 0; i < categoryIds.length; ++i)
+categories.push(this._auditsPanel.categoriesById[categoryIds[i]]);
+
+function startAuditWhenResourcesReady()
+{
+startedCallback();
+this._executeAudit(categories, this._auditFinishedCallback.bind(this, finishedCallback));
+}
+
+if (runImmediately)
+startAuditWhenResourcesReady.call(this);
+else
+this._reloadResources(startAuditWhenResourcesReady.bind(this));
+
+WebInspector.userMetrics.AuditsStarted.record();
+},
+
+
+_reloadResources: function(callback)
+{
+this._pageReloadCallback = callback;
+PageAgent.reload(false);
+},
+
+_didMainResourceLoad: function()
+{
+if (this._pageReloadCallback) {
+var callback = this._pageReloadCallback;
+delete this._pageReloadCallback;
+callback();
+}
+}
+}
+;
+
+
+
 WebInspector.AuditFormatters = function()
 {
 }
@@ -620,11 +637,12 @@
 
 
 
-WebInspector.AuditLauncherView = function(runnerCallback)
+WebInspector.AuditLauncherView = function(auditController)
 {
 WebInspector.View.call(this);
 
-this._runnerCallback = runnerCallback;
+this._auditController = auditController;
+
 this._categoryIdPrefix = "audit-category-item-";
 this._auditRunning = false;
 
@@ -739,7 +757,7 @@
 {
 this._displayResourceLoadingProgress = false;
 }
-this._runnerCallback(catIds, this._progressIndicator, this._auditPresentStateElement.checked, onAuditStarted.bind(this), this._setAuditRunning.bind(this, false));
+this._auditController.initiateAudit(catIds, this._progressIndicator, this._auditPresentStateElement.checked, onAuditStarted.bind(this), this._setAuditRunning.bind(this, false));
 },
 
 _stopAudit: function()
@@ -882,19 +900,19 @@
 
 WebInspector.AuditResultView = function(categoryResults)
 {
-WebInspector.View.call(this);
-this.element.className = "audit-result-view";
+WebInspector.SidebarPaneStack.call(this);
+this.element.addStyleClass("audit-result-view");
 
 function categorySorter(a, b) {
 return (a.title || "").localeCompare(b.title || "");
 }
 categoryResults.sort(categorySorter);
 for (var i = 0; i < categoryResults.length; ++i)
-this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
+this.addPane(new WebInspector.AuditCategoryResultPane(categoryResults[i]));
 }
 
 WebInspector.AuditResultView.prototype = {
-__proto__: WebInspector.View.prototype
+__proto__: WebInspector.SidebarPaneStack.prototype
 }
 
 
@@ -1260,23 +1278,15 @@
 
 for (var i = 0; i < styleSheets.length; ++i) {
 var styleSheet = styleSheets[i];
-var stylesheetSize = 0;
-var unusedStylesheetSize = 0;
 var unusedRules = [];
 for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
 var rule = styleSheet.rules[curRule];
-
-var textLength = (rule.selectorRange && rule.style.range && rule.style.range.end) ? rule.style.range.end - rule.selectorRange.start + 1 : 0;
-if (!textLength && rule.style.cssText)
-textLength = rule.style.cssText.length + rule.selectorText.length;
-stylesheetSize += textLength;
 if (!testedSelectors[rule.selectorText] || foundSelectors[rule.selectorText])
 continue;
-unusedStylesheetSize += textLength;
 unusedRules.push(rule.selectorText);
 }
-totalStylesheetSize += stylesheetSize;
-totalUnusedStylesheetSize += unusedStylesheetSize;
+totalStylesheetSize += styleSheet.rules.length;
+totalUnusedStylesheetSize += unusedRules.length;
 
 if (!unusedRules.length)
 continue;
@@ -1284,10 +1294,10 @@
 var resource = WebInspector.resourceForURL(styleSheet.sourceURL);
 var isInlineBlock = resource && resource.request && resource.request.type == WebInspector.resourceTypes.Document;
 var url = !isInlineBlock ? WebInspector.AuditRuleResult.linkifyDisplayName(styleSheet.sourceURL) : String.sprintf("Inline block #%d", ++inlineBlockOrdinal);
-var pctUnused = Math.round(100 * unusedStylesheetSize / stylesheetSize);
+var pctUnused = Math.round(100 * unusedRules.length / styleSheet.rules.length);
 if (!summary)
 summary = result.addChild("", true);
-var entry = summary.addFormatted("%s: %s (%d%) is not used by the current page.", url, Number.bytesToString(unusedStylesheetSize), pctUnused);
+var entry = summary.addFormatted("%s: %d% is not used by the current page.", url, pctUnused);
 
 for (var j = 0; j < unusedRules.length; ++j)
 entry.addSnippet(unusedRules[j]);
@@ -1299,7 +1309,7 @@
 return callback(null);
 
 var totalUnusedPercent = Math.round(100 * totalUnusedStylesheetSize / totalStylesheetSize);
-summary.value = String.sprintf("%s (%d%) of CSS is not used by the current page.", Number.bytesToString(totalUnusedStylesheetSize), totalUnusedPercent);
+summary.value = String.sprintf("%s rules (%d%) of CSS not used by the current page.", totalUnusedStylesheetSize, totalUnusedPercent);
 
 callback(result);
 }
@@ -1901,6 +1911,8 @@
 if (error)
 return callback(null);
 
+if (!headers.length)
+return callback(null);
 for (var i = 0; i < headers.length; ++i) {
 var header = headers[i];
 if (header.disabled)
@@ -2051,11 +2063,11 @@
 doRun: function(requests, result, callback, progress)
 {
 var self = this;
-function resultCallback(receivedCookies, isAdvanced) {
+function resultCallback(receivedCookies) {
 if (progress.isCanceled())
 return;
 
-self.processCookies(isAdvanced ? receivedCookies : [], requests, result);
+self.processCookies(receivedCookies, requests, result);
 callback(result);
 }
 
diff --git a/resources/inspector/CodeMirrorTextEditor.js b/resources/inspector/CodeMirrorTextEditor.js
index 470dc02..bc1be03 100644
--- a/resources/inspector/CodeMirrorTextEditor.js
+++ b/resources/inspector/CodeMirrorTextEditor.js
@@ -38,8 +38,8 @@
   // bugs and behavior differences.
   var gecko = /gecko\/\d/i.test(navigator.userAgent);
   var ie = /MSIE \d/.test(navigator.userAgent);
-  var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
-  var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
+  var ie_lt8 = ie && (document.documentMode == null || document.documentMode < 8);
+  var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
   var webkit = /WebKit\//.test(navigator.userAgent);
   var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
   var chrome = /Chrome\//.test(navigator.userAgent);
@@ -52,7 +52,7 @@
 
   var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
   // This is woefully incomplete. Suggestions for alternative methods welcome.
-  var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent);
+  var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
   var mac = ios || /Mac/.test(navigator.platform);
   var windows = /windows/i.test(navigator.platform);
 
@@ -60,6 +60,7 @@
   if (opera_version) opera_version = Number(opera_version[1]);
   // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
   var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));
+  var captureMiddleClick = gecko || (ie && !ie_lt9);
 
   // Optimize some code when these features are not used
   var sawReadOnlySpans = false, sawCollapsedSpans = false;
@@ -68,31 +69,38 @@
 
   function CodeMirror(place, options) {
     if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
-    
+
     this.options = options = options || {};
     // Determine effective options based on given values and defaults.
     for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
       options[opt] = defaults[opt];
     setGuttersForLineNumbers(options);
 
-    var display = this.display = makeDisplay(place);
+    var docStart = typeof options.value == "string" ? 0 : options.value.first;
+    var display = this.display = makeDisplay(place, docStart);
     display.wrapper.CodeMirror = this;
     updateGutters(this);
     if (options.autofocus && !mobile) focusInput(this);
 
-    this.view = makeView(new BranchChunk([new LeafChunk([makeLine("", null, textHeight(display))])]));
-    this.nextOpId = 0;
-    loadMode(this);
+    this.state = {keyMaps: [],
+                  overlays: [],
+                  modeGen: 0,
+                  overwrite: false, focused: false,
+                  suppressEdits: false, pasteIncoming: false,
+                  draggingText: false,
+                  highlight: new Delayed()};
+
     themeChanged(this);
     if (options.lineWrapping)
       this.display.wrapper.className += " CodeMirror-wrap";
 
-    // Initialize the content.
-    this.setValue(options.value || "");
+    var doc = options.value;
+    if (typeof doc == "string") doc = new Doc(options.value, options.mode);
+    operation(this, attachDoc)(this, doc);
+
     // Override magic textarea content restore that IE sometimes does
     // on our hidden textarea on reload
     if (ie) setTimeout(bind(resetInput, this, true), 20);
-    this.view.history = makeHistory();
 
     registerEventHandlers(this);
     // IE throws unspecified error in certain cases, when
@@ -111,11 +119,16 @@
 
   // DISPLAY CONSTRUCTOR
 
-  function makeDisplay(place) {
+  function makeDisplay(place, docStart) {
     var d = {};
+
     var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
-    if (!webkit) input.setAttribute("wrap", "off");
+    if (webkit) input.style.width = "1000px";
+    else input.setAttribute("wrap", "off");
+    // if border: 0; -- iOS fails to open keyboard (issue #1287)
+    if (ios) input.style.border = "1px solid black";
     input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
+
     // Wraps and hides input textarea
     d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
     // The actual fake scrollbars.
@@ -126,9 +139,9 @@
     d.lineDiv = elt("div");
     d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
     // Blinky cursor, and element used to ensure cursor fits at the end of a line
-    d.cursor = elt("pre", "\u00a0", "CodeMirror-cursor");
+    d.cursor = elt("div", "\u00a0", "CodeMirror-cursor");
     // Secondary cursor, shown when on a 'jump' in bi-directional text
-    d.otherCursor = elt("pre", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
+    d.otherCursor = elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
     // Used to measure text size
     d.measure = elt("div", null, "CodeMirror-measure");
     // Wraps everything that needs to exist inside the vertically-padded coordinate system
@@ -139,7 +152,7 @@
     // Set to the height of the text, causes scrolling
     d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
     // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
-    d.heightForcer = elt("div", "\u00a0", null, "position: absolute; height: " + scrollerCutOff + "px");
+    d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;");
     // Will contain the gutters, if any
     d.gutters = elt("div", null, "CodeMirror-gutters");
     d.lineGutter = null;
@@ -164,7 +177,8 @@
     else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";
 
     // Current visible range (may be bigger than the view window).
-    d.viewOffset = d.showingFrom = d.showingTo = d.lastSizeC = 0;
+    d.viewOffset = d.lastSizeC = 0;
+    d.showingFrom = d.showingTo = docStart;
 
     // Used to only resize the line number gutter when necessary (when
     // the amount of lines crosses a boundary that makes its width change)
@@ -191,73 +205,67 @@
     // string instead of the (large) selection.
     d.inaccurateSelection = false;
 
-    // Used to adjust overwrite behaviour when a paste has been
-    // detected
-    d.pasteIncoming = false;
+    // Tracks the maximum line length so that the horizontal scrollbar
+    // can be kept static when scrolling.
+    d.maxLine = null;
+    d.maxLineLength = 0;
+    d.maxLineChanged = false;
+
+    // Used for measuring wheel scrolling granularity
+    d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
 
     return d;
   }
 
-  // VIEW CONSTRUCTOR
-
-  function makeView(doc) {
-    var selPos = {line: 0, ch: 0};
-    return {
-      doc: doc,
-      // frontier is the point up to which the content has been parsed,
-      frontier: 0, highlight: new Delayed(),
-      sel: {from: selPos, to: selPos, head: selPos, anchor: selPos, shift: false, extend: false},
-      scrollTop: 0, scrollLeft: 0,
-      overwrite: false, focused: false,
-      // Tracks the maximum line length so that
-      // the horizontal scrollbar can be kept
-      // static when scrolling.
-      maxLine: getLine(doc, 0),
-      maxLineLength: 0,
-      maxLineChanged: false,
-      suppressEdits: false,
-      goalColumn: null,
-      cantEdit: false,
-      keyMaps: [],
-      overlays: [],
-      modeGen: 0
-    };
-  }
-
   // STATE UPDATES
 
   // Used to get the editor into a consistent state again when options change.
 
   function loadMode(cm) {
-    var doc = cm.view.doc;
-    cm.view.mode = CodeMirror.getMode(cm.options, cm.options.mode);
-    doc.iter(0, doc.size, function(line) { if (line.stateAfter) line.stateAfter = null; });
-    cm.view.frontier = 0;
+    cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
+    cm.doc.iter(function(line) {
+      if (line.stateAfter) line.stateAfter = null;
+      if (line.styles) line.styles = null;
+    });
+    cm.doc.frontier = cm.doc.first;
     startWorker(cm, 100);
-    cm.view.modeGen++;
+    cm.state.modeGen++;
+    if (cm.curOp) regChange(cm);
   }
 
   function wrappingChanged(cm) {
-    var doc = cm.view.doc, th = textHeight(cm.display);
     if (cm.options.lineWrapping) {
       cm.display.wrapper.className += " CodeMirror-wrap";
-      var perLine = cm.display.scroller.clientWidth / charWidth(cm.display) - 3;
-      doc.iter(0, doc.size, function(line) {
-        if (line.height == 0) return;
-        var guess = Math.ceil(line.text.length / perLine) || 1;
-        if (guess != 1) updateLineHeight(line, guess * th);
-      });
       cm.display.sizer.style.minWidth = "";
     } else {
       cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
-      computeMaxLength(cm.view);
-      doc.iter(0, doc.size, function(line) {
-        if (line.height != 0) updateLineHeight(line, th);
-      });
+      computeMaxLength(cm);
     }
-    regChange(cm, 0, doc.size);
+    estimateLineHeights(cm);
+    regChange(cm);
     clearCaches(cm);
-    setTimeout(function(){updateScrollbars(cm.display, cm.view.doc.height);}, 100);
+    setTimeout(function(){updateScrollbars(cm.display, cm.doc.height);}, 100);
+  }
+
+  function estimateHeight(cm) {
+    var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
+    var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
+    return function(line) {
+      if (lineIsHidden(cm.doc, line))
+        return 0;
+      else if (wrapping)
+        return (Math.ceil(line.text.length / perLine) || 1) * th;
+      else
+        return th;
+    };
+  }
+
+  function estimateLineHeights(cm) {
+    var doc = cm.doc, est = estimateHeight(cm);
+    doc.iter(function(line) {
+      var estHeight = est(line);
+      if (estHeight != line.height) updateLineHeight(line, estHeight);
+    });
   }
 
   function keyMapChanged(cm) {
@@ -274,7 +282,7 @@
 
   function guttersChanged(cm) {
     updateGutters(cm);
-    updateDisplay(cm, true);
+    regChange(cm);
   }
 
   function updateGutters(cm) {
@@ -309,15 +317,16 @@
     return len;
   }
 
-  function computeMaxLength(view) {
-    view.maxLine = getLine(view.doc, 0);
-    view.maxLineLength = lineLength(view.doc, view.maxLine);
-    view.maxLineChanged = true;
-    view.doc.iter(1, view.doc.size, function(line) {
-      var len = lineLength(view.doc, line);
-      if (len > view.maxLineLength) {
-        view.maxLineLength = len;
-        view.maxLine = line;
+  function computeMaxLength(cm) {
+    var d = cm.display, doc = cm.doc;
+    d.maxLine = getLine(doc, doc.first);
+    d.maxLineLength = lineLength(doc, d.maxLine);
+    d.maxLineChanged = true;
+    doc.iter(function(line) {
+      var len = lineLength(doc, line);
+      if (len > d.maxLineLength) {
+        d.maxLineLength = len;
+        d.maxLine = line;
       }
     });
   }
@@ -341,7 +350,7 @@
   // Re-synchronize the fake scrollbars with the actual size of the
   // content. Optionally force a scrollTop.
   function updateScrollbars(d /* display */, docHeight) {
-    var totalHeight = docHeight + 2 * paddingTop(d);
+    var totalHeight = docHeight + paddingVert(d);
     d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
     var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);
     var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;
@@ -349,7 +358,7 @@
     if (needsV) {
       d.scrollbarV.style.display = "block";
       d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
-      d.scrollbarV.firstChild.style.height = 
+      d.scrollbarV.firstChild.style.height =
         (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
     } else d.scrollbarV.style.display = "";
     if (needsH) {
@@ -380,18 +389,19 @@
 
   function alignHorizontally(cm) {
     var display = cm.display;
-    if (!display.alignWidgets && !display.gutters.firstChild) return;
-    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.view.scrollLeft;
+    if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
+    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
     var gutterW = display.gutters.offsetWidth, l = comp + "px";
     for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
       for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
     }
-    display.gutters.style.left = (comp + gutterW) + "px";
+    if (cm.options.fixedGutter)
+      display.gutters.style.left = (comp + gutterW) + "px";
   }
 
   function maybeUpdateLineNumberWidth(cm) {
     if (!cm.options.lineNumbers) return false;
-    var doc = cm.view.doc, last = lineNumberFor(cm.options, doc.size - 1), display = cm.display;
+    var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
     if (last.length != display.lineNumChars) {
       var test = display.measure.appendChild(elt("div", [elt("div", last)],
                                                  "CodeMirror-linenumber CodeMirror-gutter-elt"));
@@ -410,7 +420,7 @@
     return String(options.lineNumberFormatter(i + options.firstLineNumber));
   }
   function compensateForHScroll(display) {
-    return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
+    return getRect(display.scroller).left - getRect(display.sizer).left;
   }
 
   // DISPLAY DRAWING
@@ -419,12 +429,12 @@
     var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo;
     var updated = updateDisplayInner(cm, changes, viewPort);
     if (updated) {
-      signalLater(cm, cm, "update", cm);
+      signalLater(cm, "update", cm);
       if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
-        signalLater(cm, cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
+        signalLater(cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
     }
     updateSelection(cm);
-    updateScrollbars(cm.display, cm.view.doc.height);
+    updateScrollbars(cm.display, cm.doc.height);
 
     return updated;
   }
@@ -433,9 +443,10 @@
   // determine which DOM updates have to be made, and makes the
   // updates.
   function updateDisplayInner(cm, changes, viewPort) {
-    var display = cm.display, doc = cm.view.doc;
+    var display = cm.display, doc = cm.doc;
     if (!display.wrapper.clientWidth) {
-      display.showingFrom = display.showingTo = display.viewOffset = 0;
+      display.showingFrom = display.showingTo = doc.first;
+      display.viewOffset = 0;
       return;
     }
 
@@ -444,45 +455,50 @@
     // to render instead of the current scrollbar position.
     var visible = visibleLines(display, doc, viewPort);
     // Bail out if the visible area is already rendered and nothing changed.
-    if (changes !== true && changes.length == 0 &&
+    if (changes.length == 0 &&
         visible.from > display.showingFrom && visible.to < display.showingTo)
       return;
 
-    if (changes && maybeUpdateLineNumberWidth(cm))
-      changes = true;
-    display.sizer.style.marginLeft = display.scrollbarH.style.left = display.gutters.offsetWidth + "px";
-
-    // When merged lines are present, the line that needs to be
-    // redrawn might not be the one that was changed.
-    if (changes !== true && sawCollapsedSpans)
-      for (var i = 0; i < changes.length; ++i) {
-        var ch = changes[i], merged;
-        while (merged = collapsedSpanAtStart(getLine(doc, ch.from))) {
-          var from = merged.find().from.line;
-          if (ch.diff) ch.diff -= ch.from - from;
-          ch.from = from;
-        }
-      }
+    if (maybeUpdateLineNumberWidth(cm))
+      changes = [{from: doc.first, to: doc.first + doc.size}];
+    var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + "px";
+    display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : "0";
 
     // Used to determine which lines need their line numbers updated
-    var positionsChangedFrom = changes === true ? 0 : Infinity;
-    if (cm.options.lineNumbers && changes && changes !== true)
+    var positionsChangedFrom = Infinity;
+    if (cm.options.lineNumbers)
       for (var i = 0; i < changes.length; ++i)
         if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; }
 
-    var from = Math.max(visible.from - cm.options.viewportMargin, 0);
-    var to = Math.min(doc.size, visible.to + cm.options.viewportMargin);
-    if (display.showingFrom < from && from - display.showingFrom < 20) from = display.showingFrom;
-    if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(doc.size, display.showingTo);
+    var end = doc.first + doc.size;
+    var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);
+    var to = Math.min(end, visible.to + cm.options.viewportMargin);
+    if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);
+    if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);
     if (sawCollapsedSpans) {
       from = lineNo(visualLine(doc, getLine(doc, from)));
-      while (to < doc.size && lineIsHidden(getLine(doc, to))) ++to;
+      while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;
     }
 
     // Create a range of theoretically intact lines, and punch holes
     // in that using the change info.
-    var intact = changes === true ? [] :
-      computeIntact([{from: display.showingFrom, to: display.showingTo}], changes);
+    var intact = [{from: Math.max(display.showingFrom, doc.first),
+                   to: Math.min(display.showingTo, end)}];
+    if (intact[0].from >= intact[0].to) intact = [];
+    else intact = computeIntact(intact, changes);
+    // When merged lines are present, we might have to reduce the
+    // intact ranges because changes in continued fragments of the
+    // intact lines do require the lines to be redrawn.
+    if (sawCollapsedSpans)
+      for (var i = 0; i < intact.length; ++i) {
+        var range = intact[i], merged;
+        while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {
+          var newTo = merged.find().from.line;
+          if (newTo > range.from) range.to = newTo;
+          else { intact.splice(i--, 1); break; }
+        }
+      }
+
     // Clip off the parts that won't be visible
     var intactLines = 0;
     for (var i = 0; i < intact.length; ++i) {
@@ -492,8 +508,10 @@
       if (range.from >= range.to) intact.splice(i--, 1);
       else intactLines += range.to - range.from;
     }
-    if (intactLines == to - from && from == display.showingFrom && to == display.showingTo)
+    if (intactLines == to - from && from == display.showingFrom && to == display.showingTo) {
+      updateViewOffset(cm);
       return;
+    }
     intact.sort(function(a, b) {return a.from - b.from;});
 
     var focused = document.activeElement;
@@ -517,20 +535,31 @@
         height = bot - prevBottom;
         prevBottom = bot;
       } else {
-        var box = node.getBoundingClientRect();
+        var box = getRect(node);
         height = box.bottom - box.top;
       }
       var diff = node.lineObj.height - height;
       if (height < 2) height = textHeight(display);
-      if (diff > .001 || diff < -.001)
+      if (diff > .001 || diff < -.001) {
         updateLineHeight(node.lineObj, height);
+        var widgets = node.lineObj.widgets;
+        if (widgets) for (var i = 0; i < widgets.length; ++i)
+          widgets[i].height = widgets[i].node.offsetHeight;
+      }
     }
-    display.viewOffset = heightAtLine(cm, getLine(doc, from));
-    // Position the mover div to align with the current virtual scroll position
-    display.mover.style.top = display.viewOffset + "px";
+    updateViewOffset(cm);
+
+    if (visibleLines(display, doc, viewPort).to > to)
+      updateDisplayInner(cm, [], viewPort);
     return true;
   }
 
+  function updateViewOffset(cm) {
+    var off = cm.display.viewOffset = heightAtLine(cm, getLine(cm.doc, cm.display.showingFrom));
+    // Position the mover div to align with the current virtual scroll position
+    cm.display.mover.style.top = off + "px";
+  }
+
   function computeIntact(intact, changes) {
     for (var i = 0, l = changes.length || 0; i < l; ++i) {
       var change = changes[i], intact2 = [], diff = change.diff || 0;
@@ -568,9 +597,7 @@
   function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
     var dims = getDimensions(cm);
     var display = cm.display, lineNumbers = cm.options.lineNumbers;
-    // IE does bad things to nodes when .innerHTML = "" is used on a parent
-    // we still need widgets and markers intact to add back to the new content later
-    if (!intact.length && !ie && (!webkit || !cm.display.currentWheelTarget))
+    if (!intact.length && (!webkit || !cm.display.currentWheelTarget))
       removeChildren(display.lineDiv);
     var container = display.lineDiv, cur = container.firstChild;
 
@@ -580,50 +607,106 @@
         node.style.display = "none";
         node.lineObj = null;
       } else {
-        container.removeChild(node);
+        node.parentNode.removeChild(node);
       }
       return next;
     }
 
-    var nextIntact = intact.shift(), lineNo = from;
-    cm.view.doc.iter(from, to, function(line) {
-      if (nextIntact && nextIntact.to == lineNo) nextIntact = intact.shift();
-      if (lineIsHidden(line)) {
+    var nextIntact = intact.shift(), lineN = from;
+    cm.doc.iter(from, to, function(line) {
+      if (nextIntact && nextIntact.to == lineN) nextIntact = intact.shift();
+      if (lineIsHidden(cm.doc, line)) {
         if (line.height != 0) updateLineHeight(line, 0);
-      } else if (nextIntact && nextIntact.from <= lineNo && nextIntact.to > lineNo) {
+        if (line.widgets && cur.previousSibling) for (var i = 0; i < line.widgets.length; ++i)
+          if (line.widgets[i].showIfHidden) {
+            var prev = cur.previousSibling;
+            if (/pre/i.test(prev.nodeName)) {
+              var wrap = elt("div", null, null, "position: relative");
+              prev.parentNode.replaceChild(wrap, prev);
+              wrap.appendChild(prev);
+              prev = wrap;
+            }
+            var wnode = prev.appendChild(elt("div", [line.widgets[i].node], "CodeMirror-linewidget"));
+            positionLineWidget(line.widgets[i], wnode, prev, dims);
+          }
+      } else if (nextIntact && nextIntact.from <= lineN && nextIntact.to > lineN) {
         // This line is intact. Skip to the actual node. Update its
         // line number if needed.
         while (cur.lineObj != line) cur = rm(cur);
-        if (lineNumbers && updateNumbersFrom <= lineNo && cur.lineNumber)
-          setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineNo));
+        if (lineNumbers && updateNumbersFrom <= lineN && cur.lineNumber)
+          setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineN));
         cur = cur.nextSibling;
       } else {
+        // For lines with widgets, make an attempt to find and reuse
+        // the existing element, so that widgets aren't needlessly
+        // removed and re-inserted into the dom
+        if (line.widgets) for (var j = 0, search = cur, reuse; search && j < 20; ++j, search = search.nextSibling)
+          if (search.lineObj == line && /div/i.test(search.nodeName)) { reuse = search; break; }
         // This line needs to be generated.
-        var lineNode = buildLineElement(cm, line, lineNo, dims);
-        container.insertBefore(lineNode, cur);
+        var lineNode = buildLineElement(cm, line, lineN, dims, reuse);
+        if (lineNode != reuse) {
+          container.insertBefore(lineNode, cur);
+        } else {
+          while (cur != reuse) cur = rm(cur);
+          cur = cur.nextSibling;
+        }
+
         lineNode.lineObj = line;
       }
-      ++lineNo;
+      ++lineN;
     });
     while (cur) cur = rm(cur);
   }
 
-  function buildLineElement(cm, line, lineNo, dims) {
+  function buildLineElement(cm, line, lineNo, dims, reuse) {
     var lineElement = lineContent(cm, line);
-    var markers = line.gutterMarkers, display = cm.display;
+    var markers = line.gutterMarkers, display = cm.display, wrap;
 
-    if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
-        (!line.widgets || !line.widgets.length)) return lineElement;
+    if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass && !line.widgets)
+      return lineElement;
 
-    // Lines with gutter elements or a background class need
-    // to be wrapped again, and have the extra elements added
-    // to the wrapper div
+    // Lines with gutter elements, widgets or a background class need
+    // to be wrapped again, and have the extra elements added to the
+    // wrapper div
 
-    var wrap = elt("div", null, line.wrapClass, "position: relative");
+    if (reuse) {
+      reuse.alignable = null;
+      var isOk = true, widgetsSeen = 0;
+      for (var n = reuse.firstChild, next; n; n = next) {
+        next = n.nextSibling;
+        if (!/\bCodeMirror-linewidget\b/.test(n.className)) {
+          reuse.removeChild(n);
+        } else {
+          for (var i = 0, first = true; i < line.widgets.length; ++i) {
+            var widget = line.widgets[i], isFirst = false;
+            if (!widget.above) { isFirst = first; first = false; }
+            if (widget.node == n.firstChild) {
+              positionLineWidget(widget, n, reuse, dims);
+              ++widgetsSeen;
+              if (isFirst) reuse.insertBefore(lineElement, n);
+              break;
+            }
+          }
+          if (i == line.widgets.length) { isOk = false; break; }
+        }
+      }
+      if (isOk && widgetsSeen == line.widgets.length) {
+        wrap = reuse;
+        reuse.className = line.wrapClass || "";
+      }
+    }
+    if (!wrap) {
+      wrap = elt("div", null, line.wrapClass, "position: relative");
+      wrap.appendChild(lineElement);
+    }
+    // Kludge to make sure the styled element lies behind the selection (by z-index)
+    if (line.bgClass)
+      wrap.insertBefore(elt("div", null, line.bgClass + " CodeMirror-linebackground"), wrap.firstChild);
     if (cm.options.lineNumbers || markers) {
-      var gutterWrap = wrap.appendChild(elt("div", null, null, "position: absolute; left: " +
-                                            dims.fixedPos + "px"));
-      wrap.alignable = [gutterWrap];
+      var gutterWrap = wrap.insertBefore(elt("div", null, null, "position: absolute; left: " +
+                                             (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"),
+                                         wrap.firstChild);
+      if (cm.options.fixedGutter) (wrap.alignable || (wrap.alignable = [])).push(gutterWrap);
       if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
         wrap.lineNumber = gutterWrap.appendChild(
           elt("div", lineNumberFor(cm.options, lineNo),
@@ -638,44 +721,42 @@
                                        dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
         }
     }
-    // Kludge to make sure the styled element lies behind the selection (by z-index)
-    if (line.bgClass)
-      wrap.appendChild(elt("div", "\u00a0", line.bgClass + " CodeMirror-linebackground"));
-    wrap.appendChild(lineElement);
-    if (line.widgets)
-      for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
-        var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
-        node.widget = widget;
-        if (widget.noHScroll) {
-          (wrap.alignable || (wrap.alignable = [])).push(node);
-          var width = dims.wrapperWidth;
-          node.style.left = dims.fixedPos + "px";
-          if (!widget.coverGutter) {
-            width -= dims.gutterTotalWidth;
-            node.style.paddingLeft = dims.gutterTotalWidth + "px";
-          }
-          node.style.width = width + "px";
-        }
-        if (widget.coverGutter) {
-          node.style.zIndex = 5;
-          node.style.position = "relative";
-          if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
-        }
-        if (widget.above)
-          wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
-        else
-          wrap.appendChild(node);
-      }
-
     if (ie_lt8) wrap.style.zIndex = 2;
+    if (line.widgets && wrap != reuse) for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
+      var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
+      positionLineWidget(widget, node, wrap, dims);
+      if (widget.above)
+        wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
+      else
+        wrap.appendChild(node);
+      signalLater(widget, "redraw");
+    }
     return wrap;
   }
 
+  function positionLineWidget(widget, node, wrap, dims) {
+    if (widget.noHScroll) {
+      (wrap.alignable || (wrap.alignable = [])).push(node);
+      var width = dims.wrapperWidth;
+      node.style.left = dims.fixedPos + "px";
+      if (!widget.coverGutter) {
+        width -= dims.gutterTotalWidth;
+        node.style.paddingLeft = dims.gutterTotalWidth + "px";
+      }
+      node.style.width = width + "px";
+    }
+    if (widget.coverGutter) {
+      node.style.zIndex = 5;
+      node.style.position = "relative";
+      if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
+    }
+  }
+
   // SELECTION / CURSOR
 
   function updateSelection(cm) {
     var display = cm.display;
-    var collapsed = posEq(cm.view.sel.from, cm.view.sel.to);
+    var collapsed = posEq(cm.doc.sel.from, cm.doc.sel.to);
     if (collapsed || cm.options.showCursorWhenSelecting)
       updateSelectionCursor(cm);
     else
@@ -686,8 +767,8 @@
       display.selectionDiv.style.display = "none";
 
     // Move the hidden textarea near the cursor to prevent scrolling artifacts
-    var headPos = cursorCoords(cm, cm.view.sel.head, "div");
-    var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
+    var headPos = cursorCoords(cm, cm.doc.sel.head, "div");
+    var wrapOff = getRect(display.wrapper), lineOff = getRect(display.lineDiv);
     display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                                       headPos.top + lineOff.top - wrapOff.top)) + "px";
     display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
@@ -696,7 +777,7 @@
 
   // No selection, plain cursor
   function updateSelectionCursor(cm) {
-    var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, "div");
+    var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, "div");
     display.cursor.style.left = pos.left + "px";
     display.cursor.style.top = pos.top + "px";
     display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
@@ -712,7 +793,7 @@
 
   // Highlight selection
   function updateSelectionRange(cm) {
-    var display = cm.display, doc = cm.view.doc, sel = cm.view.sel;
+    var display = cm.display, doc = cm.doc, sel = cm.doc.sel;
     var fragment = document.createDocumentFragment();
     var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
 
@@ -727,7 +808,7 @@
       var lineObj = getLine(doc, line);
       var lineLen = lineObj.text.length, rVal = retTop ? Infinity : -Infinity;
       function coords(ch) {
-        return charCoords(cm, {line: line, ch: ch}, "div", lineObj);
+        return charCoords(cm, Pos(line, ch), "div", lineObj);
       }
 
       iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
@@ -805,33 +886,33 @@
   // HIGHLIGHT WORKER
 
   function startWorker(cm, time) {
-    if (cm.view.mode.startState && cm.view.frontier < cm.display.showingTo)
-      cm.view.highlight.set(time, bind(highlightWorker, cm));
+    if (cm.doc.mode.startState && cm.doc.frontier < cm.display.showingTo)
+      cm.state.highlight.set(time, bind(highlightWorker, cm));
   }
 
   function highlightWorker(cm) {
-    var view = cm.view, doc = view.doc;
-    if (view.frontier >= cm.display.showingTo) return;
+    var doc = cm.doc;
+    if (doc.frontier < doc.first) doc.frontier = doc.first;
+    if (doc.frontier >= cm.display.showingTo) return;
     var end = +new Date + cm.options.workTime;
-    var state = copyState(view.mode, getStateBefore(cm, view.frontier));
+    var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
     var changed = [], prevChange;
-    doc.iter(view.frontier, Math.min(doc.size, cm.display.showingTo + 500), function(line) {
-      if (view.frontier >= cm.display.showingFrom) { // Visible
+    doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.showingTo + 500), function(line) {
+      if (doc.frontier >= cm.display.showingFrom) { // Visible
         var oldStyles = line.styles;
         line.styles = highlightLine(cm, line, state);
         var ischange = !oldStyles || oldStyles.length != line.styles.length;
-        for (var i = 0; !ischange && i < oldStyles.length; ++i)
-          ischange = oldStyles[i] != line.styles[i];
+        for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
         if (ischange) {
-          if (prevChange && prevChange.end == view.frontier) prevChange.end++;
-          else changed.push(prevChange = {start: view.frontier, end: view.frontier + 1});
+          if (prevChange && prevChange.end == doc.frontier) prevChange.end++;
+          else changed.push(prevChange = {start: doc.frontier, end: doc.frontier + 1});
         }
-        line.stateAfter = copyState(view.mode, state);
+        line.stateAfter = copyState(doc.mode, state);
       } else {
         processLine(cm, line, state);
-        line.stateAfter = view.frontier % 5 == 0 ? copyState(view.mode, state) : null;
+        line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
       }
-      ++view.frontier;
+      ++doc.frontier;
       if (+new Date > end) {
         startWorker(cm, cm.options.workDelay);
         return true;
@@ -850,10 +931,10 @@
   // smallest indentation, which tends to need the least context to
   // parse correctly.
   function findStartLine(cm, n) {
-    var minindent, minline, doc = cm.view.doc;
+    var minindent, minline, doc = cm.doc;
     for (var search = n, lim = n - 100; search > lim; --search) {
-      if (search == 0) return 0;
-      var line = getLine(doc, search-1);
+      if (search <= doc.first) return doc.first;
+      var line = getLine(doc, search - 1);
       if (line.stateAfter) return search;
       var indented = countColumn(line.text, null, cm.options.tabSize);
       if (minline == null || minindent > indented) {
@@ -865,32 +946,33 @@
   }
 
   function getStateBefore(cm, n) {
-    var view = cm.view;
-    if (!view.mode.startState) return true;
-    var pos = findStartLine(cm, n), state = pos && getLine(view.doc, pos-1).stateAfter;
-    if (!state) state = startState(view.mode);
-    else state = copyState(view.mode, state);
-    view.doc.iter(pos, n, function(line) {
+    var doc = cm.doc, display = cm.display;
+      if (!doc.mode.startState) return true;
+    var pos = findStartLine(cm, n), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
+    if (!state) state = startState(doc.mode);
+    else state = copyState(doc.mode, state);
+    doc.iter(pos, n, function(line) {
       processLine(cm, line, state);
-      var save = pos == n - 1 || pos % 5 == 0 || pos >= view.showingFrom && pos < view.showingTo;
-      line.stateAfter = save ? copyState(view.mode, state) : null;
+      var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo;
+      line.stateAfter = save ? copyState(doc.mode, state) : null;
       ++pos;
     });
     return state;
   }
 
   // POSITION MEASUREMENT
-  
+
   function paddingTop(display) {return display.lineSpace.offsetTop;}
+  function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
   function paddingLeft(display) {
-    var e = removeChildrenAndAdd(display.measure, elt("pre")).appendChild(elt("span", "x"));
+    var e = removeChildrenAndAdd(display.measure, elt("pre", null, null, "text-align: left")).appendChild(elt("span", "x"));
     return e.offsetLeft;
   }
 
   function measureChar(cm, line, ch, data) {
     var dir = -1;
     data = data || measureLine(cm, line);
-    
+
     for (var pos = ch;; pos += dir) {
       var r = data[pos];
       if (r) break;
@@ -901,22 +983,30 @@
             top: r.top, bottom: r.bottom};
   }
 
-  function measureLine(cm, line) {
-    // First look in the cache
-    var display = cm.display, cache = cm.display.measureLineCache;
+  function findCachedMeasurement(cm, line) {
+    var cache = cm.display.measureLineCache;
     for (var i = 0; i < cache.length; ++i) {
       var memo = cache[i];
       if (memo.text == line.text && memo.markedSpans == line.markedSpans &&
-          display.scroller.clientWidth == memo.width)
+          cm.display.scroller.clientWidth == memo.width &&
+          memo.classes == line.textClass + "|" + line.bgClass + "|" + line.wrapClass)
         return memo.measure;
     }
-    
-    var measure = measureLineInner(cm, line);
-    // Store result in the cache
-    var memo = {text: line.text, width: display.scroller.clientWidth,
-                markedSpans: line.markedSpans, measure: measure};
-    if (cache.length == 16) cache[++display.measureLineCachePos % 16] = memo;
-    else cache.push(memo);
+  }
+
+  function measureLine(cm, line) {
+    // First look in the cache
+    var measure = findCachedMeasurement(cm, line);
+    if (!measure) {
+      // Failing that, recompute and store result in cache
+      measure = measureLineInner(cm, line);
+      var cache = cm.display.measureLineCache;
+      var memo = {text: line.text, width: cm.display.scroller.clientWidth,
+                  markedSpans: line.markedSpans, measure: measure,
+                  classes: line.textClass + "|" + line.bgClass + "|" + line.wrapClass};
+      if (cache.length == 16) cache[++cm.display.measureLineCachePos % 16] = memo;
+      else cache.push(memo);
+    }
     return measure;
   }
 
@@ -951,10 +1041,15 @@
 
     removeChildrenAndAdd(display.measure, pre);
 
-    var outer = display.lineDiv.getBoundingClientRect();
+    var outer = getRect(display.lineDiv);
     var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight;
+    // Work around an IE7/8 bug where it will sometimes have randomly
+    // replaced our pre with a clone at this point.
+    if (ie_lt9 && display.measure.first != pre)
+      removeChildrenAndAdd(display.measure, pre);
+
     for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) {
-      var size = cur.getBoundingClientRect();
+      var size = getRect(cur);
       var top = Math.max(0, size.top - outer.top), bot = Math.min(size.bottom - outer.top, maxBot);
       for (var j = 0; j < vranges.length; j += 2) {
         var rtop = vranges[j], rbot = vranges[j+1];
@@ -968,25 +1063,44 @@
         }
       }
       if (j == vranges.length) vranges.push(top, bot);
-      data[i] = {left: size.left - outer.left, right: size.right - outer.left, top: j};
+      var right = size.right;
+      if (cur.measureRight) right = getRect(cur.measureRight).left;
+      data[i] = {left: size.left - outer.left, right: right - outer.left, top: j};
     }
     for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) {
       var vr = cur.top;
       cur.top = vranges[vr]; cur.bottom = vranges[vr+1];
     }
+
     return data;
   }
 
+  function measureLineWidth(cm, line) {
+    var hasBadSpan = false;
+    if (line.markedSpans) for (var i = 0; i < line.markedSpans; ++i) {
+      var sp = line.markedSpans[i];
+      if (sp.collapsed && (sp.to == null || sp.to == line.text.length)) hasBadSpan = true;
+    }
+    var cached = !hasBadSpan && findCachedMeasurement(cm, line);
+    if (cached) return measureChar(cm, line, line.text.length, cached).right;
+
+    var pre = lineContent(cm, line);
+    var end = pre.appendChild(zeroWidthElement(cm.display.measure));
+    removeChildrenAndAdd(cm.display.measure, pre);
+    return getRect(end).right - getRect(cm.display.lineDiv).left;
+  }
+
   function clearCaches(cm) {
     cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
     cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
-    cm.view.maxLineChanged = true;
+    cm.display.maxLineChanged = true;
+    cm.display.lineNumChars = null;
   }
 
   // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
   function intoCoordSystem(cm, lineObj, rect, context) {
     if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
-      var size = lineObj.widgets[i].node.offsetHeight;
+      var size = widgetHeight(lineObj.widgets[i]);
       rect.top += size; rect.bottom += size;
     }
     if (context == "line") return rect;
@@ -994,7 +1108,7 @@
     var yOff = heightAtLine(cm, lineObj);
     if (context != "local") yOff -= cm.display.viewOffset;
     if (context == "page") {
-      var lOff = cm.display.lineSpace.getBoundingClientRect();
+      var lOff = getRect(cm.display.lineSpace);
       yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);
       var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);
       rect.left += xOff; rect.right += xOff;
@@ -1003,13 +1117,33 @@
     return rect;
   }
 
+  // Context may be "window", "page", "div", or "local"/null
+  // Result is in local coords
+  function fromCoordSystem(cm, coords, context) {
+    if (context == "div") return coords;
+    var left = coords.left, top = coords.top;
+    if (context == "page") {
+      left -= window.pageXOffset || (document.documentElement || document.body).scrollLeft;
+      top -= window.pageYOffset || (document.documentElement || document.body).scrollTop;
+    }
+    var lineSpaceBox = getRect(cm.display.lineSpace);
+    left -= lineSpaceBox.left;
+    top -= lineSpaceBox.top;
+    if (context == "local" || !context) {
+      var editorBox = getRect(cm.display.wrapper);
+      left -= editorBox.left;
+      top -= editorBox.top;
+    }
+    return {left: left, top: top};
+  }
+
   function charCoords(cm, pos, context, lineObj) {
-    if (!lineObj) lineObj = getLine(cm.view.doc, pos.line);
+    if (!lineObj) lineObj = getLine(cm.doc, pos.line);
     return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch), context);
   }
 
   function cursorCoords(cm, pos, context, lineObj, measurement) {
-    lineObj = lineObj || getLine(cm.view.doc, pos.line);
+    lineObj = lineObj || getLine(cm.doc, pos.line);
     if (!measurement) measurement = measureLine(cm, lineObj);
     function get(ch, right) {
       var m = measureChar(cm, lineObj, ch, measurement);
@@ -1024,10 +1158,9 @@
       if (part.from < ch && part.to > ch) return get(ch, rtl);
       var left = rtl ? part.to : part.from, right = rtl ? part.from : part.to;
       if (left == ch) {
-        // Opera and IE return bogus offsets and widths for edges
-        // where the direction flips, but only for the side with the
-        // lower level. So we try to use the side with the higher
-        // level.
+        // IE returns bogus offsets and widths for edges where the
+        // direction flips, but only for the side with the lower
+        // level. So we try to use the side with the higher level.
         if (i && part.level < (nb = order[i-1]).level) here = get(nb.level % 2 ? nb.from : nb.to - 1, true);
         else here = get(rtl && part.from != part.to ? ch - 1 : ch);
         if (rtl == linedir) main = here; else other = here;
@@ -1045,21 +1178,29 @@
     return main;
   }
 
+  function PosMaybeOutside(line, ch, outside) {
+    var pos = new Pos(line, ch);
+    if (outside) pos.outside = true;
+    return pos;
+  }
+
   // Coords must be lineSpace-local
   function coordsChar(cm, x, y) {
-    var doc = cm.view.doc;
+    var doc = cm.doc;
     y += cm.display.viewOffset;
-    if (y < 0) return {line: 0, ch: 0, outside: true};
-    var lineNo = lineAtHeight(doc, y);
-    if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};
+    if (y < 0) return PosMaybeOutside(doc.first, 0, true);
+    var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
+    if (lineNo > last)
+      return PosMaybeOutside(doc.first + doc.size - 1, getLine(doc, last).text.length, true);
     if (x < 0) x = 0;
 
     for (;;) {
       var lineObj = getLine(doc, lineNo);
       var found = coordsCharInner(cm, lineObj, lineNo, x, y);
       var merged = collapsedSpanAtEnd(lineObj);
-      if (merged && found.ch == lineRight(lineObj))
-        lineNo = merged.find().to.line;
+      var mergedPos = merged && merged.find();
+      if (merged && found.ch >= mergedPos.from.ch)
+        lineNo = mergedPos.to.line;
       else
         return found;
     }
@@ -1067,30 +1208,32 @@
 
   function coordsCharInner(cm, lineObj, lineNo, x, y) {
     var innerOff = y - heightAtLine(cm, lineObj);
-    var wrongLine = false, cWidth = cm.display.wrapper.clientWidth;
+    var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
     var measurement = measureLine(cm, lineObj);
 
     function getX(ch) {
-      var sp = cursorCoords(cm, {line: lineNo, ch: ch}, "line",
+      var sp = cursorCoords(cm, Pos(lineNo, ch), "line",
                             lineObj, measurement);
       wrongLine = true;
-      if (innerOff > sp.bottom) return Math.max(0, sp.left - cWidth);
-      else if (innerOff < sp.top) return sp.left + cWidth;
+      if (innerOff > sp.bottom) return sp.left - adjust;
+      else if (innerOff < sp.top) return sp.left + adjust;
       else wrongLine = false;
       return sp.left;
     }
 
     var bidi = getOrder(lineObj), dist = lineObj.text.length;
     var from = lineLeft(lineObj), to = lineRight(lineObj);
-    var fromX = paddingLeft(cm.display), toX = getX(to);
+    var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
 
-    if (x > toX) return {line: lineNo, ch: to, outside: wrongLine};
+    if (x > toX) return PosMaybeOutside(lineNo, to, toOutside);
     // Do a binary search between these bounds.
     for (;;) {
       if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
         var after = x - fromX < toX - x, ch = after ? from : to;
         while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch;
-        return {line: lineNo, ch: ch, after: after, outside: wrongLine};
+        var pos = PosMaybeOutside(lineNo, ch, after ? fromOutside : toOutside);
+        pos.after = after;
+        return pos;
       }
       var step = Math.ceil(dist / 2), middle = from + step;
       if (bidi) {
@@ -1098,8 +1241,8 @@
         for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
       }
       var middleX = getX(middle);
-      if (middleX > x) {to = middle; toX = middleX; if (wrongLine) toX += 1000; dist -= step;}
-      else {from = middle; fromX = middleX; dist = step;}
+      if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist -= step;}
+      else {from = middle; fromX = middleX; fromOutside = wrongLine; dist = step;}
     }
   }
 
@@ -1140,81 +1283,117 @@
   // be awkward, slow, and error-prone), but instead updates are
   // batched and then all combined and executed at once.
 
+  var nextOpId = 0;
   function startOperation(cm) {
-    if (cm.curOp) ++cm.curOp.depth;
-    else cm.curOp = {
-      // Nested operations delay update until the outermost one
-      // finishes.
-      depth: 1,
+    cm.curOp = {
       // An array of ranges of lines that have to be updated. See
       // updateDisplay.
       changes: [],
-      delayedCallbacks: [],
       updateInput: null,
       userSelChange: null,
       textChanged: null,
       selectionChanged: false,
       updateMaxLine: false,
-      id: ++cm.nextOpId
+      updateScrollPos: false,
+      id: ++nextOpId
     };
+    if (!delayedCallbackDepth++) delayedCallbacks = [];
   }
 
   function endOperation(cm) {
-    var op = cm.curOp;
-    if (--op.depth) return;
+    var op = cm.curOp, doc = cm.doc, display = cm.display;
     cm.curOp = null;
-    var view = cm.view, display = cm.display;
-    if (op.updateMaxLine) computeMaxLength(view);
-    if (view.maxLineChanged && !cm.options.lineWrapping) {
-      var width = measureChar(cm, view.maxLine, view.maxLine.text.length).right;
-      display.sizer.style.minWidth = (width + 3 + scrollerCutOff) + "px";
-      view.maxLineChanged = false;
+
+    if (op.updateMaxLine) computeMaxLength(cm);
+    if (display.maxLineChanged && !cm.options.lineWrapping) {
+      var width = measureLineWidth(cm, display.maxLine);
+      display.sizer.style.minWidth = Math.max(0, width + 3 + scrollerCutOff) + "px";
+      display.maxLineChanged = false;
       var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth);
-      if (maxScrollLeft < view.scrollLeft)
+      if (maxScrollLeft < doc.scrollLeft && !op.updateScrollPos)
         setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true);
     }
     var newScrollPos, updated;
-    if (op.selectionChanged) {
-      var coords = cursorCoords(cm, view.sel.head);
+    if (op.updateScrollPos) {
+      newScrollPos = op.updateScrollPos;
+    } else if (op.selectionChanged && display.scroller.clientHeight) { // don't rescroll if not visible
+      var coords = cursorCoords(cm, doc.sel.head);
       newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
     }
-    if (op.changes.length || newScrollPos && newScrollPos.scrollTop != null)
+    if (op.changes.length || newScrollPos && newScrollPos.scrollTop != null) {
       updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop);
+      if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;
+    }
     if (!updated && op.selectionChanged) updateSelection(cm);
-    if (newScrollPos) scrollCursorIntoView(cm);
+    if (op.updateScrollPos) {
+      display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = newScrollPos.scrollTop;
+      display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = newScrollPos.scrollLeft;
+      alignHorizontally(cm);
+    } else if (newScrollPos) {
+      scrollCursorIntoView(cm);
+    }
     if (op.selectionChanged) restartBlink(cm);
 
-    if (view.focused && op.updateInput)
+    if (cm.state.focused && op.updateInput)
       resetInput(cm, op.userSelChange);
 
+    var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
+    if (hidden) for (var i = 0; i < hidden.length; ++i)
+      if (!hidden[i].lines.length) signal(hidden[i], "hide");
+    if (unhidden) for (var i = 0; i < unhidden.length; ++i)
+      if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
+
+    var delayed;
+    if (!--delayedCallbackDepth) {
+      delayed = delayedCallbacks;
+      delayedCallbacks = null;
+    }
     if (op.textChanged)
       signal(cm, "change", cm, op.textChanged);
     if (op.selectionChanged) signal(cm, "cursorActivity", cm);
-    for (var i = 0; i < op.delayedCallbacks.length; ++i) op.delayedCallbacks[i](cm);
+    if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();
   }
 
   // Wraps a function in an operation. Returns the wrapped function.
   function operation(cm1, f) {
     return function() {
-      var cm = cm1 || this;
-      startOperation(cm);
-      try {var result = f.apply(cm, arguments);}
-      finally {endOperation(cm);}
+      var cm = cm1 || this, withOp = !cm.curOp;
+      if (withOp) startOperation(cm);
+      try { var result = f.apply(cm, arguments); }
+      finally { if (withOp) endOperation(cm); }
       return result;
     };
   }
+  function docOperation(f) {
+    return function() {
+      var withOp = this.cm && !this.cm.curOp, result;
+      if (withOp) startOperation(this.cm);
+      try { result = f.apply(this, arguments); }
+      finally { if (withOp) endOperation(this.cm); }
+      return result;
+    };
+  }
+  function runInOp(cm, f) {
+    var withOp = !cm.curOp, result;
+    if (withOp) startOperation(cm);
+    try { result = f(); }
+    finally { if (withOp) endOperation(cm); }
+    return result;
+  }
 
   function regChange(cm, from, to, lendiff) {
+    if (from == null) from = cm.doc.first;
+    if (to == null) to = cm.doc.first + cm.doc.size;
     cm.curOp.changes.push({from: from, to: to, diff: lendiff});
   }
 
   // INPUT HANDLING
 
   function slowPoll(cm) {
-    if (cm.view.pollingFast) return;
+    if (cm.display.pollingFast) return;
     cm.display.poll.set(cm.options.pollInterval, function() {
       readInput(cm);
-      if (cm.view.focused) slowPoll(cm);
+      if (cm.state.focused) slowPoll(cm);
     });
   }
 
@@ -1235,50 +1414,59 @@
   // events that indicate IME taking place, but these are not widely
   // supported or compatible enough yet to rely on.)
   function readInput(cm) {
-    var input = cm.display.input, prevInput = cm.display.prevInput, view = cm.view, sel = view.sel;
-    if (!view.focused || hasSelection(input) || isReadOnly(cm)) return false;
+    var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc, sel = doc.sel;
+    if (!cm.state.focused || hasSelection(input) || isReadOnly(cm)) return false;
     var text = input.value;
     if (text == prevInput && posEq(sel.from, sel.to)) return false;
-    startOperation(cm);
-    view.sel.shift = false;
+    // IE enjoys randomly deselecting our input's text when
+    // re-focusing. If the selection is gone but the cursor is at the
+    // start of the input, that's probably what happened.
+    if (ie && text && input.selectionStart === 0) {
+      resetInput(cm, true);
+      return false;
+    }
+    var withOp = !cm.curOp;
+    if (withOp) startOperation(cm);
+    sel.shift = false;
     var same = 0, l = Math.min(prevInput.length, text.length);
     while (same < l && prevInput[same] == text[same]) ++same;
     var from = sel.from, to = sel.to;
     if (same < prevInput.length)
-      from = {line: from.line, ch: from.ch - (prevInput.length - same)};
-    else if (view.overwrite && posEq(from, to) && !cm.display.pasteIncoming)
-      to = {line: to.line, ch: Math.min(getLine(cm.view.doc, to.line).text.length, to.ch + (text.length - same))};
+      from = Pos(from.line, from.ch - (prevInput.length - same));
+    else if (cm.state.overwrite && posEq(from, to) && !cm.state.pasteIncoming)
+      to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + (text.length - same)));
     var updateInput = cm.curOp.updateInput;
-    updateDoc(cm, from, to, splitLines(text.slice(same)), "end",
-              cm.display.pasteIncoming ? "paste" : "input", {from: from, to: to});
+    makeChange(cm.doc, {from: from, to: to, text: splitLines(text.slice(same)),
+                        origin: cm.state.pasteIncoming ? "paste" : "+input"}, "end");
+
     cm.curOp.updateInput = updateInput;
     if (text.length > 1000) input.value = cm.display.prevInput = "";
     else cm.display.prevInput = text;
-    endOperation(cm);
-    cm.display.pasteIncoming = false;
+    if (withOp) endOperation(cm);
+    cm.state.pasteIncoming = false;
     return true;
   }
 
   function resetInput(cm, user) {
-    var view = cm.view, minimal, selected;
-    if (!posEq(view.sel.from, view.sel.to)) {
+    var minimal, selected, doc = cm.doc;
+    if (!posEq(doc.sel.from, doc.sel.to)) {
       cm.display.prevInput = "";
       minimal = hasCopyEvent &&
-        (view.sel.to.line - view.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
+        (doc.sel.to.line - doc.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
       if (minimal) cm.display.input.value = "-";
       else cm.display.input.value = selected || cm.getSelection();
-      if (view.focused) selectInput(cm.display.input);
+      if (cm.state.focused) selectInput(cm.display.input);
     } else if (user) cm.display.prevInput = cm.display.input.value = "";
     cm.display.inaccurateSelection = minimal;
   }
 
   function focusInput(cm) {
-    if (cm.options.readOnly != "nocursor" && (ie || document.activeElement != cm.display.input))
+    if (cm.options.readOnly != "nocursor" && (!mobile || document.activeElement != cm.display.input))
       cm.display.input.focus();
   }
 
   function isReadOnly(cm) {
-    return cm.options.readOnly || cm.view.cantEdit;
+    return cm.options.readOnly || cm.doc.cantEdit;
   }
 
   // EVENT HANDLERS
@@ -1293,39 +1481,51 @@
     // Gecko browsers fire contextmenu *after* opening the menu, at
     // which point we can't mess with it anymore. Context menu is
     // handled in onMouseDown for Gecko.
-    if (!gecko) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
+    if (!captureMiddleClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
 
     on(d.scroller, "scroll", function() {
-      setScrollTop(cm, d.scroller.scrollTop);
-      setScrollLeft(cm, d.scroller.scrollLeft, true);
-      signal(cm, "scroll", cm);
+      if (d.scroller.clientHeight) {
+        setScrollTop(cm, d.scroller.scrollTop);
+        setScrollLeft(cm, d.scroller.scrollLeft, true);
+        signal(cm, "scroll", cm);
+      }
     });
     on(d.scrollbarV, "scroll", function() {
-      setScrollTop(cm, d.scrollbarV.scrollTop);
+      if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);
     });
     on(d.scrollbarH, "scroll", function() {
-      setScrollLeft(cm, d.scrollbarH.scrollLeft);
+      if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);
     });
 
     on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
     on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
 
-    function reFocus() { if (cm.view.focused) setTimeout(bind(focusInput, cm), 0); }
+    function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }
     on(d.scrollbarH, "mousedown", reFocus);
     on(d.scrollbarV, "mousedown", reFocus);
     // Prevent wrapper from ever scrolling
     on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
-    on(window, "resize", function resizeHandler() {
+
+    function onResize() {
       // Might be a text scaling operation, clear size caches.
       d.cachedCharWidth = d.cachedTextHeight = null;
       clearCaches(cm);
-      if (d.wrapper.parentNode) updateDisplay(cm, true);
-      else off(window, "resize", resizeHandler);
-    });
+      runInOp(cm, bind(regChange, cm));
+    }
+    on(window, "resize", onResize);
+    // Above handler holds on to the editor and its data structures.
+    // Here we poll to unregister it when the editor is no longer in
+    // the document, so that it can be garbage-collected.
+    function unregister() {
+      for (var p = d.wrapper.parentNode; p && p != document.body; p = p.parentNode) {}
+      if (p) setTimeout(unregister, 5000);
+      else off(window, "resize", onResize);
+    }
+    setTimeout(unregister, 5000);
 
     on(d.input, "keyup", operation(cm, function(e) {
       if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-      if (e_prop(e, "keyCode") == 16) cm.view.sel.shift = false;
+      if (e.keyCode == 16) cm.doc.sel.shift = false;
     }));
     on(d.input, "input", bind(fastPoll, cm));
     on(d.input, "keydown", operation(cm, onKeyDown));
@@ -1343,13 +1543,13 @@
       on(d.scroller, "dragover", drag_);
       on(d.scroller, "drop", operation(cm, onDrop));
     }
-    on(d.scroller, "paste", function(){
+    on(d.scroller, "paste", function(e){
       if (eventInWidget(d, e)) return;
-      focusInput(cm); 
+      focusInput(cm);
       fastPoll(cm);
     });
     on(d.input, "paste", function() {
-      d.pasteIncoming = true;
+      cm.state.pasteIncoming = true;
       fastPoll(cm);
     });
 
@@ -1372,9 +1572,11 @@
   }
 
   function eventInWidget(display, e) {
-    for (var n = e_target(e); n != display.wrapper; n = n.parentNode)
+    for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
+      if (!n) return true;
       if (/\bCodeMirror-(?:line)?widget\b/.test(n.className) ||
           n.parentNode == display.sizer && n != display.mover) return true;
+    }
   }
 
   function posFromMouse(cm, e, liberal) {
@@ -1385,7 +1587,7 @@
           target == display.scrollbarV || target == display.scrollbarV.firstChild ||
           target == display.scrollbarFiller) return null;
     }
-    var x, y, space = display.lineSpace.getBoundingClientRect();
+    var x, y, space = getRect(display.lineSpace);
     // Fails unpredictably on IE[67] when mouse is dragged around quickly.
     try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
     return coordsChar(cm, x - space.left, y - space.top);
@@ -1393,8 +1595,8 @@
 
   var lastClick, lastDoubleClick;
   function onMouseDown(e) {
-    var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
-    sel.shift = e_prop(e, "shiftKey");
+    var cm = this, display = cm.display, doc = cm.doc, sel = doc.sel;
+    sel.shift = e.shiftKey;
 
     if (eventInWidget(display, e)) {
       if (!webkit) {
@@ -1408,10 +1610,10 @@
 
     switch (e_button(e)) {
     case 3:
-      if (gecko) onContextMenu.call(cm, cm, e);
+      if (captureMiddleClick) onContextMenu.call(cm, cm, e);
       return;
     case 2:
-      if (start) extendSelection(cm, start);
+      if (start) extendSelection(cm.doc, start);
       setTimeout(bind(focusInput, cm), 20);
       e_preventDefault(e);
       return;
@@ -1421,7 +1623,7 @@
     // selection.
     if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
 
-    if (!view.focused) onFocus(cm);
+    if (!cm.state.focused) onFocus(cm);
 
     var now = +new Date, type = "single";
     if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
@@ -1434,7 +1636,7 @@
       lastDoubleClick = {time: now, pos: start};
       e_preventDefault(e);
       var word = findWordAt(getLine(doc, start.line).text, start);
-      extendSelection(cm, word.from, word.to);
+      extendSelection(cm.doc, word.from, word.to);
     } else { lastClick = {time: now, pos: start}; }
 
     var last = start;
@@ -1442,18 +1644,18 @@
         !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
       var dragEnd = operation(cm, function(e2) {
         if (webkit) display.scroller.draggable = false;
-        view.draggingText = false;
+        cm.state.draggingText = false;
         off(document, "mouseup", dragEnd);
         off(display.scroller, "drop", dragEnd);
         if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
           e_preventDefault(e2);
-          extendSelection(cm, start);
+          extendSelection(cm.doc, start);
           focusInput(cm);
         }
       });
       // Let the drag handler handle this.
       if (webkit) display.scroller.draggable = true;
-      view.draggingText = dragEnd;
+      cm.state.draggingText = dragEnd;
       // IE's approach to draggable
       if (display.scroller.dragDrop) display.scroller.dragDrop();
       on(document, "mouseup", dragEnd);
@@ -1461,13 +1663,13 @@
       return;
     }
     e_preventDefault(e);
-    if (type == "single") extendSelection(cm, clipPos(doc, start));
+    if (type == "single") extendSelection(cm.doc, clipPos(doc, start));
 
     var startstart = sel.from, startend = sel.to;
 
     function doSelect(cur) {
       if (type == "single") {
-        extendSelection(cm, clipPos(doc, start), cur);
+        extendSelection(cm.doc, clipPos(doc, start), cur);
         return;
       }
 
@@ -1475,15 +1677,15 @@
       startend = clipPos(doc, startend);
       if (type == "double") {
         var word = findWordAt(getLine(doc, cur.line).text, cur);
-        if (posLess(cur, startstart)) extendSelection(cm, word.from, startend);
-        else extendSelection(cm, startstart, word.to);
+        if (posLess(cur, startstart)) extendSelection(cm.doc, word.from, startend);
+        else extendSelection(cm.doc, startstart, word.to);
       } else if (type == "triple") {
-        if (posLess(cur, startstart)) extendSelection(cm, startend, clipPos(doc, {line: cur.line, ch: 0}));
-        else extendSelection(cm, startstart, clipPos(doc, {line: cur.line + 1, ch: 0}));
+        if (posLess(cur, startstart)) extendSelection(cm.doc, startend, clipPos(doc, Pos(cur.line, 0)));
+        else extendSelection(cm.doc, startstart, clipPos(doc, Pos(cur.line + 1, 0)));
       }
     }
 
-    var editorSize = display.wrapper.getBoundingClientRect();
+    var editorSize = getRect(display.wrapper);
     // Used to ensure timeout re-tries don't fire when another extend
     // happened in the meantime (clearTimeout isn't reliable -- at
     // least on Chrome, the timeouts still happen even when cleared,
@@ -1495,7 +1697,7 @@
       var cur = posFromMouse(cm, e, true);
       if (!cur) return;
       if (!posEq(cur, last)) {
-        if (!view.focused) onFocus(cm);
+        if (!cm.state.focused) onFocus(cm);
         last = cur;
         doSelect(cur);
         var visible = visibleLines(display, doc);
@@ -1544,11 +1746,8 @@
         reader.onload = function() {
           text[i] = reader.result;
           if (++read == n) {
-            pos = clipPos(cm.view.doc, pos);
-            operation(cm, function() {
-              var end = replaceRange(cm, text.join(""), pos, pos, "paste");
-              setSelection(cm, pos, end);
-            })();
+            pos = clipPos(cm.doc, pos);
+            makeChange(cm.doc, {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}, "around");
           }
         };
         reader.readAsText(file);
@@ -1556,17 +1755,18 @@
       for (var i = 0; i < n; ++i) loadFile(files[i], i);
     } else {
       // Don't do a replace if the drop happened inside of the selected text.
-      if (cm.view.draggingText && !(posLess(pos, cm.view.sel.from) || posLess(cm.view.sel.to, pos))) {
-        cm.view.draggingText(e);
-        if (ie) setTimeout(bind(focusInput, cm), 50);
+      if (cm.state.draggingText && !(posLess(pos, cm.doc.sel.from) || posLess(cm.doc.sel.to, pos))) {
+        cm.state.draggingText(e);
+        // Ensure the editor is re-focused
+        setTimeout(bind(focusInput, cm), 20);
         return;
       }
       try {
         var text = e.dataTransfer.getData("Text");
         if (text) {
-          var curFrom = cm.view.sel.from, curTo = cm.view.sel.to;
-          setSelection(cm, pos, pos);
-          if (cm.view.draggingText) replaceRange(cm, "", curFrom, curTo, "paste");
+          var curFrom = cm.doc.sel.from, curTo = cm.doc.sel.to;
+          setSelection(cm.doc, pos, pos);
+          if (cm.state.draggingText) replaceRange(cm.doc, "", curFrom, curTo, "paste");
           cm.replaceSelection(text, null, "paste");
           focusInput(cm);
           onFocus(cm);
@@ -1581,20 +1781,20 @@
     try { var mX = e.clientX, mY = e.clientY; }
     catch(e) { return false; }
 
-    if (mX >= Math.floor(display.gutters.getBoundingClientRect().right)) return false;
+    if (mX >= Math.floor(getRect(display.gutters).right)) return false;
     e_preventDefault(e);
     if (!hasHandler(cm, "gutterClick")) return true;
 
-    var lineBox = display.lineDiv.getBoundingClientRect();
+    var lineBox = getRect(display.lineDiv);
     if (mY > lineBox.bottom) return true;
     mY -= lineBox.top - display.viewOffset;
 
     for (var i = 0; i < cm.options.gutters.length; ++i) {
       var g = display.gutters.childNodes[i];
-      if (g && g.getBoundingClientRect().right >= mX) {
-        var line = lineAtHeight(cm.view.doc, mY);
+      if (g && getRect(g).right >= mX) {
+        var line = lineAtHeight(cm.doc, mY);
         var gutter = cm.options.gutters[i];
-        signalLater(cm, cm, "gutterClick", cm, line, gutter, e);
+        signalLater(cm, "gutterClick", cm, line, gutter, e);
         break;
       }
     }
@@ -1603,28 +1803,46 @@
 
   function onDragStart(cm, e) {
     if (eventInWidget(cm.display, e)) return;
-    
+
     var txt = cm.getSelection();
     e.dataTransfer.setData("Text", txt);
 
     // Use dummy image instead of default browsers image.
     // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
-    if (e.dataTransfer.setDragImage && !safari)
-      e.dataTransfer.setDragImage(elt('img'), 0, 0);
+    if (e.dataTransfer.setDragImage) {
+      var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
+      if (opera) {
+        img.width = img.height = 1;
+        cm.display.wrapper.appendChild(img);
+        // Force a relayout, or Opera won't use our image for some obscure reason
+        img._top = img.offsetTop;
+      }
+      if (safari) {
+        if (cm.display.dragImg) {
+          img = cm.display.dragImg;
+        } else {
+          cm.display.dragImg = img;
+          img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+          cm.display.wrapper.appendChild(img);
+        }
+      }
+      e.dataTransfer.setDragImage(img, 0, 0);
+      if (opera) img.parentNode.removeChild(img);
+    }
   }
 
   function setScrollTop(cm, val) {
-    if (Math.abs(cm.view.scrollTop - val) < 2) return;
-    cm.view.scrollTop = val;
+    if (Math.abs(cm.doc.scrollTop - val) < 2) return;
+    cm.doc.scrollTop = val;
     if (!gecko) updateDisplay(cm, [], val);
     if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
     if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
     if (gecko) updateDisplay(cm, []);
   }
   function setScrollLeft(cm, val, isScroller) {
-    if (isScroller ? val == cm.view.scrollLeft : Math.abs(cm.view.scrollLeft - val) < 2) return;
+    if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
     val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
-    cm.view.scrollLeft = val;
+    cm.doc.scrollLeft = val;
     alignHorizontally(cm);
     if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
     if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
@@ -1641,7 +1859,7 @@
   // is that it gives us a chance to update the display before the
   // actual scrolling happens, reducing flickering.
 
-  var wheelSamples = 0, wheelDX, wheelDY, wheelStartX, wheelStartY, wheelPixelsPerUnit = null;
+  var wheelSamples = 0, wheelPixelsPerUnit = null;
   // Fill in a browser-detected starting value on browsers where we
   // know one. These don't have to be accurate -- the result of them
   // being wrong would just be a slight flicker on the first wheel
@@ -1670,7 +1888,7 @@
       }
     }
 
-    var scroll = cm.display.scroller;
+    var display = cm.display, scroll = display.scroller;
     // On some browsers, horizontal scrolling will cause redraws to
     // happen before the gutter has been realigned, causing it to
     // wriggle around in a most unseemly way. When we have an
@@ -1682,35 +1900,35 @@
         setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
       setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
       e_preventDefault(e);
-      wheelStartX = null; // Abort measurement, if in progress
+      display.wheelStartX = null; // Abort measurement, if in progress
       return;
     }
 
     if (dy && wheelPixelsPerUnit != null) {
       var pixels = dy * wheelPixelsPerUnit;
-      var top = cm.view.scrollTop, bot = top + cm.display.wrapper.clientHeight;
+      var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
       if (pixels < 0) top = Math.max(0, top + pixels - 50);
-      else bot = Math.min(cm.view.doc.height, bot + pixels + 50);
+      else bot = Math.min(cm.doc.height, bot + pixels + 50);
       updateDisplay(cm, [], {top: top, bottom: bot});
     }
 
     if (wheelSamples < 20) {
-      if (wheelStartX == null) {
-        wheelStartX = scroll.scrollLeft; wheelStartY = scroll.scrollTop;
-        wheelDX = dx; wheelDY = dy;
+      if (display.wheelStartX == null) {
+        display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
+        display.wheelDX = dx; display.wheelDY = dy;
         setTimeout(function() {
-          if (wheelStartX == null) return;
-          var movedX = scroll.scrollLeft - wheelStartX;
-          var movedY = scroll.scrollTop - wheelStartY;
-          var sample = (movedY && wheelDY && movedY / wheelDY) ||
-            (movedX && wheelDX && movedX / wheelDX);
-          wheelStartX = wheelStartY = null;
+          if (display.wheelStartX == null) return;
+          var movedX = scroll.scrollLeft - display.wheelStartX;
+          var movedY = scroll.scrollTop - display.wheelStartY;
+          var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
+            (movedX && display.wheelDX && movedX / display.wheelDX);
+          display.wheelStartX = display.wheelStartY = null;
           if (!sample) return;
           wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
           ++wheelSamples;
         }, 200);
       } else {
-        wheelDX += dx; wheelDY += dy;
+        display.wheelDX += dx; display.wheelDY += dy;
       }
     }
   }
@@ -1723,23 +1941,20 @@
     // Ensure previous input has been read, so that the handler sees a
     // consistent view of the document
     if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
-    var view = cm.view, prevShift = view.sel.shift;
+    var doc = cm.doc, prevShift = doc.sel.shift, done = false;
     try {
-      if (isReadOnly(cm)) view.suppressEdits = true;
-      if (dropShift) view.sel.shift = false;
-      bound(cm);
-    } catch(e) {
-      if (e != Pass) throw e;
-      return false;
+      if (isReadOnly(cm)) cm.state.suppressEdits = true;
+      if (dropShift) doc.sel.shift = false;
+      done = bound(cm) != Pass;
     } finally {
-      view.sel.shift = prevShift;
-      view.suppressEdits = false;
+      doc.sel.shift = prevShift;
+      cm.state.suppressEdits = false;
     }
-    return true;
+    return done;
   }
 
   function allKeyMaps(cm) {
-    var maps = cm.view.keyMaps.slice(0);
+    var maps = cm.state.keyMaps.slice(0);
     maps.push(cm.options.keyMap);
     if (cm.options.extraKeys) maps.unshift(cm.options.extraKeys);
     return maps;
@@ -1755,27 +1970,23 @@
         cm.options.keyMap = (next.call ? next.call(null, cm) : next);
     }, 50);
 
-    var name = keyNames[e_prop(e, "keyCode")], handled = false;
-    if (name == null || e.altGraphKey) return false;
-    if (e_prop(e, "altKey")) name = "Alt-" + name;
-    if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name;
-    if (e_prop(e, flipCtrlCmd ? "ctrlKey" : "metaKey")) name = "Cmd-" + name;
-
-    var stopped = false;
-    function stop() { stopped = true; }
+    var name = keyName(e, true), handled = false;
+    if (!name) return false;
     var keymaps = allKeyMaps(cm);
 
-    if (e_prop(e, "shiftKey")) {
-      handled = lookupKey("Shift-" + name, keymaps,
-                          function(b) {return doHandleBinding(cm, b, true);}, stop)
-        || lookupKey(name, keymaps, function(b) {
-          if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(cm, b);
-        }, stop);
+    if (e.shiftKey) {
+      // First try to resolve full name (including 'Shift-'). Failing
+      // that, see if there is a cursor-motion command (starting with
+      // 'go') bound to the keyname without 'Shift-'.
+      handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);})
+             || lookupKey(name, keymaps, function(b) {
+                  if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(cm, b);
+                });
     } else {
-      handled = lookupKey(name, keymaps,
-                          function(b) { return doHandleBinding(cm, b); }, stop);
+      handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); });
     }
-    if (stopped) handled = false;
+    if (handled == "stop") handled = false;
+
     if (handled) {
       e_preventDefault(e);
       restartBlink(cm);
@@ -1797,18 +2008,18 @@
   var lastStoppedKey = null;
   function onKeyDown(e) {
     var cm = this;
-    if (!cm.view.focused) onFocus(cm);
+    if (!cm.state.focused) onFocus(cm);
     if (ie && e.keyCode == 27) { e.returnValue = false; }
     if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-    var code = e_prop(e, "keyCode");
+    var code = e.keyCode;
     // IE does strange things with escape.
-    cm.view.sel.shift = code == 16 || e_prop(e, "shiftKey");
+    cm.doc.sel.shift = code == 16 || e.shiftKey;
     // First give onKeyEvent option a chance to handle this.
     var handled = handleKeyBinding(cm, e);
     if (opera) {
       lastStoppedKey = handled ? code : null;
       // Opera has no cut event... we try to at least catch the key combo
-      if (!handled && code == 88 && !hasCopyEvent && e_prop(e, mac ? "metaKey" : "ctrlKey"))
+      if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
         cm.replaceSelection("");
     }
   }
@@ -1816,56 +2027,55 @@
   function onKeyPress(e) {
     var cm = this;
     if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
-    var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
+    var keyCode = e.keyCode, charCode = e.charCode;
     if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
     if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
     var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
-    if (this.options.electricChars && this.view.mode.electricChars &&
+    if (this.options.electricChars && this.doc.mode.electricChars &&
         this.options.smartIndent && !isReadOnly(this) &&
-        this.view.mode.electricChars.indexOf(ch) > -1)
-      setTimeout(operation(cm, function() {indentLine(cm, cm.view.sel.to.line, "smart");}), 75);
+        this.doc.mode.electricChars.indexOf(ch) > -1)
+      setTimeout(operation(cm, function() {indentLine(cm, cm.doc.sel.to.line, "smart");}), 75);
     if (handleCharBinding(cm, e, ch)) return;
     fastPoll(cm);
   }
 
   function onFocus(cm) {
     if (cm.options.readOnly == "nocursor") return;
-    if (!cm.view.focused) {
+    if (!cm.state.focused) {
       signal(cm, "focus", cm);
-      cm.view.focused = true;
-      if (cm.display.scroller.className.search(/\bCodeMirror-focused\b/) == -1)
-        cm.display.scroller.className += " CodeMirror-focused";
+      cm.state.focused = true;
+      if (cm.display.wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
+        cm.display.wrapper.className += " CodeMirror-focused";
       resetInput(cm, true);
     }
     slowPoll(cm);
     restartBlink(cm);
   }
   function onBlur(cm) {
-    if (cm.view.focused) {
+    if (cm.state.focused) {
       signal(cm, "blur", cm);
-      cm.view.focused = false;
-      cm.display.scroller.className = cm.display.scroller.className.replace(" CodeMirror-focused", "");
+      cm.state.focused = false;
+      cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-focused", "");
     }
     clearInterval(cm.display.blinker);
-    setTimeout(function() {if (!cm.view.focused) cm.view.sel.shift = false;}, 150);
+    setTimeout(function() {if (!cm.state.focused) cm.doc.sel.shift = false;}, 150);
   }
 
   var detectingSelectAll;
   function onContextMenu(cm, e) {
-    var display = cm.display;
+    var display = cm.display, sel = cm.doc.sel;
     if (eventInWidget(display, e)) return;
-    
-    var sel = cm.view.sel;
+
     var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
     if (!pos || opera) return; // Opera is difficult.
     if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
-      operation(cm, setSelection)(cm, pos, pos);
+      operation(cm, setSelection)(cm.doc, pos, pos);
 
     var oldCSS = display.input.style.cssText;
     display.inputDiv.style.position = "absolute";
     display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
       "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; outline: none;" +
-      "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
+      "border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";
     focusInput(cm);
     resetInput(cm, true);
     // Adds "Select all" to context menu in FF
@@ -1877,27 +2087,29 @@
       if (ie_lt9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
       slowPoll(cm);
 
-      // Try to detect the user choosing select-all 
-      if (display.input.selectionStart != null) {
+      // Try to detect the user choosing select-all
+      if (display.input.selectionStart != null && (!ie || ie_lt9)) {
         clearTimeout(detectingSelectAll);
         var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value), i = 0;
         display.prevInput = " ";
         display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
-        detectingSelectAll = setTimeout(function poll(){
+        var poll = function(){
           if (display.prevInput == " " && display.input.selectionStart == 0)
             operation(cm, commands.selectAll)(cm);
           else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500);
           else resetInput(cm);
-        }, 200);
+        };
+        detectingSelectAll = setTimeout(poll, 200);
       }
     }
 
-    if (gecko) {
+    if (captureMiddleClick) {
       e_stop(e);
-      on(window, "mouseup", function mouseup() {
+      var mouseup = function() {
         off(window, "mouseup", mouseup);
         setTimeout(rehide, 20);
-      });
+      };
+      on(window, "mouseup", mouseup);
     } else {
       setTimeout(rehide, 50);
     }
@@ -1905,124 +2117,206 @@
 
   // UPDATING
 
-  // Replace the range from from to to by the strings in newText.
-  // Afterwards, set the selection to selFrom, selTo.
-  function updateDoc(cm, from, to, newText, selUpdate, origin) {
+  function changeEnd(change) {
+    return Pos(change.from.line + change.text.length - 1,
+               lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
+  }
+
+  // Make sure a position will be valid after the given change.
+  function clipPostChange(doc, change, pos) {
+    if (!posLess(change.from, pos)) return clipPos(doc, pos);
+    var diff = (change.text.length - 1) - (change.to.line - change.from.line);
+    if (pos.line > change.to.line + diff) {
+      var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;
+      if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);
+      return clipToLen(pos, getLine(doc, preLine).text.length);
+    }
+    if (pos.line == change.to.line + diff)
+      return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +
+                       getLine(doc, change.to.line).text.length - change.to.ch);
+    var inside = pos.line - change.from.line;
+    return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));
+  }
+
+  // Hint can be null|"end"|"start"|"around"|{anchor,head}
+  function computeSelAfterChange(doc, change, hint) {
+    if (hint && typeof hint == "object") // Assumed to be {anchor, head} object
+      return {anchor: clipPostChange(doc, change, hint.anchor),
+              head: clipPostChange(doc, change, hint.head)};
+
+    if (hint == "start") return {anchor: change.from, head: change.from};
+
+    var end = changeEnd(change);
+    if (hint == "around") return {anchor: change.from, head: end};
+    if (hint == "end") return {anchor: end, head: end};
+
+    // hint is null, leave the selection alone as much as possible
+    var adjustPos = function(pos) {
+      if (posLess(pos, change.from)) return pos;
+      if (!posLess(change.to, pos)) return end;
+
+      var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
+      if (pos.line == change.to.line) ch += end.ch - change.to.ch;
+      return Pos(line, ch);
+    };
+    return {anchor: adjustPos(doc.sel.anchor), head: adjustPos(doc.sel.head)};
+  }
+
+  function filterChange(doc, change) {
+    var obj = {
+      canceled: false,
+      from: change.from,
+      to: change.to,
+      text: change.text,
+      origin: change.origin,
+      update: function(from, to, text, origin) {
+        if (from) this.from = clipPos(doc, from);
+        if (to) this.to = clipPos(doc, to);
+        if (text) this.text = text;
+        if (origin !== undefined) this.origin = origin;
+      },
+      cancel: function() { this.canceled = true; }
+    };
+    signal(doc, "beforeChange", doc, obj);
+    if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
+
+    if (obj.canceled) return null;
+    return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
+  }
+
+  // Replace the range from from to to by the strings in replacement.
+  // change is a {from, to, text [, origin]} object
+  function makeChange(doc, change, selUpdate, ignoreReadOnly) {
+    if (doc.cm) {
+      if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, selUpdate, ignoreReadOnly);
+      if (doc.cm.state.suppressEdits) return;
+    }
+
+    if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
+      change = filterChange(doc, change);
+      if (!change) return;
+    }
+
     // Possibly split or suppress the update based on the presence
     // of read-only spans in its range.
-    var split = sawReadOnlySpans &&
-      removeReadOnlyRanges(cm.view.doc, from, to);
+    var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
     if (split) {
       for (var i = split.length - 1; i >= 1; --i)
-        updateDocInner(cm, split[i].from, split[i].to, [""], origin);
+        makeChangeNoReadonly(doc, {from: split[i].from, to: split[i].to, text: [""]});
       if (split.length)
-        return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);
+        makeChangeNoReadonly(doc, {from: split[0].from, to: split[0].to, text: change.text}, selUpdate);
     } else {
-      return updateDocInner(cm, from, to, newText, selUpdate, origin);
+      makeChangeNoReadonly(doc, change, selUpdate);
     }
   }
 
-  function updateDocInner(cm, from, to, newText, selUpdate, origin) {
-    if (cm.view.suppressEdits) return;
+  function makeChangeNoReadonly(doc, change, selUpdate) {
+    var selAfter = computeSelAfterChange(doc, change, selUpdate);
+    addToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
 
-    var view = cm.view, doc = view.doc, old = [];
-    doc.iter(from.line, to.line + 1, function(line) {
-      old.push(newHL(line.text, line.markedSpans));
+    makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
+    var rebased = [];
+
+    linkedDocs(doc, function(doc, sharedHist) {
+      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+        rebaseHist(doc.history, change);
+        rebased.push(doc.history);
+      }
+      makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
     });
-    var startSelFrom = view.sel.from, startSelTo = view.sel.to;
-    var lines = updateMarkedSpans(hlSpans(old[0]), hlSpans(lst(old)), from.ch, to.ch, newText);
-    var retval = updateDocNoUndo(cm, from, to, lines, selUpdate, origin);
-    if (view.history) addChange(cm, from.line, newText.length, old, origin,
-                                startSelFrom, startSelTo, view.sel.from, view.sel.to);
-    return retval;
   }
 
-  function unredoHelper(cm, type) {
-    var doc = cm.view.doc, hist = cm.view.history;
-    var set = (type == "undo" ? hist.done : hist.undone).pop();
-    if (!set) return;
-    var anti = {events: [], fromBefore: set.fromAfter, toBefore: set.toAfter,
-                fromAfter: set.fromBefore, toAfter: set.toBefore};
-    for (var i = set.events.length - 1; i >= 0; i -= 1) {
-      hist.dirtyCounter += type == "undo" ? -1 : 1;
-      var change = set.events[i];
-      var replaced = [], end = change.start + change.added;
-      doc.iter(change.start, end, function(line) { replaced.push(newHL(line.text, line.markedSpans)); });
-      anti.events.push({start: change.start, added: change.old.length, old: replaced});
-      var selPos = i ? null : {from: set.fromBefore, to: set.toBefore};
-      updateDocNoUndo(cm, {line: change.start, ch: 0}, {line: end - 1, ch: getLine(doc, end-1).text.length},
-                      change.old, selPos, type);
-    }
+  function makeChangeFromHistory(doc, type) {
+    var hist = doc.history;
+    var event = (type == "undo" ? hist.done : hist.undone).pop();
+    if (!event) return;
+    hist.dirtyCounter += type == "undo" ? -1 : 1;
+
+    var anti = {changes: [], anchorBefore: event.anchorAfter, headBefore: event.headAfter,
+                anchorAfter: event.anchorBefore, headAfter: event.headBefore};
     (type == "undo" ? hist.undone : hist.done).push(anti);
+
+    for (var i = event.changes.length - 1; i >= 0; --i) {
+      var change = event.changes[i];
+      change.origin = type;
+      anti.changes.push(historyChangeFromChange(doc, change));
+
+      var after = i ? computeSelAfterChange(doc, change, null)
+                    : {anchor: event.anchorBefore, head: event.headBefore};
+      makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
+      var rebased = [];
+
+      linkedDocs(doc, function(doc, sharedHist) {
+        if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+          rebaseHist(doc.history, change);
+          rebased.push(doc.history);
+        }
+        makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
+      });
+    }
   }
 
-  function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
-    var view = cm.view, doc = view.doc, display = cm.display;
-    if (view.suppressEdits) return;
+  function shiftDoc(doc, distance) {
+    function shiftPos(pos) {return Pos(pos.line + distance, pos.ch);}
+    doc.first += distance;
+    if (doc.cm) regChange(doc.cm, doc.first, doc.first, distance);
+    doc.sel.head = shiftPos(doc.sel.head); doc.sel.anchor = shiftPos(doc.sel.anchor);
+    doc.sel.from = shiftPos(doc.sel.from); doc.sel.to = shiftPos(doc.sel.to);
+  }
 
-    var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
+  function makeChangeSingleDoc(doc, change, selAfter, spans) {
+    if (doc.cm && !doc.cm.curOp)
+      return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
+
+    if (change.to.line < doc.first) {
+      shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
+      return;
+    }
+    if (change.from.line > doc.lastLine()) return;
+
+    // Clip the change to the size of this doc
+    if (change.from.line < doc.first) {
+      var shift = change.text.length - 1 - (doc.first - change.from.line);
+      shiftDoc(doc, shift);
+      change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
+                text: [lst(change.text)], origin: change.origin};
+    }
+    var last = doc.lastLine();
+    if (change.to.line > last) {
+      change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
+                text: [change.text[0]], origin: change.origin};
+    }
+
+    change.removed = getBetween(doc, change.from, change.to);
+
+    if (!selAfter) selAfter = computeSelAfterChange(doc, change, null);
+    if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans, selAfter);
+    else updateDoc(doc, change, spans, selAfter);
+  }
+
+  function makeChangeSingleDocInEditor(cm, change, spans, selAfter) {
+    var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
+
     var recomputeMaxLength = false, checkWidthStart = from.line;
     if (!cm.options.lineWrapping) {
-      checkWidthStart = lineNo(visualLine(doc, firstLine));
+      checkWidthStart = lineNo(visualLine(doc, getLine(doc, from.line)));
       doc.iter(checkWidthStart, to.line + 1, function(line) {
-        if (lineLength(doc, line) == view.maxLineLength) {
+        if (line == display.maxLine) {
           recomputeMaxLength = true;
           return true;
         }
       });
     }
 
-    var lastHL = lst(lines), th = textHeight(display);
+    updateDoc(doc, change, spans, selAfter, estimateHeight(cm));
 
-    // First adjust the line structure
-    if (from.ch == 0 && to.ch == 0 && hlText(lastHL) == "") {
-      // This is a whole-line replace. Treated specially to make
-      // sure line objects move the way they are supposed to.
-      var added = [];
-      for (var i = 0, e = lines.length - 1; i < e; ++i)
-        added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
-      updateLine(cm, lastLine, lastLine.text, hlSpans(lastHL));
-      if (nlines) doc.remove(from.line, nlines, cm);
-      if (added.length) doc.insert(from.line, added);
-    } else if (firstLine == lastLine) {
-      if (lines.length == 1) {
-        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
-                   firstLine.text.slice(to.ch), hlSpans(lines[0]));
-      } else {
-        for (var added = [], i = 1, e = lines.length - 1; i < e; ++i)
-          added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
-        added.push(makeLine(hlText(lastHL) + firstLine.text.slice(to.ch), hlSpans(lastHL), th));
-        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
-        doc.insert(from.line + 1, added);
-      }
-    } else if (lines.length == 1) {
-      updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
-                 lastLine.text.slice(to.ch), hlSpans(lines[0]));
-      doc.remove(from.line + 1, nlines, cm);
-    } else {
-      var added = [];
-      updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
-      updateLine(cm, lastLine, hlText(lastHL) + lastLine.text.slice(to.ch), hlSpans(lastHL));
-      for (var i = 1, e = lines.length - 1; i < e; ++i)
-        added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
-      if (nlines > 1) doc.remove(from.line + 1, nlines - 1, cm);
-      doc.insert(from.line + 1, added);
-    }
-
-    if (cm.options.lineWrapping) {
-      var perLine = Math.max(5, display.scroller.clientWidth / charWidth(display) - 3);
-      doc.iter(from.line, from.line + lines.length, function(line) {
-        if (line.height == 0) return;
-        var guess = (Math.ceil(line.text.length / perLine) || 1) * th;
-        if (guess != line.height) updateLineHeight(line, guess);
-      });
-    } else {
-      doc.iter(checkWidthStart, from.line + lines.length, function(line) {
+    if (!cm.options.lineWrapping) {
+      doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
         var len = lineLength(doc, line);
-        if (len > view.maxLineLength) {
-          view.maxLine = line;
-          view.maxLineLength = len;
-          view.maxLineChanged = true;
+        if (len > display.maxLineLength) {
+          display.maxLine = line;
+          display.maxLineLength = len;
+          display.maxLineChanged = true;
           recomputeMaxLength = false;
         }
       });
@@ -2030,82 +2324,66 @@
     }
 
     // Adjust frontier, schedule worker
-    view.frontier = Math.min(view.frontier, from.line);
+    doc.frontier = Math.min(doc.frontier, from.line);
     startWorker(cm, 400);
 
-    var lendiff = lines.length - nlines - 1;
+    var lendiff = change.text.length - (to.line - from.line) - 1;
     // Remember that these lines changed, for updating the display
     regChange(cm, from.line, to.line + 1, lendiff);
+
     if (hasHandler(cm, "change")) {
-      // Normalize lines to contain only strings, since that's what
-      // the change event handler expects
-      for (var i = 0; i < lines.length; ++i)
-        if (typeof lines[i] != "string") lines[i] = lines[i].text;
-      var changeObj = {from: from, to: to, text: lines, origin: origin};
+      var changeObj = {from: from, to: to,
+                       text: change.text,
+                       removed: change.removed,
+                       origin: change.origin};
       if (cm.curOp.textChanged) {
         for (var cur = cm.curOp.textChanged; cur.next; cur = cur.next) {}
         cur.next = changeObj;
       } else cm.curOp.textChanged = changeObj;
     }
-
-    // Update the selection
-    var newSelFrom, newSelTo, end = {line: from.line + lines.length - 1,
-                                     ch: hlText(lastHL).length  + (lines.length == 1 ? from.ch : 0)};
-    if (selUpdate && typeof selUpdate != "string") {
-      if (selUpdate.from) { newSelFrom = selUpdate.from; newSelTo = selUpdate.to; }
-      else newSelFrom = newSelTo = selUpdate;
-    } else if (selUpdate == "end") {
-      newSelFrom = newSelTo = end;
-    } else if (selUpdate == "start") {
-      newSelFrom = newSelTo = from;
-    } else if (selUpdate == "around") {
-      newSelFrom = from; newSelTo = end;
-    } else {
-      var adjustPos = function(pos) {
-        if (posLess(pos, from)) return pos;
-        if (!posLess(to, pos)) return end;
-        var line = pos.line + lendiff;
-        var ch = pos.ch;
-        if (pos.line == to.line)
-          ch += hlText(lastHL).length - (to.ch - (to.line == from.line ? from.ch : 0));
-        return {line: line, ch: ch};
-      };
-      newSelFrom = adjustPos(view.sel.from);
-      newSelTo = adjustPos(view.sel.to);
-    }
-    setSelection(cm, newSelFrom, newSelTo, null, true);
-    return end;
   }
 
-  function replaceRange(cm, code, from, to, origin) {
+  function replaceRange(doc, code, from, to, origin) {
     if (!to) to = from;
     if (posLess(to, from)) { var tmp = to; to = from; from = tmp; }
-    return updateDoc(cm, from, to, splitLines(code), null, origin);
+    if (typeof code == "string") code = splitLines(code);
+    makeChange(doc, {from: from, to: to, text: code, origin: origin}, null);
   }
 
-  // SELECTION
+  // POSITION OBJECT
+
+  function Pos(line, ch) {
+    if (!(this instanceof Pos)) return new Pos(line, ch);
+    this.line = line; this.ch = ch;
+  }
+  CodeMirror.Pos = Pos;
 
   function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
   function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
-  function copyPos(x) {return {line: x.line, ch: x.ch};}
+  function copyPos(x) {return Pos(x.line, x.ch);}
 
-  function clipLine(doc, n) {return Math.max(0, Math.min(n, doc.size-1));}
+  // SELECTION
+
+  function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
   function clipPos(doc, pos) {
-    if (pos.line < 0) return {line: 0, ch: 0};
-    if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc, doc.size-1).text.length};
-    var ch = pos.ch, linelen = getLine(doc, pos.line).text.length;
-    if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
-    else if (ch < 0) return {line: pos.line, ch: 0};
+    if (pos.line < doc.first) return Pos(doc.first, 0);
+    var last = doc.first + doc.size - 1;
+    if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
+    return clipToLen(pos, getLine(doc, pos.line).text.length);
+  }
+  function clipToLen(pos, linelen) {
+    var ch = pos.ch;
+    if (ch == null || ch > linelen) return Pos(pos.line, linelen);
+    else if (ch < 0) return Pos(pos.line, 0);
     else return pos;
   }
-  function isLine(doc, l) {return l >= 0 && l < doc.size;}
+  function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
 
   // If shift is held, this will move the selection anchor. Otherwise,
   // it'll set the whole selection.
-  function extendSelection(cm, pos, other, bias) {
-    var sel = cm.view.sel;
-    if (sel.shift || sel.extend) {
-      var anchor = sel.anchor;
+  function extendSelection(doc, pos, other, bias) {
+    if (doc.sel.shift || doc.sel.extend) {
+      var anchor = doc.sel.anchor;
       if (other) {
         var posBefore = posLess(pos, anchor);
         if (posBefore != posLess(other, anchor)) {
@@ -2115,24 +2393,38 @@
           pos = other;
         }
       }
-      setSelection(cm, anchor, pos, bias);
+      setSelection(doc, anchor, pos, bias);
     } else {
-      setSelection(cm, pos, other || pos, bias);
+      setSelection(doc, pos, other || pos, bias);
     }
-    cm.curOp.userSelChange = true;
+    if (doc.cm) doc.cm.curOp.userSelChange = true;
+  }
+
+  function filterSelectionChange(doc, anchor, head) {
+    var obj = {anchor: anchor, head: head};
+    signal(doc, "beforeSelectionChange", doc, obj);
+    if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
+    obj.anchor = clipPos(doc, obj.anchor); obj.head = clipPos(doc, obj.head);
+    return obj;
   }
 
   // Update the selection. Last two args are only used by
   // updateDoc, since they have to be expressed in the line
   // numbers before the update.
-  function setSelection(cm, anchor, head, bias, checkAtomic) {
-    cm.view.goalColumn = null;
-    var sel = cm.view.sel;
+  function setSelection(doc, anchor, head, bias, checkAtomic) {
+    if (!checkAtomic && hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) {
+      var filtered = filterSelectionChange(doc, anchor, head);
+      head = filtered.head;
+      anchor = filtered.anchor;
+    }
+
+    var sel = doc.sel;
+    sel.goalColumn = null;
     // Skip over atomic spans.
     if (checkAtomic || !posEq(anchor, sel.anchor))
-      anchor = skipAtomic(cm, anchor, bias, checkAtomic != "push");
+      anchor = skipAtomic(doc, anchor, bias, checkAtomic != "push");
     if (checkAtomic || !posEq(head, sel.head))
-      head = skipAtomic(cm, head, bias, checkAtomic != "push");
+      head = skipAtomic(doc, head, bias, checkAtomic != "push");
 
     if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;
 
@@ -2141,18 +2433,20 @@
     sel.from = inv ? head : anchor;
     sel.to = inv ? anchor : head;
 
-    cm.curOp.updateInput = true;
-    cm.curOp.selectionChanged = true;
+    if (doc.cm)
+      doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
+
+    signalLater(doc, "cursorActivity", doc);
   }
 
   function reCheckSelection(cm) {
-    setSelection(cm, cm.view.sel.from, cm.view.sel.to, null, "push");
+    setSelection(cm.doc, cm.doc.sel.from, cm.doc.sel.to, null, "push");
   }
 
-  function skipAtomic(cm, pos, bias, mayClear) {
-    var doc = cm.view.doc, flipped = false, curPos = pos;
+  function skipAtomic(doc, pos, bias, mayClear) {
+    var flipped = false, curPos = pos;
     var dir = bias || 1;
-    cm.view.cantEdit = false;
+    doc.cantEdit = false;
     search: for (;;) {
       var line = getLine(doc, curPos.line), toClear;
       if (line.markedSpans) {
@@ -2168,20 +2462,20 @@
             if (posEq(newPos, curPos)) {
               newPos.ch += dir;
               if (newPos.ch < 0) {
-                if (newPos.line) newPos = clipPos(doc, {line: newPos.line - 1});
+                if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
                 else newPos = null;
               } else if (newPos.ch > line.text.length) {
-                if (newPos.line < doc.size - 1) newPos = {line: newPos.line + 1, ch: 0};
+                if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
                 else newPos = null;
               }
               if (!newPos) {
                 if (flipped) {
                   // Driven in a corner -- no valid cursor position found at all
                   // -- try again *with* clearing, if we didn't already
-                  if (!mayClear) return skipAtomic(cm, pos, bias, true);
+                  if (!mayClear) return skipAtomic(doc, pos, bias, true);
                   // Otherwise, turn off editing until further notice, and return the start of the doc
-                  cm.view.cantEdit = true;
-                  return {line: 0, ch: 0};
+                  doc.cantEdit = true;
+                  return Pos(doc.first, 0);
                 }
                 flipped = true; newPos = pos; dir = -dir;
               }
@@ -2199,12 +2493,11 @@
   // SCROLLING
 
   function scrollCursorIntoView(cm) {
-    var view = cm.view;
-    var coords = scrollPosIntoView(cm, view.sel.head);
-    if (!view.focused) return;
-    var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
-    if (coords.top + box.top < 0) doScroll = true;
-    else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
+    var coords = scrollPosIntoView(cm, cm.doc.sel.head);
+    if (!cm.state.focused) return;
+    var display = cm.display, box = getRect(display.sizer), doScroll = null, pTop = paddingTop(cm.display);
+    if (coords.top + pTop + box.top < 0) doScroll = true;
+    else if (coords.bottom + pTop + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
     if (doScroll != null && !phantom) {
       var hidden = display.cursor.style.display == "none";
       if (hidden) {
@@ -2217,18 +2510,19 @@
     }
   }
 
-  function scrollPosIntoView(cm, pos) {
+  function scrollPosIntoView(cm, pos, margin) {
+    if (margin == null) margin = 0;
     for (;;) {
       var changed = false, coords = cursorCoords(cm, pos);
-      var scrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
-      var startTop = cm.view.scrollTop, startLeft = cm.view.scrollLeft;
+      var scrollPos = calculateScrollPos(cm, coords.left, coords.top - margin, coords.left, coords.bottom + margin);
+      var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
       if (scrollPos.scrollTop != null) {
         setScrollTop(cm, scrollPos.scrollTop);
-        if (Math.abs(cm.view.scrollTop - startTop) > 1) changed = true;
+        if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
       }
       if (scrollPos.scrollLeft != null) {
         setScrollLeft(cm, scrollPos.scrollLeft);
-        if (Math.abs(cm.view.scrollLeft - startLeft) > 1) changed = true;
+        if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;
       }
       if (!changed) return coords;
     }
@@ -2244,7 +2538,7 @@
     var display = cm.display, pt = paddingTop(display);
     y1 += pt; y2 += pt;
     var screen = display.scroller.clientHeight - scrollerCutOff, screentop = display.scroller.scrollTop, result = {};
-    var docBottom = cm.view.doc.height + 2 * pt;
+    var docBottom = cm.doc.height + paddingVert(display);
     var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;
     if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);
     else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;
@@ -2262,13 +2556,24 @@
     return result;
   }
 
+  function updateScrollPos(cm, left, top) {
+    cm.curOp.updateScrollPos = {scrollLeft: left, scrollTop: top};
+  }
+
+  function addToScrollPos(cm, left, top) {
+    var pos = cm.curOp.updateScrollPos || (cm.curOp.updateScrollPos = {scrollLeft: cm.doc.scrollLeft, scrollTop: cm.doc.scrollTop});
+    var scroll = cm.display.scroller;
+    pos.scrollTop = Math.max(0, Math.min(scroll.scrollHeight - scroll.clientHeight, pos.scrollTop + top));
+    pos.scrollLeft = Math.max(0, Math.min(scroll.scrollWidth - scroll.clientWidth, pos.scrollLeft + left));
+  }
+
   // API UTILITIES
 
   function indentLine(cm, n, how, aggressive) {
-    var doc = cm.view.doc;
+    var doc = cm.doc;
     if (!how) how = "add";
     if (how == "smart") {
-      if (!cm.view.mode.indent) how = "prev";
+      if (!cm.doc.mode.indent) how = "prev";
       else var state = getStateBefore(cm, n);
     }
 
@@ -2276,18 +2581,20 @@
     var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
     var curSpaceString = line.text.match(/^\s*/)[0], indentation;
     if (how == "smart") {
-      indentation = cm.view.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
+      indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
       if (indentation == Pass) {
         if (!aggressive) return;
         how = "prev";
       }
     }
     if (how == "prev") {
-      if (n) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
+      if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
       else indentation = 0;
+    } else if (how == "add") {
+      indentation = curSpace + cm.options.indentUnit;
+    } else if (how == "subtract") {
+      indentation = curSpace - cm.options.indentUnit;
     }
-    else if (how == "add") indentation = curSpace + cm.options.indentUnit;
-    else if (how == "subtract") indentation = curSpace - cm.options.indentUnit;
     indentation = Math.max(0, indentation);
 
     var indentString = "", pos = 0;
@@ -2296,12 +2603,12 @@
     if (pos < indentation) indentString += spaceStr(indentation - pos);
 
     if (indentString != curSpaceString)
-      replaceRange(cm, indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}, "input");
+      replaceRange(cm.doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
     line.stateAfter = null;
   }
 
   function changeLine(cm, handle, op) {
-    var no = handle, line = handle, doc = cm.view.doc;
+    var no = handle, line = handle, doc = cm.doc;
     if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
     else no = lineNo(handle);
     if (no == null) return null;
@@ -2310,12 +2617,13 @@
     return line;
   }
 
-  function findPosH(cm, dir, unit, visually) {
-    var doc = cm.view.doc, end = cm.view.sel.head, line = end.line, ch = end.ch;
+  function findPosH(doc, pos, dir, unit, visually) {
+    var line = pos.line, ch = pos.ch;
     var lineObj = getLine(doc, line);
+    var possible = true;
     function findNextLine() {
       var l = line + dir;
-      if (l < 0 || l == doc.size) return false;
+      if (l < doc.first || l >= doc.first + doc.size) return (possible = false);
       line = l;
       return lineObj = getLine(doc, l);
     }
@@ -2325,22 +2633,50 @@
         if (!boundToLine && findNextLine()) {
           if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
           else ch = dir < 0 ? lineObj.text.length : 0;
-        } else return false;
+        } else return (possible = false);
       } else ch = next;
       return true;
     }
+
     if (unit == "char") moveOnce();
     else if (unit == "column") moveOnce(true);
-    else if (unit == "word") {
-      var sawWord = false;
-      for (;;) {
-        if (dir < 0) if (!moveOnce()) break;
-        if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
-        else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
-        if (dir > 0) if (!moveOnce()) break;
+    else if (unit == "word" || unit == "group") {
+      var sawType = null, group = unit == "group";
+      for (var first = true;; first = false) {
+        if (dir < 0 && !moveOnce(!first)) break;
+        var cur = lineObj.text.charAt(ch) || "\n";
+        var type = isWordChar(cur) ? "w"
+          : !group ? null
+          : /\s/.test(cur) ? null
+          : "p";
+        if (sawType && sawType != type) {
+          if (dir < 0) {dir = 1; moveOnce();}
+          break;
+        }
+        if (type) sawType = type;
+        if (dir > 0 && !moveOnce(!first)) break;
       }
     }
-    return skipAtomic(cm, {line: line, ch: ch}, dir, true);
+    var result = skipAtomic(doc, Pos(line, ch), dir, true);
+    if (!possible) result.hitSide = true;
+    return result;
+  }
+
+  function findPosV(cm, pos, dir, unit) {
+    var doc = cm.doc, x = pos.left, y;
+    if (unit == "page") {
+      var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
+      y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
+    } else if (unit == "line") {
+      y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
+    }
+    for (;;) {
+      var target = coordsChar(cm, x, y);
+      if (!target.outside) break;
+      if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
+      y += dir * 5;
+    }
+    return target;
   }
 
   function findWordAt(line, pos) {
@@ -2348,17 +2684,17 @@
     if (line) {
       if (pos.after === false || end == line.length) --start; else ++end;
       var startChar = line.charAt(start);
-      var check = isWordChar(startChar) ? isWordChar :
-        /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
-      function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
+      var check = isWordChar(startChar) ? isWordChar
+        : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
+        : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
       while (start > 0 && check(line.charAt(start - 1))) --start;
       while (end < line.length && check(line.charAt(end))) ++end;
     }
-    return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};
+    return {from: Pos(pos.line, start), to: Pos(pos.line, end)};
   }
 
   function selectLine(cm, line) {
-    extendSelection(cm, {line: line, ch: 0}, clipPos(cm.view.doc, {line: line + 1, ch: 0}));
+    extendSelection(cm.doc, Pos(line, 0), clipPos(cm.doc, Pos(line + 1, 0)));
   }
 
   // PROTOTYPE
@@ -2367,24 +2703,6 @@
   // 'wrap f in an operation, performed on its `this` parameter'
 
   CodeMirror.prototype = {
-    getValue: function(lineSep) {
-      var text = [], doc = this.view.doc;
-      doc.iter(0, doc.size, function(line) { text.push(line.text); });
-      return text.join(lineSep || "\n");
-    },
-
-    setValue: operation(null, function(code) {
-      var doc = this.view.doc, top = {line: 0, ch: 0}, lastLen = getLine(doc, doc.size-1).text.length;
-      updateDocInner(this, top, {line: doc.size - 1, ch: lastLen}, splitLines(code), top, top, "setValue");
-    }),
-
-    getSelection: function(lineSep) { return this.getRange(this.view.sel.from, this.view.sel.to, lineSep); },
-
-    replaceSelection: operation(null, function(code, collapse, origin) {
-      var sel = this.view.sel;
-      updateDoc(this, sel.from, sel.to, splitLines(code), collapse || "around", origin);
-    }),
-
     focus: function(){window.focus(); focusInput(this); onFocus(this); fastPoll(this);},
 
     setOption: function(option, value) {
@@ -2396,15 +2714,13 @@
     },
 
     getOption: function(option) {return this.options[option];},
-
-    getMode: function() {return this.view.mode;},
+    getDoc: function() {return this.doc;},
 
     addKeyMap: function(map) {
-      this.view.keyMaps.push(map);
+      this.state.keyMaps.push(map);
     },
-
     removeKeyMap: function(map) {
-      var maps = this.view.keyMaps;
+      var maps = this.state.keyMaps;
       for (var i = 0; i < maps.length; ++i)
         if ((typeof map == "string" ? maps[i].name : maps[i]) == map) {
           maps.splice(i, 1);
@@ -2415,84 +2731,42 @@
     addOverlay: operation(null, function(spec, options) {
       var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
       if (mode.startState) throw new Error("Overlays may not be stateful.");
-      this.view.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
-      this.view.modeGen++;
-      regChange(this, 0, this.view.doc.size);
+      this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
+      this.state.modeGen++;
+      regChange(this);
     }),
     removeOverlay: operation(null, function(spec) {
-      var overlays = this.view.overlays;
+      var overlays = this.state.overlays;
       for (var i = 0; i < overlays.length; ++i) {
         if (overlays[i].modeSpec == spec) {
           overlays.splice(i, 1);
-          this.view.modeGen++;
-          regChange(this, 0, this.view.doc.size);
+          this.state.modeGen++;
+          regChange(this);
           return;
         }
       }
     }),
 
-    undo: operation(null, function() {unredoHelper(this, "undo");}),
-    redo: operation(null, function() {unredoHelper(this, "redo");}),
-
     indentLine: operation(null, function(n, dir, aggressive) {
       if (typeof dir != "string") {
         if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
         else dir = dir ? "add" : "subtract";
       }
-      if (isLine(this.view.doc, n)) indentLine(this, n, dir, aggressive);
+      if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);
     }),
-
     indentSelection: operation(null, function(how) {
-      var sel = this.view.sel;
+      var sel = this.doc.sel;
       if (posEq(sel.from, sel.to)) return indentLine(this, sel.from.line, how);
       var e = sel.to.line - (sel.to.ch ? 0 : 1);
       for (var i = sel.from.line; i <= e; ++i) indentLine(this, i, how);
     }),
 
-    historySize: function() {
-      var hist = this.view.history;
-      return {undo: hist.done.length, redo: hist.undone.length};
-    },
-
-    clearHistory: function() {this.view.history = makeHistory();},
-
-    markClean: function() {
-      this.view.history.dirtyCounter = 0;
-      this.view.history.lastOp = this.view.history.lastOrigin = null;
-    },
-
-    isClean: function () {return this.view.history.dirtyCounter == 0;},
-      
-    getHistory: function() {
-      var hist = this.view.history;
-      function cp(arr) {
-        for (var i = 0, nw = [], nwelt; i < arr.length; ++i) {
-          var set = arr[i];
-          nw.push({events: nwelt = [], fromBefore: set.fromBefore, toBefore: set.toBefore,
-                   fromAfter: set.fromAfter, toAfter: set.toAfter});
-          for (var j = 0, elt = set.events; j < elt.length; ++j) {
-            var old = [], cur = elt[j];
-            nwelt.push({start: cur.start, added: cur.added, old: old});
-            for (var k = 0; k < cur.old.length; ++k) old.push(hlText(cur.old[k]));
-          }
-        }
-        return nw;
-      }
-      return {done: cp(hist.done), undone: cp(hist.undone)};
-    },
-
-    setHistory: function(histData) {
-      var hist = this.view.history = makeHistory();
-      hist.done = histData.done;
-      hist.undone = histData.undone;
-    },
-
     // Fetch the parser token for a given character. Useful for hacks
     // that want to inspect the mode state (say, for completion).
     getTokenAt: function(pos) {
-      var doc = this.view.doc;
+      var doc = this.doc;
       pos = clipPos(doc, pos);
-      var state = getStateBefore(this, pos.line), mode = this.view.mode;
+      var state = getStateBefore(this, pos.line), mode = this.doc.mode;
       var line = getLine(doc, pos.line);
       var stream = new StringStream(line.text, this.options.tabSize);
       while (stream.pos < pos.ch && !stream.eol()) {
@@ -2508,52 +2782,30 @@
     },
 
     getStateAfter: function(line) {
-      var doc = this.view.doc;
-      line = clipLine(doc, line == null ? doc.size - 1: line);
+      var doc = this.doc;
+      line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
       return getStateBefore(this, line + 1);
     },
 
     cursorCoords: function(start, mode) {
-      var pos, sel = this.view.sel;
+      var pos, sel = this.doc.sel;
       if (start == null) pos = sel.head;
-      else if (typeof start == "object") pos = clipPos(this.view.doc, start);
+      else if (typeof start == "object") pos = clipPos(this.doc, start);
       else pos = start ? sel.from : sel.to;
       return cursorCoords(this, pos, mode || "page");
     },
 
     charCoords: function(pos, mode) {
-      return charCoords(this, clipPos(this.view.doc, pos), mode || "page");
+      return charCoords(this, clipPos(this.doc, pos), mode || "page");
     },
 
-    coordsChar: function(coords) {
-      var off = this.display.lineSpace.getBoundingClientRect();
-      return coordsChar(this, coords.left - off.left, coords.top - off.top);
+    coordsChar: function(coords, mode) {
+      coords = fromCoordSystem(this, coords, mode || "page");
+      return coordsChar(this, coords.left, coords.top);
     },
 
     defaultTextHeight: function() { return textHeight(this.display); },
-
-    markText: operation(null, function(from, to, options) {
-      return markText(this, clipPos(this.view.doc, from), clipPos(this.view.doc, to),
-                      options, "range");
-    }),
-
-    setBookmark: operation(null, function(pos, widget) {
-      pos = clipPos(this.view.doc, pos);
-      return markText(this, pos, pos, widget ? {replacedWith: widget} : {}, "bookmark");
-    }),
-
-    findMarksAt: function(pos) {
-      var doc = this.view.doc;
-      pos = clipPos(doc, pos);
-      var markers = [], spans = getLine(doc, pos.line).markedSpans;
-      if (spans) for (var i = 0; i < spans.length; ++i) {
-        var span = spans[i];
-        if ((span.from == null || span.from <= pos.ch) &&
-            (span.to == null || span.to >= pos.ch))
-          markers.push(span.marker);
-      }
-      return markers;
-    },
+    defaultCharWidth: function() { return charWidth(this.display); },
 
     setGutterMarker: operation(null, function(line, gutterID, value) {
       return changeLine(this, line, function(line) {
@@ -2565,8 +2817,8 @@
     }),
 
     clearGutter: operation(null, function(gutterID) {
-      var i = 0, cm = this, doc = cm.view.doc;
-      doc.iter(0, doc.size, function(line) {
+      var cm = this, doc = cm.doc, i = doc.first;
+      doc.iter(function(line) {
         if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
           line.gutterMarkers[gutterID] = null;
           regChange(cm, i, i + 1);
@@ -2602,31 +2854,16 @@
     }),
 
     addLineWidget: operation(null, function(handle, node, options) {
-      var widget = options || {};
-      widget.node = node;
-      if (widget.noHScroll) this.display.alignWidgets = true;
-      changeLine(this, handle, function(line) {
-        (line.widgets || (line.widgets = [])).push(widget);
-        widget.line = line;
-        return true;
-      });
-      return widget;
+      return addLineWidget(this, handle, node, options);
     }),
 
-    removeLineWidget: operation(null, function(widget) {
-      var ws = widget.line.widgets, no = lineNo(widget.line);
-      if (no == null || !ws) return;
-      for (var i = 0; i < ws.length; ++i) if (ws[i] == widget) ws.splice(i--, 1);
-      var newHeight = widget.node.offsetHeight ? widget.line.height - widget.node.offsetHeight : textHeight(this.display);
-      updateLineHeight(widget.line, newHeight);
-      regChange(this, no, no + 1);
-    }),
+    removeLineWidget: function(widget) { widget.clear(); },
 
     lineInfo: function(line) {
       if (typeof line == "number") {
-        if (!isLine(this.view.doc, line)) return null;
+        if (!isLine(this.doc, line)) return null;
         var n = line;
-        line = getLine(this.view.doc, line);
+        line = getLine(this.doc, line);
         if (!line) return null;
       } else {
         var n = lineNo(line);
@@ -2641,16 +2878,20 @@
 
     addWidget: function(pos, node, scroll, vert, horiz) {
       var display = this.display;
-      pos = cursorCoords(this, clipPos(this.view.doc, pos));
-      var top = pos.top, left = pos.left;
+      pos = cursorCoords(this, clipPos(this.doc, pos));
+      var top = pos.bottom, left = pos.left;
       node.style.position = "absolute";
       display.sizer.appendChild(node);
-      if (vert == "over") top = pos.top;
-      else if (vert == "near") {
-        var vspace = Math.max(display.wrapper.clientHeight, this.view.doc.height),
+      if (vert == "over") {
+        top = pos.top;
+      } else if (vert == "above" || vert == "near") {
+        var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
         hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
-        if (pos.bottom + node.offsetHeight > vspace && pos.top > node.offsetHeight)
+        // Default to positioning above (if specified and possible); otherwise default to positioning below
+        if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
           top = pos.top - node.offsetHeight;
+        else if (pos.bottom + node.offsetHeight <= vspace)
+          top = pos.bottom;
         if (left + node.offsetWidth > hspace)
           left = hspace - node.offsetWidth;
       }
@@ -2668,147 +2909,71 @@
         scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
     },
 
-    lineCount: function() {return this.view.doc.size;},
-
-    clipPos: function(pos) {return clipPos(this.view.doc, pos);},
-
-    getCursor: function(start) {
-      var sel = this.view.sel, pos;
-      if (start == null || start == "head") pos = sel.head;
-      else if (start == "anchor") pos = sel.anchor;
-      else if (start == "end" || start === false) pos = sel.to;
-      else pos = sel.from;
-      return copyPos(pos);
-    },
-
-    somethingSelected: function() {return !posEq(this.view.sel.from, this.view.sel.to);},
-
-    setCursor: operation(null, function(line, ch, extend) {
-      var pos = clipPos(this.view.doc, typeof line == "number" ? {line: line, ch: ch || 0} : line);
-      if (extend) extendSelection(this, pos);
-      else setSelection(this, pos, pos);
-    }),
-
-    setSelection: operation(null, function(anchor, head) {
-      var doc = this.view.doc;
-      setSelection(this, clipPos(doc, anchor), clipPos(doc, head || anchor));
-    }),
-
-    extendSelection: operation(null, function(from, to) {
-      var doc = this.view.doc;
-      extendSelection(this, clipPos(doc, from), to && clipPos(doc, to));
-    }),
-
-    setExtending: function(val) {this.view.sel.extend = val;},
-
-    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
-
-    getLineHandle: function(line) {
-      var doc = this.view.doc;
-      if (isLine(doc, line)) return getLine(doc, line);
-    },
-
-    getLineNumber: function(line) {return lineNo(line);},
-
-    setLine: operation(null, function(line, text) {
-      if (isLine(this.view.doc, line))
-        replaceRange(this, text, {line: line, ch: 0}, {line: line, ch: getLine(this.view.doc, line).text.length});
-    }),
-
-    removeLine: operation(null, function(line) {
-      if (isLine(this.view.doc, line))
-        replaceRange(this, "", {line: line, ch: 0}, clipPos(this.view.doc, {line: line+1, ch: 0}));
-    }),
-
-    replaceRange: operation(null, function(code, from, to) {
-      var doc = this.view.doc;
-      from = clipPos(doc, from);
-      to = to ? clipPos(doc, to) : from;
-      return replaceRange(this, code, from, to);
-    }),
-
-    getRange: function(from, to, lineSep) {
-      var doc = this.view.doc;
-      from = clipPos(doc, from); to = clipPos(doc, to);
-      var l1 = from.line, l2 = to.line;
-      if (l1 == l2) return getLine(doc, l1).text.slice(from.ch, to.ch);
-      var code = [getLine(doc, l1).text.slice(from.ch)];
-      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
-      code.push(getLine(doc, l2).text.slice(0, to.ch));
-      return code.join(lineSep || "\n");
-    },
-
     triggerOnKeyDown: operation(null, onKeyDown),
 
     execCommand: function(cmd) {return commands[cmd](this);},
 
-    // Stuff used by commands, probably not much use to outside code.
+    findPosH: function(from, amount, unit, visually) {
+      var dir = 1;
+      if (amount < 0) { dir = -1; amount = -amount; }
+      for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
+        cur = findPosH(this.doc, cur, dir, unit, visually);
+        if (cur.hitSide) break;
+      }
+      return cur;
+    },
+
     moveH: operation(null, function(dir, unit) {
-      var sel = this.view.sel, pos = dir < 0 ? sel.from : sel.to;
+      var sel = this.doc.sel, pos;
       if (sel.shift || sel.extend || posEq(sel.from, sel.to))
-        pos = findPosH(this, dir, unit, this.options.rtlMoveVisually);
-      extendSelection(this, pos, pos, dir);
+        pos = findPosH(this.doc, sel.head, dir, unit, this.options.rtlMoveVisually);
+      else
+        pos = dir < 0 ? sel.from : sel.to;
+      extendSelection(this.doc, pos, pos, dir);
     }),
 
     deleteH: operation(null, function(dir, unit) {
-      var sel = this.view.sel;
-      if (!posEq(sel.from, sel.to)) replaceRange(this, "", sel.from, sel.to, "delete");
-      else replaceRange(this, "", sel.from, findPosH(this, dir, unit, false), "delete");
+      var sel = this.doc.sel;
+      if (!posEq(sel.from, sel.to)) replaceRange(this.doc, "", sel.from, sel.to, "+delete");
+      else replaceRange(this.doc, "", sel.from, findPosH(this.doc, sel.head, dir, unit, false), "+delete");
       this.curOp.userSelChange = true;
     }),
 
-    moveV: operation(null, function(dir, unit) {
-      var view = this.view, doc = view.doc, display = this.display;
-      var cur = view.sel.head, pos = cursorCoords(this, cur, "div");
-      var x = pos.left, y;
-      if (view.goalColumn != null) x = view.goalColumn;
-      if (unit == "page") {
-        var pageSize = Math.min(display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
-        y = pos.top + dir * pageSize;
-      } else if (unit == "line") {
-        y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
+    findPosV: function(from, amount, unit, goalColumn) {
+      var dir = 1, x = goalColumn;
+      if (amount < 0) { dir = -1; amount = -amount; }
+      for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
+        var coords = cursorCoords(this, cur, "div");
+        if (x == null) x = coords.left;
+        else coords.left = x;
+        cur = findPosV(this, coords, dir, unit);
+        if (cur.hitSide) break;
       }
-      do {
-        var target = coordsChar(this, x, y);
-        y += dir * 5;
-      } while (target.outside && (dir < 0 ? y > 0 : y < doc.height));
+      return cur;
+    },
 
-      if (unit == "page") display.scrollbarV.scrollTop += charCoords(this, target, "div").top - pos.top;
-      extendSelection(this, target, target, dir);
-      view.goalColumn = x;
+    moveV: operation(null, function(dir, unit) {
+      var sel = this.doc.sel;
+      var pos = cursorCoords(this, sel.head, "div");
+      if (sel.goalColumn != null) pos.left = sel.goalColumn;
+      var target = findPosV(this, pos, dir, unit);
+
+      if (unit == "page") addToScrollPos(this, 0, charCoords(this, target, "div").top - pos.top);
+      extendSelection(this.doc, target, target, dir);
+      sel.goalColumn = pos.left;
     }),
 
     toggleOverwrite: function() {
-      if (this.view.overwrite = !this.view.overwrite)
+      if (this.state.overwrite = !this.state.overwrite)
         this.display.cursor.className += " CodeMirror-overwrite";
       else
         this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "");
     },
+    hasFocus: function() { return this.state.focused; },
 
-    posFromIndex: function(off) {
-      var lineNo = 0, ch, doc = this.view.doc;
-      doc.iter(0, doc.size, function(line) {
-        var sz = line.text.length + 1;
-        if (sz > off) { ch = off; return true; }
-        off -= sz;
-        ++lineNo;
-      });
-      return clipPos(doc, {line: lineNo, ch: ch});
-    },
-    indexFromPos: function (coords) {
-      coords = clipPos(this.view.doc, coords);
-      var index = coords.ch;
-      this.view.doc.iter(0, coords.line, function (line) {
-        index += line.text.length + 1;
-      });
-      return index;
-    },
-
-    scrollTo: function(x, y) {
-      if (x != null) this.display.scrollbarH.scrollLeft = this.display.scroller.scrollLeft = x;
-      if (y != null) this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = y;
-      updateDisplay(this, []);
-    },
+    scrollTo: operation(null, function(x, y) {
+      updateScrollPos(this, x, y);
+    }),
     getScrollInfo: function() {
       var scroller = this.display.scroller, co = scrollerCutOff;
       return {left: scroller.scrollLeft, top: scroller.scrollTop,
@@ -2816,13 +2981,13 @@
               clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
     },
 
-    scrollIntoView: function(pos) {
-      if (typeof pos == "number") pos = {line: pos, ch: 0};
+    scrollIntoView: function(pos, margin) {
+      if (typeof pos == "number") pos = Pos(pos, 0);
       if (!pos || pos.line != null) {
-        pos = pos ? clipPos(this.view.doc, pos) : this.view.sel.head;
-        scrollPosIntoView(this, pos);
+        pos = pos ? clipPos(this.doc, pos) : this.doc.sel.head;
+        scrollPosIntoView(this, pos, margin);
       } else {
-        scrollIntoView(this, pos.left, pos.top, pos.right, pos.bottom);
+        scrollIntoView(this, pos.left, pos.top - margin, pos.right, pos.bottom + margin);
       }
     },
 
@@ -2838,14 +3003,22 @@
     on: function(type, f) {on(this, type, f);},
     off: function(type, f) {off(this, type, f);},
 
-    operation: function(f){return operation(this, f)();},
+    operation: function(f){return runInOp(this, f);},
 
-    refresh: function() {
+    refresh: operation(null, function() {
       clearCaches(this);
-      if (this.display.scroller.scrollHeight > this.view.scrollTop)
-        this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = this.view.scrollTop;
-      updateDisplay(this, true);
-    },
+      updateScrollPos(this, this.doc.scrollLeft, this.doc.scrollTop);
+      regChange(this);
+    }),
+
+    swapDoc: operation(null, function(doc) {
+      var old = this.doc;
+      old.cm = null;
+      attachDoc(this, doc);
+      clearCaches(this);
+      updateScrollPos(this, doc.scrollLeft, doc.scrollTop);
+      return old;
+    }),
 
     getInputField: function(){return this.display.input;},
     getWrapperElement: function(){return this.display.wrapper;},
@@ -2870,8 +3043,13 @@
 
   // These two are, on init, called from the constructor because they
   // have to be initialized before the editor can start at all.
-  option("value", "", function(cm, val) {cm.setValue(val);}, true);
-  option("mode", null, loadMode, true);
+  option("value", "", function(cm, val) {
+    cm.setValue(val);
+  }, true);
+  option("mode", null, function(cm, val) {
+    cm.doc.modeOption = val;
+    loadMode(cm);
+  }, true);
 
   option("indentUnit", 2, loadMode, true);
   option("indentWithTabs", false);
@@ -2879,7 +3057,7 @@
   option("tabSize", 4, function(cm) {
     loadMode(cm);
     clearCaches(cm);
-    updateDisplay(cm, true);
+    regChange(cm);
   }, true);
   option("electricChars", true);
   option("rtlMoveVisually", !windows);
@@ -2899,6 +3077,10 @@
     setGuttersForLineNumbers(cm.options);
     guttersChanged(cm);
   }, true);
+  option("fixedGutter", true, function(cm, val) {
+    cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
+    cm.refresh();
+  }, true);
   option("lineNumbers", false, function(cm) {
     setGuttersForLineNumbers(cm.options);
     guttersChanged(cm);
@@ -2906,7 +3088,7 @@
   option("firstLineNumber", 1, guttersChanged, true);
   option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
   option("showCursorWhenSelecting", false, updateSelection, true);
-  
+
   option("readOnly", false, function(cm, val) {
     if (val == "nocursor") {onBlur(cm); cm.display.input.blur();}
     else if (!val) resetInput(cm, true);
@@ -2919,7 +3101,7 @@
   option("workDelay", 100);
   option("flattenSpans", true);
   option("pollInterval", 100);
-  option("undoDepth", 40);
+  option("undoDepth", 40, function(cm, val){cm.doc.history.undoDepth = val;});
   option("viewportMargin", 10, function(cm){cm.refresh();}, true);
 
   option("tabindex", null, function(cm, val) {
@@ -2979,8 +3161,7 @@
   var modeExtensions = CodeMirror.modeExtensions = {};
   CodeMirror.extendMode = function(mode, properties) {
     var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
-    for (var prop in properties) if (properties.hasOwnProperty(prop))
-      exts[prop] = properties[prop];
+    copyObj(properties, exts);
   };
 
   // EXTENSIONS
@@ -3028,21 +3209,21 @@
   // STANDARD COMMANDS
 
   var commands = CodeMirror.commands = {
-    selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
+    selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()));},
     killLine: function(cm) {
       var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
       if (!sel && cm.getLine(from.line).length == from.ch)
-        cm.replaceRange("", from, {line: from.line + 1, ch: 0}, "delete");
-      else cm.replaceRange("", from, sel ? to : {line: from.line}, "delete");
+        cm.replaceRange("", from, Pos(from.line + 1, 0), "+delete");
+      else cm.replaceRange("", from, sel ? to : Pos(from.line), "+delete");
     },
     deleteLine: function(cm) {
       var l = cm.getCursor().line;
-      cm.replaceRange("", {line: l, ch: 0}, {line: l}, "delete");
+      cm.replaceRange("", Pos(l, 0), Pos(l), "+delete");
     },
     undo: function(cm) {cm.undo();},
     redo: function(cm) {cm.redo();},
-    goDocStart: function(cm) {cm.extendSelection({line: 0, ch: 0});},
-    goDocEnd: function(cm) {cm.extendSelection({line: cm.lineCount() - 1});},
+    goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},
+    goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},
     goLineStart: function(cm) {
       cm.extendSelection(lineStart(cm, cm.getCursor().line));
     },
@@ -3053,12 +3234,20 @@
       if (!order || order[0].level == 0) {
         var firstNonWS = Math.max(0, line.text.search(/\S/));
         var inWS = cur.line == start.line && cur.ch <= firstNonWS && cur.ch;
-        cm.extendSelection({line: start.line, ch: inWS ? 0 : firstNonWS});
+        cm.extendSelection(Pos(start.line, inWS ? 0 : firstNonWS));
       } else cm.extendSelection(start);
     },
     goLineEnd: function(cm) {
       cm.extendSelection(lineEnd(cm, cm.getCursor().line));
     },
+    goLineRight: function(cm) {
+      var top = cm.charCoords(cm.getCursor(), "div").top + 5;
+      cm.extendSelection(cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"));
+    },
+    goLineLeft: function(cm) {
+      var top = cm.charCoords(cm.getCursor(), "div").top + 5;
+      cm.extendSelection(cm.coordsChar({left: 0, top: top}, "div"));
+    },
     goLineUp: function(cm) {cm.moveV(-1, "line");},
     goLineDown: function(cm) {cm.moveV(1, "line");},
     goPageUp: function(cm) {cm.moveV(-1, "page");},
@@ -3068,28 +3257,32 @@
     goColumnLeft: function(cm) {cm.moveH(-1, "column");},
     goColumnRight: function(cm) {cm.moveH(1, "column");},
     goWordLeft: function(cm) {cm.moveH(-1, "word");},
+    goGroupRight: function(cm) {cm.moveH(1, "group");},
+    goGroupLeft: function(cm) {cm.moveH(-1, "group");},
     goWordRight: function(cm) {cm.moveH(1, "word");},
     delCharBefore: function(cm) {cm.deleteH(-1, "char");},
     delCharAfter: function(cm) {cm.deleteH(1, "char");},
     delWordBefore: function(cm) {cm.deleteH(-1, "word");},
     delWordAfter: function(cm) {cm.deleteH(1, "word");},
+    delGroupBefore: function(cm) {cm.deleteH(-1, "group");},
+    delGroupAfter: function(cm) {cm.deleteH(1, "group");},
     indentAuto: function(cm) {cm.indentSelection("smart");},
     indentMore: function(cm) {cm.indentSelection("add");},
     indentLess: function(cm) {cm.indentSelection("subtract");},
-    insertTab: function(cm) {cm.replaceSelection("\t", "end", "input");},
+    insertTab: function(cm) {cm.replaceSelection("\t", "end", "+input");},
     defaultTab: function(cm) {
       if (cm.somethingSelected()) cm.indentSelection("add");
-      else cm.replaceSelection("\t", "end", "input");
+      else cm.replaceSelection("\t", "end", "+input");
     },
     transposeChars: function(cm) {
       var cur = cm.getCursor(), line = cm.getLine(cur.line);
       if (cur.ch > 0 && cur.ch < line.length - 1)
         cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
-                        {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
+                        Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
     },
     newlineAndIndent: function(cm) {
       operation(cm, function() {
-        cm.replaceSelection("\n", "end", "input");
+        cm.replaceSelection("\n", "end", "+input");
         cm.indentLine(cm.getCursor().line, null, true);
       })();
     },
@@ -3110,17 +3303,17 @@
   keyMap.pcDefault = {
     "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
     "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
-    "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
-    "Ctrl-Backspace": "delWordBefore", "Ctrl-Delete": "delWordAfter", "Ctrl-S": "save", "Ctrl-F": "find",
+    "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
+    "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
     "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
     "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
     fallthrough: "basic"
   };
   keyMap.macDefault = {
     "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
-    "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft",
-    "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordBefore",
-    "Ctrl-Alt-Backspace": "delWordAfter", "Alt-Delete": "delWordAfter", "Cmd-S": "save", "Cmd-F": "find",
+    "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
+    "Alt-Right": "goGroupRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delGroupBefore",
+    "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
     "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
     "Cmd-[": "indentLess", "Cmd-]": "indentMore",
     fallthrough: ["basic", "emacsy"]
@@ -3140,37 +3333,46 @@
     else return val;
   }
 
-  function lookupKey(name, maps, handle, stop) {
+  function lookupKey(name, maps, handle) {
     function lookup(map) {
       map = getKeyMap(map);
       var found = map[name];
-      if (found === false) {
-        if (stop) stop();
-        return true;
-      }
+      if (found === false) return "stop";
       if (found != null && handle(found)) return true;
-      if (map.nofallthrough) {
-        if (stop) stop();
-        return true;
-      }
+      if (map.nofallthrough) return "stop";
+
       var fallthrough = map.fallthrough;
       if (fallthrough == null) return false;
       if (Object.prototype.toString.call(fallthrough) != "[object Array]")
         return lookup(fallthrough);
       for (var i = 0, e = fallthrough.length; i < e; ++i) {
-        if (lookup(fallthrough[i])) return true;
+        var done = lookup(fallthrough[i]);
+        if (done) return done;
       }
       return false;
     }
 
-    for (var i = 0; i < maps.length; ++i)
-      if (lookup(maps[i])) return true;
+    for (var i = 0; i < maps.length; ++i) {
+      var done = lookup(maps[i]);
+      if (done) return done;
+    }
   }
   function isModifierKey(event) {
-    var name = keyNames[e_prop(event, "keyCode")];
+    var name = keyNames[event.keyCode];
     return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
   }
+  function keyName(event, noShift) {
+    var name = keyNames[event.keyCode];
+    if (name == null || event.altGraphKey) return false;
+    if (event.altKey) name = "Alt-" + name;
+    if (flipCtrlCmd ? event.metaKey : event.ctrlKey) name = "Ctrl-" + name;
+    if (flipCtrlCmd ? event.ctrlKey : event.metaKey) name = "Cmd-" + name;
+    if (!noShift && event.shiftKey) name = "Shift-" + name;
+    return name;
+  }
+  CodeMirror.lookupKey = lookupKey;
   CodeMirror.isModifierKey = isModifierKey;
+  CodeMirror.keyName = keyName;
 
   // FROMTEXTAREA
 
@@ -3179,6 +3381,8 @@
     options.value = textarea.value;
     if (!options.tabindex && textarea.tabindex)
       options.tabindex = textarea.tabindex;
+    if (!options.placeholder && textarea.placeholder)
+      options.placeholder = textarea.placeholder;
     // Set autofocus to true if this textarea is focused, or if it has
     // autofocus and no other element is focused.
     if (options.autofocus == null) {
@@ -3191,17 +3395,19 @@
 
     function save() {textarea.value = cm.getValue();}
     if (textarea.form) {
-      // Deplorable hack to make the submit method do the right thing.
       on(textarea.form, "submit", save);
-      var form = textarea.form, realSubmit = form.submit;
-      try {
-        form.submit = function wrappedSubmit() {
-          save();
-          form.submit = realSubmit;
-          form.submit();
-          form.submit = wrappedSubmit;
-        };
-      } catch(e) {}
+      // Deplorable hack to make the submit method do the right thing.
+      if (!options.leaveSubmitMethodAlone) {
+        var form = textarea.form, realSubmit = form.submit;
+        try {
+          var wrappedSubmit = form.submit = function() {
+            save();
+            form.submit = realSubmit;
+            form.submit();
+            form.submit = wrappedSubmit;
+          };
+        } catch(e) {}
+      }
     }
 
     textarea.style.display = "none";
@@ -3233,6 +3439,7 @@
     this.pos = this.start = 0;
     this.string = string;
     this.tabSize = tabSize || 8;
+    this.lastColumnPos = this.lastColumnValue = 0;
   }
 
   StringStream.prototype = {
@@ -3265,12 +3472,19 @@
       if (found > -1) {this.pos = found; return true;}
     },
     backUp: function(n) {this.pos -= n;},
-    column: function() {return countColumn(this.string, this.start, this.tabSize);},
+    column: function() {
+      if (this.lastColumnPos < this.start) {
+        this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
+        this.lastColumnPos = this.start;
+      }
+      return this.lastColumnValue;
+    },
     indentation: function() {return countColumn(this.string, null, this.tabSize);},
     match: function(pattern, consume, caseInsensitive) {
       if (typeof pattern == "string") {
         var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
-        if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
+        var substr = this.string.substr(this.pos, pattern.length);
+        if (cased(substr) == cased(pattern)) {
           if (consume !== false) this.pos += pattern.length;
           return true;
         }
@@ -3287,15 +3501,17 @@
 
   // TEXTMARKERS
 
-  function TextMarker(cm, type) {
+  function TextMarker(doc, type) {
     this.lines = [];
     this.type = type;
-    this.cm = cm;
+    this.doc = doc;
   }
+  CodeMirror.TextMarker = TextMarker;
 
   TextMarker.prototype.clear = function() {
     if (this.explicitlyCleared) return;
-    startOperation(this.cm);
+    var cm = this.doc.cm, withOp = cm && !cm.curOp;
+    if (withOp) startOperation(cm);
     var min = null, max = null;
     for (var i = 0; i < this.lines.length; ++i) {
       var line = this.lines[i];
@@ -3304,18 +3520,27 @@
       line.markedSpans = removeMarkedSpan(line.markedSpans, span);
       if (span.from != null)
         min = lineNo(line);
-      else if (this.collapsed && !lineIsHidden(line))
-        updateLineHeight(line, textHeight(this.cm.display));
+      else if (this.collapsed && !lineIsHidden(this.doc, line) && cm)
+        updateLineHeight(line, textHeight(cm.display));
     }
-    if (min != null) regChange(this.cm, min, max + 1);
+    if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {
+      var visual = visualLine(cm.doc, this.lines[i]), len = lineLength(cm.doc, visual);
+      if (len > cm.display.maxLineLength) {
+        cm.display.maxLine = visual;
+        cm.display.maxLineLength = len;
+        cm.display.maxLineChanged = true;
+      }
+    }
+
+    if (min != null && cm) regChange(cm, min, max + 1);
     this.lines.length = 0;
     this.explicitlyCleared = true;
-    if (this.collapsed && this.cm.view.cantEdit) {
-      this.cm.view.cantEdit = false;
-      reCheckSelection(this.cm);
+    if (this.collapsed && this.doc.cantEdit) {
+      this.doc.cantEdit = false;
+      if (cm) reCheckSelection(cm);
     }
-    endOperation(this.cm);
-    signalLater(this.cm, this, "clear");
+    if (withOp) endOperation(cm);
+    signalLater(this, "clear");
   };
 
   TextMarker.prototype.find = function() {
@@ -3325,28 +3550,59 @@
       var span = getMarkedSpanFor(line.markedSpans, this);
       if (span.from != null || span.to != null) {
         var found = lineNo(line);
-        if (span.from != null) from = {line: found, ch: span.from};
-        if (span.to != null) to = {line: found, ch: span.to};
+        if (span.from != null) from = Pos(found, span.from);
+        if (span.to != null) to = Pos(found, span.to);
       }
     }
     if (this.type == "bookmark") return from;
     return from && {from: from, to: to};
   };
 
-  function markText(cm, from, to, options, type) {
-    var doc = cm.view.doc;
-    var marker = new TextMarker(cm, type);
+  TextMarker.prototype.getOptions = function(copyWidget) {
+    var repl = this.replacedWith;
+    return {className: this.className,
+            inclusiveLeft: this.inclusiveLeft, inclusiveRight: this.inclusiveRight,
+            atomic: this.atomic,
+            collapsed: this.collapsed,
+            clearOnEnter: this.clearOnEnter,
+            replacedWith: copyWidget ? repl && repl.cloneNode(true) : repl,
+            readOnly: this.readOnly,
+            startStyle: this.startStyle, endStyle: this.endStyle};
+  };
+
+  TextMarker.prototype.attachLine = function(line) {
+    if (!this.lines.length && this.doc.cm) {
+      var op = this.doc.cm.curOp;
+      if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
+        (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);
+    }
+    this.lines.push(line);
+  };
+  TextMarker.prototype.detachLine = function(line) {
+    this.lines.splice(indexOf(this.lines, line), 1);
+    if (!this.lines.length && this.doc.cm) {
+      var op = this.doc.cm.curOp;
+      (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
+    }
+  };
+
+  function markText(doc, from, to, options, type) {
+    if (options && options.shared) return markTextShared(doc, from, to, options, type);
+    if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);
+
+    var marker = new TextMarker(doc, type);
     if (type == "range" && !posLess(from, to)) return marker;
-    if (options) for (var opt in options) if (options.hasOwnProperty(opt))
-      marker[opt] = options[opt];
+    if (options) copyObj(options, marker);
     if (marker.replacedWith) {
       marker.collapsed = true;
       marker.replacedWith = elt("span", [marker.replacedWith], "CodeMirror-widget");
     }
     if (marker.collapsed) sawCollapsedSpans = true;
 
-    var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd;
+    var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd, cm = doc.cm, updateMaxLine;
     doc.iter(curLine, to.line + 1, function(line) {
+      if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(doc, line) == cm.display.maxLine)
+        updateMaxLine = true;
       var span = {from: null, to: null, marker: marker};
       size += line.text.length;
       if (curLine == from.line) {span.from = from.ch; size -= from.ch;}
@@ -3357,15 +3613,16 @@
         else updateLineHeight(line, 0);
       }
       addMarkedSpan(line, span);
-      if (marker.collapsed && curLine == from.line && lineIsHidden(line))
-        updateLineHeight(line, 0);
       ++curLine;
     });
+    if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {
+      if (lineIsHidden(doc, line)) updateLineHeight(line, 0);
+    });
 
     if (marker.readOnly) {
       sawReadOnlySpans = true;
-      if (cm.view.history.done.length || cm.view.history.undone.length)
-        cm.clearHistory();
+      if (doc.history.done.length || doc.history.undone.length)
+        doc.clearHistory();
     }
     if (marker.collapsed) {
       if (collapsedAtStart != collapsedAtEnd)
@@ -3373,12 +3630,58 @@
       marker.size = size;
       marker.atomic = true;
     }
-    if (marker.className || marker.startStyle || marker.endStyle || marker.collapsed)
-      regChange(cm, from.line, to.line + 1);
-    if (marker.atomic) reCheckSelection(cm);
+    if (cm) {
+      if (updateMaxLine) cm.curOp.updateMaxLine = true;
+      if (marker.className || marker.startStyle || marker.endStyle || marker.collapsed)
+        regChange(cm, from.line, to.line + 1);
+      if (marker.atomic) reCheckSelection(cm);
+    }
     return marker;
   }
 
+  // SHARED TEXTMARKERS
+
+  function SharedTextMarker(markers, primary) {
+    this.markers = markers;
+    this.primary = primary;
+    for (var i = 0, me = this; i < markers.length; ++i) {
+      markers[i].parent = this;
+      on(markers[i], "clear", function(){me.clear();});
+    }
+  }
+  CodeMirror.SharedTextMarker = SharedTextMarker;
+
+  SharedTextMarker.prototype.clear = function() {
+    if (this.explicitlyCleared) return;
+    this.explicitlyCleared = true;
+    for (var i = 0; i < this.markers.length; ++i)
+      this.markers[i].clear();
+    signalLater(this, "clear");
+  };
+  SharedTextMarker.prototype.find = function() {
+    return this.primary.find();
+  };
+  SharedTextMarker.prototype.getOptions = function(copyWidget) {
+    var inner = this.primary.getOptions(copyWidget);
+    inner.shared = true;
+    return inner;
+  };
+
+  function markTextShared(doc, from, to, options, type) {
+    options = copyObj(options);
+    options.shared = false;
+    var markers = [markText(doc, from, to, options, type)], primary = markers[0];
+    var widget = options.replacedWith;
+    linkedDocs(doc, function(doc) {
+      if (widget) options.replacedWith = widget.cloneNode(true);
+      markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
+      for (var i = 0; i < doc.linked.length; ++i)
+        if (doc.linked[i].isParent) return;
+      primary = lst(markers);
+    });
+    return new SharedTextMarker(markers, primary);
+  }
+
   // TEXTMARKER SPANS
 
   function getMarkedSpanFor(spans, marker) {
@@ -3394,14 +3697,14 @@
   }
   function addMarkedSpan(line, span) {
     line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
-    span.marker.lines.push(line);
+    span.marker.attachLine(line);
   }
 
-  function markedSpansBefore(old, startCh) {
+  function markedSpansBefore(old, startCh, isInsert) {
     if (old) for (var i = 0, nw; i < old.length; ++i) {
       var span = old[i], marker = span.marker;
       var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
-      if (startsBefore || marker.type == "bookmark" && span.from == startCh) {
+      if (startsBefore || marker.type == "bookmark" && span.from == startCh && (!isInsert || !span.marker.insertLeft)) {
         var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
         (nw || (nw = [])).push({from: span.from,
                                 to: endsAfter ? null : span.to,
@@ -3411,11 +3714,11 @@
     return nw;
   }
 
-  function markedSpansAfter(old, startCh, endCh) {
+  function markedSpansAfter(old, endCh, isInsert) {
     if (old) for (var i = 0, nw; i < old.length; ++i) {
       var span = old[i], marker = span.marker;
       var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
-      if (endsAfter || marker.type == "bookmark" && span.from == endCh && span.from != startCh) {
+      if (endsAfter || marker.type == "bookmark" && span.from == endCh && (!isInsert || span.marker.insertLeft)) {
         var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
         (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
                                 to: span.to == null ? null : span.to - endCh,
@@ -3425,14 +3728,18 @@
     return nw;
   }
 
-  function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) {
-    if (!oldFirst && !oldLast) return newText;
+  function stretchSpansOverChange(doc, change) {
+    var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
+    var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
+    if (!oldFirst && !oldLast) return null;
+
+    var startCh = change.from.ch, endCh = change.to.ch, isInsert = posEq(change.from, change.to);
     // Get the spans that 'stick out' on both sides
-    var first = markedSpansBefore(oldFirst, startCh);
-    var last = markedSpansAfter(oldLast, startCh, endCh);
+    var first = markedSpansBefore(oldFirst, startCh, isInsert);
+    var last = markedSpansAfter(oldLast, endCh, isInsert);
 
     // Next, merge those two ends
-    var sameLine = newText.length == 1, offset = lst(newText).length + (sameLine ? startCh : 0);
+    var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
     if (first) {
       // Fix up .to properties of first
       for (var i = 0; i < first.length; ++i) {
@@ -3462,21 +3769,43 @@
       }
     }
 
-    var newMarkers = [newHL(newText[0], first)];
+    var newMarkers = [first];
     if (!sameLine) {
       // Fill gap with whole-line-spans
-      var gap = newText.length - 2, gapMarkers;
+      var gap = change.text.length - 2, gapMarkers;
       if (gap > 0 && first)
         for (var i = 0; i < first.length; ++i)
           if (first[i].to == null)
             (gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker});
       for (var i = 0; i < gap; ++i)
-        newMarkers.push(newHL(newText[i+1], gapMarkers));
-      newMarkers.push(newHL(lst(newText), last));
+        newMarkers.push(gapMarkers);
+      newMarkers.push(last);
     }
     return newMarkers;
   }
 
+  function mergeOldSpans(doc, change) {
+    var old = getOldSpans(doc, change);
+    var stretched = stretchSpansOverChange(doc, change);
+    if (!old) return stretched;
+    if (!stretched) return old;
+
+    for (var i = 0; i < old.length; ++i) {
+      var oldCur = old[i], stretchCur = stretched[i];
+      if (oldCur && stretchCur) {
+        spans: for (var j = 0; j < stretchCur.length; ++j) {
+          var span = stretchCur[j];
+          for (var k = 0; k < oldCur.length; ++k)
+            if (oldCur[k].marker == span.marker) continue spans;
+          oldCur.push(span);
+        }
+      } else if (stretchCur) {
+        old[i] = stretchCur;
+      }
+    }
+    return old;
+  }
+
   function removeReadOnlyRanges(doc, from, to) {
     var markers = null;
     doc.iter(from.line, to.line + 1, function(line) {
@@ -3489,13 +3818,15 @@
     if (!markers) return null;
     var parts = [{from: from, to: to}];
     for (var i = 0; i < markers.length; ++i) {
-      var m = markers[i].find();
+      var mk = markers[i], m = mk.find();
       for (var j = 0; j < parts.length; ++j) {
         var p = parts[j];
-        if (!posLess(m.from, p.to) || posLess(m.to, p.from)) continue;
+        if (posLess(p.to, m.from) || posLess(m.to, p.from)) continue;
         var newParts = [j, 1];
-        if (posLess(p.from, m.from)) newParts.push({from: p.from, to: m.from});
-        if (posLess(m.to, p.to)) newParts.push({from: m.to, to: p.to});
+        if (posLess(p.from, m.from) || !mk.inclusiveLeft && posEq(p.from, m.from))
+          newParts.push({from: p.from, to: m.from});
+        if (posLess(m.to, p.to) || !mk.inclusiveRight && posEq(p.to, m.to))
+          newParts.push({from: m.to, to: p.to});
         parts.splice.apply(parts, newParts);
         j += newParts.length - 1;
       }
@@ -3525,81 +3856,124 @@
     return line;
   }
 
-  function lineIsHidden(line) {
+  function lineIsHidden(doc, line) {
     var sps = sawCollapsedSpans && line.markedSpans;
     if (sps) for (var sp, i = 0; i < sps.length; ++i) {
       sp = sps[i];
       if (!sp.marker.collapsed) continue;
       if (sp.from == null) return true;
-      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(line, sp))
+      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
         return true;
     }
   }
-  window.lineIsHidden = lineIsHidden;
-  function lineIsHiddenInner(line, span) {
-    if (span.to == null || span.marker.inclusiveRight && span.to == line.text.length)
+  function lineIsHiddenInner(doc, line, span) {
+    if (span.to == null) {
+      var end = span.marker.find().to, endLine = getLine(doc, end.line);
+      return lineIsHiddenInner(doc, endLine, getMarkedSpanFor(endLine.markedSpans, span.marker));
+    }
+    if (span.marker.inclusiveRight && span.to == line.text.length)
       return true;
     for (var sp, i = 0; i < line.markedSpans.length; ++i) {
       sp = line.markedSpans[i];
       if (sp.marker.collapsed && sp.from == span.to &&
           (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
-          lineIsHiddenInner(line, sp)) return true;
+          lineIsHiddenInner(doc, line, sp)) return true;
     }
   }
 
-  // hl stands for history-line, a data structure that can be either a
-  // string (line without markers) or a {text, markedSpans} object.
-  function hlText(val) { return typeof val == "string" ? val : val.text; }
-  function hlSpans(val) {
-    if (typeof val == "string") return null;
-    var spans = val.markedSpans, out = null;
-    for (var i = 0; i < spans.length; ++i) {
-      if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
-      else if (out) out.push(spans[i]);
-    }
-    return !out ? spans : out.length ? out : null;
-  }
-  function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; }
-
   function detachMarkedSpans(line) {
     var spans = line.markedSpans;
     if (!spans) return;
-    for (var i = 0; i < spans.length; ++i) {
-      var lines = spans[i].marker.lines;
-      var ix = indexOf(lines, line);
-      lines.splice(ix, 1);
-    }
+    for (var i = 0; i < spans.length; ++i)
+      spans[i].marker.detachLine(line);
     line.markedSpans = null;
   }
 
   function attachMarkedSpans(line, spans) {
     if (!spans) return;
     for (var i = 0; i < spans.length; ++i)
-      spans[i].marker.lines.push(line);
+      spans[i].marker.attachLine(line);
     line.markedSpans = spans;
   }
 
+  // LINE WIDGETS
+
+  var LineWidget = CodeMirror.LineWidget = function(cm, node, options) {
+    for (var opt in options) if (options.hasOwnProperty(opt))
+      this[opt] = options[opt];
+    this.cm = cm;
+    this.node = node;
+  };
+  function widgetOperation(f) {
+    return function() {
+      var withOp = !this.cm.curOp;
+      if (withOp) startOperation(this.cm);
+      try {var result = f.apply(this, arguments);}
+      finally {if (withOp) endOperation(this.cm);}
+      return result;
+    };
+  }
+  LineWidget.prototype.clear = widgetOperation(function() {
+    var ws = this.line.widgets, no = lineNo(this.line);
+    if (no == null || !ws) return;
+    for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);
+    if (!ws.length) this.line.widgets = null;
+    updateLineHeight(this.line, Math.max(0, this.line.height - widgetHeight(this)));
+    regChange(this.cm, no, no + 1);
+  });
+  LineWidget.prototype.changed = widgetOperation(function() {
+    var oldH = this.height;
+    this.height = null;
+    var diff = widgetHeight(this) - oldH;
+    if (!diff) return;
+    updateLineHeight(this.line, this.line.height + diff);
+    var no = lineNo(this.line);
+    regChange(this.cm, no, no + 1);
+  });
+
+  function widgetHeight(widget) {
+    if (widget.height != null) return widget.height;
+    if (!widget.node.parentNode || widget.node.parentNode.nodeType != 1)
+      removeChildrenAndAdd(widget.cm.display.measure, elt("div", [widget.node], null, "position: relative"));
+    return widget.height = widget.node.offsetHeight;
+  }
+
+  function addLineWidget(cm, handle, node, options) {
+    var widget = new LineWidget(cm, node, options);
+    if (widget.noHScroll) cm.display.alignWidgets = true;
+    changeLine(cm, handle, function(line) {
+      (line.widgets || (line.widgets = [])).push(widget);
+      widget.line = line;
+      if (!lineIsHidden(cm.doc, line) || widget.showIfHidden) {
+        var aboveVisible = heightAtLine(cm, line) < cm.display.scroller.scrollTop;
+        updateLineHeight(line, line.height + widgetHeight(widget));
+        if (aboveVisible) addToScrollPos(cm, 0, widget.height);
+      }
+      return true;
+    });
+    return widget;
+  }
+
   // LINE DATA STRUCTURE
 
   // Line objects. These hold state related to a line, including
   // highlighting info (the styles array).
-  function makeLine(text, markedSpans, height) {
-    var line = {text: text, height: height};
+  function makeLine(text, markedSpans, estimateHeight) {
+    var line = {text: text};
     attachMarkedSpans(line, markedSpans);
-    if (lineIsHidden(line)) line.height = 0;
+    line.height = estimateHeight ? estimateHeight(line) : 1;
     return line;
   }
 
-  function updateLine(cm, line, text, markedSpans) {
+  function updateLine(line, text, markedSpans, estimateHeight) {
     line.text = text;
     if (line.stateAfter) line.stateAfter = null;
     if (line.styles) line.styles = null;
     if (line.order != null) line.order = null;
     detachMarkedSpans(line);
     attachMarkedSpans(line, markedSpans);
-    if (lineIsHidden(line)) line.height = 0;
-    else if (!line.height) line.height = textHeight(cm.display);
-    signalLater(cm, line, "change");
+    var estHeight = estimateHeight ? estimateHeight(line) : 1;
+    if (estHeight != line.height) updateLineHeight(line, estHeight);
   }
 
   function cleanUpLine(line) {
@@ -3611,15 +3985,17 @@
   // array, which contains alternating fragments of text and CSS
   // classes.
   function runMode(cm, text, mode, state, f) {
-    var flattenSpans = cm.options.flattenSpans;
+    var flattenSpans = mode.flattenSpans;
+    if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
     var curText = "", curStyle = null;
     var stream = new StringStream(text, cm.options.tabSize);
     if (text == "" && mode.blankLine) mode.blankLine(state);
     while (!stream.eol()) {
       var style = mode.token(stream, state);
       if (stream.pos > 5000) {
+        flattenSpans = false;
         // Webkit seems to refuse to render text nodes longer than 57444 characters
-        stream.pos = Math.min(text.length, stream.pos + 50000);
+        stream.pos = Math.min(text.length, stream.start + 50000);
         style = null;
       }
       var substr = stream.current();
@@ -3635,13 +4011,13 @@
   function highlightLine(cm, line, state) {
     // A styles array always starts with a number identifying the
     // mode/overlays that it is based on (for easy invalidation).
-    var st = [cm.view.modeGen];
+    var st = [cm.state.modeGen];
     // Compute the base array of styles
-    runMode(cm, line.text, cm.view.mode, state, function(txt, style) {st.push(txt, style);});
+    runMode(cm, line.text, cm.doc.mode, state, function(txt, style) {st.push(txt, style);});
 
     // Run overlays, adjust style array.
-    for (var o = 0; o < cm.view.overlays.length; ++o) {
-      var overlay = cm.view.overlays[o], i = 1;
+    for (var o = 0; o < cm.state.overlays.length; ++o) {
+      var overlay = cm.state.overlays[o], i = 1;
       runMode(cm, line.text, overlay.mode, true, function(txt, style) {
         var start = i, len = txt.length;
         // Ensure there's a token end at the current position, and that i points at it
@@ -3672,7 +4048,7 @@
   }
 
   function getLineStyles(cm, line) {
-    if (!line.styles || line.styles[0] != cm.view.modeGen)
+    if (!line.styles || line.styles[0] != cm.state.modeGen)
       line.styles = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line)));
     return line.styles;
   }
@@ -3680,7 +4056,7 @@
   // Lightweight form of highlight -- proceed over this line and
   // update state, but don't save a style array.
   function processLine(cm, line, state) {
-    var mode = cm.view.mode;
+    var mode = cm.doc.mode;
     var stream = new StringStream(line.text, cm.options.tabSize);
     if (line.text == "" && mode.blankLine) mode.blankLine(state);
     while (!stream.eol() && stream.pos <= 5000) {
@@ -3700,7 +4076,7 @@
     var merged, line = realLine, lineBefore, sawBefore, simple = true;
     while (merged = collapsedSpanAtStart(line)) {
       simple = false;
-      line = getLine(cm.view.doc, merged.find().from.line);
+      line = getLine(cm.doc, merged.find().from.line);
       if (!lineBefore) lineBefore = line;
     }
 
@@ -3712,6 +4088,8 @@
       builder.measure = line == realLine && measure;
       builder.pos = 0;
       builder.addToken = builder.measure ? buildTokenMeasure : buildToken;
+      if ((ie || webkit) && cm.getOption("lineWrapping"))
+        builder.addToken = buildTokenSplitSpaces(builder.addToken);
       if (measure && sawBefore && line != realLine && !builder.addedOne) {
         measure[0] = builder.pre.appendChild(zeroWidthElement(cm.display.measure));
         builder.addedOne = true;
@@ -3719,20 +4097,36 @@
       var next = insertLineContent(line, builder, getLineStyles(cm, line));
       sawBefore = line == lineBefore;
       if (next) {
-        line = getLine(cm.view.doc, next.to.line);
+        line = getLine(cm.doc, next.to.line);
         simple = false;
       }
     } while (next);
 
     if (measure && !builder.addedOne)
       measure[0] = builder.pre.appendChild(simple ? elt("span", "\u00a0") : zeroWidthElement(cm.display.measure));
-    if (!builder.pre.firstChild && !lineIsHidden(realLine))
+    if (!builder.pre.firstChild && !lineIsHidden(cm.doc, realLine))
       builder.pre.appendChild(document.createTextNode("\u00a0"));
 
+    var order;
+    // Work around problem with the reported dimensions of single-char
+    // direction spans on IE (issue #1129). See also the comment in
+    // cursorCoords.
+    if (measure && ie && (order = getOrder(line))) {
+      var l = order.length - 1;
+      if (order[l].from == order[l].to) --l;
+      var last = order[l], prev = order[l - 1];
+      if (last.from + 1 == last.to && prev && last.level < prev.level) {
+        var span = measure[builder.pos - 1];
+        if (span) span.parentNode.insertBefore(span.measureRight = zeroWidthElement(cm.display.measure),
+                                               span.nextSibling);
+      }
+    }
+
+    signal(cm, "renderLine", cm, realLine, builder.pre);
     return builder.pre;
   }
 
-  var tokenSpecialChars = /[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;
+  var tokenSpecialChars = /[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;
   function buildToken(builder, text, style, startStyle, endStyle) {
     if (!text) return;
     if (!tokenSpecialChars.test(text)) {
@@ -3772,18 +4166,42 @@
   }
 
   function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
+    var wrapping = builder.cm.options.lineWrapping;
     for (var i = 0; i < text.length; ++i) {
-      if (i && i < text.length - 1 &&
-          builder.cm.options.lineWrapping &&
-          spanAffectsWrapping.test(text.slice(i - 1, i + 1)))
+      var ch = text.charAt(i), start = i == 0;
+      if (ch >= "\ud800" && ch < "\udbff" && i < text.length - 1) {
+        ch = text.slice(i, i + 2);
+        ++i;
+      } else if (i && wrapping &&
+                 spanAffectsWrapping.test(text.slice(i - 1, i + 1))) {
         builder.pre.appendChild(elt("wbr"));
-      builder.measure[builder.pos++] =
-        buildToken(builder, text.charAt(i), style,
-                   i == 0 && startStyle, i == text.length - 1 && endStyle);
+      }
+      var span = builder.measure[builder.pos] =
+        buildToken(builder, ch, style,
+                   start && startStyle, i == text.length - 1 && endStyle);
+      // In IE single-space nodes wrap differently than spaces
+      // embedded in larger text nodes, except when set to
+      // white-space: normal (issue #1268).
+      if (ie && wrapping && ch == " " && i && !/\s/.test(text.charAt(i - 1)) &&
+          i < text.length - 1 && !/\s/.test(text.charAt(i + 1)))
+        span.style.whiteSpace = "normal";
+      builder.pos += ch.length;
     }
     if (text.length) builder.addedOne = true;
   }
 
+  function buildTokenSplitSpaces(inner) {
+    function split(old) {
+      var out = " ";
+      for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0";
+      out += " ";
+      return out;
+    }
+    return function(builder, text, style, startStyle, endStyle) {
+      return inner(builder, text.replace(/ {3,}/, split), style, startStyle, endStyle);
+    };
+  }
+
   function buildCollapsedSpan(builder, size, widget) {
     if (widget) {
       if (!builder.display) widget = widget.cloneNode(true);
@@ -3844,7 +4262,7 @@
           var end = pos + text.length;
           if (!collapsed) {
             var tokenText = end > upto ? text.slice(0, upto - pos) : text;
-            builder.addToken(builder, tokenText, style + spanStyle,
+            builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
                              spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "");
           }
           if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
@@ -3858,6 +4276,52 @@
 
   // DOCUMENT DATA STRUCTURE
 
+  function updateDoc(doc, change, markedSpans, selAfter, estimateHeight) {
+    function spansFor(n) {return markedSpans ? markedSpans[n] : null;}
+    function update(line, text, spans) {
+      updateLine(line, text, spans, estimateHeight);
+      signalLater(line, "change", line, change);
+    }
+
+    var from = change.from, to = change.to, text = change.text;
+    var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
+    var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
+
+    // First adjust the line structure
+    if (from.ch == 0 && to.ch == 0 && lastText == "") {
+      // This is a whole-line replace. Treated specially to make
+      // sure line objects move the way they are supposed to.
+      for (var i = 0, e = text.length - 1, added = []; i < e; ++i)
+        added.push(makeLine(text[i], spansFor(i), estimateHeight));
+      update(lastLine, lastLine.text, lastSpans);
+      if (nlines) doc.remove(from.line, nlines);
+      if (added.length) doc.insert(from.line, added);
+    } else if (firstLine == lastLine) {
+      if (text.length == 1) {
+        update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
+      } else {
+        for (var added = [], i = 1, e = text.length - 1; i < e; ++i)
+          added.push(makeLine(text[i], spansFor(i), estimateHeight));
+        added.push(makeLine(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
+        update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+        doc.insert(from.line + 1, added);
+      }
+    } else if (text.length == 1) {
+      update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
+      doc.remove(from.line + 1, nlines);
+    } else {
+      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+      update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
+      for (var i = 1, e = text.length - 1, added = []; i < e; ++i)
+        added.push(makeLine(text[i], spansFor(i), estimateHeight));
+      if (nlines > 1) doc.remove(from.line + 1, nlines - 1);
+      doc.insert(from.line + 1, added);
+    }
+
+    signalLater(doc, "change", doc, change);
+    setSelection(doc, selAfter.anchor, selAfter.head, null, true);
+  }
+
   function LeafChunk(lines) {
     this.lines = lines;
     this.parent = null;
@@ -3870,19 +4334,19 @@
 
   LeafChunk.prototype = {
     chunkSize: function() { return this.lines.length; },
-    remove: function(at, n, cm) {
+    removeInner: function(at, n) {
       for (var i = at, e = at + n; i < e; ++i) {
         var line = this.lines[i];
         this.height -= line.height;
         cleanUpLine(line);
-        signalLater(cm, line, "delete");
+        signalLater(line, "delete");
       }
       this.lines.splice(at, n);
     },
     collapse: function(lines) {
       lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
     },
-    insertHeight: function(at, lines, height) {
+    insertInner: function(at, lines, height) {
       this.height += height;
       this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
       for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
@@ -3908,13 +4372,13 @@
 
   BranchChunk.prototype = {
     chunkSize: function() { return this.size; },
-    remove: function(at, n, callbacks) {
+    removeInner: function(at, n) {
       this.size -= n;
       for (var i = 0; i < this.children.length; ++i) {
         var child = this.children[i], sz = child.chunkSize();
         if (at < sz) {
           var rm = Math.min(n, sz - at), oldHeight = child.height;
-          child.remove(at, rm, callbacks);
+          child.removeInner(at, rm);
           this.height -= oldHeight - child.height;
           if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
           if ((n -= rm) == 0) break;
@@ -3931,18 +4395,13 @@
     collapse: function(lines) {
       for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
     },
-    insert: function(at, lines) {
-      var height = 0;
-      for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
-      this.insertHeight(at, lines, height);
-    },
-    insertHeight: function(at, lines, height) {
+    insertInner: function(at, lines, height) {
       this.size += lines.length;
       this.height += height;
       for (var i = 0, e = this.children.length; i < e; ++i) {
         var child = this.children[i], sz = child.chunkSize();
         if (at <= sz) {
-          child.insertHeight(at, lines, height);
+          child.insertInner(at, lines, height);
           if (child.lines && child.lines.length > 50) {
             while (child.lines.length > 50) {
               var spilled = child.lines.splice(child.lines.length - 25, 25);
@@ -3979,7 +4438,6 @@
       } while (me.children.length > 10);
       me.parent.maybeSpill();
     },
-    iter: function(from, to, op) { this.iterN(from, to - from, op); },
     iterN: function(at, n, op) {
       for (var i = 0, e = this.children.length; i < e; ++i) {
         var child = this.children[i], sz = child.chunkSize();
@@ -3993,9 +4451,268 @@
     }
   };
 
+  var nextDocId = 0;
+  var Doc = CodeMirror.Doc = function(text, mode, firstLine) {
+    if (!(this instanceof Doc)) return new Doc(text, mode, firstLine);
+    if (firstLine == null) firstLine = 0;
+
+    BranchChunk.call(this, [new LeafChunk([makeLine("", null)])]);
+    this.first = firstLine;
+    this.scrollTop = this.scrollLeft = 0;
+    this.cantEdit = false;
+    this.history = makeHistory();
+    this.frontier = firstLine;
+    var start = Pos(firstLine, 0);
+    this.sel = {from: start, to: start, head: start, anchor: start, shift: false, extend: false, goalColumn: null};
+    this.id = ++nextDocId;
+    this.modeOption = mode;
+
+    if (typeof text == "string") text = splitLines(text);
+    updateDoc(this, {from: start, to: start, text: text}, null, {head: start, anchor: start});
+  };
+
+  Doc.prototype = createObj(BranchChunk.prototype, {
+    iter: function(from, to, op) {
+      if (op) this.iterN(from - this.first, to - from, op);
+      else this.iterN(this.first, this.first + this.size, from);
+    },
+
+    insert: function(at, lines) {
+      var height = 0;
+      for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
+      this.insertInner(at - this.first, lines, height);
+    },
+    remove: function(at, n) { this.removeInner(at - this.first, n); },
+
+    getValue: function(lineSep) {
+      var lines = getLines(this, this.first, this.first + this.size);
+      if (lineSep === false) return lines;
+      return lines.join(lineSep || "\n");
+    },
+    setValue: function(code) {
+      var top = Pos(this.first, 0), last = this.first + this.size - 1;
+      makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
+                        text: splitLines(code), origin: "setValue"},
+                 {head: top, anchor: top}, true);
+    },
+    replaceRange: function(code, from, to, origin) {
+      from = clipPos(this, from);
+      to = to ? clipPos(this, to) : from;
+      replaceRange(this, code, from, to, origin);
+    },
+    getRange: function(from, to, lineSep) {
+      var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
+      if (lineSep === false) return lines;
+      return lines.join(lineSep || "\n");
+    },
+
+    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
+    setLine: function(line, text) {
+      if (isLine(this, line))
+        replaceRange(this, text, Pos(line, 0), clipPos(this, Pos(line)));
+    },
+    removeLine: function(line) {
+      if (isLine(this, line))
+        replaceRange(this, "", Pos(line, 0), clipPos(this, Pos(line + 1, 0)));
+    },
+
+    getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},
+    getLineNumber: function(line) {return lineNo(line);},
+
+    lineCount: function() {return this.size;},
+    firstLine: function() {return this.first;},
+    lastLine: function() {return this.first + this.size - 1;},
+
+    clipPos: function(pos) {return clipPos(this, pos);},
+
+    getCursor: function(start) {
+      var sel = this.sel, pos;
+      if (start == null || start == "head") pos = sel.head;
+      else if (start == "anchor") pos = sel.anchor;
+      else if (start == "end" || start === false) pos = sel.to;
+      else pos = sel.from;
+      return copyPos(pos);
+    },
+    somethingSelected: function() {return !posEq(this.sel.head, this.sel.anchor);},
+
+    setCursor: docOperation(function(line, ch, extend) {
+      var pos = clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line);
+      if (extend) extendSelection(this, pos);
+      else setSelection(this, pos, pos);
+    }),
+    setSelection: docOperation(function(anchor, head) {
+      setSelection(this, clipPos(this, anchor), clipPos(this, head || anchor));
+    }),
+    extendSelection: docOperation(function(from, to) {
+      extendSelection(this, clipPos(this, from), to && clipPos(this, to));
+    }),
+
+    getSelection: function(lineSep) {return this.getRange(this.sel.from, this.sel.to, lineSep);},
+    replaceSelection: function(code, collapse, origin) {
+      makeChange(this, {from: this.sel.from, to: this.sel.to, text: splitLines(code), origin: origin}, collapse || "around");
+    },
+    undo: docOperation(function() {makeChangeFromHistory(this, "undo");}),
+    redo: docOperation(function() {makeChangeFromHistory(this, "redo");}),
+
+    setExtending: function(val) {this.sel.extend = val;},
+
+    historySize: function() {
+      var hist = this.history;
+      return {undo: hist.done.length, redo: hist.undone.length};
+    },
+    clearHistory: function() {this.history = makeHistory();},
+
+    markClean: function() {
+      this.history.dirtyCounter = 0;
+      this.history.lastOp = this.history.lastOrigin = null;
+    },
+    isClean: function () {return this.history.dirtyCounter == 0;},
+
+    getHistory: function() {
+      return {done: copyHistoryArray(this.history.done),
+              undone: copyHistoryArray(this.history.undone)};
+    },
+    setHistory: function(histData) {
+      var hist = this.history = makeHistory();
+      hist.done = histData.done.slice(0);
+      hist.undone = histData.undone.slice(0);
+    },
+
+    markText: function(from, to, options) {
+      return markText(this, clipPos(this, from), clipPos(this, to), options, "range");
+    },
+    setBookmark: function(pos, options) {
+      var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
+                      insertLeft: options && options.insertLeft};
+      pos = clipPos(this, pos);
+      return markText(this, pos, pos, realOpts, "bookmark");
+    },
+    findMarksAt: function(pos) {
+      pos = clipPos(this, pos);
+      var markers = [], spans = getLine(this, pos.line).markedSpans;
+      if (spans) for (var i = 0; i < spans.length; ++i) {
+        var span = spans[i];
+        if ((span.from == null || span.from <= pos.ch) &&
+            (span.to == null || span.to >= pos.ch))
+          markers.push(span.marker.parent || span.marker);
+      }
+      return markers;
+    },
+    getAllMarks: function() {
+      var markers = [];
+      this.iter(function(line) {
+        var sps = line.markedSpans;
+        if (sps) for (var i = 0; i < sps.length; ++i)
+          if (sps[i].from != null) markers.push(sps[i].marker);
+      });
+      return markers;
+    },
+
+    posFromIndex: function(off) {
+      var ch, lineNo = this.first;
+      this.iter(function(line) {
+        var sz = line.text.length + 1;
+        if (sz > off) { ch = off; return true; }
+        off -= sz;
+        ++lineNo;
+      });
+      return clipPos(this, Pos(lineNo, ch));
+    },
+    indexFromPos: function (coords) {
+      coords = clipPos(this, coords);
+      var index = coords.ch;
+      if (coords.line < this.first || coords.ch < 0) return 0;
+      this.iter(this.first, coords.line, function (line) {
+        index += line.text.length + 1;
+      });
+      return index;
+    },
+
+    copy: function(copyHistory) {
+      var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first);
+      doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
+      doc.sel = {from: this.sel.from, to: this.sel.to, head: this.sel.head, anchor: this.sel.anchor,
+                 shift: this.sel.shift, extend: false, goalColumn: this.sel.goalColumn};
+      if (copyHistory) {
+        doc.history.undoDepth = this.history.undoDepth;
+        doc.setHistory(this.getHistory());
+      }
+      return doc;
+    },
+
+    linkedDoc: function(options) {
+      if (!options) options = {};
+      var from = this.first, to = this.first + this.size;
+      if (options.from != null && options.from > from) from = options.from;
+      if (options.to != null && options.to < to) to = options.to;
+      var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from);
+      if (options.sharedHist) copy.history = this.history;
+      (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
+      copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
+      return copy;
+    },
+    unlinkDoc: function(other) {
+      if (other instanceof CodeMirror) other = other.doc;
+      if (this.linked) for (var i = 0; i < this.linked.length; ++i) {
+        var link = this.linked[i];
+        if (link.doc != other) continue;
+        this.linked.splice(i, 1);
+        other.unlinkDoc(this);
+        break;
+      }
+      // If the histories were shared, split them again
+      if (other.history == this.history) {
+        var splitIds = [other.id];
+        linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);
+        other.history = makeHistory();
+        other.history.done = copyHistoryArray(this.history.done, splitIds);
+        other.history.undone = copyHistoryArray(this.history.undone, splitIds);
+      }
+    },
+    iterLinkedDocs: function(f) {linkedDocs(this, f);},
+
+    getMode: function() {return this.mode;},
+    getEditor: function() {return this.cm;}
+  });
+
+  Doc.prototype.eachLine = Doc.prototype.iter;
+
+  // The Doc methods that should be available on CodeMirror instances
+  var dontDelegate = "iter insert remove copy getEditor".split(" ");
+  for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
+    CodeMirror.prototype[prop] = (function(method) {
+      return function() {return method.apply(this.doc, arguments);};
+    })(Doc.prototype[prop]);
+
+  function linkedDocs(doc, f, sharedHistOnly) {
+    function propagate(doc, skip, sharedHist) {
+      if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {
+        var rel = doc.linked[i];
+        if (rel.doc == skip) continue;
+        var shared = sharedHist && rel.sharedHist;
+        if (sharedHistOnly && !shared) continue;
+        f(rel.doc, shared);
+        propagate(rel.doc, doc, shared);
+      }
+    }
+    propagate(doc, null, true);
+  }
+
+  function attachDoc(cm, doc) {
+    if (doc.cm) throw new Error("This document is already in use.");
+    cm.doc = doc;
+    doc.cm = cm;
+    estimateLineHeights(cm);
+    loadMode(cm);
+    if (!cm.options.lineWrapping) computeMaxLength(cm);
+    cm.options.mode = doc.modeOption;
+    regChange(cm);
+  }
+
   // LINE UTILITIES
 
   function getLine(chunk, n) {
+    n -= chunk.first;
     while (!chunk.lines) {
       for (var i = 0;; ++i) {
         var child = chunk.children[i], sz = child.chunkSize();
@@ -4006,6 +4723,23 @@
     return chunk.lines[n];
   }
 
+  function getBetween(doc, start, end) {
+    var out = [], n = start.line;
+    doc.iter(start.line, end.line + 1, function(line) {
+      var text = line.text;
+      if (n == end.line) text = text.slice(0, end.ch);
+      if (n == start.line) text = text.slice(start.ch);
+      out.push(text);
+      ++n;
+    });
+    return out;
+  }
+  function getLines(doc, from, to) {
+    var out = [];
+    doc.iter(from, to, function(line) { out.push(line.text); });
+    return out;
+  }
+
   function updateLineHeight(line, height) {
     var diff = height - line.height;
     for (var n = line; n; n = n.parent) n.height += diff;
@@ -4020,11 +4754,11 @@
         no += chunk.children[i].chunkSize();
       }
     }
-    return no;
+    return no + cur.first;
   }
 
   function lineAtHeight(chunk, h) {
-    var n = 0;
+    var n = chunk.first;
     outer: do {
       for (var i = 0, e = chunk.children.length; i < e; ++i) {
         var child = chunk.children[i], ch = child.height;
@@ -4043,7 +4777,7 @@
   }
 
   function heightAtLine(cm, lineObj) {
-    lineObj = visualLine(cm.view.doc, lineObj);
+    lineObj = visualLine(cm.doc, lineObj);
 
     var h = 0, chunk = lineObj.parent;
     for (var i = 0; i < chunk.lines.length; ++i) {
@@ -4074,7 +4808,7 @@
       // Arrays of history events. Doing something adds an event to
       // done and clears undo. Undoing moves events from done to
       // undone, redoing moves them in the other direction.
-      done: [], undone: [],
+      done: [], undone: [], undoDepth: Infinity,
       // Used to track when changes can be merged into a single undo
       // event
       lastTime: 0, lastOp: null, lastOrigin: null,
@@ -4083,47 +4817,151 @@
     };
   }
 
-  function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
-    var history = cm.view.history;
-    history.undone.length = 0;
-    var time = +new Date, cur = lst(history.done);
-    
+  function attachLocalSpans(doc, change, from, to) {
+    var existing = change["spans_" + doc.id], n = 0;
+    doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
+      if (line.markedSpans)
+        (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
+      ++n;
+    });
+  }
+
+  function historyChangeFromChange(doc, change) {
+    var histChange = {from: change.from, to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
+    attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
+    linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);
+    return histChange;
+  }
+
+  function addToHistory(doc, change, selAfter, opId) {
+    var hist = doc.history;
+    hist.undone.length = 0;
+    var time = +new Date, cur = lst(hist.done);
+
     if (cur &&
-        (history.lastOp == cm.curOp.id ||
-         history.lastOrigin == origin && (origin == "input" || origin == "delete") &&
-         history.lastTime > time - 600)) {
+        (hist.lastOp == opId ||
+         hist.lastOrigin == change.origin && change.origin &&
+         ((change.origin.charAt(0) == "+" && hist.lastTime > time - 600) || change.origin.charAt(0) == "*"))) {
       // Merge this change into the last event
-      var last = lst(cur.events);
-      if (last.start > start + old.length || last.start + last.added < start) {
-        // Doesn't intersect with last sub-event, add new sub-event
-        cur.events.push({start: start, added: added, old: old});
+      var last = lst(cur.changes);
+      if (posEq(change.from, change.to) && posEq(change.from, last.to)) {
+        // Optimized case for simple insertion -- don't want to add
+        // new changesets for every character typed
+        last.to = changeEnd(change);
       } else {
-        // Patch up the last sub-event
-        var startBefore = Math.max(0, last.start - start),
-        endAfter = Math.max(0, (start + old.length) - (last.start + last.added));
-        for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]);
-        for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]);
-        if (startBefore) last.start = start;
-        last.added += added - (old.length - startBefore - endAfter);
+        // Add new sub-event
+        cur.changes.push(historyChangeFromChange(doc, change));
       }
-      cur.fromAfter = fromAfter; cur.toAfter = toAfter;
+      cur.anchorAfter = selAfter.anchor; cur.headAfter = selAfter.head;
     } else {
       // Can not be merged, start a new event.
-      cur = {events: [{start: start, added: added, old: old}],
-             fromBefore: fromBefore, toBefore: toBefore, fromAfter: fromAfter, toAfter: toAfter};
-      history.done.push(cur);
-      while (history.done.length > cm.options.undoDepth)
-        history.done.shift();
-      if (history.dirtyCounter < 0)
-          // The user has made a change after undoing past the last clean state. 
-          // We can never get back to a clean state now until markClean() is called.
-          history.dirtyCounter = NaN;
+      cur = {changes: [historyChangeFromChange(doc, change)],
+             anchorBefore: doc.sel.anchor, headBefore: doc.sel.head,
+             anchorAfter: selAfter.anchor, headAfter: selAfter.head};
+      hist.done.push(cur);
+      while (hist.done.length > hist.undoDepth)
+        hist.done.shift();
+      if (hist.dirtyCounter < 0)
+        // The user has made a change after undoing past the last clean state.
+        // We can never get back to a clean state now until markClean() is called.
+        hist.dirtyCounter = NaN;
       else
-        history.dirtyCounter++;
+        hist.dirtyCounter++;
     }
-    history.lastTime = time;
-    history.lastOp = cm.curOp.id;
-    history.lastOrigin = origin;
+    hist.lastTime = time;
+    hist.lastOp = opId;
+    hist.lastOrigin = change.origin;
+  }
+
+  function removeClearedSpans(spans) {
+    if (!spans) return null;
+    for (var i = 0, out; i < spans.length; ++i) {
+      if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
+      else if (out) out.push(spans[i]);
+    }
+    return !out ? spans : out.length ? out : null;
+  }
+
+  function getOldSpans(doc, change) {
+    var found = change["spans_" + doc.id];
+    if (!found) return null;
+    for (var i = 0, nw = []; i < change.text.length; ++i)
+      nw.push(removeClearedSpans(found[i]));
+    return nw;
+  }
+
+  // Used both to provide a JSON-safe object in .getHistory, and, when
+  // detaching a document, to split the history in two
+  function copyHistoryArray(events, newGroup) {
+    for (var i = 0, copy = []; i < events.length; ++i) {
+      var event = events[i], changes = event.changes, newChanges = [];
+      copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,
+                 anchorAfter: event.anchorAfter, headAfter: event.headAfter});
+      for (var j = 0; j < changes.length; ++j) {
+        var change = changes[j], m;
+        newChanges.push({from: change.from, to: change.to, text: change.text});
+        if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
+          if (indexOf(newGroup, Number(m[1])) > -1) {
+            lst(newChanges)[prop] = change[prop];
+            delete change[prop];
+          }
+        }
+      }
+    }
+    return copy;
+  }
+
+  // Rebasing/resetting history to deal with externally-sourced changes
+
+  function rebaseHistSel(pos, from, to, diff) {
+    if (to < pos.line) {
+      pos.line += diff;
+    } else if (from < pos.line) {
+      pos.line = from;
+      pos.ch = 0;
+    }
+  }
+
+  // Tries to rebase an array of history events given a change in the
+  // document. If the change touches the same lines as the event, the
+  // event, and everything 'behind' it, is discarded. If the change is
+  // before the event, the event's positions are updated. Uses a
+  // copy-on-write scheme for the positions, to avoid having to
+  // reallocate them all on every rebase, but also avoid problems with
+  // shared position objects being unsafely updated.
+  function rebaseHistArray(array, from, to, diff) {
+    for (var i = 0; i < array.length; ++i) {
+      var sub = array[i], ok = true;
+      for (var j = 0; j < sub.changes.length; ++j) {
+        var cur = sub.changes[j];
+        if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }
+        if (to < cur.from.line) {
+          cur.from.line += diff;
+          cur.to.line += diff;
+        } else if (from <= cur.to.line) {
+          ok = false;
+          break;
+        }
+      }
+      if (!sub.copied) {
+        sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);
+        sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);
+        sub.copied = true;
+      }
+      if (!ok) {
+        array.splice(0, i + 1);
+        i = 0;
+      } else {
+        rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);
+        rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);
+      }
+    }
+  }
+
+  function rebaseHist(hist, change) {
+    var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
+    rebaseHistArray(hist.done, from, to, diff);
+    rebaseHistArray(hist.undone, from, to, diff);
   }
 
   // EVENT OPERATORS
@@ -4160,13 +4998,6 @@
     return b;
   }
 
-  // Allow 3rd-party code to override event properties by adding an override
-  // object to an event object.
-  function e_prop(e, prop) {
-    var overridden = e.override && e.override.hasOwnProperty(prop);
-    return overridden ? e.override[prop] : e[prop];
-  }
-
   // EVENT HANDLING
 
   function on(emitter, type, f) {
@@ -4201,14 +5032,26 @@
     for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
   }
 
-  function signalLater(cm, emitter, type /*, values...*/) {
+  var delayedCallbacks, delayedCallbackDepth = 0;
+  function signalLater(emitter, type /*, values...*/) {
     var arr = emitter._handlers && emitter._handlers[type];
     if (!arr) return;
-    var args = Array.prototype.slice.call(arguments, 3), flist = cm.curOp && cm.curOp.delayedCallbacks;
+    var args = Array.prototype.slice.call(arguments, 2);
+    if (!delayedCallbacks) {
+      ++delayedCallbackDepth;
+      delayedCallbacks = [];
+      setTimeout(fireDelayed, 0);
+    }
     function bnd(f) {return function(){f.apply(null, args);};};
     for (var i = 0; i < arr.length; ++i)
-      if (flist) flist.push(bnd(arr[i]));
-      else arr[i].apply(null, args);
+      delayedCallbacks.push(bnd(arr[i]));
+  }
+
+  function fireDelayed() {
+    --delayedCallbackDepth;
+    var delayed = delayedCallbacks;
+    delayedCallbacks = null;
+    for (var i = 0; i < delayed.length; ++i) delayed[i]();
   }
 
   function hasHandler(emitter, type) {
@@ -4232,12 +5075,12 @@
 
   // Counts the column offset in a string, taking tabs into account.
   // Used mostly to find indentation.
-  function countColumn(string, end, tabSize) {
+  function countColumn(string, end, tabSize, startIndex, startValue) {
     if (end == null) {
       end = string.search(/[^\s\u00a0]/);
       if (end == -1) end = string.length;
     }
-    for (var i = 0, n = 0; i < end; ++i) {
+    for (var i = startIndex || 0, n = startValue || 0; i < end; ++i) {
       if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
       else ++n;
     }
@@ -4268,6 +5111,20 @@
     return -1;
   }
 
+  function createObj(base, props) {
+    function Obj() {}
+    Obj.prototype = base;
+    var inst = new Obj();
+    if (props) copyObj(props, inst);
+    return inst;
+  }
+
+  function copyObj(obj, target) {
+    if (!target) target = {};
+    for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
+    return target;
+  }
+
   function emptyArray(size) {
     for (var a = [], i = 0; i < size; ++i) a.push(undefined);
     return a;
@@ -4285,12 +5142,11 @@
   }
 
   function isEmpty(obj) {
-    var c = 0;
-    for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) ++c;
-    return !c;
+    for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
+    return true;
   }
 
-  var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/;
+  var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;
 
   // DOM UTILITIES
 
@@ -4304,7 +5160,9 @@
   }
 
   function removeChildren(e) {
-    e.innerHTML = "";
+    // IE will break all parent-child relations in subnodes when setting innerHTML
+    if (!ie) e.innerHTML = "";
+    else while (e.firstChild) e.removeChild(e.firstChild);
     return e;
   }
 
@@ -4319,6 +5177,11 @@
     } else e.textContent = str;
   }
 
+  function getRect(node) {
+    return node.getBoundingClientRect();
+  }
+  CodeMirror.replaceGetRect = function(f) { getRect = f; };
+
   // FEATURE DETECTION
 
   // Detect drag-and-drop
@@ -4339,8 +5202,8 @@
   // various browsers.
   var spanAffectsWrapping = /^$/; // Won't match any two-character string
   if (gecko) spanAffectsWrapping = /$'/;
-  else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;
-  else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/;
+  else if (safari && !/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;
+  else if (webkit) spanAffectsWrapping = /[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.]|\?[\w~`@#$%\^&*(_=+{[|><]/;
 
   var knownScrollbarWidth;
   function scrollbarWidth(measure) {
@@ -4443,20 +5306,20 @@
   }
 
   function lineStart(cm, lineN) {
-    var line = getLine(cm.view.doc, lineN);
-    var visual = visualLine(cm.view.doc, line);
+    var line = getLine(cm.doc, lineN);
+    var visual = visualLine(cm.doc, line);
     if (visual != line) lineN = lineNo(visual);
     var order = getOrder(visual);
     var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
-    return {line: lineN, ch: ch};
+    return Pos(lineN, ch);
   }
-  function lineEnd(cm, lineNo) {
+  function lineEnd(cm, lineN) {
     var merged, line;
-    while (merged = collapsedSpanAtEnd(line = getLine(cm.view.doc, lineNo)))
-      lineNo = merged.find().to.line;
+    while (merged = collapsedSpanAtEnd(line = getLine(cm.doc, lineN)))
+      lineN = merged.find().to.line;
     var order = getOrder(line);
     var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
-    return {line: lineNo, ch: ch};
+    return Pos(lineN, ch);
   }
 
   // This is somewhat involved. It is needed in order to move
@@ -4548,7 +5411,7 @@
     // Browsers seem to always treat the boundaries of block elements as being L.
     var outerType = "L";
 
-    return function charOrdering(str) {
+    return function(str) {
       if (!bidiRE.test(str)) return false;
       var len = str.length, types = [];
       for (var i = 0, type; i < len; ++i)
@@ -4670,7 +5533,7 @@
 
   // THE END
 
-  CodeMirror.version = "3.0 +";
+  CodeMirror.version = "3.1 +";
 
   return CodeMirror;
 })();
@@ -5971,6 +6834,169 @@
 
 CodeMirror.defineMIME("text/html", "htmlmixed");
 ;
+(function() {
+  var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
+    (document.documentMode == null || document.documentMode < 8);
+
+  var Pos = CodeMirror.Pos;
+  // Disable brace matching in long lines, since it'll cause hugely slow updates  
+  var maxLineLen = 1000;
+
+  var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
+  function findMatchingBracket(cm) {
+    var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
+    var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
+    if (!match) return null;
+    var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
+    var style = cm.getTokenAt(Pos(cur.line, pos + 1)).type;
+
+    var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
+    function scan(line, lineNo, start) {
+      if (!line.text) return;
+      var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
+      if (start != null) pos = start + d;
+      for (; pos != end; pos += d) {
+        var ch = line.text.charAt(pos);
+        if (re.test(ch) && cm.getTokenAt(Pos(lineNo, pos + 1)).type == style) {
+          var match = matching[ch];
+          if (match.charAt(1) == ">" == forward) stack.push(ch);
+          else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
+          else if (!stack.length) return {pos: pos, match: true};
+        }
+      }
+    }
+    for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
+      if (i == cur.line) found = scan(line, i, pos);
+      else found = scan(cm.getLineHandle(i), i);
+      if (found) break;
+    }
+    return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos), match: found && found.match};
+  }
+
+  function matchBrackets(cm, autoclear) {
+    var found = findMatchingBracket(cm);
+    if (!found || cm.getLine(found.from.line).length > maxLineLen ||
+       found.to && cm.getLine(found.to.line).length > maxLineLen)
+      return;
+
+    var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
+    var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
+    var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
+    // Kludge to work around the IE bug from issue #1193, where text
+    // input stops going to the textare whever this fires.
+    if (ie_lt8 && cm.state.focused) cm.display.input.focus();
+    var clear = function() {
+      cm.operation(function() { one.clear(); two && two.clear(); });
+    };
+    if (autoclear) setTimeout(clear, 800);
+    else return clear;
+  }
+
+  var currentlyHighlighted = null;
+  function doMatchBrackets(cm) {
+    cm.operation(function() {
+      if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
+      if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
+    });
+  }
+
+  CodeMirror.defineOption("matchBrackets", false, function(cm, val) {
+    if (val) cm.on("cursorActivity", doMatchBrackets);
+    else cm.off("cursorActivity", doMatchBrackets);
+  });
+
+  CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
+  CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);});
+})();
+;
+(function() {
+  var DEFAULT_BRACKETS = "()[]{}''\"\"";
+  var SPACE_CHAR_REGEX = /\s/;
+
+  CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
+    var wasOn = old && old != CodeMirror.Init;
+    if (val && !wasOn)
+      cm.addKeyMap(buildKeymap(typeof val == "string" ? val : DEFAULT_BRACKETS));
+    else if (!val && wasOn)
+      cm.removeKeyMap("autoCloseBrackets");
+  });
+
+  function buildKeymap(pairs) {
+    var map = {
+      name : "autoCloseBrackets",
+      Backspace: function(cm) {
+        if (cm.somethingSelected()) return CodeMirror.Pass;
+        var cur = cm.getCursor(), line = cm.getLine(cur.line);
+        if (cur.ch && cur.ch < line.length &&
+            pairs.indexOf(line.slice(cur.ch - 1, cur.ch + 1)) % 2 == 0)
+          cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1));
+        else
+          return CodeMirror.Pass;
+      }
+    };
+    var closingBrackets = [];
+    for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
+      if (left != right) closingBrackets.push(right);
+      function surround(cm) {
+          var selection = cm.getSelection();
+          cm.replaceSelection(left + selection + right);
+      }
+      function maybeOverwrite(cm) {
+        var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
+        if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass;
+        else cm.execCommand("goCharRight");
+      }
+      map["'" + left + "'"] = function(cm) {
+        if (cm.somethingSelected()) return surround(cm);
+        if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
+        var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
+        var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch);
+        if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar))
+          cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
+        else
+          return CodeMirror.Pass;
+      };
+      if (left != right) map["'" + right + "'"] = maybeOverwrite;
+    })(pairs.charAt(i), pairs.charAt(i + 1));
+    return map;
+  }
+})();
+;
+// Because sometimes you need to mark the selected *text*.
+//
+// Adds an option 'styleSelectedText' which, when enabled, gives
+// selected text the CSS class "CodeMirror-selectedtext".
+
+(function() {
+  "use strict";
+
+  CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
+    var prev = old && old != CodeMirror.Init;
+    if (val && !prev) {
+      updateSelectedText(cm);
+      cm.on("cursorActivity", updateSelectedText);
+    } else if (!val && prev) {
+      cm.off("cursorActivity", updateSelectedText);
+      clearSelectedText(cm);
+      delete cm._selectionMark;
+    }
+  });
+
+  function clearSelectedText(cm) {
+    if (cm._selectionMark) cm._selectionMark.clear();
+  }
+
+  function updateSelectedText(cm) {
+    clearSelectedText(cm);
+
+    if (cm.somethingSelected())
+      cm._selectionMark = cm.markText(cm.getCursor("start"), cm.getCursor("end"),
+                                      {className: "CodeMirror-selectedtext"});
+    else
+      cm._selectionMark = null;
+  }
+})();
+;
 
 /**
  * @constructor
@@ -5985,16 +7011,44 @@
     this._delegate = delegate;
     this._url = url;
 
-    this.registerRequiredCSS("codemirror.css");
-    this.registerRequiredCSS("cmdevtools.css");
+    this.registerRequiredCSS("cm/codemirror.css");
+    this.registerRequiredCSS("cm/cmdevtools.css");
 
     this._codeMirror = window.CodeMirror(this.element, {
         lineNumbers: true,
-        gutters: ["CodeMirror-linenumbers", "breakpoints"]
+        gutters: ["CodeMirror-linenumbers"],
+        matchBrackets: true,
+        smartIndent: false,
+        styleSelectedText: true,
+        electricChars: false,
+        autoCloseBrackets: WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled()
     });
 
+    var extraKeys = {};
+    var indent = WebInspector.settings.textEditorIndent.get();
+    if (indent === WebInspector.TextUtils.Indent.TabCharacter) {
+        this._codeMirror.setOption("indentWithTabs", true);
+        this._codeMirror.setOption("indentUnit", 4);
+    } else {
+        this._codeMirror.setOption("indentWithTabs", false);
+        this._codeMirror.setOption("indentUnit", indent.length);
+        extraKeys.Tab = function(codeMirror)
+        {
+            if (codeMirror.somethingSelected())
+                return CodeMirror.Pass;
+            codeMirror.replaceRange(indent, codeMirror.getCursor());
+        }
+    }
+    this._codeMirror.setOption("extraKeys", extraKeys);
+
+    this._tokenHighlighter = new WebInspector.CodeMirrorTextEditor.TokenHighlighter(this._codeMirror);
+    this._blockIndentController = new WebInspector.CodeMirrorTextEditor.BlockIndentController(this._codeMirror);
+    this._fixWordMovement = new WebInspector.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);
+
     this._codeMirror.on("change", this._change.bind(this));
     this._codeMirror.on("gutterClick", this._gutterClick.bind(this));
+    this._codeMirror.on("cursorActivity", this._cursorActivity.bind(this));
+    this._codeMirror.on("scroll", this._scroll.bind(this));
     this.element.addEventListener("contextmenu", this._contextMenu.bind(this));
 
     this._lastRange = this.range();
@@ -6002,9 +7056,110 @@
     this.element.firstChild.addStyleClass("source-code");
     this.element.firstChild.addStyleClass("fill");
     this._elementToWidget = new Map();
+    this._nestedUpdatesCounter = 0;
+
+    this.element.addEventListener("focus", this._handleElementFocus.bind(this), false);
+    this.element.tabIndex = 0;
+    this._setupSelectionColor();
 }
 
 WebInspector.CodeMirrorTextEditor.prototype = {
+    _setupSelectionColor: function()
+    {
+        if (WebInspector.CodeMirrorTextEditor._selectionStyleInjected)
+            return;
+        var style = document.createElement("style");
+        var backgroundColor = ".CodeMirror .CodeMirror-selected { background-color: " + WebInspector.getSelectionBackgroundColor() + ";}";
+        var foregroundColor = ".CodeMirror .CodeMirror-selectedtext { color: " + WebInspector.getSelectionForegroundColor() + "!important;}";
+        style.textContent = backgroundColor + foregroundColor;
+        document.head.appendChild(style);
+        WebInspector.CodeMirrorTextEditor._selectionStyleInjected = true;
+    },
+
+    /**
+     * @param {number} lineNumber
+     * @param {number} column
+     * @return {?{x: number, y: number, height: number}}
+     */
+    cursorPositionToCoordinates: function(lineNumber, column)
+    {
+        if (lineNumber >= this._codeMirror.lineCount || column > this._codeMirror.getLine(lineNumber).length || lineNumber < 0 || column < 0)
+            return null;
+
+        var metrics = this._codeMirror.cursorCoords(new CodeMirror.Pos(lineNumber, column));
+
+        return {
+            x: metrics.left,
+            y: metrics.top,
+            height: metrics.bottom - metrics.top
+        };
+    },
+
+    /**
+     * @param {number} x
+     * @param {number} y
+     * @return {?WebInspector.TextRange}
+     */
+    coordinatesToCursorPosition: function(x, y)
+    {
+        var element = document.elementFromPoint(x, y);
+        if (!element || !element.isSelfOrDescendant(this._codeMirror.getWrapperElement()))
+            return null;
+        var gutterBox = this._codeMirror.getGutterElement().boxInWindow();
+        if (x >= gutterBox.x && x <= gutterBox.x + gutterBox.width &&
+            y >= gutterBox.y && y <= gutterBox.y + gutterBox.height)
+            return null;
+        var coords = this._codeMirror.coordsChar({left: x, top: y});
+        ++coords.ch;
+        return this._toRange(coords, coords);
+    },
+
+    /**
+     * @param {number} lineNumber
+     * @param {number} column
+     * @return {?{startColumn: number, endColumn: number, type: string}}
+     */
+    tokenAtTextPosition: function(lineNumber, column)
+    {
+        if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount())
+            return null;
+        var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, column || 1));
+        if (!token || !token.type)
+            return null;
+        var convertedType = null;
+        if (token.type.startsWith("variable") || token.type.startsWith("property") || token.type === "def") {
+            return {
+                startColumn: token.start,
+                endColumn: token.end - 1,
+                type: "javascript-ident"
+            };
+        }
+        return null;
+    },
+
+    /**
+     * @param {WebInspector.TextRange} textRange
+     * @return {string}
+     */
+    copyRange: function(textRange)
+    {
+        var pos = this._toPos(textRange);
+        return this._codeMirror.getRange(pos.start, pos.end);
+    },
+
+    /**
+     * @return {boolean}
+     */
+    isClean: function()
+    {
+        return this._codeMirror.isClean();
+    },
+
+    markClean: function()
+    {
+        this._codeMirror.markClean();
+    },
+
     /**
      * @param {string} mimeType
      */
@@ -6023,7 +7178,7 @@
      */
     setReadOnly: function(readOnly)
     {
-        this._codeMirror.setOption("readOnly", readOnly);
+        this._codeMirror.setOption("readOnly", readOnly ? "nocursor" : false);
     },
 
     /**
@@ -6035,6 +7190,37 @@
     },
 
     /**
+     * @param {Object} highlightDescriptor
+     */
+    removeHighlight: function(highlightDescriptor)
+    {
+        highlightDescriptor.clear();
+    },
+
+    /**
+     * @param {WebInspector.TextRange} range
+     * @param {string} cssClass
+     * @return {Object}
+     */
+    highlightRange: function(range, cssClass)
+    {
+        var pos = this._toPos(range);
+        ++pos.end.ch;
+        return this._codeMirror.markText(pos.start, pos.end, {
+            className: cssClass,
+            startStyle: cssClass + "-start",
+            endStyle: cssClass + "-end"
+        });
+    },
+
+    /**
+     * @param {string} regex
+     * @param {string} cssClass
+     * @return {Object}
+     */
+    highlightRegex: function(regex, cssClass) { },
+
+    /**
      * @return {Element}
      */
     defaultFocusedElement: function()
@@ -6047,17 +7233,39 @@
         this._codeMirror.focus();
     },
 
-    beginUpdates: function() { },
+    _handleElementFocus: function()
+    {
+        this._codeMirror.focus();
+    },
 
-    endUpdates: function() { },
+    beginUpdates: function()
+    {
+        ++this._nestedUpdatesCounter;
+    },
+
+    endUpdates: function()
+    {
+        if (!--this._nestedUpdatesCounter)
+            this._codeMirror.refresh();
+    },
 
     /**
      * @param {number} lineNumber
      */
     revealLine: function(lineNumber)
     {
-        this._codeMirror.setCursor({ line: lineNumber, ch: 0 });
-        this._codeMirror.scrollIntoView();
+        var pos = new CodeMirror.Pos(lineNumber, 0);
+        var topLine = this._topScrolledLine();
+        var bottomLine = this._bottomScrolledLine();
+
+        var margin = null;
+        var lineMargin = 3;
+        var scrollInfo = this._codeMirror.getScrollInfo();
+        if ((lineNumber < topLine + lineMargin) || (lineNumber >= bottomLine - lineMargin)) {
+            // scrollIntoView could get into infinite loop if margin exceeds half of the clientHeight.
+            margin = (scrollInfo.clientHeight*0.9/2) >>> 0;
+        }
+        this._codeMirror.scrollIntoView(pos, margin);
     },
 
     _gutterClick: function(instance, lineNumber, gutter, event)
@@ -6072,7 +7280,7 @@
         if (target)
             this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1);
         else
-            this._delegate.populateTextAreaContextMenu(contextMenu, null);
+            this._delegate.populateTextAreaContextMenu(contextMenu, 0);
         contextMenu.show();
     },
 
@@ -6083,10 +7291,8 @@
      */
     addBreakpoint: function(lineNumber, disabled, conditional)
     {
-        var element = document.createElement("span");
-        element.textContent = lineNumber + 1;
-        element.className = "cm-breakpoint" + (disabled ? " cm-breakpoint-disabled" : "") + (conditional ? " cm-breakpoint-conditional" : "");
-        this._codeMirror.setGutterMarker(lineNumber, "breakpoints", element);
+        var className = "cm-breakpoint" + (conditional ? " cm-breakpoint-conditional" : "") + (disabled ? " cm-breakpoint-disabled" : "");
+        this._codeMirror.addLineClass(lineNumber, "wrap", className);
     },
 
     /**
@@ -6094,7 +7300,14 @@
      */
     removeBreakpoint: function(lineNumber)
     {
-        this._codeMirror.setGutterMarker(lineNumber, "breakpoints", null);
+        var wrapClasses = this._codeMirror.getLineHandle(lineNumber).wrapClass;
+        if (!wrapClasses)
+            return;
+        var classes = wrapClasses.split(" ");
+        for(var i = 0; i < classes.length; ++i) {
+            if (classes[i].startsWith("cm-breakpoint"))
+                this._codeMirror.removeLineClass(lineNumber, "wrap", classes[i]);
+        }
     },
 
     /**
@@ -6103,13 +7316,13 @@
     setExecutionLine: function(lineNumber)
     {
         this._executionLine = this._codeMirror.getLineHandle(lineNumber);
-        this._codeMirror.addLineClass(this._executionLine, null, "cm-execution-line");
+        this._codeMirror.addLineClass(this._executionLine, "wrap", "cm-execution-line");
     },
 
     clearExecutionLine: function()
     {
         if (this._executionLine)
-            this._codeMirror.removeLineClass(this._executionLine, null, "cm-execution-line");
+            this._codeMirror.removeLineClass(this._executionLine, "wrap", "cm-execution-line");
         delete this._executionLine;
     },
 
@@ -6210,22 +7423,75 @@
         this._elementToWidget.clear();
 
         var newRange = this.range();
-        this._delegate.onTextChanged(this._lastRange, newRange);
+        if (!this._muteTextChangedEvent)
+            this._delegate.onTextChanged(this._lastRange, newRange);
         this._lastRange = newRange;
     },
 
+    _cursorActivity: function()
+    {
+        var start = this._codeMirror.getCursor("anchor");
+        var end = this._codeMirror.getCursor("head");
+        this._delegate.selectionChanged(this._toRange(start, end));
+    },
+
+    _coordsCharLocal: function(coords)
+    {
+        var top = coords.top;
+        var totalLines = this._codeMirror.lineCount();
+        var begin = 0;
+        var end = totalLines - 1;
+        while (end - begin > 1) {
+            var middle = (begin + end) >> 1;
+            coords = this._codeMirror.charCoords(new CodeMirror.Pos(middle, 0), "local");
+            if (coords.top >= top)
+                end = middle;
+            else
+                begin = middle;
+        }
+
+        return end;
+    },
+
+    _topScrolledLine: function()
+    {
+        var scrollInfo = this._codeMirror.getScrollInfo();
+        // Workaround for CodeMirror's coordsChar incorrect result for "local" mode.
+        return this._coordsCharLocal(scrollInfo);
+    },
+
+    _bottomScrolledLine: function()
+    {
+        var scrollInfo = this._codeMirror.getScrollInfo();
+        scrollInfo.top += scrollInfo.clientHeight;
+        // Workaround for CodeMirror's coordsChar incorrect result for "local" mode.
+        return this._coordsCharLocal(scrollInfo);
+    },
+
+    _scroll: function()
+    {
+        this._delegate.scrollChanged(this._topScrolledLine());
+    },
+
     /**
      * @param {number} lineNumber
      */
     scrollToLine: function(lineNumber)
     {
-        this._codeMirror.setCursor({line:lineNumber, ch:0});
+        function performScroll()
+        {
+            var pos = new CodeMirror.Pos(lineNumber, 0);
+            var coords = this._codeMirror.charCoords(pos, "local");
+            this._codeMirror.scrollTo(0, coords.top);
+        }
+
+        setTimeout(performScroll.bind(this), 0);
     },
 
     /**
      * @return {WebInspector.TextRange}
      */
-    selection: function(textRange)
+    selection: function()
     {
         var start = this._codeMirror.getCursor(true);
         var end = this._codeMirror.getCursor(false);
@@ -6249,9 +7515,14 @@
      */
     setSelection: function(textRange)
     {
-        this._lastSelection = textRange;
-        var pos = this._toPos(textRange);
-        this._codeMirror.setSelection(pos.start, pos.end);
+        function performSelectionSet()
+        {
+            this._lastSelection = textRange;
+            var pos = this._toPos(textRange);
+            this._codeMirror.setSelection(pos.start, pos.end);
+        }
+
+        setTimeout(performSelectionSet.bind(this), 0);
     },
 
     /**
@@ -6259,7 +7530,10 @@
      */
     setText: function(text)
     {
+        this._muteTextChangedEvent = true;
         this._codeMirror.setValue(text);
+        this._codeMirror.clearHistory();
+        delete this._muteTextChangedEvent;
     },
 
     /**
@@ -6277,7 +7551,7 @@
     {
         var lineCount = this.linesCount;
         var lastLine = this._codeMirror.getLine(lineCount - 1);
-        return this._toRange({ line: 0, ch: 0 }, { line: lineCount - 1, ch: lastLine.length });
+        return this._toRange(new CodeMirror.Pos(0, 0), new CodeMirror.Pos(lineCount - 1, lastLine.length));
     },
 
     /**
@@ -6331,11 +7605,15 @@
             delete handle.attributes[name];
     },
 
+    /**
+     * @param {WebInspector.TextRange} range
+     * @return {{start: CodeMirror.Pos, end: CodeMirror.Pos}}
+     */
     _toPos: function(range)
     {
         return {
-            start: {line: range.startLine, ch: range.startColumn},
-            end: {line: range.endLine, ch: range.endColumn}
+            start: new CodeMirror.Pos(range.startLine, range.startColumn),
+            end: new CodeMirror.Pos(range.endLine, range.endColumn)
         }
     },
 
@@ -6346,3 +7624,166 @@
 
     __proto__: WebInspector.View.prototype
 }
+
+/**
+ * @constructor
+ * @param {CodeMirror} codeMirror
+ */
+WebInspector.CodeMirrorTextEditor.TokenHighlighter = function(codeMirror)
+{
+    this._codeMirror = codeMirror;
+    this._codeMirror.on("cursorActivity", this._cursorChange.bind(this));
+}
+
+WebInspector.CodeMirrorTextEditor.TokenHighlighter.prototype = {
+    _cursorChange: function()
+    {
+        this._codeMirror.operation(this._removeHighlight.bind(this));
+        var selectionStart = this._codeMirror.getCursor("start");
+        var selectionEnd = this._codeMirror.getCursor("end");
+        if (selectionStart.line !== selectionEnd.line)
+            return;
+        if (selectionStart.ch === selectionEnd.ch)
+            return;
+
+        var selectedText = this._codeMirror.getSelection();
+        if (this._isWord(selectedText, selectionStart.line, selectionStart.ch, selectionEnd.ch))
+            this._codeMirror.operation(this._addHighlight.bind(this, selectedText, selectionStart));
+    },
+
+    _isWord: function(selectedText, lineNumber, startColumn, endColumn)
+    {
+        var line = this._codeMirror.getLine(lineNumber);
+        var leftBound = startColumn === 0 || !WebInspector.TextUtils.isWordChar(line.charAt(startColumn - 1));
+        var rightBound = endColumn === line.length || !WebInspector.TextUtils.isWordChar(line.charAt(endColumn));
+        return leftBound && rightBound && WebInspector.TextUtils.isWord(selectedText);
+    },
+
+    _removeHighlight: function()
+    {
+        if (this._highlightDescriptor) {
+            this._codeMirror.removeOverlay(this._highlightDescriptor.overlay);
+            this._codeMirror.removeLineClass(this._highlightDescriptor.selectionStart.line, "wrap", "cm-line-with-selection");
+            delete this._highlightDescriptor;
+        }
+    },
+
+    _addHighlight: function(token, selectionStart)
+    {
+        const tokenFirstChar = token.charAt(0);
+        /**
+         * @param {CodeMirror.StringStream} stream
+         */
+        function nextToken(stream)
+        {
+            if (stream.match(token) && (stream.eol() || !WebInspector.TextUtils.isWordChar(stream.peek())))
+                return stream.column() === selectionStart.ch ? "token-highlight column-with-selection" : "token-highlight";
+
+            var eatenChar;
+            do {
+                eatenChar = stream.next();
+            } while (eatenChar && (WebInspector.TextUtils.isWordChar(eatenChar) || stream.peek() !== tokenFirstChar));
+        }
+
+        var overlayMode = {
+            token: nextToken
+        };
+        this._codeMirror.addOverlay(overlayMode);
+        this._codeMirror.addLineClass(selectionStart.line, "wrap", "cm-line-with-selection")
+        this._highlightDescriptor = {
+            overlay: overlayMode,
+            selectionStart: selectionStart
+        };
+    }
+}
+
+/**
+ * @constructor
+ * @param {CodeMirror} codeMirror
+ */
+WebInspector.CodeMirrorTextEditor.BlockIndentController = function(codeMirror)
+{
+    codeMirror.addKeyMap(this);
+}
+
+WebInspector.CodeMirrorTextEditor.BlockIndentController.prototype = {
+    name: "blockIndentKeymap",
+
+    Enter: function(codeMirror)
+    {
+        if (codeMirror.somethingSelected())
+            return CodeMirror.Pass;
+        var cursor = codeMirror.getCursor();
+        var line = codeMirror.getLine(cursor.line);
+        if (line.substr(cursor.ch - 1, 2) === "{}") {
+            codeMirror.execCommand("newlineAndIndent");
+            codeMirror.setCursor(cursor);
+            codeMirror.execCommand("newlineAndIndent");
+            codeMirror.execCommand("indentMore");
+        } else if (line.substr(cursor.ch-1, 1) === "{") {
+            codeMirror.execCommand("newlineAndIndent");
+            codeMirror.execCommand("indentMore");
+        } else
+            return CodeMirror.Pass;
+    },
+
+    "'}'": function(codeMirror)
+    {
+        var cursor = codeMirror.getCursor();
+        var line = codeMirror.getLine(cursor.line);
+        for(var i = 0 ; i < line.length; ++i)
+            if (!WebInspector.TextUtils.isSpaceChar(line.charAt(i)))
+                return CodeMirror.Pass;
+
+        codeMirror.replaceRange("}", cursor);
+        var matchingBracket = codeMirror.findMatchingBracket();
+        if (!matchingBracket.match)
+            return;
+
+        line = codeMirror.getLine(matchingBracket.to.line);
+        var desiredIndentation = 0;
+        while (desiredIndentation < line.length && WebInspector.TextUtils.isSpaceChar(line.charAt(desiredIndentation)))
+            ++desiredIndentation;
+
+        codeMirror.replaceRange(line.substr(0, desiredIndentation) + "}", new CodeMirror.Pos(cursor.line, 0), new CodeMirror.Pos(cursor.line, cursor.ch + 1));
+    }
+}
+
+/**
+ * @constructor
+ * @param {CodeMirror} codeMirror
+ */
+WebInspector.CodeMirrorTextEditor.FixWordMovement = function(codeMirror)
+{
+    function moveLeft(shift, codeMirror)
+    {
+        var cursor = codeMirror.getCursor("head");
+        if (cursor.ch !== 0 || cursor.line === 0)
+            return CodeMirror.Pass;
+        codeMirror.setExtending(shift);
+        codeMirror.execCommand("goLineUp");
+        codeMirror.execCommand("goLineEnd")
+        codeMirror.setExtending(false);
+    }
+    function moveRight(shift, codeMirror)
+    {
+        var cursor = codeMirror.getCursor("head");
+        var line = codeMirror.getLine(cursor.line);
+        if (cursor.ch !== line.length || cursor.line + 1 === codeMirror.lineCount())
+            return CodeMirror.Pass;
+        codeMirror.setExtending(shift);
+        codeMirror.execCommand("goLineDown");
+        codeMirror.execCommand("goLineStart");
+        codeMirror.setExtending(false);
+    }
+
+    var modifierKey = WebInspector.isMac() ? "Alt" : "Ctrl";
+    var leftKey = modifierKey + "-Left";
+    var rightKey = modifierKey + "-Right";
+    var keyMap = {};
+    keyMap[leftKey] = moveLeft.bind(this, false);
+    keyMap[rightKey] = moveRight.bind(this, false);
+    keyMap["Shift-" + leftKey] = moveLeft.bind(this, true);
+    keyMap["Shift-" + rightKey] = moveRight.bind(this, true);
+    codeMirror.addKeyMap(keyMap);
+}
diff --git a/resources/inspector/ElementsPanel.js b/resources/inspector/ElementsPanel.js
index bae0e39..db7b694 100644
--- a/resources/inspector/ElementsPanel.js
+++ b/resources/inspector/ElementsPanel.js
@@ -6,7 +6,7 @@
 
 WebInspector.CSSNamedFlowCollectionsView = function()
 {
-WebInspector.SidebarView.call(this, WebInspector.SidebarView.SidebarPosition.Left);
+WebInspector.SidebarView.call(this, WebInspector.SidebarView.SidebarPosition.Start);
 this.registerRequiredCSS("cssNamedFlows.css");
 
 this._namedFlows = {};
@@ -19,11 +19,11 @@
 this._statusElement = document.createElement("span");
 this._statusElement.textContent = WebInspector.UIString("CSS Named Flows");
 
-var sidebarHeader = this._leftElement.createChild("div", "tabbed-pane-header selected sidebar-header")
+var sidebarHeader = this.firstElement().createChild("div", "tabbed-pane-header selected sidebar-header");
 var tab = sidebarHeader.createChild("div", "tabbed-pane-header-tab");
 tab.createChild("span", "tabbed-pane-header-tab-title").textContent = WebInspector.UIString("CSS Named Flows");
 
-this._sidebarContentElement = this._leftElement.createChild("div", "sidebar-content outline-disclosure");
+this._sidebarContentElement = this.firstElement().createChild("div", "sidebar-content outline-disclosure");
 this._flowListElement = this._sidebarContentElement.createChild("ol");
 this._flowTree = new TreeOutline(this._flowListElement);
 
@@ -33,7 +33,7 @@
 
 this._tabbedPane = new WebInspector.TabbedPane();
 this._tabbedPane.closeableTabs = true;
-this._tabbedPane.show(this._rightElement);
+this._tabbedPane.show(this.secondElement());
 }
 
 WebInspector.CSSNamedFlowCollectionsView.prototype = {
@@ -642,7 +642,7 @@
 }
 
 if (node)
-node.eventListeners(callback);
+node.eventListeners(WebInspector.EventListenersSidebarPane._objectGroupName, callback);
 this._selectedNode = node;
 },
 
@@ -719,6 +719,10 @@
 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("isAttribute", this.eventListener.isAttribute));
 if (nodeObject)
 properties.push(new WebInspector.RemoteObjectProperty("node", nodeObject));
+if (typeof this.eventListener.handler !== "undefined") {
+var remoteObject = WebInspector.RemoteObject.fromPayload(this.eventListener.handler);
+properties.push(new WebInspector.RemoteObjectProperty("handler", remoteObject));
+}
 if (typeof this.eventListener.handlerBody !== "undefined")
 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("listenerBody", this.eventListener.handlerBody));
 if (this.eventListener.sourceName)
@@ -965,7 +969,7 @@
 WebInspector.Color.PageHighlight.Padding,
 WebInspector.Color.PageHighlight.Border,
 WebInspector.Color.PageHighlight.Margin,
-WebInspector.Color.fromRGBA(0, 0, 0, 0)
+WebInspector.Color.fromRGBA([0, 0, 0, 0])
 ];
 var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin"), WebInspector.UIString("position")];
 var previousBox = null;
@@ -982,7 +986,7 @@
 
 var boxElement = document.createElement("div");
 boxElement.className = name;
-boxElement._backgroundColor = boxColors[i].toString("original");
+boxElement._backgroundColor = boxColors[i].toString(WebInspector.Color.Format.RGBA);
 boxElement._name = name;
 boxElement.style.backgroundColor = boxElement._backgroundColor;
 boxElement.addEventListener("mouseover", this._highlightDOMNode.bind(this, true, name === "position" ? "all" : name), false);
@@ -1450,7 +1454,7 @@
 userCallback();
 }
 
-if (this._computedStylePane.expanded || forceFetchComputedStyle) {
+if (this._computedStylePane.isShowing() || forceFetchComputedStyle) {
 this._refreshUpdateInProgress = true;
 WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this));
 } else {
@@ -1513,7 +1517,7 @@
 resultStyles.computedStyle = computedStyle;
 }
 
-if (this._computedStylePane.expanded)
+if (this._computedStylePane.isShowing())
 WebInspector.cssModel.getComputedStyleAsync(node.id, computedCallback.bind(this));
 WebInspector.cssModel.getInlineStylesAsync(node.id, inlineCallback.bind(this));
 WebInspector.cssModel.getMatchedStylesAsync(node.id, true, true, stylesCallback.bind(this));
@@ -1585,7 +1589,7 @@
 this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, 0, null);
 var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
 
-if (styles.computedStyle)        
+if (styles.computedStyle)
 this.sections[0][0].rebuildComputedTrace(this.sections[0]);
 
 for (var i = 0; i < styles.pseudoElements.length; ++i) {
@@ -1880,7 +1884,7 @@
 _createNewRule: function(event)
 {
 event.consume();
-this.expanded = true;
+this.expand();
 this.addBlankSection().startEditingSelector();
 },
 
@@ -2005,16 +2009,23 @@
 }
 
 WebInspector.ComputedStyleSidebarPane.prototype = {
+wasShown: function()
+{
+WebInspector.SidebarPane.prototype.wasShown.call(this);
+if (!this._hasFreshContent)
+this.prepareContent();
+},
 
 
-expand: function()
+prepareContent: function(callback)
 {
-function callback()
-{
-WebInspector.SidebarPane.prototype.expand.call(this);
+function wrappedCallback() {
+this._hasFreshContent = true;
+if (callback)
+callback();
+delete this._hasFreshContent;
 }
-
-this._stylesSidebarPane._refreshUpdate(null, true, callback.bind(this));
+this._stylesSidebarPane._refreshUpdate(null, true, wrappedCallback.bind(this));
 },
 
 __proto__: WebInspector.SidebarPane.prototype
@@ -2026,6 +2037,8 @@
 WebInspector.PropertiesSection.call(this, "");
 this.element.className = "styles-section matched-styles monospace" + (isFirstSection ? " first-styles-section" : "");
 
+this.propertiesElement.removeStyleClass("properties-tree");
+
 if (styleRule.media) {
 for (var i = styleRule.media.length - 1; i >= 0; --i) {
 var media = styleRule.media[i];
@@ -2088,6 +2101,11 @@
 
 if (this.rule.isUserAgent || this.rule.isUser)
 this.editable = false;
+else {
+
+if (this.rule.id)
+this.navigable = this.rule.isSourceNavigable();
+}
 this.titleElement.addStyleClass("styles-selector");
 }
 
@@ -2103,6 +2121,9 @@
 if (isInherited)
 this.element.addStyleClass("show-inherited"); 
 
+if (this.navigable)
+this.element.addStyleClass("navigable");
+
 if (!this.editable)
 this.element.addStyleClass("read-only");
 }
@@ -2231,7 +2252,7 @@
 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.longhands(property.name);
 var inherited = this.isPropertyInherited(property.name);
 var overloaded = property.inactive || this.isPropertyOverloaded(property.name);
-var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded);
+var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded);
 this.propertiesTreeOutline.appendChild(item);
 }
 return;
@@ -2265,7 +2286,7 @@
 
 var shorthandProperty = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.shorthandValue(shorthand), "", "style", true, true, undefined);
 var overloaded = property.inactive || this.isPropertyOverloaded(property.name, true);
-var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, shorthandProperty,    true,   false, overloaded);
+var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, shorthandProperty,    true,   false, overloaded);
 this.propertiesTreeOutline.appendChild(item);
 generatedShorthands[shorthand] = shorthandProperty;
 shorthandPropertyAvailable = true;
@@ -2275,7 +2296,7 @@
 
 var inherited = this.isPropertyInherited(property.name);
 var overloaded = property.inactive || this.isPropertyOverloaded(property.name, isShorthand);
-var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded);
+var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded);
 this.propertiesTreeOutline.appendChild(item);
 }
 },
@@ -2347,7 +2368,7 @@
 {
 var style = this.styleRule.style;
 var property = style.newBlankProperty(index);
-var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, false, false, false);
+var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, false, false, false);
 index = property.index;
 this.propertiesTreeOutline.insertChild(item, index);
 item.listItemElement.textContent = "";
@@ -2535,12 +2556,12 @@
 }
 
 
-WebInspector.ComputedStylePropertiesSection = function(parentPane, styleRule, usedProperties)
+WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, usedProperties)
 {
 WebInspector.PropertiesSection.call(this, "");
 this.headerElement.addStyleClass("hidden");
 this.element.className = "styles-section monospace first-styles-section read-only computed-style";
-this._parentPane = parentPane;
+this._stylesPane = stylesPane;
 this.styleRule = styleRule;
 this._usedProperties = usedProperties;
 this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
@@ -2550,11 +2571,6 @@
 }
 
 WebInspector.ComputedStylePropertiesSection.prototype = {
-get pane()
-{
-return this._parentPane;
-},
-
 collapse: function(dontRememberState)
 {
 
@@ -2582,7 +2598,7 @@
 {
 function sorter(a, b)
 {
-return a.name.localeCompare(b.name);
+return a.name.compareTo(b.name);
 }
 
 var style = this.styleRule.style;
@@ -2599,7 +2615,7 @@
 for (var i = 0; i < uniqueProperties.length; ++i) {
 var property = uniqueProperties[i];
 var inherited = this._isPropertyInherited(property.name);
-var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, false, inherited, false);
+var item = new WebInspector.ComputedStylePropertyTreeElement(this._stylesPane, this.styleRule, style, property, inherited);
 this.propertiesTreeOutline.appendChild(item);
 this._propertyTreeElements[property.name] = item;
 }
@@ -2652,9 +2668,9 @@
 }
 
 
-WebInspector.BlankStylePropertiesSection = function(parentPane, defaultSelectorText)
+WebInspector.BlankStylePropertiesSection = function(stylesPane, defaultSelectorText)
 {
-WebInspector.StylePropertiesSection.call(this, parentPane, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
+WebInspector.StylePropertiesSection.call(this, stylesPane, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
 this.element.addStyleClass("blank-section");
 }
 
@@ -2728,24 +2744,33 @@
 }
 
 
-WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, isShorthand, inherited, overloaded)
+WebInspector.StylePropertyTreeElementBase = function(styleRule, style, property, inherited, overloaded, hasChildren)
 {
-this.section = section;
-this._parentPane = parentPane;
 this._styleRule = styleRule;
 this.style = style;
 this.property = property;
-this.isShorthand = isShorthand;
 this._inherited = inherited;
 this._overloaded = overloaded;
 
 
-TreeElement.call(this, "", null, isShorthand);
+TreeElement.call(this, "", null, hasChildren);
 
 this.selectable = false;
 }
 
-WebInspector.StylePropertyTreeElement.prototype = {
+WebInspector.StylePropertyTreeElementBase.prototype = {
+
+node: function()
+{
+return null;  
+},
+
+
+editablePane: function()
+{
+return null;  
+},
+
 get inherited()
 {
 return this._inherited;
@@ -2822,27 +2847,6 @@
 onattach: function()
 {
 this.updateTitle();
-this.listItemElement.addEventListener("mousedown", this._mouseDown.bind(this));
-this.listItemElement.addEventListener("mouseup", this._resetMouseDownElement.bind(this));
-this.listItemElement.addEventListener("click", this._mouseClick.bind(this));
-},
-
-_mouseDown: function(event)
-{
-if (this._parentPane) {
-this._parentPane._mouseDownTreeElement = this;
-this._parentPane._mouseDownTreeElementIsName = this._isNameElement(event.target);
-this._parentPane._mouseDownTreeElementIsValue = this._isValueElement(event.target);
-}
-},
-
-_resetMouseDownElement: function()
-{
-if (this._parentPane) {
-delete this._parentPane._mouseDownTreeElement;
-delete this._parentPane._mouseDownTreeElementIsName;
-delete this._parentPane._mouseDownTreeElementIsValue;
-}
 },
 
 updateTitle: function()
@@ -2851,15 +2855,6 @@
 
 this.updateState();
 
-var enabledCheckboxElement;
-if (this.parsedOk) {
-enabledCheckboxElement = document.createElement("input");
-enabledCheckboxElement.className = "enabled-button";
-enabledCheckboxElement.type = "checkbox";
-enabledCheckboxElement.checked = !this.disabled;
-enabledCheckboxElement.addEventListener("click", this.toggleEnabled.bind(this), false);
-}
-
 var nameElement = document.createElement("span");
 nameElement.className = "webkit-css-property";
 nameElement.textContent = this.name;
@@ -2909,8 +2904,8 @@
 container.appendChild(document.createTextNode("url("));
 if (self._styleRule.sourceURL)
 hrefUrl = WebInspector.ParsedURL.completeURL(self._styleRule.sourceURL, hrefUrl);
-else if (self._parentPane.node)
-hrefUrl = self._parentPane.node.resolveURL(hrefUrl);
+else if (self.node())
+hrefUrl = self.node().resolveURL(hrefUrl);
 var hasResource = !!WebInspector.resourceForURL(hrefUrl);
 
 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl, url, undefined, !hasResource));
@@ -2920,27 +2915,27 @@
 
 function processColor(text)
 {
-try {
-var color = new WebInspector.Color(text);
-} catch (e) {
+var color = WebInspector.Color.parse(text);
+
+
+if (!color)
 return document.createTextNode(text);
-}
 
 var format = getFormat();
-var hasSpectrum = self._parentPane;
-var spectrumHelper = hasSpectrum ? self._parentPane._spectrumHelper : null;
+var spectrumHelper = self.editablePane() && self.editablePane()._spectrumHelper;
 var spectrum = spectrumHelper ? spectrumHelper.spectrum() : null;
 
 var colorSwatch = new WebInspector.ColorSwatch();
 colorSwatch.setColorString(text);
 colorSwatch.element.addEventListener("click", swatchClick, false);
 
-var scrollerElement = hasSpectrum ? self._parentPane._computedStylePane.element.parentElement : null;
+var scrollerElement;
 
 function spectrumChanged(e)
 {
 color = e.data;
 var colorString = color.toString();
+spectrum.displayText = colorString;
 colorValueElement.textContent = colorString;
 colorSwatch.setColorString(colorString);
 self.applyStyleText(nameElement.textContent + ": " + valueElement.textContent, false, false, false);
@@ -2948,6 +2943,7 @@
 
 function spectrumHidden(event)
 {
+if (scrollerElement)
 scrollerElement.removeEventListener("scroll", repositionSpectrum, false);
 var commitEdit = event.data;
 var propertyText = !commitEdit && self.originalPropertyText ? self.originalPropertyText : (nameElement.textContent + ": " + valueElement.textContent);
@@ -2955,7 +2951,7 @@
 spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorChanged, spectrumChanged);
 spectrumHelper.removeEventListener(WebInspector.SpectrumPopupHelper.Events.Hidden, spectrumHidden);
 
-delete self._parentPane._isEditingStyle;
+delete self.editablePane()._isEditingStyle;
 delete self.originalPropertyText;
 }
 
@@ -2976,11 +2972,15 @@
 if (visible) {
 spectrum.displayText = color.toString(format);
 self.originalPropertyText = self.property.propertyText;
-self._parentPane._isEditingStyle = true;
+self.editablePane()._isEditingStyle = true;
 spectrum.addEventListener(WebInspector.Spectrum.Events.ColorChanged, spectrumChanged);
 spectrumHelper.addEventListener(WebInspector.SpectrumPopupHelper.Events.Hidden, spectrumHidden);
 
+scrollerElement = colorSwatch.element.enclosingNodeOrSelfWithClass("scroll-target");
+if (scrollerElement)
 scrollerElement.addEventListener("scroll", repositionSpectrum, false);
+else
+console.error("Unable to handle color picker scrolling");
 }
 }
 e.consume(true);
@@ -2992,14 +2992,12 @@
 var formatSetting = WebInspector.settings.colorFormat.get();
 if (formatSetting === cf.Original)
 format = cf.Original;
-else if (color.nickname)
-format = cf.Nickname;
 else if (formatSetting === cf.RGB)
-format = (color.simple ? cf.RGB : cf.RGBA);
+format = (color.hasAlpha() ? cf.RGBA : cf.RGB);
 else if (formatSetting === cf.HSL)
-format = (color.simple ? cf.HSL : cf.HSLA);
-else if (color.simple)
-format = (color.hasShortHex() ? cf.ShortHEX : cf.HEX);
+format = (color.hasAlpha() ? cf.HSLA : cf.HSL);
+else if (!color.hasAlpha())
+format = (color.canBeShortHex() ? cf.ShortHEX : cf.HEX);
 else
 format = cf.RGBA;
 
@@ -3021,18 +3019,18 @@
 
 switch (curFormat) {
 case cf.Original:
-return color.simple ? cf.RGB : cf.RGBA;
+return !color.hasAlpha() ? cf.RGB : cf.RGBA;
 
 case cf.RGB:
 case cf.RGBA:
-return color.simple ? cf.HSL : cf.HSLA;
+return !color.hasAlpha() ? cf.HSL : cf.HSLA;
 
 case cf.HSL:
 case cf.HSLA:
-if (color.nickname)
+if (color.nickname())
 return cf.Nickname;
-if (color.simple)
-return color.hasShortHex() ? cf.ShortHEX : cf.HEX;
+if (!color.hasAlpha())
+return color.canBeShortHex() ? cf.ShortHEX : cf.HEX;
 else
 return cf.Original;
 
@@ -3043,13 +3041,13 @@
 return cf.Original;
 
 case cf.Nickname:
-if (color.simple)
-return color.hasShortHex() ? cf.ShortHEX : cf.HEX;
+if (!color.hasAlpha())
+return color.canBeShortHex() ? cf.ShortHEX : cf.HEX;
 else
 return cf.Original;
 
 default:
-return null;
+return cf.RGBA;
 }
 }
 
@@ -3057,10 +3055,8 @@
 {
 do {
 format = nextFormat(format);
-var currentValue = color.toString(format || "");
-} while (format && currentValue === color.value && format !== cf.Original);
-
-if (format)
+var currentValue = color.toString(format);
+} while (currentValue === colorValueElement.textContent);
 colorValueElement.textContent = currentValue;
 }
 
@@ -3073,7 +3069,7 @@
 var colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;
 var colorProcessor = processValue.bind(window, colorRegex, processColor, null);
 
-valueElement.appendChild(processValue(/url\(\s*([^)\s]+)\s*\)/g, linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(self.name) ? colorProcessor : null, value));
+valueElement.appendChild(processValue(/url\(\s*([^)]+)\s*\)/g, linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(self.name) ? colorProcessor : null, value));
 }
 
 this.listItemElement.removeChildren();
@@ -3083,9 +3079,6 @@
 if (!this.treeOutline)
 return;
 
-
-if (enabledCheckboxElement && this.treeOutline.section && this.parent.root && !this.section.computedStyle)
-this.listItemElement.appendChild(enabledCheckboxElement);
 this.listItemElement.appendChild(nameElement);
 this.listItemElement.appendChild(document.createTextNode(": "));
 this.listItemElement.appendChild(this._expandElement);
@@ -3104,41 +3097,6 @@
 this.listItemElement.addStyleClass("inactive");
 },
 
-_updatePane: function(userCallback)
-{
-if (this.treeOutline && this.treeOutline.section && this.treeOutline.section.pane)
-this.treeOutline.section.pane._refreshUpdate(this.treeOutline.section, false, userCallback);
-else  {
-if (userCallback)
-userCallback();
-}
-},
-
-toggleEnabled: function(event)
-{
-var disabled = !event.target.checked;
-
-function callback(newStyle)
-{
-if (!newStyle)
-return;
-
-this.style = newStyle;
-this._styleRule.style = newStyle;
-
-if (this.treeOutline.section && this.treeOutline.section.pane)
-this.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
-
-this._updatePane();
-
-delete this._parentPane._userOperation;
-}
-
-this._parentPane._userOperation = true;
-this.property.setDisabled(disabled, callback.bind(this));
-event.consume();
-},
-
 updateState: function()
 {
 if (!this.listItemElement)
@@ -3165,6 +3123,97 @@
 this.listItemElement.removeStyleClass("disabled");
 },
 
+__proto__: TreeElement.prototype
+}
+
+
+WebInspector.ComputedStylePropertyTreeElement = function(stylesPane, styleRule, style, property, inherited)
+{
+WebInspector.StylePropertyTreeElementBase.call(this, styleRule, style, property, inherited, false, false);
+this._stylesPane = stylesPane;
+}
+
+WebInspector.ComputedStylePropertyTreeElement.prototype = {
+
+node: function()
+{
+return this._stylesPane.node;
+},
+
+
+editablePane: function()
+{
+return null;
+},
+
+__proto__: WebInspector.StylePropertyTreeElementBase.prototype
+}
+
+
+WebInspector.StylePropertyTreeElement = function(stylesPane, styleRule, style, property, isShorthand, inherited, overloaded)
+{
+WebInspector.StylePropertyTreeElementBase.call(this, styleRule, style, property, inherited, overloaded, isShorthand);
+this._parentPane = stylesPane;
+this.isShorthand = isShorthand;
+}
+
+WebInspector.StylePropertyTreeElement.prototype = {
+
+node: function()
+{
+return this._parentPane.node;
+},
+
+
+editablePane: function()
+{
+return this._parentPane;
+},
+
+
+section: function()
+{
+return this.treeOutline && this.treeOutline.section;
+},
+
+_updatePane: function(userCallback)
+{
+var section = this.section();
+if (section && section.pane)
+section.pane._refreshUpdate(section, false, userCallback);
+else  {
+if (userCallback)
+userCallback();
+}
+},
+
+toggleEnabled: function(event)
+{
+var disabled = !event.target.checked;
+
+function callback(newStyle)
+{
+if (!newStyle)
+return;
+
+newStyle.parentRule = this.style.parentRule;
+this.style = newStyle;
+this._styleRule.style = newStyle;
+
+var section = this.section();
+if (section && section.pane)
+section.pane.dispatchEventToListeners("style property toggled");
+
+this._updatePane();
+
+delete this._parentPane._userOperation;
+}
+
+this._parentPane._userOperation = true;
+this.property.setDisabled(disabled, callback.bind(this));
+event.consume();
+},
+
 onpopulate: function()
 {
 
@@ -3175,16 +3224,17 @@
 for (var i = 0; i < longhandProperties.length; ++i) {
 var name = longhandProperties[i].name;
 
-if (this.treeOutline.section) {
-var inherited = this.treeOutline.section.isPropertyInherited(name);
-var overloaded = this.treeOutline.section.isPropertyOverloaded(name);
+var section = this.section();
+if (section) {
+var inherited = section.isPropertyInherited(name);
+var overloaded = section.isPropertyOverloaded(name);
 }
 
 var liveProperty = this.style.getLiveProperty(name);
 if (!liveProperty)
 continue;
 
-var item = new WebInspector.StylePropertyTreeElement(this.section, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded);
+var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded);
 this.appendChild(item);
 }
 },
@@ -3201,6 +3251,47 @@
 this.listItemElement.insertBefore(this.nameElement, this.listItemElement.firstChild);
 },
 
+onattach: function()
+{
+WebInspector.StylePropertyTreeElementBase.prototype.onattach.call(this);
+
+this.listItemElement.addEventListener("mousedown", this._mouseDown.bind(this));
+this.listItemElement.addEventListener("mouseup", this._resetMouseDownElement.bind(this));
+this.listItemElement.addEventListener("click", this._mouseClick.bind(this));
+},
+
+_mouseDown: function(event)
+{
+if (this._parentPane) {
+this._parentPane._mouseDownTreeElement = this;
+this._parentPane._mouseDownTreeElementIsName = this._isNameElement(event.target);
+this._parentPane._mouseDownTreeElementIsValue = this._isValueElement(event.target);
+}
+},
+
+_resetMouseDownElement: function()
+{
+if (this._parentPane) {
+delete this._parentPane._mouseDownTreeElement;
+delete this._parentPane._mouseDownTreeElementIsName;
+delete this._parentPane._mouseDownTreeElementIsValue;
+}
+},
+
+updateTitle: function()
+{
+WebInspector.StylePropertyTreeElementBase.prototype.updateTitle.call(this);
+
+if (this.parsedOk && this.section() && this.parent.root) {
+var enabledCheckboxElement = document.createElement("input");
+enabledCheckboxElement.className = "enabled-button";
+enabledCheckboxElement.type = "checkbox";
+enabledCheckboxElement.checked = !this.disabled;
+enabledCheckboxElement.addEventListener("click", this.toggleEnabled.bind(this), false);
+this.listItemElement.insertBefore(enabledCheckboxElement, this.listItemElement.firstChild);
+}
+},
+
 _mouseClick: function(event)
 {
 if (!window.getSelection().isCollapsed)
@@ -3209,18 +3300,35 @@
 event.consume(true);
 
 if (event.target === this.listItemElement) {
-if (!this.section.editable) 
+var section = this.section();
+if (!section || !section.editable)
 return;
 
-if (this.section._checkWillCancelEditing())
+if (section._checkWillCancelEditing())
 return;
-this.section.addNewBlankProperty(this.property.index + 1).startEditing();
+section.addNewBlankProperty(this.property.index + 1).startEditing();
+return;
+}
+
+if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && this.section().navigable) {
+this._navigateToSource(event.target);
 return;
 }
 
 this.startEditing(event.target);
 },
 
+
+_navigateToSource: function(element)
+{
+console.assert(this.section().navigable);
+var propertyNameClicked = element === this.nameElement;
+var uiLocation = this.property.uiLocation(propertyNameClicked);
+if (!uiLocation)
+return;
+WebInspector.showPanel("scripts").showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber);
+},
+
 _isNameElement: function(element)
 {
 return element.enclosingNodeOrSelfWithClass("webkit-css-property") === this.nameElement;
@@ -3240,7 +3348,8 @@
 if (selectElement === this._expandElement)
 return;
 
-if (this.treeOutline.section && !this.treeOutline.section.editable)
+var section = this.section();
+if (section && !section.editable)
 return;
 
 if (!selectElement)
@@ -3249,12 +3358,15 @@
 selectElement = selectElement.enclosingNodeOrSelfWithClass("webkit-css-property") || selectElement.enclosingNodeOrSelfWithClass("value");
 
 var isEditingName = selectElement === this.nameElement;
-if (!isEditingName && selectElement !== this.valueElement) {
+if (!isEditingName) {
+if (selectElement !== this.valueElement) {
 
-isEditingName = false;
 selectElement = this.valueElement;
 }
 
+this.valueElement.textContent = this.value;
+}
+
 if (WebInspector.isBeingEdited(selectElement))
 return;
 
@@ -3289,6 +3401,8 @@
 context.originalName = this.nameElement.textContent;
 context.originalValue = this.valueElement.textContent;
 }
+this.property.name = name;
+this.property.value = value;
 this.nameElement.textContent = name;
 this.valueElement.textContent = value;
 this.nameElement.normalize();
@@ -3473,10 +3587,13 @@
 
 
 var createNewProperty, moveToPropertyName, moveToSelector;
+var isDataPasted = "originalName" in context;
+var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== context.originalName || this.valueElement.textContent !== context.originalValue);
+var isPropertySplitPaste = isDataPasted && isEditingName && this.valueElement.textContent !== context.originalValue;
 var moveTo = this;
 var moveToOther = (isEditingName ^ (moveDirection === "forward"));
 var abandonNewProperty = this._newProperty && !userInput && (moveToOther || isEditingName);
-if (moveDirection === "forward" && !isEditingName || moveDirection === "backward" && isEditingName) {
+if (moveDirection === "forward" && (!isEditingName || isPropertySplitPaste) || moveDirection === "backward" && isEditingName) {
 moveTo = moveTo._findSibling(moveDirection);
 if (moveTo)
 moveToPropertyName = moveTo.name;
@@ -3489,11 +3606,10 @@
 
 var moveToIndex = moveTo && this.treeOutline ? this.treeOutline.children.indexOf(moveTo) : -1;
 var blankInput = /^\s*$/.test(userInput);
-var isDataPasted = "originalName" in context;
-var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== context.originalName || this.valueElement.textContent !== context.originalValue);
-var shouldCommitNewProperty = this._newProperty && (moveToOther || (!moveDirection && !isEditingName) || (isEditingName && blankInput));
+var shouldCommitNewProperty = this._newProperty && (isPropertySplitPaste || moveToOther || (!moveDirection && !isEditingName) || (isEditingName && blankInput));
+var section = this.section();
 if (((userInput !== previousContent || isDirtyViaPaste) && !this._newProperty) || shouldCommitNewProperty) {
-this.treeOutline.section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !blankInput, this.treeOutline.section);
+section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !blankInput, section);
 var propertyText;
 if (blankInput || (this._newProperty && /^\s*$/.test(this.valueElement.textContent)))
 propertyText = "";
@@ -3507,7 +3623,7 @@
 } else {
 if (!isDataPasted && !this._newProperty)
 this.updateTitle();
-moveToNextCallback.call(this, this._newProperty, false, this.treeOutline.section);
+moveToNextCallback.call(this, this._newProperty, false, section);
 }
 
 
@@ -3533,7 +3649,7 @@
 else {
 var treeElement = moveToIndex >= 0 ? propertyElements[moveToIndex] : null;
 if (treeElement) {
-var elementToEdit = !isEditingName ? treeElement.nameElement : treeElement.valueElement;
+var elementToEdit = !isEditingName || isPropertySplitPaste ? treeElement.nameElement : treeElement.valueElement;
 if (alreadyNew && blankInput)
 elementToEdit = moveDirection === "forward" ? treeElement.nameElement : treeElement.valueElement;
 treeElement.startEditing(elementToEdit);
@@ -3607,7 +3723,7 @@
 if (!this.treeOutline)
 return;
 
-var section = this.treeOutline.section;
+var section = this.section();
 styleText = styleText.replace(/\s/g, " ").trim(); 
 var styleTextLength = styleText.length;
 if (!styleTextLength && updateInterface && !isRevert && this._newProperty && !this._hasBeenModifiedIncrementally()) {
@@ -3634,6 +3750,7 @@
 
 if (this._newProperty)
 this._newPropertyInStyle = true;
+newStyle.parentRule = this.style.parentRule;
 this.style = newStyle;
 this.property = newStyle.propertyAt(this.property.index);
 this._styleRule.style = this.style;
@@ -3641,7 +3758,7 @@
 if (section && section.pane)
 section.pane.dispatchEventToListeners("style edited");
 
-if (updateInterface && currentNode === section.pane.node) {
+if (updateInterface && currentNode === this.node()) {
 this._updatePane(userCallback);
 return;
 }
@@ -3664,16 +3781,14 @@
 
 isEventWithinDisclosureTriangle: function(event)
 {
-if (!this.section.computedStyle)
 return event.target === this._expandElement;
-return TreeElement.prototype.isEventWithinDisclosureTriangle.call(this, event);
 },
 
-__proto__: TreeElement.prototype
+__proto__: WebInspector.StylePropertyTreeElementBase.prototype
 }
 
 
-WebInspector.StylesSidebarPane.CSSPropertyPrompt = function(cssCompletions, sidebarPane, isEditingName, acceptCallback)
+WebInspector.StylesSidebarPane.CSSPropertyPrompt = function(cssCompletions, sidebarPane, isEditingName)
 {
 
 WebInspector.TextPrompt.call(this, this._buildPropertyCompletions.bind(this), WebInspector.StyleValueDelimiters);
@@ -3768,9 +3883,13 @@
 
 const initialSidebarWidth = 325;
 const minimumContentWidthPercent = 34;
-this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPosition.Right, initialSidebarWidth);
+const initialSidebarHeight = 325;
+const minimumContentHeightPercent = 34;
+this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPosition.End, initialSidebarWidth, initialSidebarHeight);
 this.splitView.setMinimumSidebarWidth(Preferences.minElementsSidebarWidth);
 this.splitView.setMinimumMainWidthPercent(minimumContentWidthPercent);
+this.splitView.setMinimumSidebarHeight(Preferences.minElementsSidebarHeight);
+this.splitView.setMinimumMainHeightPercent(minimumContentHeightPercent);
 
 this.contentElement = this.splitView.mainElement;
 this.contentElement.id = "elements-content";
@@ -3781,6 +3900,7 @@
 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSettingChanged.bind(this));
 
 this.contentElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
+this.splitView.sidebarElement.addEventListener("contextmenu", this._sidebarContextMenuEventFired.bind(this), false);
 
 this.treeOutline = new WebInspector.ElementsTreeOutline(true, true, false, this._populateContextMenu.bind(this), this._setPseudoClassForNodeId.bind(this));
 this.treeOutline.wireToDomAgent();
@@ -3797,25 +3917,21 @@
 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle, this._setPseudoClassForNodeId.bind(this));
 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
-this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane;
+this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.createProxy(this);
 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane();
 
-this.sidebarPanes.styles.onexpand = this.updateStyles.bind(this);
-this.sidebarPanes.metrics.onexpand = this.updateMetrics.bind(this);
-this.sidebarPanes.properties.onexpand = this.updateProperties.bind(this);
-this.sidebarPanes.eventListeners.onexpand = this.updateEventListeners.bind(this);
-
-this.sidebarPanes.styles.expanded = true;
+this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown, this.updateStyles.bind(this, false));
+this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown, this.updateMetrics.bind(this));
+this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown, this.updateProperties.bind(this));
+this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown, this.updateEventListeners.bind(this));
 
 this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEdited, this);
 this.sidebarPanes.styles.addEventListener("style property toggled", this._stylesPaneEdited, this);
 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPaneEdited, this);
 
-for (var pane in this.sidebarPanes) {
-this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
-if (this.sidebarPanes[pane].onattach)
-this.sidebarPanes[pane].onattach();
-}
+WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged, this._dockSideChanged.bind(this));
+WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));
+this._dockSideChanged();
 
 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this));
 this._popoverHelper.setTimeout(0);
@@ -3860,8 +3976,6 @@
 
 if (!this.treeOutline.rootDOMNode)
 WebInspector.domAgent.requestDocument();
-
-this.sidebarElement.insertBefore(this.sidebarPanes.domBreakpoints.element, this.sidebarPanes.eventListeners.element);
 },
 
 willHide: function()
@@ -3873,11 +3987,6 @@
 
 this.contentElement.removeChild(this.treeOutline.element);
 
-for (var pane in this.sidebarPanes) {
-if (this.sidebarPanes[pane].willHide)
-this.sidebarPanes[pane].willHide();
-}
-
 WebInspector.Panel.prototype.willHide.call(this);
 },
 
@@ -3973,7 +4082,7 @@
 return;
 }
 
-this.sidebarPanes.domBreakpoints.restoreBreakpoints();
+WebInspector.domBreakpointsSidebarPane.restoreBreakpoints();
 
 
 function selectNode(candidateFocusNode)
@@ -4052,11 +4161,11 @@
 }
 
 var contextMenu = new WebInspector.ContextMenu(event);
-var populated = this.treeOutline.populateContextMenu(contextMenu, event);
+this.treeOutline.populateContextMenu(contextMenu, event);
 
 if (WebInspector.experimentsSettings.cssRegions.isEnabled()) {
 contextMenu.appendSeparator();
-contextMenu.appendItem(WebInspector.UIString("CSS Named Flows..."), this._showNamedFlowCollections.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "CSS named flows\u2026" : "CSS Named Flows\u2026"), this._showNamedFlowCollections.bind(this));
 }
 
 contextMenu.appendSeparator();
@@ -4100,7 +4209,7 @@
 {
 
 contextMenu.appendSeparator();
-var pane = this.sidebarPanes.domBreakpoints;
+var pane = WebInspector.domBreakpointsSidebarPane;
 pane.populateNodeContextMenu(node, contextMenu);
 },
 
@@ -4195,7 +4304,6 @@
 this._currentSearchResultIndex = (this._searchResults.length - 1);
 
 this._highlightCurrentSearchResult();
-return true;
 },
 
 _highlightCurrentSearchResult: function()
@@ -4226,6 +4334,9 @@
 if (treeElement) {
 treeElement.highlightSearchResults(this._searchQuery);
 treeElement.reveal();
+var matches = treeElement.listItemElement.getElementsByClassName("webkit-search-result");
+if (matches.length)
+matches[0].scrollIntoViewIfNeeded();
 }
 },
 
@@ -4664,11 +4775,12 @@
 collapse(selectedCrumb, true);
 },
 
+
 updateStyles: function(forceUpdate)
 {
 var stylesSidebarPane = this.sidebarPanes.styles;
 var computedStylePane = this.sidebarPanes.computedStyle;
-if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate)
+if ((!stylesSidebarPane.isShowing() && !computedStylePane.isShowing()) || !stylesSidebarPane.needsUpdate)
 return;
 
 stylesSidebarPane.update(this.selectedDOMNode(), forceUpdate);
@@ -4678,7 +4790,7 @@
 updateMetrics: function()
 {
 var metricsSidebarPane = this.sidebarPanes.metrics;
-if (!metricsSidebarPane.expanded || !metricsSidebarPane.needsUpdate)
+if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate)
 return;
 
 metricsSidebarPane.update(this.selectedDOMNode());
@@ -4688,7 +4800,7 @@
 updateProperties: function()
 {
 var propertiesSidebarPane = this.sidebarPanes.properties;
-if (!propertiesSidebarPane.expanded || !propertiesSidebarPane.needsUpdate)
+if (!propertiesSidebarPane.isShowing() || !propertiesSidebarPane.needsUpdate)
 return;
 
 propertiesSidebarPane.update(this.selectedDOMNode());
@@ -4698,7 +4810,7 @@
 updateEventListeners: function()
 {
 var eventListenersSidebarPane = this.sidebarPanes.eventListeners;
-if (!eventListenersSidebarPane.expanded || !eventListenersSidebarPane.needsUpdate)
+if (!eventListenersSidebarPane.isShowing() || !eventListenersSidebarPane.needsUpdate)
 return;
 
 eventListenersSidebarPane.update(this.selectedDOMNode());
@@ -4707,6 +4819,8 @@
 
 handleShortcut: function(event)
 {
+function handleUndoRedo()
+{
 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && event.keyIdentifier === "U+005A") { 
 WebInspector.domAgent.undo(this._updateSidebars.bind(this));
 event.handled = true;
@@ -4718,6 +4832,12 @@
 if (isRedoKey) {
 DOMAgent.redo(this._updateSidebars.bind(this));
 event.handled = true;
+}
+}
+
+if (!this.treeOutline.editing()) {
+handleUndoRedo.call(this);
+if (event.handled)
 return;
 }
 
@@ -4777,7 +4897,74 @@
 remoteObject.pushNodeToFrontend(selectNode);
 }
 
-contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), revealElement.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Elements panel" : "Reveal in Elements Panel"), revealElement.bind(this));
+},
+
+_sidebarContextMenuEventFired: function(event)
+{
+var contextMenu = new WebInspector.ContextMenu(event);
+contextMenu.show();
+},
+
+_dockSideChanged: function()
+{
+var dockSide = WebInspector.dockController.dockSide();
+var vertically = dockSide === WebInspector.DockController.State.DockedToRight && WebInspector.settings.splitVerticallyWhenDockedToRight.get();
+this._splitVertically(vertically);
+},
+
+
+_splitVertically: function(vertically)
+{
+if (this.sidebarPaneView && vertically === !this.splitView.isVertical())
+return;
+
+if (this.sidebarPaneView)
+this.sidebarPaneView.detach();
+
+this.splitView.setVertical(!vertically);
+
+if (!vertically) {
+this.sidebarPaneView = new WebInspector.SidebarPaneStack();
+for (var pane in this.sidebarPanes)
+this.sidebarPaneView.addPane(this.sidebarPanes[pane]);
+} else {
+this.sidebarPaneView = new WebInspector.SidebarTabbedPane();
+
+var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.styles.title());
+compositePane.element.addStyleClass("composite");
+compositePane.element.addStyleClass("fill");
+var expandComposite = compositePane.expand.bind(compositePane);
+
+var splitView = new WebInspector.SplitView(true, "StylesPaneSplitRatio", 0.5);
+splitView.show(compositePane.bodyElement);
+
+this.sidebarPanes.styles.show(splitView.firstElement());
+splitView.firstElement().appendChild(this.sidebarPanes.styles.titleElement);
+this.sidebarPanes.styles.setExpandCallback(expandComposite);
+
+this.sidebarPanes.metrics.show(splitView.secondElement());
+this.sidebarPanes.metrics.setExpandCallback(expandComposite);
+
+splitView.secondElement().appendChild(this.sidebarPanes.computedStyle.titleElement);
+splitView.secondElement().addStyleClass("metrics-and-computed");
+this.sidebarPanes.computedStyle.show(splitView.secondElement());
+this.sidebarPanes.computedStyle.setExpandCallback(expandComposite);
+
+this.sidebarPaneView.addPane(compositePane);
+this.sidebarPaneView.addPane(this.sidebarPanes.properties);
+this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);
+this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);
+}
+this.sidebarPaneView.show(this.splitView.sidebarElement);
+this.sidebarPanes.styles.expand();
+},
+
+
+addExtensionSidebarPane: function(id, pane)
+{
+this.sidebarPanes[id] = pane;
+this.sidebarPaneView.addPane(pane);
 },
 
 __proto__: WebInspector.Panel.prototype
diff --git a/resources/inspector/HeapSnapshotWorker.js b/resources/inspector/HeapSnapshotWorker.js
index e130736..3e63992 100644
--- a/resources/inspector/HeapSnapshotWorker.js
+++ b/resources/inspector/HeapSnapshotWorker.js
@@ -280,11 +280,6 @@
 }
 
 WebInspector.HeapSnapshotNode.prototype = {
-isUserObject: function()
-{
-return true;
-},
-
 distance: function()
 {
 return this._snapshot._nodeDistances[this.nodeIndex / this._snapshot._nodeFieldCount];
@@ -453,6 +448,10 @@
 this._metaNode = profile.snapshot.meta;
 this._strings = profile.strings;
 
+this._rootNodeIndex = 0;
+if (profile.snapshot.root_index)
+this._rootNodeIndex = profile.snapshot.root_index;
+
 this._snapshotDiffs = {};
 this._aggregatesForDiff = null;
 
@@ -467,6 +466,7 @@
 this.node_types = [];
 this.edge_fields = [];
 this.edge_types = [];
+this.type_strings = {};
 
 
 this.fields = [];
@@ -488,7 +488,6 @@
 _init: function()
 {
 var meta = this._metaNode;
-this._rootNodeIndex = 0;
 
 this._nodeTypeOffset = meta.node_fields.indexOf("type");
 this._nodeNameOffset = meta.node_fields.indexOf("name");
@@ -725,9 +724,9 @@
 return this._aggregatesForDiff;
 },
 
-canHaveDistanceOne: function(node)
+distanceForUserRoot: function(node)
 {
-return true;
+return 1;
 },
 
 _calculateDistances: function()
@@ -740,9 +739,10 @@
 var nodesToVisitLength = 0;
 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (this.canHaveDistanceOne(node)) {
+var distance = this.distanceForUserRoot(node);
+if (distance !== -1) {
 nodesToVisit[nodesToVisitLength++] = node.nodeIndex;
-distances[node.nodeIndex / nodeFieldCount] = 1;
+distances[node.nodeIndex / nodeFieldCount] = distance;
 }
 }
 this._bfs(nodesToVisit, nodesToVisitLength, distances);
@@ -977,8 +977,21 @@
 }
 }
 
-if (postOrderIndex !== nodeCount)
+if (postOrderIndex !== nodeCount) {
+var dumpNode = this.rootNode();
+for (var i = 0; i < nodeCount; ++i) {
+if (painted[i] !== black) {
+dumpNode.nodeIndex = i * nodeFieldCount;
+console.log(JSON.stringify(dumpNode.serialize()));
+var retainers = dumpNode.retainers();
+while (retainers) {
+console.log("edgeName: " + retainers.item().name() + " nodeClassName: " + retainers.item().node().className());
+retainers = retainers.item().node().retainers();
+}
+}
+}
 throw new Error("Postordering failed. " + (nodeCount - postOrderIndex) + " hanging nodes");
+}
 
 return {postOrderIndex2NodeOrdinal: postOrderIndex2NodeOrdinal, nodeOrdinal2PostOrderIndex: nodeOrdinal2PostOrderIndex};
 },
@@ -1308,16 +1321,34 @@
 return parsedFilter.bind(this);
 },
 
-createEdgesProvider: function(nodeIndex, filter)
+createEdgesProvider: function(nodeIndex, showHiddenData)
 {
 var node = this.createNode(nodeIndex);
-return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.edges());
+var filter = this.containmentEdgesFilter(showHiddenData);
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
 },
 
-createRetainingEdgesProvider: function(nodeIndex, filter)
+createEdgesProviderForTest: function(nodeIndex, filter)
 {
 var node = this.createNode(nodeIndex);
-return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.retainers());
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
+},
+
+retainingEdgesFilter: function(showHiddenData)
+{
+return null;
+},
+
+containmentEdgesFilter: function(showHiddenData)
+{
+return null;
+},
+
+createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
+{
+var node = this.createNode(nodeIndex);
+var filter = this.retainingEdgesFilter(showHiddenData);
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.retainers());
 },
 
 createAddedNodesProvider: function(baseSnapshotId, className)
@@ -1332,12 +1363,14 @@
 return new WebInspector.HeapSnapshotNodesProvider(this, null, nodeIndexes);
 },
 
+classNodesFilter: function()
+{
+return null;
+},
+
 createNodesProviderForClass: function(className, aggregatesKey)
 {
-function filter(node) {
-return node.isUserObject();
-}
-return new WebInspector.HeapSnapshotNodesProvider(this, filter, this.aggregates(false, aggregatesKey)[className].idxs);
+return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesFilter(), this.aggregates(false, aggregatesKey)[className].idxs);
 },
 
 createNodesProviderForDominator: function(nodeIndex)
@@ -1495,7 +1528,7 @@
 
 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator = function(fieldNames)
 {
-return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
+return {fieldName1: fieldNames[0], ascending1: fieldNames[1], fieldName2: fieldNames[2], ascending2: fieldNames[3]};
 }
 
 
@@ -1665,9 +1698,10 @@
 this._parseStringsArray();
 },
 
-buildSnapshot: function()
+buildSnapshot: function(constructorName)
 {
-var result = new WebInspector.JSHeapSnapshot(this._snapshot);
+var constructor = WebInspector[constructorName];
+var result = new constructor(this._snapshot);
 this._reset();
 return result;
 },
@@ -1899,6 +1933,38 @@
 return new WebInspector.JSHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
 },
 
+classNodesFilter: function()
+{
+function filter(node)
+{
+return node.isUserObject();
+}
+return filter;
+},
+
+containmentEdgesFilter: function(showHiddenData)
+{
+function filter(edge) {
+if (edge.isInvisible())
+return false;
+if (showHiddenData)
+return true;
+return !edge.isHidden() && !edge.node().isHidden();
+}
+return filter;
+},
+
+retainingEdgesFilter: function(showHiddenData)
+{
+var containmentEdgesFilter = this.containmentEdgesFilter(showHiddenData);
+function filter(edge) {
+if (!containmentEdgesFilter(edge))
+return false;
+return edge.node().id() !== 1 && !edge.node().isSynthetic() && !edge.isWeak();
+}
+return filter;
+},
+
 dispose: function()
 {
 WebInspector.HeapSnapshot.prototype.dispose.call(this);
@@ -1940,9 +2006,13 @@
 this._markPageOwnedNodes();
 },
 
-canHaveDistanceOne: function(node)
+distanceForUserRoot: function(node)
 {
-return node.isWindow();
+if (node.isWindow())
+return 1;
+if (node.isDocumentDOMTreesRoot())
+return 0;
+return -1;
 },
 
 userObjectsMapAndFlag: function()
@@ -1964,7 +2034,7 @@
 var detachedDOMTreesRoot;
 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (node.isDetachedDOMTreesRoot()) {
+if (node.name() === "(Detached DOM trees)") {
 detachedDOMTreesRoot = node;
 break;
 }
@@ -1973,9 +2043,10 @@
 if (!detachedDOMTreesRoot)
 return;
 
+var detachedDOMTreeRE = /^Detached DOM tree/;
 for (var iter = detachedDOMTreesRoot.edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (node.isDetachedDOMTree()) {
+if (detachedDOMTreeRE.test(node.className())) {
 for (var edgesIter = node.edges(); edgesIter.hasNext(); edgesIter.next())
 this._flags[edgesIter.edge.node().nodeIndex / this._nodeFieldCount] |= flag;
 }
@@ -2032,6 +2103,7 @@
 _markPageOwnedNodes: function()
 {
 var edgeShortcutType = this._edgeShortcutType;
+var edgeElementType = this._edgeElementType;
 var edgeToNodeOffset = this._edgeToNodeOffset;
 var edgeTypeOffset = this._edgeTypeOffset;
 var edgeFieldsCount = this._edgeFieldsCount;
@@ -2053,15 +2125,22 @@
 var nodesToVisitLength = 0;
 
 var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount;
+var node = this.rootNode();
 for (var edgeIndex = firstEdgeIndexes[rootNodeOrdinal], endEdgeIndex = firstEdgeIndexes[rootNodeOrdinal + 1];
 edgeIndex < endEdgeIndex;
 edgeIndex += edgeFieldsCount) {
-if (containmentEdges[edgeIndex + edgeTypeOffset] === edgeShortcutType) {
-var nodeOrdinal = containmentEdges[edgeIndex + edgeToNodeOffset] / nodeFieldCount;
+var edgeType = containmentEdges[edgeIndex + edgeTypeOffset];
+var nodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset];
+if (edgeType === edgeElementType) {
+node.nodeIndex = nodeIndex;
+if (!node.isDocumentDOMTreesRoot())
+continue;
+} else if (edgeType !== edgeShortcutType)
+continue;
+var nodeOrdinal = nodeIndex / nodeFieldCount;
 nodesToVisit[nodesToVisitLength++] = nodeOrdinal;
 flags[nodeOrdinal] |= visitedMarker;
 }
-}
 
 while (nodesToVisitLength) {
 var nodeOrdinal = nodesToVisit[--nodesToVisitLength];
@@ -2110,12 +2189,12 @@
 var type = this.type();
 switch (type) {
 case "hidden":
-return WebInspector.UIString("(system)");
+return "(system)";
 case "object":
 case "native":
 return this.name();
 case "code":
-return WebInspector.UIString("(compiled code)");
+return "(compiled code)";
 default:
 return "(" + type + ")";
 }
@@ -2153,15 +2232,9 @@
 return windowRE.test(this.name());
 },
 
-isDetachedDOMTreesRoot: function()
+isDocumentDOMTreesRoot: function()
 {
-return this.name() === "(Detached DOM trees)";
-},
-
-isDetachedDOMTree: function()
-{
-const detachedDOMTreeRE = /^Detached DOM tree/;
-return detachedDOMTreeRE.test(this.className());
+return this.isSynthetic() && this.name() === "(Document DOM trees)";
 },
 
 serialize: function()
@@ -2293,9 +2366,237 @@
 return new WebInspector.JSHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
 },
 
-isElement: function()
+isHidden: function()
 {
-return this._edge().isElement();
+return this._edge().isHidden();
+},
+
+isInternal: function()
+{
+return this._edge().isInternal();
+},
+
+isInvisible: function()
+{
+return this._edge().isInvisible();
+},
+
+isShortcut: function()
+{
+return this._edge().isShortcut();
+},
+
+isWeak: function()
+{
+return this._edge().isWeak();
+},
+
+__proto__: WebInspector.HeapSnapshotRetainerEdge.prototype
+}
+
+;
+
+
+
+WebInspector.NativeHeapSnapshot = function(profile)
+{
+WebInspector.HeapSnapshot.call(this, profile);
+this._nodeObjectType = this._metaNode.type_strings["object"];
+this._edgeWeakType = this._metaNode.type_strings["weak"];
+this._edgeElementType = this._metaNode.type_strings["property"];
+}
+
+WebInspector.NativeHeapSnapshot.prototype = {
+createNode: function(nodeIndex)
+{
+return new WebInspector.NativeHeapSnapshotNode(this, nodeIndex);
+},
+
+createEdge: function(edges, edgeIndex)
+{
+return new WebInspector.NativeHeapSnapshotEdge(this, edges, edgeIndex);
+},
+
+createRetainingEdge: function(retainedNodeIndex, retainerIndex)
+{
+return new WebInspector.NativeHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
+},
+
+_markInvisibleEdges: function()
+{
+},
+
+_calculateFlags: function()
+{
+},
+
+userObjectsMapAndFlag: function()
+{
+return null;
+},
+
+images: function()
+{
+var aggregatesByClassName = this.aggregates(false, "allObjects");
+var result = [];
+var cachedImages = aggregatesByClassName["WebCore::CachedImage"];
+function getImageName(node)
+{
+return node.name();
+}
+this._addNodes(cachedImages, getImageName, result);
+
+var canvases = aggregatesByClassName["WebCore::HTMLCanvasElement"];
+function getCanvasName(node)
+{
+return "HTMLCanvasElement";
+}
+this._addNodes(canvases, getCanvasName, result);
+return result;
+},
+
+_addNodes: function(classData, nameResolver, result)
+{
+if (!classData)
+return;
+var node = this.rootNode();
+for (var i = 0; i < classData.idxs.length; i++) {
+node.nodeIndex = classData.idxs[i];
+result.push({
+name: nameResolver(node),
+size: node.retainedSize(),
+});
+}
+},
+
+__proto__: WebInspector.HeapSnapshot.prototype
+};
+
+
+WebInspector.NativeHeapSnapshotNode = function(snapshot, nodeIndex)
+{
+WebInspector.HeapSnapshotNode.call(this, snapshot, nodeIndex)
+}
+
+WebInspector.NativeHeapSnapshotNode.prototype = {
+className: function()
+{
+return this._snapshot._strings[this.classIndex()];
+},
+
+classIndex: function()
+{
+return this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeTypeOffset];
+},
+
+id: function()
+{
+return this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeIdOffset];
+},
+
+name: function()
+{
+return this._snapshot._strings[this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeNameOffset]];;
+},
+
+serialize: function()
+{
+return {
+id: this.id(),
+name: this.className(),
+displayName: this.name(),
+distance: this.distance(),
+nodeIndex: this.nodeIndex,
+retainedSize: this.retainedSize(),
+selfSize: this.selfSize(),
+type: this._snapshot._nodeObjectType
+};
+},
+
+isHidden: function()
+{
+return false;
+},
+
+isSynthetic: function()
+{
+return false;
+},
+
+__proto__: WebInspector.HeapSnapshotNode.prototype
+};
+
+
+WebInspector.NativeHeapSnapshotEdge = function(snapshot, edges, edgeIndex)
+{
+WebInspector.HeapSnapshotEdge.call(this, snapshot, edges, edgeIndex);
+}
+
+WebInspector.NativeHeapSnapshotEdge.prototype = {
+clone: function()
+{
+return new WebInspector.NativeHeapSnapshotEdge(this._snapshot, this._edges, this.edgeIndex);
+},
+
+hasStringName: function()
+{
+return true;
+},
+
+isHidden: function()
+{
+return false;
+},
+
+isWeak: function()
+{
+return false;
+},
+
+isInternal: function()
+{
+return false;
+},
+
+isInvisible: function()
+{
+return false;
+},
+
+isShortcut: function()
+{
+return false;
+},
+
+name: function()
+{
+return this._snapshot._strings[this._nameOrIndex()];
+},
+
+toString: function()
+{
+return  "NativeHeapSnapshotEdge: " + this.name();
+},
+
+_nameOrIndex: function()
+{
+return this._edges.item(this.edgeIndex + this._snapshot._edgeNameOffset);
+},
+
+__proto__: WebInspector.HeapSnapshotEdge.prototype
+};
+
+
+
+WebInspector.NativeHeapSnapshotRetainerEdge = function(snapshot, retainedNodeIndex, retainerIndex)
+{
+WebInspector.HeapSnapshotRetainerEdge.call(this, snapshot, retainedNodeIndex, retainerIndex);
+}
+
+WebInspector.NativeHeapSnapshotRetainerEdge.prototype = {
+clone: function()
+{
+return new WebInspector.NativeHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
 },
 
 isHidden: function()
@@ -2547,6 +2848,7 @@
 WebInspector.createFileSelectorElement = function(callback) {
 var fileSelectorElement = document.createElement("input");
 fileSelectorElement.type = "file";
+fileSelectorElement.setAttribute("tabindex", -1);
 fileSelectorElement.style.zIndex = -1;
 fileSelectorElement.style.position = "absolute";
 fileSelectorElement.onchange = function(event) {
@@ -2696,7 +2998,7 @@
 }
 
 if (!foundChar)
-return this;
+return String(this);
 
 var result = "";
 for (var i = 0; i < this.length; ++i) {
@@ -2708,9 +3010,14 @@
 return result;
 }
 
+String.regexSpecialCharacters = function()
+{
+return "^[]{}()\\.$*+?|-,";
+}
+
 String.prototype.escapeForRegExp = function()
 {
-return this.escapeCharacters("^[]{}()\\.$*+?|");
+return this.escapeCharacters(String.regexSpecialCharacters);
 }
 
 String.prototype.escapeHTML = function()
@@ -2726,7 +3033,7 @@
 String.prototype.trimMiddle = function(maxLength)
 {
 if (this.length <= maxLength)
-return this;
+return String(this);
 var leftHalf = maxLength >> 1;
 var rightHalf = maxLength - leftHalf - 1;
 return this.substr(0, leftHalf) + "\u2026" + this.substr(this.length - rightHalf, rightHalf);
@@ -2735,7 +3042,7 @@
 String.prototype.trimEnd = function(maxLength)
 {
 if (this.length <= maxLength)
-return this;
+return String(this);
 return this.substr(0, maxLength - 1) + "\u2026";
 }
 
@@ -2747,6 +3054,21 @@
 return result;
 }
 
+String.prototype.toTitleCase = function()
+{
+return this.substring(0, 1).toUpperCase() + this.substring(1);
+}
+
+
+String.prototype.compareTo = function(other)
+{
+if (this > other)
+return 1;
+if (this < other)
+return -1;
+return 0;
+}
+
 
 function sanitizeHref(href)
 {
@@ -2902,10 +3224,10 @@
 var pivotNewIndex = array.partition(comparator, left, right, pivotIndex);
 quickSortFirstK(array, comparator, left, pivotNewIndex - 1, k);
 if (pivotNewIndex < left + k - 1)
-quickSortFirstK(array, comparator, pivotNewIndex + 1, right, k);
+quickSortFirstK(array, comparator, pivotNewIndex + 1, right, left + k - 1 - pivotNewIndex);
 }
 
-if (leftBound === 0 && rightBound === (this.length - 1) && k === this.length)
+if (leftBound === 0 && rightBound === (this.length - 1) && k >= this.length)
 this.sort(comparator);
 else
 quickSortFirstK(this, comparator, leftBound, rightBound, k);
@@ -2983,6 +3305,15 @@
 }
 });
 
+Object.defineProperty(Array.prototype, "peekLast",
+{
+
+value: function()
+{
+return this[this.length - 1];
+}
+});
+
 
 function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
 {
@@ -3188,7 +3519,7 @@
 function createPlainTextSearchRegex(query, flags)
 {
 
-var regexSpecialCharacters = "[](){}+-*.,?\\^$|";
+var regexSpecialCharacters = String.regexSpecialCharacters();
 var regex = "";
 for (var i = 0; i < query.length; ++i) {
 var c = query.charAt(i);
@@ -3223,21 +3554,88 @@
 }
 
 
+var createObjectIdentifier = function()
+{
+
+return '_' + ++createObjectIdentifier._last;
+}
+
+createObjectIdentifier._last = 0;
+
+
+var Set = function()
+{
+
+this._set = {};
+this._size = 0;
+}
+
+Set.prototype = {
+
+add: function(item)
+{
+var objectIdentifier = item.__identifier;
+if (!objectIdentifier) {
+objectIdentifier = createObjectIdentifier();
+item.__identifier = objectIdentifier;
+}
+if (!this._set[objectIdentifier])
+++this._size;
+this._set[objectIdentifier] = item;
+},
+
+
+remove: function(item)
+{
+if (this._set[item.__identifier]) {
+--this._size;
+delete this._set[item.__identifier];
+}
+},
+
+
+items: function()
+{
+var result = new Array(this._size);
+var i = 0;
+for (var objectIdentifier in this._set)
+result[i++] = this._set[objectIdentifier];
+return result;
+},
+
+
+hasItem: function(item)
+{
+return this._set[item.__identifier];
+},
+
+
+size: function()
+{
+return this._size;
+},
+
+clear: function()
+{
+this._set = {};
+this._size = 0;
+}
+}
+
+
 var Map = function()
 {
 this._map = {};
 this._size = 0;
 }
 
-Map._lastObjectIdentifier = 0;
-
 Map.prototype = {
 
 put: function(key, value)
 {
 var objectIdentifier = key.__identifier;
 if (!objectIdentifier) {
-objectIdentifier = ++Map._lastObjectIdentifier;
+objectIdentifier = createObjectIdentifier();
 key.__identifier = objectIdentifier;
 }
 if (!this._map[objectIdentifier])
@@ -3249,9 +3647,11 @@
 remove: function(key)
 {
 var result = this._map[key.__identifier];
-delete this._map[key.__identifier];
+if (!result)
+return undefined;
 --this._size;
-return result ? result[1] : undefined;
+delete this._map[key.__identifier];
+return result[1];
 },
 
 
@@ -3282,6 +3682,13 @@
 return entry ? entry[1] : undefined;
 },
 
+
+contains: function(key)
+{
+var entry = this._map[key.__identifier];
+return !!entry;
+},
+
 size: function()
 {
 return this._size;
@@ -3377,13 +3784,19 @@
 {
 if (_importedScripts[scriptName])
 return;
-_importedScripts[scriptName] = true;
 var xhr = new XMLHttpRequest();
+_importedScripts[scriptName] = true;
+if (window.flattenImports)
+scriptName = scriptName.split("/").reverse()[0];
 xhr.open("GET", scriptName, false);
 xhr.send(null);
+if (!xhr.responseText)
+throw "empty response arrived for script '" + scriptName + "'";
 var sourceURL = WebInspector.ParsedURL.completeURL(window.location.href, scriptName); 
 window.eval(xhr.responseText + "\n//@ sourceURL=" + sourceURL);
 }
+
+var loadScript = importScript;
 ;
 
 function postMessageWrapper(message)
diff --git a/resources/inspector/Images/addIcon.png b/resources/inspector/Images/addIcon.png
new file mode 100644
index 0000000..06d07b0
--- /dev/null
+++ b/resources/inspector/Images/addIcon.png
Binary files differ
diff --git a/resources/inspector/Images/breakpoint2.png b/resources/inspector/Images/breakpoint2.png
new file mode 100644
index 0000000..d0e5d96
--- /dev/null
+++ b/resources/inspector/Images/breakpoint2.png
Binary files differ
diff --git a/resources/inspector/Images/breakpoint2_2x.png b/resources/inspector/Images/breakpoint2_2x.png
new file mode 100644
index 0000000..ee4abb4
--- /dev/null
+++ b/resources/inspector/Images/breakpoint2_2x.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointConditional2.png b/resources/inspector/Images/breakpointConditional2.png
new file mode 100644
index 0000000..efb2e20
--- /dev/null
+++ b/resources/inspector/Images/breakpointConditional2.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointConditional2_2x.png b/resources/inspector/Images/breakpointConditional2_2x.png
new file mode 100644
index 0000000..227a691
--- /dev/null
+++ b/resources/inspector/Images/breakpointConditional2_2x.png
Binary files differ
diff --git a/resources/inspector/Images/debuggerContinue.png b/resources/inspector/Images/debuggerContinue.png
deleted file mode 100644
index 01d99ee..0000000
--- a/resources/inspector/Images/debuggerContinue.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/debuggerPause.png b/resources/inspector/Images/debuggerPause.png
deleted file mode 100644
index c173868..0000000
--- a/resources/inspector/Images/debuggerPause.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/debuggerStepInto.png b/resources/inspector/Images/debuggerStepInto.png
deleted file mode 100644
index 68ec92f..0000000
--- a/resources/inspector/Images/debuggerStepInto.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/debuggerStepOut.png b/resources/inspector/Images/debuggerStepOut.png
deleted file mode 100644
index caf1394..0000000
--- a/resources/inspector/Images/debuggerStepOut.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/debuggerStepOver.png b/resources/inspector/Images/debuggerStepOver.png
deleted file mode 100644
index 94f116d..0000000
--- a/resources/inspector/Images/debuggerStepOver.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/navigatorShowHideButton.png b/resources/inspector/Images/navigatorShowHideButton.png
deleted file mode 100644
index e4f7403..0000000
--- a/resources/inspector/Images/navigatorShowHideButton.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segment.png b/resources/inspector/Images/segment.png
index 735ec1a..a636820 100644
--- a/resources/inspector/Images/segment.png
+++ b/resources/inspector/Images/segment.png
Binary files differ
diff --git a/resources/inspector/Images/segmentChromium.png b/resources/inspector/Images/segmentChromium.png
deleted file mode 100644
index a636820..0000000
--- a/resources/inspector/Images/segmentChromium.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segmentHover.png b/resources/inspector/Images/segmentHover.png
index ffe99ee..0510773 100644
--- a/resources/inspector/Images/segmentHover.png
+++ b/resources/inspector/Images/segmentHover.png
Binary files differ
diff --git a/resources/inspector/Images/segmentHoverChromium.png b/resources/inspector/Images/segmentHoverChromium.png
deleted file mode 100644
index 0510773..0000000
--- a/resources/inspector/Images/segmentHoverChromium.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segmentHoverEnd.png b/resources/inspector/Images/segmentHoverEnd.png
index c2c27fa..91be9db 100644
--- a/resources/inspector/Images/segmentHoverEnd.png
+++ b/resources/inspector/Images/segmentHoverEnd.png
Binary files differ
diff --git a/resources/inspector/Images/segmentHoverEndChromium.png b/resources/inspector/Images/segmentHoverEndChromium.png
deleted file mode 100644
index 91be9db..0000000
--- a/resources/inspector/Images/segmentHoverEndChromium.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segmentSelected.png b/resources/inspector/Images/segmentSelected.png
index 114ffc9..9df447b 100644
--- a/resources/inspector/Images/segmentSelected.png
+++ b/resources/inspector/Images/segmentSelected.png
Binary files differ
diff --git a/resources/inspector/Images/segmentSelectedChromium.png b/resources/inspector/Images/segmentSelectedChromium.png
deleted file mode 100644
index 9df447b..0000000
--- a/resources/inspector/Images/segmentSelectedChromium.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segmentSelectedEnd.png b/resources/inspector/Images/segmentSelectedEnd.png
index 6cb3ac5..425ab5e 100644
--- a/resources/inspector/Images/segmentSelectedEnd.png
+++ b/resources/inspector/Images/segmentSelectedEnd.png
Binary files differ
diff --git a/resources/inspector/Images/segmentSelectedEndChromium.png b/resources/inspector/Images/segmentSelectedEndChromium.png
deleted file mode 100644
index 425ab5e..0000000
--- a/resources/inspector/Images/segmentSelectedEndChromium.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/statusbarButtonGlyphs.png b/resources/inspector/Images/statusbarButtonGlyphs.png
index 28eb7f6..9dcce9a 100644
--- a/resources/inspector/Images/statusbarButtonGlyphs.png
+++ b/resources/inspector/Images/statusbarButtonGlyphs.png
Binary files differ
diff --git a/resources/inspector/Images/statusbarButtonGlyphs2x.png b/resources/inspector/Images/statusbarButtonGlyphs2x.png
index 4e8a5df..e0ecf65 100644
--- a/resources/inspector/Images/statusbarButtonGlyphs2x.png
+++ b/resources/inspector/Images/statusbarButtonGlyphs2x.png
Binary files differ
diff --git a/resources/inspector/Images/treeDownTriangleBlack.png b/resources/inspector/Images/treeDownTriangleBlack.png
deleted file mode 100644
index f797585..0000000
--- a/resources/inspector/Images/treeDownTriangleBlack.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/treeDownTriangleWhite.png b/resources/inspector/Images/treeDownTriangleWhite.png
deleted file mode 100644
index 24d3d55..0000000
--- a/resources/inspector/Images/treeDownTriangleWhite.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/treeRightTriangleBlack.png b/resources/inspector/Images/treeRightTriangleBlack.png
deleted file mode 100644
index 9b4c2f1..0000000
--- a/resources/inspector/Images/treeRightTriangleBlack.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/treeRightTriangleWhite.png b/resources/inspector/Images/treeRightTriangleWhite.png
deleted file mode 100644
index fcb2eb6..0000000
--- a/resources/inspector/Images/treeRightTriangleWhite.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/treeUpTriangleBlack.png b/resources/inspector/Images/treeUpTriangleBlack.png
deleted file mode 100644
index 91bde8a..0000000
--- a/resources/inspector/Images/treeUpTriangleBlack.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/treeUpTriangleWhite.png b/resources/inspector/Images/treeUpTriangleWhite.png
deleted file mode 100644
index c49a0ae..0000000
--- a/resources/inspector/Images/treeUpTriangleWhite.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/NetworkPanel.js b/resources/inspector/NetworkPanel.js
index 8fa4f20..d917805 100644
--- a/resources/inspector/NetworkPanel.js
+++ b/resources/inspector/NetworkPanel.js
@@ -194,14 +194,14 @@
 this.element.addStyleClass("resource-cookies-view");
 
 this._request = request;
-
-request.addEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshCookies, this);
-request.addEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshCookies, this);
 }
 
 WebInspector.RequestCookiesView.prototype = {
 wasShown: function()
 {
+this._request.addEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshCookies, this);
+this._request.addEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshCookies, this);
+
 if (!this._gotCookies) {
 if (!this._emptyView) {
 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("This request has no cookies."));
@@ -214,6 +214,12 @@
 this._buildCookiesTable();
 },
 
+willHide: function()
+{
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshCookies, this);
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshCookies, this);
+},
+
 get _gotCookies()
 {
 return (this._request.requestCookies && this._request.requestCookies.length) || (this._request.responseCookies && this._request.responseCookies.length);
@@ -224,8 +230,10 @@
 this.detachChildViews();
 
 this._cookiesTable = new WebInspector.CookiesTable(true);
-this._cookiesTable.addCookiesFolder(WebInspector.UIString("Request Cookies"), this._request.requestCookies);
-this._cookiesTable.addCookiesFolder(WebInspector.UIString("Response Cookies"), this._request.responseCookies);
+this._cookiesTable.setCookieFolders([
+{folderName: WebInspector.UIString("Request Cookies"), cookies: this._request.requestCookies},
+{folderName: WebInspector.UIString("Response Cookies"), cookies: this._request.responseCookies}
+]);
 this._cookiesTable.show(this.element);
 },
 
@@ -235,7 +243,6 @@
 if (!this._gotCookies || !this.isShowing())
 return;
 this._buildCookiesTable();
-this._cookiesTable.updateWidths();
 },
 
 __proto__: WebInspector.View.prototype
@@ -309,10 +316,15 @@
 this._responseHeadersTreeElement.expanded = true;
 this._responseHeadersTreeElement.selectable = false;
 this._headersTreeOutline.appendChild(this._responseHeadersTreeElement);
+}
 
-request.addEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshRequestHeaders, this);
-request.addEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshResponseHeaders, this);
-request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._refreshHTTPInformation, this);
+WebInspector.RequestHeadersView.prototype = {
+
+wasShown: function()
+{
+this._request.addEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshRequestHeaders, this);
+this._request.addEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshResponseHeaders, this);
+this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._refreshHTTPInformation, this);
 
 this._refreshURL();
 this._refreshQueryString();
@@ -320,9 +332,15 @@
 this._refreshRequestHeaders();
 this._refreshResponseHeaders();
 this._refreshHTTPInformation();
-}
+},
 
-WebInspector.RequestHeadersView.prototype = {
+willHide: function()
+{
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshRequestHeaders, this);
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refreshResponseHeaders, this);
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._refreshHTTPInformation, this);
+},
+
 
 _formatHeader: function(name, value)
 {
@@ -343,7 +361,7 @@
 if (value.indexOf("%") >= 0) {
 try {
 value = decodeURIComponent(value);
-} catch(e) {
+} catch (e) {
 errorDecoding = true;
 }
 }
@@ -406,7 +424,12 @@
 this._refreshParams(WebInspector.UIString("Form Data"), formParameters, formData, this._formDataTreeElement);
 } else {
 this._requestPayloadTreeElement.hidden = false;
-this._populateTreeElementWithSourceText(this._requestPayloadTreeElement, formData)
+try {
+var json = JSON.parse(formData);
+this._refreshRequestJSONPayload(json, formData, false);
+} catch (e) {
+this._populateTreeElementWithSourceText(this._requestPayloadTreeElement, formData);
+}
 }
 },
 
@@ -443,10 +466,7 @@
 this._refreshParams(title, params, sourceText, paramsTreeElement);
 }
 
-var viewSourceToggleTitle = paramsTreeElement._viewSource ? WebInspector.UIString("view parsed") : WebInspector.UIString("view source");
-var viewSourceToggleButton = this._createToggleButton(viewSourceToggleTitle);
-viewSourceToggleButton.addEventListener("click", toggleViewSource.bind(this));
-paramsTreeElement.listItemElement.appendChild(viewSourceToggleButton);
+paramsTreeElement.listItemElement.appendChild(this._createViewSourceToggle(paramsTreeElement._viewSource, toggleViewSource.bind(this)));
 
 if (paramsTreeElement._viewSource) {
 this._populateTreeElementWithSourceText(paramsTreeElement, sourceText);
@@ -471,6 +491,39 @@
 }
 },
 
+
+_refreshRequestJSONPayload: function(parsedObject, sourceText, viewSource)
+{
+this._requestPayloadTreeElement.removeChildren();
+
+var listItem = this._requestPayloadTreeElement.listItemElement;
+listItem.removeChildren();
+listItem.appendChild(document.createTextNode(this._requestPayloadTreeElement.title));
+
+var setViewSource = this._refreshRequestJSONPayload.bind(this, parsedObject, sourceText);
+
+if (viewSource) {
+listItem.appendChild(this._createViewSourceToggle(true, setViewSource.bind(this, false)));
+this._populateTreeElementWithSourceText(this._requestPayloadTreeElement, sourceText);
+} else {
+listItem.appendChild(this._createViewSourceToggle(false, setViewSource.bind(this, true)));
+var object = WebInspector.RemoteObject.fromLocalObject(parsedObject);
+var section = new WebInspector.ObjectPropertiesSection(object, object.description);
+section.expand();
+section.editable = false;
+listItem.appendChild(section.element);
+}
+},
+
+
+_createViewSourceToggle: function(viewSource, handler)
+{
+var viewSourceToggleTitle = viewSource ? WebInspector.UIString("view parsed") : WebInspector.UIString("view source");
+var viewSourceToggleButton = this._createToggleButton(viewSourceToggleTitle);
+viewSourceToggleButton.addEventListener("click", handler);
+return viewSourceToggleButton;
+},
+
 _toggleURLDecoding: function(event)
 {
 this._decodeRequestParameters = !this._decodeRequestParameters;
@@ -489,13 +542,10 @@
 
 _refreshRequestHeaders: function()
 {
-var additionalRow = null;
-if (typeof this._request.webSocketRequestKey3 !== "undefined")
-additionalRow = {name: "(Key3)", value: this._request.webSocketRequestKey3};
 if (this._showRequestHeadersText)
 this._refreshHeadersText(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, this._request.requestHeadersText, this._requestHeadersTreeElement);
 else
-this._refreshHeaders(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, additionalRow, this._requestHeadersTreeElement);
+this._refreshHeaders(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, this._requestHeadersTreeElement);
 
 if (this._request.requestHeadersText) {
 var toggleButton = this._createHeadersToggleButton(this._showRequestHeadersText);
@@ -508,13 +558,10 @@
 
 _refreshResponseHeaders: function()
 {
-var additionalRow = null;
-if (typeof this._request.webSocketChallengeResponse !== "undefined")
-additionalRow = {name: "(Challenge Response)", value: this._request.webSocketChallengeResponse};
 if (this._showResponseHeadersText)
 this._refreshHeadersText(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, this._request.responseHeadersText, this._responseHeadersTreeElement);
 else
-this._refreshHeaders(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, additionalRow, this._responseHeadersTreeElement);
+this._refreshHeaders(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, this._responseHeadersTreeElement);
 
 if (this._request.responseHeadersText) {
 var toggleButton = this._createHeadersToggleButton(this._showResponseHeadersText);
@@ -567,7 +614,7 @@
 headersTreeElement.listItemElement.appendChild(headerCount);
 },
 
-_refreshHeaders: function(title, headers, additionalRow, headersTreeElement)
+_refreshHeaders: function(title, headers, headersTreeElement)
 {
 headersTreeElement.removeChildren();
 
@@ -580,13 +627,6 @@
 headerTreeElement.selectable = false;
 headersTreeElement.appendChild(headerTreeElement);
 }
-
-if (additionalRow) {
-var headerTreeElement = new TreeElement(null, null, false);
-headerTreeElement.title = this._formatHeader(additionalRow.name, additionalRow.value);
-headerTreeElement.selectable = false;
-headersTreeElement.appendChild(headerTreeElement);
-}
 },
 
 _refreshHeadersText: function(title, headers, headersText, headersTreeElement)
@@ -884,13 +924,13 @@
 this.element.addStyleClass("resource-timing-view");
 
 this._request = request;
-
-request.addEventListener(WebInspector.NetworkRequest.Events.TimingChanged, this._refresh, this);
 }
 
 WebInspector.RequestTimingView.prototype = {
 wasShown: function()
 {
+this._request.addEventListener(WebInspector.NetworkRequest.Events.TimingChanged, this._refresh, this);
+
 if (!this._request.timing) {
 if (!this._emptyView) {
 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("This request has no detailed timing info."));
@@ -908,6 +948,11 @@
 this._refresh();
 },
 
+willHide: function()
+{
+this._request.removeEventListener(WebInspector.NetworkRequest.Events.TimingChanged, this._refresh, this);
+},
+
 _refresh: function()
 {
 if (this._tableElement)
@@ -1016,11 +1061,11 @@
 this.resource = resource;
 this.element.removeChildren();
 
-var dataGrid = new WebInspector.DataGrid({
-data: {title: WebInspector.UIString("Data"), sortable: false},
-length: {title: WebInspector.UIString("Length"), sortable: false, aligned: "right", width: "50px"},
-time: {title: WebInspector.UIString("Time"), width: "70px"}
-});
+var dataGrid = new WebInspector.DataGrid([
+{id: "data", title: WebInspector.UIString("Data"), sortable: false},
+{id: "length", title: WebInspector.UIString("Length"), sortable: false, alig: WebInspector.DataGrid.Align.Right, width: "50px"},
+{id: "time", title: WebInspector.UIString("Time"), width: "70px"}
+]);
 
 var frames = this.resource.frames();
 for (var i = 0; i < frames.length; i++) {
@@ -1029,7 +1074,7 @@
 var date = new Date(payload.time * 1000);
 var row = {
 data: "",
-length: payload.payloadData.length.toString(),
+length: typeof payload.payloadData === "undefined" ? payload.errorMessage.length.toString() : payload.payloadData.length.toString(),
 time: date.toLocaleTimeString()
 };
 
@@ -1090,11 +1135,12 @@
 ;
 
 
-WebInspector.NetworkLogView = function()
+WebInspector.NetworkLogView = function(coulmnsVisibilitySetting)
 {
 WebInspector.View.call(this);
 this.registerRequiredCSS("networkLogView.css");
 
+this._coulmnsVisibilitySetting = coulmnsVisibilitySetting;
 this._allowRequestSelection = false;
 this._requests = [];
 this._requestsById = {};
@@ -1125,21 +1171,13 @@
 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this);
 
 this._initializeView();
-function onCanClearBrowserCache(error, result)
-{
-this._canClearBrowserCache = result;
-}
-NetworkAgent.canClearBrowserCache(onCanClearBrowserCache.bind(this));
-
-function onCanClearBrowserCookies(error, result)
-{
-this._canClearBrowserCookies = result;
-}
-NetworkAgent.canClearBrowserCookies(onCanClearBrowserCookies.bind(this));
 
 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this));
 }
 
+WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": true, "wss": true};
+WebInspector.NetworkLogView._defaultColumnsVisivility = {method: true, status: true, domain: false, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true};
+
 WebInspector.NetworkLogView.prototype = {
 _initializeView: function()
 {
@@ -1154,7 +1192,7 @@
 this._setLargerRequests(this.useLargeRows);
 
 this._allowPopover = true;
-this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this));
+this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.bind(this));
 
 this._popoverHelper.setTimeout(100);
 
@@ -1200,53 +1238,105 @@
 
 _createTable: function()
 {
-var columns = {name: {}, method: {}, status: {}, type: {}, initiator: {}, size: {}, time: {}, timeline: {}};
+var columns = [];
+columns.push({
+id: "name", 
+titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path")),
+title: WebInspector.UIString("Name"),
+sortable: true,
+weight: 20,
+disclosure: true
+});
 
-columns.name.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path"));
-columns.name.sortable = true;
-columns.name.width = "20%";
-columns.name.disclosure = true;
+columns.push({
+id: "method",
+title: WebInspector.UIString("Method"),
+sortable: true,
+weight: 6
+});
 
-columns.method.title = WebInspector.UIString("Method");
-columns.method.sortable = true;
-columns.method.width = "6%";
+columns.push({
+id: "status",
+titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Status"), WebInspector.UIString("Text")),
+title: WebInspector.UIString("Status"),
+sortable: true,
+weight: 6
+});
 
-columns.status.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Status"), WebInspector.UIString("Text"));
-columns.status.sortable = true;
-columns.status.width = "6%";
+columns.push({
+id: "domain",
+title: WebInspector.UIString("Domain"),
+sortable: true,
+weight: 6
+});
 
-columns.type.title = WebInspector.UIString("Type");
-columns.type.sortable = true;
-columns.type.width = "6%";
+columns.push({
+id: "type",
+title: WebInspector.UIString("Type"),
+sortable: true,
+weight: 6
+});
 
-columns.initiator.title = WebInspector.UIString("Initiator");
-columns.initiator.sortable = true;
-columns.initiator.width = "10%";
+columns.push({
+id: "initiator",
+title: WebInspector.UIString("Initiator"),
+sortable: true,
+weight: 10
+});
 
-columns.size.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Content"));
-columns.size.sortable = true;
-columns.size.width = "6%";
-columns.size.aligned = "right";
+columns.push({
+id: "cookies",
+title: WebInspector.UIString("Cookies"),
+sortable: true,
+weight: 6,
+align: WebInspector.DataGrid.Align.Right
+});
 
-columns.time.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Time"), WebInspector.UIString("Latency"));
-columns.time.sortable = true;
-columns.time.width = "6%";
-columns.time.aligned = "right";
+columns.push({
+id: "setCookies",
+title: WebInspector.UIString("Set-Cookies"),
+sortable: true,
+weight: 6,
+align: WebInspector.DataGrid.Align.Right
+});
 
-columns.timeline.title = "";
-columns.timeline.sortable = false;
-columns.timeline.width = "40%";
-columns.timeline.sort = "ascending";
+columns.push({
+id: "size",
+titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Content")),
+title: WebInspector.UIString("Size"),
+sortable: true,
+weight: 6,
+align: WebInspector.DataGrid.Align.Right
+});
+
+columns.push({
+id: "time",
+titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Time"), WebInspector.UIString("Latency")),
+title: WebInspector.UIString("Time"),
+sortable: true,
+weight: 6,
+align: WebInspector.DataGrid.Align.Right
+});
+
+columns.push({
+id: "timeline",
+titleDOMFragment: document.createDocumentFragment(),
+title: WebInspector.UIString("Timeline"),
+sortable: false,
+weight: 40,
+sort: WebInspector.DataGrid.Order.Ascending
+});
 
 this._dataGrid = new WebInspector.DataGrid(columns);
+this._dataGrid.setName("networkLog");
 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
 this._dataGrid.element.addStyleClass("network-log-grid");
 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
 this._dataGrid.show(this.element);
 
 
-this._dataGrid.addEventListener("sorting changed", this._sortItems, this);
-this._dataGrid.addEventListener("width changed", this._updateDividersIfNeeded, this);
+this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this);
+this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResized, this._updateDividersIfNeeded, this);
 this._dataGrid.scrollContainer.addEventListener("scroll", this._updateOffscreenRows.bind(this));
 
 this._patchTimelineHeader();
@@ -1255,11 +1345,9 @@
 _makeHeaderFragment: function(title, subtitle)
 {
 var fragment = document.createDocumentFragment();
-fragment.appendChild(document.createTextNode(title));
-var subtitleDiv = document.createElement("div");
-subtitleDiv.className = "network-header-subtitle";
-subtitleDiv.textContent = subtitle;
-fragment.appendChild(subtitleDiv);
+fragment.createTextChild(title);
+var subtitleDiv = fragment.createChild("div", "network-header-subtitle");
+subtitleDiv.createTextChild(subtitle);
 return fragment;
 },
 
@@ -1311,8 +1399,11 @@
 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameComparator;
 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "method", false);
 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "statusCode", false);
+this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "domain", false);
 this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "mimeType", false);
 this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.InitiatorComparator;
+this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.RequestCookiesCountComparator;
+this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator;
 this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeComparator;
 this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "duration", false);
 this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "startTime", false);
@@ -1337,7 +1428,7 @@
 _sortItems: function()
 {
 this._removeAllNodeHighlights();
-var columnIdentifier = this._dataGrid.sortColumnIdentifier;
+var columnIdentifier = this._dataGrid.sortColumnIdentifier();
 if (columnIdentifier === "timeline") {
 this._sortByTimeline();
 return;
@@ -1346,7 +1437,7 @@
 if (!sortingFunction)
 return;
 
-this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "descending");
+this._dataGrid.sortNodes(sortingFunction, !this._dataGrid.isSortOrderAscending());
 this._timelineSortSelector.selectedIndex = 0;
 this._updateOffscreenRows();
 
@@ -1355,7 +1446,7 @@
 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
 action: WebInspector.UserMetrics.UserActionNames.NetworkSort,
 column: columnIdentifier,
-sortOrder: this._dataGrid.sortOrder
+sortOrder: this._dataGrid.sortOrder()
 });
 },
 
@@ -1375,7 +1466,7 @@
 this._timelineGrid.hideEventDividers();
 else
 this._timelineGrid.showEventDividers();
-this._dataGrid.markColumnAsSortedBy("timeline", "ascending");
+this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Order.Ascending);
 this._updateOffscreenRows();
 },
 
@@ -1383,6 +1474,7 @@
 {
 var filterBarElement = document.createElement("div");
 filterBarElement.className = "scope-bar status-bar-item";
+filterBarElement.title = WebInspector.UIString("Use %s Click to select multiple types.", WebInspector.KeyboardShortcut.shortcutToString("", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));
 
 
 function createFilterElement(typeName, label)
@@ -1390,7 +1482,7 @@
 var categoryElement = document.createElement("li");
 categoryElement.typeName = typeName;
 categoryElement.className = typeName;
-categoryElement.appendChild(document.createTextNode(label));
+categoryElement.createTextChild(label);
 categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
 filterBarElement.appendChild(categoryElement);
 
@@ -1398,11 +1490,7 @@
 }
 
 this._filterAllElement = createFilterElement.call(this, "all", WebInspector.UIString("All"));
-
-
-var dividerElement = document.createElement("div");
-dividerElement.addStyleClass("scope-bar-divider");
-filterBarElement.appendChild(dividerElement);
+filterBarElement.createChild("div", "scope-bar-divider");
 
 for (var typeId in WebInspector.resourceTypes) {
 var type = WebInspector.resourceTypes[typeId];
@@ -1452,7 +1540,7 @@
 var request = this._requests[i];
 var requestTransferSize = (request.cached || !request.transferSize) ? 0 : request.transferSize;
 transferSize += requestTransferSize;
-if ((!this._hiddenCategories.all || !this._hiddenCategories[request.type.name()]) && !this._filteredOutRequests.get(request)) {
+if ((!this._hiddenCategories["all"] || !this._hiddenCategories[request.type.name()]) && !this._filteredOutRequests.get(request)) {
 selectedRequestsNumber++;
 selectedTransferSize += requestTransferSize;
 }
@@ -1579,10 +1667,9 @@
 return;
 var timelineColumn = this._dataGrid.columns.timeline;
 for (var i = 0; i < this._dataGrid.resizers.length; ++i) {
-if (timelineColumn.ordinal === this._dataGrid.resizers[i].rightNeighboringColumnID) {
+if (timelineColumn.ordinal === this._dataGrid.resizers[i].rightNeighboringColumnIndex) {
 
 this._timelineGrid.element.style.left = this._dataGrid.resizers[i].style.left;
-this._timelineGrid.element.style.right = "18px";
 }
 }
 
@@ -1591,7 +1678,7 @@
 this._scheduleRefresh();
 proceed = false;
 } else {
-this.calculator.setDisplayWindow(this._timelineGrid.element.clientWidth);
+this.calculator.setDisplayWindow(this._timelineGrid.dividersElement.clientWidth);
 proceed = this._timelineGrid.updateDividers(this.calculator);
 }
 if (!proceed)
@@ -1801,7 +1888,6 @@
 
 this._mainRequestLoadTime = -1;
 this._mainRequestDOMContentTime = -1;
-this._linkifier.reset();
 },
 
 get requests()
@@ -1896,45 +1982,16 @@
 this._dataGrid.selectedNode.selected = false;
 
 this.element.removeStyleClass("brief-mode");
-
-this._dataGrid.showColumn("method");
-this._dataGrid.showColumn("status");
-this._dataGrid.showColumn("type");
-this._dataGrid.showColumn("initiator");
-this._dataGrid.showColumn("size");
-this._dataGrid.showColumn("time");
-this._dataGrid.showColumn("timeline");
-
-var widths = {};
-widths.name = 20;
-widths.method = 6;
-widths.status = 6;
-widths.type = 6;
-widths.initiator = 10;
-widths.size = 6;
-widths.time = 6;
-widths.timeline = 40;
-
-this._dataGrid.applyColumnWidthsMap(widths);
+this._detailedMode = true;
+this._updateColumns();
 },
 
 switchToBriefView: function()
 {
 this.element.addStyleClass("brief-mode");
 this._removeAllNodeHighlights();
-
-this._dataGrid.hideColumn("method");
-this._dataGrid.hideColumn("status");
-this._dataGrid.hideColumn("type");
-this._dataGrid.hideColumn("initiator");
-this._dataGrid.hideColumn("size");
-this._dataGrid.hideColumn("time");
-this._dataGrid.hideColumn("timeline");
-
-var widths = {};
-widths.name = 100;
-this._dataGrid.applyColumnWidthsMap(widths);
-
+this._detailedMode = false;
+this._updateColumns();
 this._popoverHelper.hidePopover();
 },
 
@@ -1985,6 +2042,11 @@
 popover.show(content, anchor);
 },
 
+_onHidePopover: function()
+{
+this._linkifier.reset();
+},
+
 
 _generateScriptInitiatedPopoverContent: function(request)
 {
@@ -1995,15 +2057,67 @@
 var row = document.createElement("tr");
 row.createChild("td").textContent = stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)");
 row.createChild("td").textContent = " @ ";
-row.createChild("td").appendChild(this._linkifier.linkifyLocation(stackFrame.url, stackFrame.lineNumber - 1, 0));
+row.createChild("td").appendChild(this._linkifier.linkifyLocation(stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumber - 1));
 framesTable.appendChild(row);
 }
 return framesTable;
 },
 
+_updateColumns: function()
+{
+var columnsVisibility = this._coulmnsVisibilitySetting.get();
+var detailedMode = !!this._detailedMode;
+for (var columnIdentifier in columnsVisibility) {
+var visible = detailedMode && columnsVisibility[columnIdentifier];
+this._dataGrid.setColumnVisible(columnIdentifier, visible);
+}
+this._dataGrid.setColumnVisible("timeline", detailedMode);
+this._dataGrid.applyColumnWeights();
+},
+
+
+_toggleColumnVisibility: function(columnIdentifier)
+{
+var columnsVisibility = this._coulmnsVisibilitySetting.get();
+columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifier];
+this._coulmnsVisibilitySetting.set(columnsVisibility);
+
+this._updateColumns();
+},
+
+
+_getConfigurableColumnIDs: function()
+{
+if (this._configurableColumnIDs)
+return this._configurableColumnIDs;
+
+var columns = this._dataGrid.columns;
+function compare(id1, id2)
+{
+return columns[id1].title.compareTo(columns[id2].title);
+}
+
+var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get());
+this._configurableColumnIDs = columnIDs.sort(compare);
+return this._configurableColumnIDs;
+},
+
 _contextMenu: function(event)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
+
+if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid.headerTableBody)) {
+var columnsVisibility = this._coulmnsVisibilitySetting.get();
+var columnIDs = this._getConfigurableColumnIDs();
+for (var i = 0; i < columnIDs.length; ++i) {
+var columnIdentifier = columnIDs[i];
+var column = this._dataGrid.columns[columnIdentifier];
+contextMenu.appendCheckboxItem(column.title, this._toggleColumnVisibility.bind(this, columnIdentifier), !!columnsVisibility[columnIdentifier]);
+}
+contextMenu.show();
+return;
+}
+
 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target);
 var request = gridNode && gridNode._request;
 
@@ -2015,22 +2129,17 @@
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy request headers" : "Copy Request Headers"), this._copyRequestHeaders.bind(this, request));
 if (request.responseHeadersText)
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy response headers" : "Copy Response Headers"), this._copyResponseHeaders.bind(this, request));
+contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.bind(this, request));
 }
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this));
 
-if (InspectorFrontendHost.canSave()) {
 contextMenu.appendSeparator();
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as HAR with content" : "Save as HAR with Content"), this._exportAll.bind(this));
-}
 
-if (this._canClearBrowserCache || this._canClearBrowserCookies)
 contextMenu.appendSeparator();
-if (this._canClearBrowserCache)
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear browser cache" : "Clear Browser Cache"), this._clearBrowserCache.bind(this));
-if (this._canClearBrowserCookies)
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear browser cookies" : "Clear Browser Cookies"), this._clearBrowserCookies.bind(this));
 
-
 if (request && request.type === WebInspector.resourceTypes.XHR) {
 contextMenu.appendSeparator();
 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), this._replayXHR.bind(this, request.requestId));
@@ -2048,7 +2157,7 @@
 _copyAll: function()
 {
 var harArchive = {
-log: (new WebInspector.HARLog(this._requests)).build()
+log: (new WebInspector.HARLog(this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter))).build()
 };
 InspectorFrontendHost.copyText(JSON.stringify(harArchive, null, 2));
 },
@@ -2068,6 +2177,12 @@
 InspectorFrontendHost.copyText(request.responseHeadersText);
 },
 
+
+_copyCurlCommand: function(request)
+{
+InspectorFrontendHost.copyText(this._generateCurlCommand(request));
+},
+
 _exportAll: function()
 {
 var filename = WebInspector.inspectedPageDomain + ".har";
@@ -2078,17 +2193,17 @@
 var progressIndicator = new WebInspector.ProgressIndicator();
 this._progressBarContainer.appendChild(progressIndicator.element);
 var harWriter = new WebInspector.HARWriter();
-harWriter.write(stream, this._requests, progressIndicator);
+harWriter.write(stream, this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter), progressIndicator);
 }
 },
 
-_clearBrowserCache: function(event)
+_clearBrowserCache: function()
 {
 if (confirm(WebInspector.UIString("Are you sure you want to clear browser cache?")))
 NetworkAgent.clearBrowserCache();
 },
 
-_clearBrowserCookies: function(event)
+_clearBrowserCookies: function()
 {
 if (confirm(WebInspector.UIString("Are you sure you want to clear browser cookies?")))
 NetworkAgent.clearBrowserCookies();
@@ -2123,10 +2238,7 @@
 
 var rowIsVisible = unfilteredRowIndex * rowHeight < visibleBottom && (unfilteredRowIndex + 1) * rowHeight > visibleTop;
 if (rowIsVisible !== row.rowIsVisible) {
-if (rowIsVisible)
-row.removeStyleClass("offscreen");
-else
-row.addStyleClass("offscreen");
+row.enableStyleClass("offscreen", !rowIsVisible);
 row.rowIsVisible = rowIsVisible;
 }
 unfilteredRowIndex++;
@@ -2325,10 +2437,77 @@
 this._highlightedNode = node;
 },
 
+
+_generateCurlCommand: function(request)
+{
+var command = ["curl"];
+var ignoredHeaders = {};
+
+function escapeCharacter(x)
+{
+var code = x.charCodeAt(0);
+
+return code < 16 ? "\\x0" + code.toString(16) : "\\x" + code.toString(16);
+}
+
+function escape(str)
+{
+if (/[\0-\x1f\']/.test(str)) {
+
+return "$\'" + str.replace(/\\/g, "\\\\")
+.replace(/\'/g, "\\\'")
+.replace(/\n/g, "\\n")
+.replace(/\r/g, "\\r")
+.replace(/[\0-\x1f]/g, escapeCharacter) + "'";
+} else {
+
+return "'" + str + "'";
+}
+}
+command.push(escape(request.url));
+
+var inferredMethod = "GET";
+var data = [];
+var requestContentType = request.requestContentType();
+if (requestContentType && requestContentType.startsWith("application/x-www-form-urlencoded") && request.requestFormData) {
+data.push("--data");
+data.push(escape(request.requestFormData));
+ignoredHeaders["Content-Length"] = true;
+inferredMethod = "POST";
+} else if (request.requestFormData) {
+data.push("--data-binary");
+data.push(escape(request.requestFormData));
+ignoredHeaders["Content-Length"] = true;
+inferredMethod = "POST";
+}
+
+if (request.requestMethod !== inferredMethod) {
+command.push("-X");
+command.push(request.requestMethod);
+}
+
+for (var i = 0; i < request.requestHeaders.length; i++) {
+var header = request.requestHeaders[i];
+if (header.name in ignoredHeaders)
+continue;
+command.push("-H");
+command.push(escape(header.name + ": " + header.value));
+}
+command = command.concat(data);
+command.push("--compressed");
+return command.join(" ");
+}, 
+
 __proto__: WebInspector.View.prototype
 }
 
 
+WebInspector.NetworkLogView.HTTPRequestsFilter = function(request)
+{
+return request.parsedURL.isValid && (request.parsedURL.scheme in WebInspector.NetworkLogView.HTTPSchemas);
+}
+
+
 WebInspector.NetworkLogView.EventTypes = {
 ViewCleared: "ViewCleared",
 RowSizeChanged: "RowSizeChanged",
@@ -2342,11 +2521,20 @@
 {
 WebInspector.Panel.call(this, "network");
 this.registerRequiredCSS("networkPanel.css");
+this._injectStyles();
 
 this.createSidebarView();
 this.splitView.hideMainElement();
 
-this._networkLogView = new WebInspector.NetworkLogView();
+var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVisivility;
+var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting("networkLogColumnsVisibility", defaultColumnsVisibility);
+var savedColumnsVisibility = networkLogColumnsVisibilitySetting.get();
+var columnsVisibility = {};
+for (var columnId in defaultColumnsVisibility)
+columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(columnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId];
+networkLogColumnsVisibilitySetting.set(columnsVisibility);
+
+this._networkLogView = new WebInspector.NetworkLogView(networkLogColumnsVisibilitySetting);
 this._networkLogView.show(this.sidebarElement);
 
 this._viewsContainerElement = this.splitView.mainElement;
@@ -2449,10 +2637,7 @@
 
 _onRowSizeChanged: function(event)
 {
-if (event.data.largeRows)
-this._viewsContainerElement.removeStyleClass("small");
-else
-this._viewsContainerElement.addStyleClass("small");
+this._viewsContainerElement.enableStyleClass("small", !event.data.largeRows);
 },
 
 _onSearchCountUpdated: function(event)
@@ -2569,7 +2754,35 @@
 WebInspector.inspectorView.setCurrentPanel(this);
 this.revealAndHighlightRequest(  (target));
 }
-contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in network panel" : "Reveal in Network Panel"), reveal.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Network panel" : "Reveal in Network Panel"), reveal.bind(this));
+},
+
+_injectStyles: function()
+{
+var style = document.createElement("style");
+var rules = [];
+
+var columns = WebInspector.NetworkLogView._defaultColumnsVisivility;
+
+var hideSelectors = [];
+var bgSelectors = [];
+for (var columnId in columns) {
+hideSelectors.push("#network-container .hide-" + columnId + "-column ." + columnId + "-column");
+bgSelectors.push(".network-log-grid.data-grid td." + columnId + "-column");
+}
+rules.push(hideSelectors.join(", ") + "{border-right: 0 none transparent;}");
+rules.push(bgSelectors.join(", ") + "{background-color: rgba(0, 0, 0, 0.07);}");
+
+var filterSelectors = [];
+for (var typeId in WebInspector.resourceTypes) {
+var typeName = WebInspector.resourceTypes[typeId].name();
+filterSelectors.push(".network-log-grid.data-grid.filter-" + typeName + " table.data tr.revealed.network-type-" + typeName + ":not(.filtered-out)");
+}
+filterSelectors.push(".network-log-grid.data-grid.filter-all table.data tr.revealed.network-item:not(.filtered-out)");
+rules.push(filterSelectors.join(", ") + "{display: table-row;}");
+
+style.textContent = rules.join("\n");
+document.head.appendChild(style);
 },
 
 __proto__: WebInspector.Panel.prototype
@@ -2630,6 +2843,11 @@
 return this._minimumBoundary;
 },
 
+zeroTime: function()
+{
+return this._minimumBoundary;
+},
+
 _value: function(item)
 {
 return 0;
@@ -2825,6 +3043,7 @@
 WebInspector.DataGridNode.call(this, {});
 this._parentView = parentView;
 this._request = request;
+this._linkifier = new WebInspector.Linkifier();
 }
 
 WebInspector.NetworkDataGridNode.prototype = {
@@ -2835,8 +3054,11 @@
 this._nameCell = this._createDivInTD("name");
 this._methodCell = this._createDivInTD("method");
 this._statusCell = this._createDivInTD("status");
+this._domainCell = this._createDivInTD("domain");
 this._typeCell = this._createDivInTD("type");
 this._initiatorCell = this._createDivInTD("initiator");
+this._cookiesCell = this._createDivInTD("cookies");
+this._setCookiesCell = this._createDivInTD("setCookies");
 this._sizeCell = this._createDivInTD("size");
 this._timeCell = this._createDivInTD("time");
 this._createTimelineCell();
@@ -2844,11 +3066,16 @@
 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this), false);
 },
 
+wasDetached: function()
+{
+this._linkifier.reset();
+},
+
 isFilteredOut: function()
 {
 if (this._parentView._filteredOutRequests.get(this._request))
 return true;
-if (!this._parentView._hiddenCategories.all)
+if (!this._parentView._hiddenCategories["all"])
 return false;
 return this._request.type.name() in this._parentView._hiddenCategories;
 },
@@ -2891,10 +3118,8 @@
 
 _createDivInTD: function(columnIdentifier)
 {
-var td = document.createElement("td");
-td.className = columnIdentifier + "-column";
-var div = document.createElement("div");
-td.appendChild(div);
+var td = this.createTD(columnIdentifier);
+var div = td.createChild("div");
 this._element.appendChild(td);
 return div;
 },
@@ -2942,8 +3167,11 @@
 this._methodCell.setTextAndTitle(this._request.requestMethod);
 
 this._refreshStatusCell();
+this._refreshDomainCell();
 this._refreshTypeCell();
 this._refreshInitiatorCell();
+this._refreshCookiesCell();
+this._refreshSetCookiesCell();
 this._refreshSizeCell();
 this._refreshTimeCell();
 
@@ -2951,9 +3179,16 @@
 this._graphElement.addStyleClass("resource-cached");
 
 this._element.addStyleClass("network-item");
-if (!this._element.hasStyleClass("network-type-" + this._request.type.name())) {
-this._element.removeMatchingStyleClasses("network-type-\\w+");
-this._element.addStyleClass("network-type-" + this._request.type.name());
+this._updateElementStyleClasses(this._element);
+},
+
+
+_updateElementStyleClasses: function(element)
+{
+var typeClassName = "network-type-" + this._request.type.name();
+if (!element.hasStyleClass(typeClassName)) {
+element.removeMatchingStyleClasses("network-type-\\w+");
+element.addStyleClass(typeClassName);
 }
 },
 
@@ -3001,7 +3236,7 @@
 this.element.removeStyleClass("network-error-row");
 
 if (this._request.statusCode) {
-this._statusCell.appendChild(document.createTextNode(this._request.statusCode));
+this._statusCell.appendChild(document.createTextNode("" + this._request.statusCode));
 this._appendSubtitle(this._statusCell, this._request.statusText);
 this._statusCell.title = this._request.statusCode + " " + this._request.statusText;
 if (this._request.statusCode >= 400)
@@ -3019,6 +3254,13 @@
 }
 },
 
+_refreshDomainCell: function()
+{
+this._domainCell.removeChildren();
+this._domainCell.appendChild(document.createTextNode(this._request.domain));
+this._domainCell.title = this._request.parsedURL.host;
+},
+
 _refreshTypeCell: function()
 {
 if (this._request.mimeType) {
@@ -3035,44 +3277,55 @@
 
 _refreshInitiatorCell: function()
 {
+this._initiatorCell.removeChildren();
 this._initiatorCell.removeStyleClass("network-dim-cell");
 this._initiatorCell.removeStyleClass("network-script-initiated");
 delete this._initiatorCell.request;
-this._initiatorCell.title = null;
 
-var initiator = this._request.initiator;
-if ((initiator && initiator.type !== "other") || this._request.redirectSource) {
-this._initiatorCell.removeChildren();
-if (this._request.redirectSource) {
-var redirectSource = this._request.redirectSource;
-this._initiatorCell.title = redirectSource.url;
-this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource));
-this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Redirect"));
-} else if (initiator.type === "script") {
-var topFrame = initiator.stackTrace[0];
+var request = this._request;
+var initiator = request.initiatorInfo();
 
-if (!topFrame.url) {
-this._initiatorCell.addStyleClass("network-dim-cell");
-this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other"));
-return;
-}
-var urlElement = this._parentView._linkifier.linkifyLocation(topFrame.url, topFrame.lineNumber - 1, 0);
-urlElement.title = null;
-this._initiatorCell.appendChild(urlElement);
-this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script"));
-this._initiatorCell.addStyleClass("network-script-initiated");
-this._initiatorCell.request = this._request;
-} else { 
+switch (initiator.type) {
+case WebInspector.NetworkRequest.InitiatorType.Parser:
 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumber;
 this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, initiator.lineNumber - 1));
 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Parser"));
-}
-} else {
+break;
+
+case WebInspector.NetworkRequest.InitiatorType.Redirect:
+this._initiatorCell.title = initiator.url;
+this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(request.redirectSource));
+this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Redirect"));
+break;
+
+case WebInspector.NetworkRequest.InitiatorType.Script:
+var urlElement = this._linkifier.linkifyLocation(initiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1);
+urlElement.title = "";
+this._initiatorCell.appendChild(urlElement);
+this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script"));
+this._initiatorCell.addStyleClass("network-script-initiated");
+this._initiatorCell.request = request;
+break;
+
+default:
+this._initiatorCell.title = "";
 this._initiatorCell.addStyleClass("network-dim-cell");
 this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other"));
 }
 },
 
+_refreshCookiesCell: function()
+{
+var requestCookies = this._request.requestCookies;
+this._cookiesCell.setTextAndTitle(requestCookies ? "" + requestCookies.length : "");
+},
+
+_refreshSetCookiesCell: function()
+{
+var responseCookies = this._request.responseCookies;
+this._setCookiesCell.setTextAndTitle(responseCookies ? "" + responseCookies.length : "");
+},
+
 _refreshSizeCell: function()
 {
 if (this._request.cached) {
@@ -3113,11 +3366,7 @@
 this._percentages = percentages;
 
 this._barAreaElement.removeStyleClass("hidden");
-
-if (!this._graphElement.hasStyleClass("network-type-" + this._request.type.name())) {
-this._graphElement.removeMatchingStyleClasses("network-type-\\w+");
-this._graphElement.addStyleClass("network-type-" + this._request.type.name());
-}
+this._updateElementStyleClasses(this._graphElement);
 
 this._barLeftElement.style.setProperty("left", percentages.start + "%");
 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
@@ -3226,25 +3475,52 @@
 if (a._request.cached && !b._request.cached)
 return -1;
 
-if (a._request.resourceSize === b._request.resourceSize)
+if (a._request.transferSize === b._request.transferSize)
 return 0;
 
-return a._request.resourceSize - b._request.resourceSize;
+return a._request.transferSize - b._request.transferSize;
 }
 
 WebInspector.NetworkDataGridNode.InitiatorComparator = function(a, b)
 {
-if (!a._request.initiator || a._request.initiator.type === "Other")
+var aInitiator = a._request.initiatorInfo();
+var bInitiator = b._request.initiatorInfo();
+
+if (aInitiator.type < bInitiator.type)
 return -1;
-if (!b._request.initiator || b._request.initiator.type === "Other")
+if (aInitiator.type > bInitiator.type)
 return 1;
 
-if (a._request.initiator.url < b._request.initiator.url)
+if (aInitiator.source < bInitiator.source)
 return -1;
-if (a._request.initiator.url > b._request.initiator.url)
+if (aInitiator.source > bInitiator.source)
 return 1;
 
-return a._request.initiator.lineNumber - b._request.initiator.lineNumber;
+if (aInitiator.lineNumber < bInitiator.lineNumber)
+return -1;
+if (aInitiator.lineNumber > bInitiator.lineNumber)
+return 1;
+
+if (aInitiator.columnNumber < bInitiator.columnNumber)
+return -1;
+if (aInitiator.columnNumber > bInitiator.columnNumber)
+return 1;
+
+return 0;
+}
+
+WebInspector.NetworkDataGridNode.RequestCookiesCountComparator = function(a, b)
+{
+var aScore = a._request.requestCookies ? a._request.requestCookies.length : 0;
+var bScore = b._request.requestCookies ? b._request.requestCookies.length : 0;
+return aScore - bScore;
+}
+
+WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator = function(a, b)
+{
+var aScore = a._request.responseCookies ? a._request.responseCookies.length : 0;
+var bScore = b._request.responseCookies ? b._request.responseCookies.length : 0;
+return aScore - bScore;
 }
 
 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyName, revert, a, b)
diff --git a/resources/inspector/ProfilesPanel.js b/resources/inspector/ProfilesPanel.js
index 32574ea..61349ad 100644
--- a/resources/inspector/ProfilesPanel.js
+++ b/resources/inspector/ProfilesPanel.js
@@ -9,10 +9,31 @@
 this._id = id;
 this._name = name;
 
+this._profiles = [];
+this._profilesIdMap = {};
+
 this.treeElement = null;
 }
 
+WebInspector.ProfileType.Events = {
+AddProfileHeader: "add-profile-header",
+RemoveProfileHeader: "remove-profile-header",
+ProgressUpdated: "progress-updated",
+ViewUpdated: "view-updated"
+}
+
 WebInspector.ProfileType.prototype = {
+
+fileExtension: function()
+{
+return null;
+},
+
+get statusBarItems()
+{
+return [];
+},
+
 get buttonTooltip()
 {
 return "";
@@ -34,21 +55,41 @@
 },
 
 
-buttonClicked: function(profilesPanel)
+buttonClicked: function()
 {
 return false;
 },
 
-reset: function()
-{
-},
-
 get description()
 {
 return "";
 },
 
 
+isInstantProfile: function()
+{
+return false;
+},
+
+
+getProfiles: function()
+{
+return this._profiles.filter(function(profile) { return !profile.isTemporary; });
+},
+
+
+decorationElement: function()
+{
+return null;
+},
+
+
+getProfile: function(uid)
+{
+return this._profilesIdMap[this._makeKey(uid)];
+},
+
+
 
 createTemporaryProfile: function(title)
 {
@@ -59,21 +100,92 @@
 createProfile: function(profile)
 {
 throw new Error("Not supported for " + this._name + " profiles.");
+},
+
+
+_makeKey: function(id)
+{
+return id + '/' + escape(this.id);
+},
+
+
+addProfile: function(profile)
+{
+this._profiles.push(profile);
+
+this._profilesIdMap[this._makeKey(profile.uid)] = profile;
+this.dispatchEventToListeners(WebInspector.ProfileType.Events.AddProfileHeader, profile);
+},
+
+
+removeProfile: function(profile)
+{
+for (var i = 0; i < this._profiles.length; ++i) {
+if (this._profiles[i].uid === profile.uid) {
+this._profiles.splice(i, 1);
+break;
 }
 }
+delete this._profilesIdMap[this._makeKey(profile.uid)];
+},
+
+
+findTemporaryProfile: function()
+{
+for (var i = 0; i < this._profiles.length; ++i) {
+if (this._profiles[i].isTemporary)
+return this._profiles[i];
+}
+return null;
+},
+
+_reset: function()
+{
+var profiles = this._profiles.slice(0);
+for (var i = 0; i < profiles.length; ++i) {
+var profile = profiles[i];
+var view = profile.existingView();
+if (view) {
+view.detach();
+if ("dispose" in view)
+view.dispose();
+}
+this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeader, profile);
+}
+this.treeElement.removeChildren();
+this._profiles = [];
+this._profilesIdMap = {};
+},
+
+
+_requestProfilesFromBackend: function(populateCallback)
+{
+},
+
+_populateProfiles: function()
+{
+
+function populateCallback(error, profileHeaders) {
+if (error)
+return;
+profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
+var count = profileHeaders.length;
+for (var i = 0; i < count; ++i)
+this.addProfile(this.createProfile(profileHeaders[i]));
+}
+this._requestProfilesFromBackend(populateCallback.bind(this));
+},
+
+__proto__: WebInspector.Object.prototype
+}
 
 
 WebInspector.ProfileHeader = function(profileType, title, uid)
 {
 this._profileType = profileType;
 this.title = title;
-if (uid === undefined) {
-this.uid = -1;
-this.isTemporary = true;
-} else {
-this.uid = uid;
-this.isTemporary = false;
-}
+this.isTemporary = uid === undefined;
+this.uid = this.isTemporary ? -1 : uid;
 this._fromFile = false;
 }
 
@@ -97,42 +209,59 @@
 },
 
 
-view: function()
+view: function(panel)
 {
 if (!this._view)
-this._view = this.createView(WebInspector.ProfilesPanel._instance);
+this._view = this.createView(panel);
 return this._view;
 },
 
 
-createView: function(profilesPanel)
+createView: function(panel)
 {
 throw new Error("Not implemented.");
 },
 
-
-load: function(callback) { },
+dispose: function()
+{
+},
 
 
-canSaveToFile: function() { return false; },
-
-saveToFile: function() { throw new Error("Needs implemented"); },
+load: function(callback)
+{
+},
 
 
-canLoadFromFile: function() { return false; },
+canSaveToFile: function()
+{
+return false;
+},
+
+saveToFile: function()
+{
+throw new Error("Needs implemented");
+},
 
 
-loadFromFile: function(file) { throw new Error("Needs implemented"); },
+loadFromFile: function(file)
+{
+throw new Error("Needs implemented");
+},
 
 
-fromFile: function() { return this._fromFile; }
+fromFile: function()
+{
+return this._fromFile;
+}
 }
 
 
-WebInspector.ProfilesPanel = function()
+WebInspector.ProfilesPanel = function(name, type)
 {
-WebInspector.Panel.call(this, "profiles");
-WebInspector.ProfilesPanel._instance = this;
+
+var singleProfileMode = typeof name !== "undefined";
+name = name || "profiles";
+WebInspector.Panel.call(this, name);
 this.registerRequiredCSS("panelEnablerView.css");
 this.registerRequiredCSS("heapProfiler.css");
 this.registerRequiredCSS("profilesPanel.css");
@@ -142,25 +271,15 @@
 this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(this);
 this.sidebarTree.appendChild(this.profilesItemTreeElement);
 
+this._singleProfileMode = singleProfileMode;
 this._profileTypesByIdMap = {};
 
-var panelEnablerHeading = WebInspector.UIString("You need to enable profiling before you can use the Profiles panel.");
-var panelEnablerDisclaimer = WebInspector.UIString("Enabling profiling will make scripts run slower.");
-var panelEnablerButton = WebInspector.UIString("Enable Profiling");
-this.panelEnablerView = new WebInspector.PanelEnablerView("profiles", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
-this.panelEnablerView.addEventListener("enable clicked", this.enableProfiler, this);
-
 this.profileViews = document.createElement("div");
 this.profileViews.id = "profile-views";
 this.splitView.mainElement.appendChild(this.profileViews);
 
 this._statusBarButtons = [];
 
-this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-if (Capabilities.profilerCausesRecompilation) {
-this._statusBarButtons.push(this.enableToggleButton);
-this.enableToggleButton.addEventListener("click", this._onToggleProfiling, this);
-}
 this.recordButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item");
 this.recordButton.addEventListener("click", this.toggleRecordButton, this);
 this._statusBarButtons.push(this.recordButton);
@@ -169,33 +288,34 @@
 this.clearResultsButton.addEventListener("click", this._clearProfiles, this);
 this._statusBarButtons.push(this.clearResultsButton);
 
-if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
-this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"), "garbage-collect-status-bar-item");
-this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked, this);
-this._statusBarButtons.push(this.garbageCollectButton);
-}
+this._profileTypeStatusBarItemsContainer = document.createElement("div");
+this._profileTypeStatusBarItemsContainer.className = "status-bar-items";
 
-this.profileViewStatusBarItemsContainer = document.createElement("div");
-this.profileViewStatusBarItemsContainer.className = "status-bar-items";
+this._profileViewStatusBarItemsContainer = document.createElement("div");
+this._profileViewStatusBarItemsContainer.className = "status-bar-items";
 
-this._profiles = [];
-this._profilerEnabled = !Capabilities.profilerCausesRecompilation;
-
-this._launcherView = new WebInspector.ProfileLauncherView(this);
-this._launcherView.addEventListener(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
-this._reset();
+if (singleProfileMode) {
+this._launcherView = this._createLauncherView();
+this._registerProfileType(  (type));
+this._selectedProfileType = type;
+this._updateProfileTypeSpecificUI();
+} else {
+this._launcherView = new WebInspector.MultiProfileLauncherView(this);
+this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
 
 this._registerProfileType(new WebInspector.CPUProfileType());
 if (!WebInspector.WorkerManager.isWorkerFrontend())
 this._registerProfileType(new WebInspector.CSSSelectorProfileType());
-if (Capabilities.heapProfilerPresent)
 this._registerProfileType(new WebInspector.HeapSnapshotProfileType());
-if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled())
+if (!WebInspector.WorkerManager.isWorkerFrontend() && WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled()) {
+this._registerProfileType(new WebInspector.NativeSnapshotProfileType());
 this._registerProfileType(new WebInspector.NativeMemoryProfileType());
-if (WebInspector.experimentsSettings.canvasInspection.isEnabled())
+}
+if (!WebInspector.WorkerManager.isWorkerFrontend() && WebInspector.experimentsSettings.canvasInspection.isEnabled())
 this._registerProfileType(new WebInspector.CanvasProfileType());
+}
 
-InspectorBackend.registerProfilerDispatcher(new WebInspector.ProfilerDispatcher(this));
+this._reset();
 
 this._createFileSelectorElement();
 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
@@ -213,106 +333,111 @@
 },
 
 
+_createLauncherView: function()
+{
+return new WebInspector.ProfileLauncherView(this);
+},
+
+_findProfileTypeByExtension: function(fileName)
+{
+for (var id in this._profileTypesByIdMap) {
+var type = this._profileTypesByIdMap[id];
+var extension = type.fileExtension();
+if (!extension)
+continue;
+if (fileName.endsWith(type.fileExtension()))
+return type;
+}
+return null;
+},
+
+
 _loadFromFile: function(file)
 {
-if (!file.name.endsWith(".heapsnapshot")) {
-WebInspector.log(WebInspector.UIString("Only heap snapshots from files with extension '.heapsnapshot' can be loaded."));
+this._createFileSelectorElement();
+
+var profileType = this._findProfileTypeByExtension(file.name);
+if (!profileType) {
+var extensions = [];
+for (var id in this._profileTypesByIdMap) {
+var extension = this._profileTypesByIdMap[id].fileExtension();
+if (!extension)
+continue;
+extensions.push(extension);
+}
+WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensions '%s' can be loaded.", extensions.join("', '")));
 return;
 }
 
-if (!!this.findTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId)) {
+if (!!profileType.findTemporaryProfile()) {
 WebInspector.log(WebInspector.UIString("Can't load profile when other profile is recording."));
 return;
 }
 
-var profileType = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
-var temporaryProfile = profileType.createTemporaryProfile(UserInitiatedProfileName + "." + file.name);
-this.addProfileHeader(temporaryProfile);
-
+var temporaryProfile = profileType.createTemporaryProfile(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName + "." + file.name);
+profileType.addProfile(temporaryProfile);
 temporaryProfile._fromFile = true;
 temporaryProfile.loadFromFile(file);
-this._createFileSelectorElement();
 },
 
 get statusBarItems()
 {
-return this._statusBarButtons.select("element").concat([this.profileViewStatusBarItemsContainer]);
+return this._statusBarButtons.select("element").concat(this._profileTypeStatusBarItemsContainer, this._profileViewStatusBarItemsContainer);
 },
 
 toggleRecordButton: function()
 {
-var isProfiling = this._selectedProfileType.buttonClicked(this);
-this.recordButton.toggled = isProfiling;
-this.recordButton.title = this._selectedProfileType.buttonTooltip;
-if (isProfiling)
-this._launcherView.profileStarted();
-else
-this._launcherView.profileFinished();
+var isProfiling = this._selectedProfileType.buttonClicked();
+this.setRecordingProfile(this._selectedProfileType.id, isProfiling);
+},
+
+_populateAllProfiles: function()
+{
+if (this._profilesWereRequested)
+return;
+this._profilesWereRequested = true;
+for (var typeId in this._profileTypesByIdMap)
+this._profileTypesByIdMap[typeId]._populateProfiles();
 },
 
 wasShown: function()
 {
 WebInspector.Panel.prototype.wasShown.call(this);
-this._populateProfiles();
-},
-
-_profilerWasEnabled: function()
-{
-if (this._profilerEnabled)
-return;
-
-this._profilerEnabled = true;
-
-this._reset();
-if (this.isShowing())
-this._populateProfiles();
-},
-
-_profilerWasDisabled: function()
-{
-if (!this._profilerEnabled)
-return;
-
-this._profilerEnabled = false;
-this._reset();
+this._populateAllProfiles();
 },
 
 
 _onProfileTypeSelected: function(event)
 {
 this._selectedProfileType =   (event.data);
+this._updateProfileTypeSpecificUI();
+},
+
+_updateProfileTypeSpecificUI: function()
+{
 this.recordButton.title = this._selectedProfileType.buttonTooltip;
+
+this._profileTypeStatusBarItemsContainer.removeChildren();
+var statusBarItems = this._selectedProfileType.statusBarItems;
+if (statusBarItems) {
+for (var i = 0; i < statusBarItems.length; ++i)
+this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);
+}
+this._resize(this.splitView.sidebarWidth());
 },
 
 _reset: function()
 {
 WebInspector.Panel.prototype.reset.call(this);
 
-for (var i = 0; i < this._profiles.length; ++i) {
-var view = this._profiles[i].existingView();
-if (view) {
-view.detach();
-if ("dispose" in view)
-view.dispose();
-}
-}
-delete this.visibleView;
+for (var typeId in this._profileTypesByIdMap)
+this._profileTypesByIdMap[typeId]._reset();
 
+delete this.visibleView;
 delete this.currentQuery;
 this.searchCanceled();
 
-for (var id in this._profileTypesByIdMap) {
-var profileType = this._profileTypesByIdMap[id];
-var treeElement = profileType.treeElement;
-treeElement.removeChildren();
-treeElement.hidden = true;
-profileType.reset();
-}
-
-this._profiles = [];
-this._profilesIdMap = {};
 this._profileGroups = {};
-this._profileGroupsForLinks = {};
 this._profilesWereRequested = false;
 this.recordButton.toggled = false;
 if (this._selectedProfileType)
@@ -322,11 +447,13 @@
 this.sidebarTreeElement.removeStyleClass("some-expandable");
 
 this.profileViews.removeChildren();
-this.profileViewStatusBarItemsContainer.removeChildren();
+this._profileViewStatusBarItemsContainer.removeChildren();
 
 this.removeAllListeners();
 
-this._updateInterface();
+this.recordButton.visible = true;
+this._profileViewStatusBarItemsContainer.removeStyleClass("hidden");
+this.clearResultsButton.element.removeStyleClass("hidden");
 this.profilesItemTreeElement.select();
 this._showLauncherView();
 },
@@ -334,7 +461,7 @@
 _showLauncherView: function()
 {
 this.closeVisibleView();
-this.profileViewStatusBarItemsContainer.removeChildren();
+this._profileViewStatusBarItemsContainer.removeChildren();
 this._launcherView.show(this.splitView.mainElement);
 this.visibleView = this._launcherView;
 },
@@ -342,12 +469,13 @@
 _clearProfiles: function()
 {
 ProfilerAgent.clearProfiles();
+HeapProfilerAgent.clearProfiles();
 this._reset();
 },
 
 _garbageCollectButtonClicked: function()
 {
-ProfilerAgent.collectGarbage();
+HeapProfilerAgent.collectGarbage();
 },
 
 
@@ -356,9 +484,25 @@
 this._profileTypesByIdMap[profileType.id] = profileType;
 this._launcherView.addProfileType(profileType);
 profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.treeItemTitle, null, true);
-profileType.treeElement.hidden = true;
+profileType.treeElement.hidden = !this._singleProfileMode;
 this.sidebarTree.appendChild(profileType.treeElement);
 profileType.treeElement.childrenListElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+function onAddProfileHeader(event)
+{
+this._addProfileHeader(event.data);
+}
+function onRemoveProfileHeader(event)
+{
+this._removeProfileHeader(event.data);
+}
+function onProgressUpdated(event)
+{
+this._reportProfileProgress(event.data.profile, event.data.done, event.data.total);
+}
+profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated, this._updateProfileTypeSpecificUI, this);
+profileType.addEventListener(WebInspector.ProfileType.Events.AddProfileHeader, onAddProfileHeader, this);
+profileType.addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader, onRemoveProfileHeader, this);
+profileType.addEventListener(WebInspector.ProfileType.Events.ProgressUpdated, onProgressUpdated, this);
 },
 
 
@@ -370,14 +514,14 @@
 if (!element)
 return;
 if (element.treeElement && element.treeElement.handleContextMenuEvent) {
-element.treeElement.handleContextMenuEvent(event);
+element.treeElement.handleContextMenuEvent(event, this);
 return;
 }
 if (element !== this.element || event.srcElement === this.sidebarElement) {
 var contextMenu = new WebInspector.ContextMenu(event);
 if (this.visibleView instanceof WebInspector.HeapSnapshotView)
 this.visibleView.populateContextMenu(contextMenu, event);
-contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement));
+contextMenu.appendItem(WebInspector.UIString("Load\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement));
 contextMenu.show();
 }
 
@@ -390,14 +534,9 @@
 },
 
 
-_makeKey: function(id, profileTypeId)
+_addProfileHeader: function(profile)
 {
-return id + '/' + escape(profileTypeId);
-},
-
-
-addProfileHeader: function(profile)
-{
+if (!profile.isTemporary)
 this._removeTemporaryProfile(profile.profileType().id);
 
 var profileType = profile.profileType();
@@ -407,20 +546,16 @@
 var small = false;
 var alternateTitle;
 
-this._profiles.push(profile);
-this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
-
-if (!profile.title.startsWith(UserInitiatedProfileName)) {
+if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile.title) && !profile.isTemporary) {
 var profileTitleKey = this._makeTitleKey(profile.title, typeId);
 if (!(profileTitleKey in this._profileGroups))
 this._profileGroups[profileTitleKey] = [];
 
 var group = this._profileGroups[profileTitleKey];
 group.push(profile);
-
 if (group.length === 2) {
 
-group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(profile.title);
+group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(this, profile.title);
 
 
 var index = sidebarParent.children.indexOf(group[0]._profilesTreeElement);
@@ -456,7 +591,7 @@
 sidebarParent.appendChild(profileTreeElement);
 if (!profile.isTemporary) {
 if (!this.visibleView)
-this.showProfile(profile);
+this._showProfile(profile);
 this.dispatchEventToListeners("profile added", {
 type: typeId
 });
@@ -466,40 +601,47 @@
 
 _removeProfileHeader: function(profile)
 {
+profile.dispose();
+profile.profileType().removeProfile(profile);
+
 var sidebarParent = profile.profileType().treeElement;
-
-for (var i = 0; i < this._profiles.length; ++i) {
-if (this._profiles[i].uid === profile.uid) {
-profile = this._profiles[i];
-this._profiles.splice(i, 1);
-break;
-}
-}
-delete this._profilesIdMap[this._makeKey(profile.uid, profile.profileType().id)];
-
 var profileTitleKey = this._makeTitleKey(profile.title, profile.profileType().id);
-delete this._profileGroups[profileTitleKey];
+var group = this._profileGroups[profileTitleKey];
+if (group) {
+group.splice(group.indexOf(profile), 1);
+if (group.length === 1) {
 
+var index = sidebarParent.children.indexOf(group._profilesTreeElement);
+sidebarParent.insertChild(group[0]._profilesTreeElement, index);
+group[0]._profilesTreeElement.small = false;
+group[0]._profilesTreeElement.mainTitle = group[0].title;
+sidebarParent.removeChild(group._profilesTreeElement);
+}
+if (group.length !== 0)
+sidebarParent = group._profilesTreeElement;
+else
+delete this._profileGroups[profileTitleKey];
+}
 sidebarParent.removeChild(profile._profilesTreeElement);
 
-if (!profile.isTemporary)
-ProfilerAgent.removeProfile(profile.profileType().id, profile.uid);
 
 
-
-if (!this._profiles.length)
-this.closeVisibleView();
+if (!sidebarParent.children.length) {
+this.profilesItemTreeElement.select();
+this._showLauncherView();
+sidebarParent.hidden = !this._singleProfileMode;
+}
 },
 
 
-showProfile: function(profile)
+_showProfile: function(profile)
 {
 if (!profile || profile.isTemporary)
-return;
+return null;
 
-var view = profile.view();
+var view = profile.view(this);
 if (view === this.visibleView)
-return;
+return view;
 
 this.closeVisibleView();
 
@@ -511,38 +653,28 @@
 
 this.visibleView = view;
 
-this.profileViewStatusBarItemsContainer.removeChildren();
+this._profileViewStatusBarItemsContainer.removeChildren();
 
 var statusBarItems = view.statusBarItems;
 if (statusBarItems)
 for (var i = 0; i < statusBarItems.length; ++i)
-this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
-},
+this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
 
-
-getProfiles: function(typeId)
-{
-var result = [];
-var profilesCount = this._profiles.length;
-for (var i = 0; i < profilesCount; ++i) {
-var profile = this._profiles[i];
-if (!profile.isTemporary && profile.profileType().id === typeId)
-result.push(profile);
-}
-return result;
+return view;
 },
 
 
 showObject: function(snapshotObjectId, viewName)
 {
-var heapProfiles = this.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
+var heapProfiles = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();
 for (var i = 0; i < heapProfiles.length; i++) {
 var profile = heapProfiles[i];
 
 if (profile.maxJSObjectId >= snapshotObjectId) {
-this.showProfile(profile);
-profile.view().changeView(viewName, function() {
-profile.view().dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId);
+this._showProfile(profile);
+var view = profile.view(this);
+view.changeView(viewName, function() {
+view.dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId);
 });
 break;
 }
@@ -550,51 +682,31 @@
 },
 
 
-findTemporaryProfile: function(typeId)
+_createTemporaryProfile: function(typeId)
 {
-var profilesCount = this._profiles.length;
-for (var i = 0; i < profilesCount; ++i)
-if (this._profiles[i].profileType().id === typeId && this._profiles[i].isTemporary)
-return this._profiles[i];
-return null;
+var type = this.getProfileType(typeId);
+if (!type.findTemporaryProfile())
+type.addProfile(type.createTemporaryProfile());
 },
 
 
 _removeTemporaryProfile: function(typeId)
 {
-var temporaryProfile = this.findTemporaryProfile(typeId);
-if (temporaryProfile)
+var temporaryProfile = this.getProfileType(typeId).findTemporaryProfile();
+if (!!temporaryProfile)
 this._removeProfileHeader(temporaryProfile);
 },
 
 
 getProfile: function(typeId, uid)
 {
-return this._profilesIdMap[this._makeKey(uid, typeId)];
-},
-
-
-_addHeapSnapshotChunk: function(uid, chunk)
-{
-var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
-if (!profile)
-return;
-profile.transferChunk(chunk);
-},
-
-
-_finishHeapSnapshot: function(uid)
-{
-var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
-if (!profile)
-return;
-profile.finishHeapSnapshot();
+return this.getProfileType(typeId).getProfile(uid);
 },
 
 
 showView: function(view)
 {
-this.showProfile(view.profile);
+this._showProfile(view.profile);
 },
 
 
@@ -604,12 +716,9 @@
 },
 
 
-showProfileForURL: function(url)
+showProfile: function(typeId, uid)
 {
-var match = url.match(WebInspector.ProfileURLRegExp);
-if (!match)
-return;
-this.showProfile(this._profilesIdMap[this._makeKey(Number(match[3]), match[1])]);
+return this._showProfile(this.getProfile(typeId, Number(uid)));
 },
 
 closeVisibleView: function()
@@ -620,28 +729,6 @@
 },
 
 
-displayTitleForProfileLink: function(title, typeId)
-{
-title = unescape(title);
-if (title.startsWith(UserInitiatedProfileName)) {
-title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));
-} else {
-var titleKey = this._makeTitleKey(title, typeId);
-if (!(titleKey in this._profileGroupsForLinks))
-this._profileGroupsForLinks[titleKey] = 0;
-
-var groupNumber = ++this._profileGroupsForLinks[titleKey];
-
-if (groupNumber > 2)
-
-
-title += " " + WebInspector.UIString("Run %d", (groupNumber + 1) / 2);
-}
-
-return title;
-},
-
-
 performSearch: function(query)
 {
 this.searchCanceled();
@@ -787,24 +874,32 @@
 currentView.jumpToPreviousSearchResult();
 },
 
+
+_getAllProfiles: function()
+{
+var profiles = [];
+for (var typeId in this._profileTypesByIdMap)
+profiles = profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());
+return profiles;
+},
+
+
 _searchableViews: function()
 {
-var views = [];
-
-const visibleView = this.visibleView;
-if (visibleView && visibleView.performSearch)
-views.push(visibleView);
-
-var profilesLength = this._profiles.length;
-for (var i = 0; i < profilesLength; ++i) {
-var profile = this._profiles[i];
-var view = profile.view();
-if (!view.performSearch || view === visibleView)
-continue;
-views.push(view);
+var profiles = this._getAllProfiles();
+var searchableViews = [];
+for (var i = 0; i < profiles.length; ++i) {
+var view = profiles[i].view(this);
+if (view.performSearch)
+searchableViews.push(view)
 }
+var index = searchableViews.indexOf(this.visibleView);
+if (index > 0) {
 
-return views;
+searchableViews[index] = searchableViews[0];
+searchableViews[0] = this.visibleView;
+}
+return searchableViews;
 },
 
 searchMatchFound: function(view, matches)
@@ -834,92 +929,9 @@
 this._currentSearchResultIndex = 0;
 this._searchResults = [];
 
-if (!this._profiles)
-return;
-
-for (var i = 0; i < this._profiles.length; ++i) {
-var profile = this._profiles[i];
-profile._profilesTreeElement.searchMatches = 0;
-}
-},
-
-_updateInterface: function()
-{
-
-if (this._profilerEnabled) {
-this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
-this.enableToggleButton.toggled = true;
-this.recordButton.visible = true;
-this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
-this.clearResultsButton.element.removeStyleClass("hidden");
-this.panelEnablerView.detach();
-} else {
-this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
-this.enableToggleButton.toggled = false;
-this.recordButton.visible = false;
-this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
-this.clearResultsButton.element.addStyleClass("hidden");
-this.panelEnablerView.show(this.element);
-}
-},
-
-get profilerEnabled()
-{
-return this._profilerEnabled;
-},
-
-enableProfiler: function()
-{
-if (this._profilerEnabled)
-return;
-this._toggleProfiling(this.panelEnablerView.alwaysEnabled);
-},
-
-disableProfiler: function()
-{
-if (!this._profilerEnabled)
-return;
-this._toggleProfiling(this.panelEnablerView.alwaysEnabled);
-},
-
-
-_onToggleProfiling: function(event) {
-this._toggleProfiling(true);
-},
-
-
-_toggleProfiling: function(always)
-{
-if (this._profilerEnabled) {
-WebInspector.settings.profilerEnabled.set(false);
-ProfilerAgent.disable(this._profilerWasDisabled.bind(this));
-} else {
-WebInspector.settings.profilerEnabled.set(always);
-ProfilerAgent.enable(this._profilerWasEnabled.bind(this));
-}
-},
-
-_populateProfiles: function()
-{
-if (!this._profilerEnabled || this._profilesWereRequested)
-return;
-
-
-function populateCallback(error, profileHeaders) {
-if (error)
-return;
-profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
-var profileHeadersLength = profileHeaders.length;
-for (var i = 0; i < profileHeadersLength; ++i) {
-var profileHeader = profileHeaders[i];
-var profileType = this.getProfileType(profileHeader.typeId);
-this.addProfileHeader(profileType.createProfile(profileHeader));
-}
-}
-
-ProfilerAgent.getProfileHeaders(populateCallback.bind(this));
-
-this._profilesWereRequested = true;
+var profiles = this._getAllProfiles();
+for (var i = 0; i < profiles.length; ++i)
+profiles[i]._profilesTreeElement.searchMatches = 0;
 },
 
 
@@ -938,57 +950,30 @@
 _resize: function(sidebarWidth)
 {
 var lastItemElement = this._statusBarButtons[this._statusBarButtons.length - 1].element;
-var minFloatingStatusBarItemsOffset = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
-this.profileViewStatusBarItemsContainer.style.left = Math.max(minFloatingStatusBarItemsOffset, sidebarWidth) + "px";
+var left = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
+this._profileTypeStatusBarItemsContainer.style.left = left + "px";
+left += this._profileTypeStatusBarItemsContainer.offsetWidth - 1;
+this._profileViewStatusBarItemsContainer.style.left = Math.max(left, sidebarWidth) + "px";
 },
 
 
 setRecordingProfile: function(profileType, isProfiling)
 {
 var profileTypeObject = this.getProfileType(profileType);
-profileTypeObject.setRecordingProfile(isProfiling);
-var temporaryProfile = this.findTemporaryProfile(profileType);
-if (!!temporaryProfile === isProfiling)
-return;
-if (!temporaryProfile)
-temporaryProfile = profileTypeObject.createTemporaryProfile();
-if (isProfiling)
-this.addProfileHeader(temporaryProfile);
-else
-this._removeTemporaryProfile(profileType);
 this.recordButton.toggled = isProfiling;
 this.recordButton.title = profileTypeObject.buttonTooltip;
-if (isProfiling)
+if (isProfiling) {
 this._launcherView.profileStarted();
-else
+this._createTemporaryProfile(profileType);
+} else
 this._launcherView.profileFinished();
 },
 
-takeHeapSnapshot: function()
-{
-var temporaryRecordingProfile = this.findTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId);
-if (!temporaryRecordingProfile) {
-var profileTypeObject = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
-this.addProfileHeader(profileTypeObject.createTemporaryProfile());
-}
-this._launcherView.profileStarted();
-function done() {
-this._launcherView.profileFinished();
-}
-ProfilerAgent.takeHeapSnapshot(done.bind(this));
-WebInspector.userMetrics.ProfilesHeapProfileTaken.record();
-},
 
-
-_reportHeapSnapshotProgress: function(done, total)
+_reportProfileProgress: function(profile, done, total)
 {
-var temporaryProfile = this.findTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId);
-if (temporaryProfile) {
-temporaryProfile.sidebarElement.subtitle = WebInspector.UIString("%.2f%", (done / total) * 100);
-temporaryProfile.sidebarElement.wait = true;
-if (done >= total)
-this._removeTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId);
-}
+profile.sidebarElement.subtitle = WebInspector.UIString("%.0f%", (done / total) * 100);
+profile.sidebarElement.wait = true;
 },
 
 
@@ -1002,13 +987,13 @@
 if (!objectId)
 return;
 
-var heapProfiles = this.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
+var heapProfiles = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();
 if (!heapProfiles.length)
 return;
 
 function revealInView(viewName)
 {
-ProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this, viewName));
+HeapProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this, viewName));
 }
 
 function didReceiveHeapObjectId(viewName, error, result)
@@ -1019,66 +1004,21 @@
 this.showObject(result, viewName);
 }
 
-contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInView.bind(this, "Dominators"));
-contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInView.bind(this, "Summary"));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Dominators view" : "Reveal in Dominators View"), revealInView.bind(this, "Dominators"));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Summary view" : "Reveal in Summary View"), revealInView.bind(this, "Summary"));
 },
 
 __proto__: WebInspector.Panel.prototype
 }
 
 
-WebInspector.ProfilerDispatcher = function(profilesPanel)
-{
-this._profilesPanel = profilesPanel;
-}
-
-WebInspector.ProfilerDispatcher.prototype = {
-
-addProfileHeader: function(profile)
-{
-var profileType = this._profilesPanel.getProfileType(profile.typeId);
-this._profilesPanel.addProfileHeader(profileType.createProfile(profile));
-},
-
-
-addHeapSnapshotChunk: function(uid, chunk)
-{
-this._profilesPanel._addHeapSnapshotChunk(uid, chunk);
-},
-
-
-finishHeapSnapshot: function(uid)
-{
-this._profilesPanel._finishHeapSnapshot(uid);
-},
-
-
-setRecordingProfile: function(isProfiling)
-{
-this._profilesPanel.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling);
-},
-
-
-resetProfiles: function()
-{
-this._profilesPanel._reset();
-},
-
-
-reportHeapSnapshotProgress: function(done, total)
-{
-this._profilesPanel._reportHeapSnapshotProgress(done, total);
-}
-}
-
-
 WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
 {
 this.profile = profile;
 this._titleFormat = titleFormat;
 
-if (this.profile.title.startsWith(UserInitiatedProfileName))
-this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
+if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
+this._profileNumber = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(this.profile.title);
 
 WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
 
@@ -1089,7 +1029,7 @@
 onselect: function()
 {
 if (!this._suppressOnSelect)
-this.treeOutline.panel.showProfile(this.profile);
+this.treeOutline.panel._showProfile(this.profile);
 },
 
 ondelete: function()
@@ -1102,7 +1042,7 @@
 {
 if (this._mainTitle)
 return this._mainTitle;
-if (this.profile.title.startsWith(UserInitiatedProfileName))
+if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
 return WebInspector.UIString(this._titleFormat, this._profileNumber);
 return this.profile.title;
 },
@@ -1128,20 +1068,15 @@
 },
 
 
-handleContextMenuEvent: function(event)
+handleContextMenuEvent: function(event, panel)
 {
 var profile = this.profile;
 var contextMenu = new WebInspector.ContextMenu(event);
-var profilesPanel = WebInspector.ProfilesPanel._instance;
 
-if (profile.canSaveToFile()) {
-contextMenu.appendItem(WebInspector.UIString("Save Heap Snapshot\u2026"), profile.saveToFile.bind(profile));
-contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), profilesPanel._fileSelectorElement.click.bind(profilesPanel._fileSelectorElement));
-contextMenu.appendItem(WebInspector.UIString("Delete Heap Snapshot"), this.ondelete.bind(this));
-} else {
-contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), profilesPanel._fileSelectorElement.click.bind(profilesPanel._fileSelectorElement));
-contextMenu.appendItem(WebInspector.UIString("Delete profile"), this.ondelete.bind(this));
-}
+contextMenu.appendItem(WebInspector.UIString("Load\u2026"), panel._fileSelectorElement.click.bind(panel._fileSelectorElement));
+if (profile.canSaveToFile())
+contextMenu.appendItem(WebInspector.UIString("Save\u2026"), profile.saveToFile.bind(profile));
+contextMenu.appendItem(WebInspector.UIString("Delete"), this.ondelete.bind(this));
 contextMenu.show();
 },
 
@@ -1149,16 +1084,17 @@
 }
 
 
-WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle)
+WebInspector.ProfileGroupSidebarTreeElement = function(panel, title, subtitle)
 {
 WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);
+this._panel = panel;
 }
 
 WebInspector.ProfileGroupSidebarTreeElement.prototype = {
 onselect: function()
 {
 if (this.children.length > 0)
-WebInspector.ProfilesPanel._instance.showProfile(this.children[this.children.length - 1].profile);
+this._panel._showProfile(this.children[this.children.length - 1].profile);
 },
 
 __proto__: WebInspector.SidebarTreeElement.prototype
@@ -1189,16 +1125,80 @@
 
 
 
-
-WebInspector.ProfileDataGridNode = function(profileView, profileNode, owningTree, hasChildren)
+WebInspector.CPUProfilerPanel = function()
 {
-this.profileView = profileView;
+WebInspector.ProfilesPanel.call(this, "cpu-profiler", new WebInspector.CPUProfileType());
+}
+
+WebInspector.CPUProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+WebInspector.CSSSelectorProfilerPanel = function()
+{
+WebInspector.ProfilesPanel.call(this, "css-profiler", new WebInspector.CSSSelectorProfileType());
+}
+
+WebInspector.CSSSelectorProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+WebInspector.HeapProfilerPanel = function()
+{
+WebInspector.ProfilesPanel.call(this, "heap-profiler", new WebInspector.HeapSnapshotProfileType());
+}
+
+WebInspector.HeapProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+WebInspector.CanvasProfilerPanel = function()
+{
+WebInspector.ProfilesPanel.call(this, "canvas-profiler", new WebInspector.CanvasProfileType());
+}
+
+WebInspector.CanvasProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+WebInspector.MemoryChartProfilerPanel = function()
+{
+WebInspector.ProfilesPanel.call(this, "memory-chart-profiler", new WebInspector.NativeMemoryProfileType());
+}
+
+WebInspector.MemoryChartProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+WebInspector.NativeMemoryProfilerPanel = function()
+{
+WebInspector.ProfilesPanel.call(this, "memory-snapshot-profiler", new WebInspector.NativeSnapshotProfileType());
+}
+
+WebInspector.NativeMemoryProfilerPanel.prototype = {
+__proto__: WebInspector.ProfilesPanel.prototype
+}
+
+
+
+
+
+WebInspector.ProfileDataGridNode = function(profileNode, owningTree, hasChildren)
+{
 this.profileNode = profileNode;
 
 WebInspector.DataGridNode.call(this, null, hasChildren);
 
-this.addEventListener("populate", this._populate, this);
-
 this.tree = owningTree;
 
 this.childrenByCallUID = {};
@@ -1217,7 +1217,7 @@
 {
 function formatMilliseconds(time)
 {
-return Number.secondsToString(time / 1000, !Capabilities.samplingCPUProfiler);
+return WebInspector.UIString("%.0f\u2009ms", time);
 }
 
 var data = {};
@@ -1225,17 +1225,17 @@
 data["function"] = this.functionName;
 data["calls"] = this.numberOfCalls;
 
-if (this.profileView.showSelfTimeAsPercent.get())
+if (this.tree.profileView.showSelfTimeAsPercent.get())
 data["self"] = WebInspector.UIString("%.2f%", this.selfPercent);
 else
 data["self"] = formatMilliseconds(this.selfTime);
 
-if (this.profileView.showTotalTimeAsPercent.get())
+if (this.tree.profileView.showTotalTimeAsPercent.get())
 data["total"] = WebInspector.UIString("%.2f%", this.totalPercent);
 else
 data["total"] = formatMilliseconds(this.totalTime);
 
-if (this.profileView.showAverageTimeAsPercent.get())
+if (this.tree.profileView.showAverageTimeAsPercent.get())
 data["average"] = WebInspector.UIString("%.2f%", this.averagePercent);
 else
 data["average"] = formatMilliseconds(this.averageTime);
@@ -1243,6 +1243,7 @@
 return data;
 },
 
+
 createCell: function(columnIdentifier)
 {
 var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
@@ -1265,7 +1266,7 @@
 if (this.profileNode.url) {
 
 var lineNumber = this.profileNode.lineNumber ? this.profileNode.lineNumber - 1 : 0;
-var urlElement = this.profileView._linkifier.linkifyLocation(this.profileNode.url, lineNumber, 0, "profile-node-file");
+var urlElement = this.tree.profileView._linkifier.linkifyLocation(this.profileNode.url, lineNumber, 0, "profile-node-file");
 urlElement.style.maxWidth = "75%";
 cell.insertBefore(urlElement, cell.firstChild);
 }
@@ -1276,16 +1277,17 @@
 select: function(supressSelectedEvent)
 {
 WebInspector.DataGridNode.prototype.select.call(this, supressSelectedEvent);
-this.profileView._dataGridNodeSelected(this);
+this.tree.profileView._dataGridNodeSelected(this);
 },
 
 deselect: function(supressDeselectedEvent)
 {
 WebInspector.DataGridNode.prototype.deselect.call(this, supressDeselectedEvent);
-this.profileView._dataGridNodeDeselected(this);
+this.tree.profileView._dataGridNodeDeselected(this);
 },
 
-sort: function(  comparator,   force)
+
+sort: function(comparator, force)
 {
 var gridNodeGroups = [[this]];
 
@@ -1321,28 +1323,31 @@
 }
 },
 
-insertChild: function(  profileDataGridNode, index)
+
+insertChild: function(profileDataGridNode, index)
 {
 WebInspector.DataGridNode.prototype.insertChild.call(this, profileDataGridNode, index);
 
 this.childrenByCallUID[profileDataGridNode.callUID] = profileDataGridNode;
 },
 
-removeChild: function(  profileDataGridNode)
+
+removeChild: function(profileDataGridNode)
 {
 WebInspector.DataGridNode.prototype.removeChild.call(this, profileDataGridNode);
 
 delete this.childrenByCallUID[profileDataGridNode.callUID];
 },
 
-removeChildren: function(  profileDataGridNode)
+removeChildren: function()
 {
 WebInspector.DataGridNode.prototype.removeChildren.call(this);
 
 this.childrenByCallUID = {};
 },
 
-findChild: function(  node)
+
+findChild: function(node)
 {
 if (!node)
 return null;
@@ -1374,8 +1379,12 @@
 return this.parent !== this.dataGrid ? this.parent : this.tree;
 },
 
-_populate: function()
+populate: function()
 {
+if (this._populated)
+return;
+this._populated = true;
+
 this._sharedPopulate();
 
 if (this._parent) {
@@ -1384,9 +1393,6 @@
 if (currentComparator)
 this.sort(currentComparator, true);
 }
-
-if (this.removeEventListener)
-this.removeEventListener("populate", this._populate, this);
 },
 
 
@@ -1463,14 +1469,14 @@
 }
 
 
-WebInspector.ProfileDataGridTree = function(profileView, profileNode)
+WebInspector.ProfileDataGridTree = function(profileView, rootProfileNode)
 {
 this.tree = this;
 this.children = [];
 
 this.profileView = profileView;
 
-this.totalTime = profileNode.totalTime;
+this.totalTime = rootProfileNode.totalTime;
 this.lastComparator = null;
 
 this.childrenByCallUID = {};
@@ -1531,7 +1537,8 @@
 
 WebInspector.ProfileDataGridTree.propertyComparators = [{}, {}];
 
-WebInspector.ProfileDataGridTree.propertyComparator = function(  property,   isAscending)
+
+WebInspector.ProfileDataGridTree.propertyComparator = function(property, isAscending)
 {
 var comparator = WebInspector.ProfileDataGridTree.propertyComparators[(isAscending ? 1 : 0)][property];
 
@@ -1575,15 +1582,16 @@
 
 
 
-WebInspector.BottomUpProfileDataGridNode = function(  profileView,   profileNode,   owningTree)
+WebInspector.BottomUpProfileDataGridNode = function(profileNode, owningTree)
 {
-WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
+WebInspector.ProfileDataGridNode.call(this, profileNode, owningTree, this._willHaveChildren(profileNode));
 
 this._remainingNodeInfos = [];
 }
 
 WebInspector.BottomUpProfileDataGridNode.prototype = {
-_takePropertiesFromProfileDataGridNode: function(  profileDataGridNode)
+
+_takePropertiesFromProfileDataGridNode: function(profileDataGridNode)
 {
 this._save();
 
@@ -1593,7 +1601,7 @@
 },
 
 
-_keepOnlyChild: function(  child)
+_keepOnlyChild: function(child)
 {
 this._save();
 
@@ -1604,7 +1612,7 @@
 _exclude: function(aCallUID)
 {
 if (this._remainingNodeInfos)
-this._populate();
+this.populate();
 
 this._save();
 
@@ -1628,7 +1636,8 @@
 this.hasChildren = this._willHaveChildren(this.profileNode);
 },
 
-_merge: function(  child,   shouldAbsorb)
+
+_merge: function(child, shouldAbsorb)
 {
 this.selfTime -= child.selfTime;
 
@@ -1658,7 +1667,7 @@
 } else {
 
 
-child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);
+child = new WebInspector.BottomUpProfileDataGridNode(ancestor, this.tree);
 
 if (ancestor !== focusNode) {
 
@@ -1691,13 +1700,13 @@
 }
 
 
-WebInspector.BottomUpProfileDataGridTree = function(  aProfileView,   aProfileNode)
+WebInspector.BottomUpProfileDataGridTree = function(profileView, rootProfileNode)
 {
-WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode);
+WebInspector.ProfileDataGridTree.call(this, profileView, rootProfileNode);
 
 
 var profileNodeUIDs = 0;
-var profileNodeGroups = [[], [aProfileNode]];
+var profileNodeGroups = [[], [rootProfileNode]];
 var visitedProfileNodesForCallUID = {};
 
 this._remainingNodeInfos = [];
@@ -1747,16 +1756,16 @@
 }
 
 
-var any =  this;
-var node =  any;
-WebInspector.BottomUpProfileDataGridNode.prototype._populate.call(node);
+var any =  (this);
+var node =  (any);
+WebInspector.BottomUpProfileDataGridNode.prototype.populate.call(node);
 
 return this;
 }
 
 WebInspector.BottomUpProfileDataGridTree.prototype = {
 
-focus: function(  profileDataGridNode)
+focus: function(profileDataGridNode)
 {
 if (!profileDataGridNode)
 return;
@@ -1780,7 +1789,8 @@
 this.totalTime = profileDataGridNode.totalTime;
 },
 
-exclude: function(  profileDataGridNode)
+
+exclude: function(profileDataGridNode)
 {
 if (!profileDataGridNode)
 return;
@@ -1813,7 +1823,7 @@
 
 
 
-WebInspector.CPUProfileView = function(profile)
+WebInspector.CPUProfileView = function(profileHeader)
 {
 WebInspector.View.call(this);
 
@@ -1824,33 +1834,31 @@
 this.showAverageTimeAsPercent = WebInspector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent", true);
 this._viewType = WebInspector.settings.createSetting("cpuProfilerView", WebInspector.CPUProfileView._TypeHeavy);
 
-var columns = { "self": { title: WebInspector.UIString("Self"), width: "72px", sort: "descending", sortable: true },
-"total": { title: WebInspector.UIString("Total"), width: "72px", sortable: true },
-"average": { title: WebInspector.UIString("Average"), width: "72px", sortable: true },
-"calls": { title: WebInspector.UIString("Calls"), width: "54px", sortable: true },
-"function": { title: WebInspector.UIString("Function"), disclosure: true, sortable: true } };
-
-if (Capabilities.samplingCPUProfiler) {
-delete columns.average;
-delete columns.calls;
-}
+var columns = [];
+columns.push({id: "self", title: WebInspector.UIString("Self"), width: "72px", sort: WebInspector.DataGrid.Order.Descending, sortable: true});
+columns.push({id: "total", title: WebInspector.UIString("Total"), width: "72px", sortable: true});
+columns.push({id: "function", title: WebInspector.UIString("Function"), disclosure: true, sortable: true});
 
 this.dataGrid = new WebInspector.DataGrid(columns);
-this.dataGrid.addEventListener("sorting changed", this._sortProfile, this);
+this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortProfile, this);
 this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
+
+if (WebInspector.experimentsSettings.cpuFlameChart.isEnabled()) {
+this._splitView = new WebInspector.SplitView(false, "flameChartSplitLocation");
+this._splitView.show(this.element);
+
+this._flameChart = new WebInspector.FlameChart(this);
+this._flameChart.addEventListener(WebInspector.FlameChart.Events.SelectedNode, this._revealProfilerNode.bind(this));
+this._flameChart.show(this._splitView.firstElement());
+
+this.dataGrid.show(this._splitView.secondElement());
+} else
 this.dataGrid.show(this.element);
 
 this.viewSelectComboBox = new WebInspector.StatusBarComboBox(this._changeView.bind(this));
 
-var heavyViewOption = document.createElement("option");
-heavyViewOption.label = WebInspector.UIString("Heavy (Bottom Up)");
-heavyViewOption.value = WebInspector.CPUProfileView._TypeHeavy;
-var treeViewOption = document.createElement("option");
-treeViewOption.label = WebInspector.UIString("Tree (Top Down)");
-treeViewOption.value = WebInspector.CPUProfileView._TypeTree;
-
-this.viewSelectComboBox.addOption(heavyViewOption);
-this.viewSelectComboBox.addOption(treeViewOption);
+var heavyViewOption = this.viewSelectComboBox.createOption(WebInspector.UIString("Heavy (Bottom Up)"), "", WebInspector.CPUProfileView._TypeHeavy);
+var treeViewOption = this.viewSelectComboBox.createOption(WebInspector.UIString("Tree (Top Down)"), "", WebInspector.CPUProfileView._TypeTree);
 this.viewSelectComboBox.select(this._viewType.get() === WebInspector.CPUProfileView._TypeHeavy ? heavyViewOption : treeViewOption);
 
 this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
@@ -1868,9 +1876,42 @@
 this.resetButton.visible = false;
 this.resetButton.addEventListener("click", this._resetClicked, this);
 
-this.profile = profile;
+this.profileHead =   (null);
+this.profileHeader = profileHeader;
 
-function profileCallback(error, profile)
+this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));
+
+if (this.profileHeader._profile) 
+this._processProfileData(this.profileHeader._profile);
+else
+ProfilerAgent.getCPUProfile(this.profileHeader.uid, this._getCPUProfileCallback.bind(this));
+}
+
+WebInspector.CPUProfileView._TypeTree = "Tree";
+WebInspector.CPUProfileView._TypeHeavy = "Heavy";
+
+WebInspector.CPUProfileView.prototype = {
+
+selectRange: function(timeLeft, timeRight)
+{
+if (!this._flameChart)
+return;
+this._flameChart.selectRange(timeLeft, timeRight);
+},
+
+_revealProfilerNode: function(event)
+{
+var current = this.profileDataGridTree.children[0];
+
+while (current && current.profileNode !== event.data)
+current = current.traverseNextNode(false, null, false);
+
+if (current)
+current.revealAndSelect();
+},
+
+
+_getCPUProfileCallback: function(error, profile)
 {
 if (error)
 return;
@@ -1879,59 +1920,48 @@
 
 return;
 }
-this.profile.head = profile.head;
+
+this._processProfileData(profile);
+},
+
+_processProfileData: function(profile)
+{
+this.profileHead = profile.head;
+this.samples = profile.samples;
 
 if (profile.idleTime)
 this._injectIdleTimeNode(profile);
 
 this._assignParentsInProfile();
+if (this.samples)
+this._buildIdToNodeMap();
 this._changeView();
 this._updatePercentButton();
-}
+if (this._flameChart)
+this._flameChart.update();
+},
 
-this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));
-
-ProfilerAgent.getProfile(this.profile.profileType().id, this.profile.uid, profileCallback.bind(this));
-}
-
-WebInspector.CPUProfileView._TypeTree = "Tree";
-WebInspector.CPUProfileView._TypeHeavy = "Heavy";
-
-WebInspector.CPUProfileView.prototype = {
 get statusBarItems()
 {
 return [this.viewSelectComboBox.element, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
 },
 
-get bottomUpProfileDataGridTree()
+
+_getBottomUpProfileDataGridTree: function()
 {
-if (!this._bottomUpProfileDataGridTree) {
-if (this.profile.bottomUpHead)
-this._bottomUpProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profile.bottomUpHead);
-else
-this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profile.head);
-}
+if (!this._bottomUpProfileDataGridTree)
+this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profileHead);
 return this._bottomUpProfileDataGridTree;
 },
 
-get topDownProfileDataGridTree()
+
+_getTopDownProfileDataGridTree: function()
 {
 if (!this._topDownProfileDataGridTree)
-this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profile.head);
+this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profileHead);
 return this._topDownProfileDataGridTree;
 },
 
-get currentTree()
-{
-return this._currentTree;
-},
-
-set currentTree(tree)
-{
-this._currentTree = tree;
-this.refresh();
-},
-
 willHide: function()
 {
 this._currentSearchResultIndex = -1;
@@ -2091,7 +2121,7 @@
 profileDataGridNode._searchMatchedCallsColumn = true;
 }
 
-if (profileDataGridNode.functionName.match(matcher) || profileDataGridNode.url.match(matcher))
+if (profileDataGridNode.functionName.match(matcher) || (profileDataGridNode.url && profileDataGridNode.url.match(matcher)))
 profileDataGridNode._searchMatchedFunctionColumn = true;
 
 if (profileDataGridNode._searchMatchedSelfColumn ||
@@ -2176,17 +2206,17 @@
 
 _changeView: function()
 {
-if (!this.profile)
+if (!this.profileHeader)
 return;
 
 switch (this.viewSelectComboBox.selectedOption().value) {
 case WebInspector.CPUProfileView._TypeTree:
-this.profileDataGridTree = this.topDownProfileDataGridTree;
+this.profileDataGridTree = this._getTopDownProfileDataGridTree();
 this._sortProfile();
 this._viewType.set(WebInspector.CPUProfileView._TypeTree);
 break;
 case WebInspector.CPUProfileView._TypeHeavy:
-this.profileDataGridTree = this.bottomUpProfileDataGridTree;
+this.profileDataGridTree = this._getBottomUpProfileDataGridTree();
 this._sortProfile();
 this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);
 }
@@ -2270,8 +2300,8 @@
 
 _sortProfile: function()
 {
-var sortAscending = this.dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+var sortAscending = this.dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier();
 var sortProperty = {
 "average": "averageTime",
 "self": "selfTime",
@@ -2308,12 +2338,12 @@
 
 _assignParentsInProfile: function()
 {
-var head = this.profile.head;
+var head = this.profileHead;
 head.parent = null;
 head.head = null;
 var nodesToTraverse = [ { parent: head, children: head.children } ];
 while (nodesToTraverse.length > 0) {
-var pair = nodesToTraverse.shift();
+var pair = nodesToTraverse.pop();
 var parent = pair.parent;
 var children = pair.children;
 var length = children.length;
@@ -2326,6 +2356,19 @@
 }
 },
 
+_buildIdToNodeMap: function()
+{
+var idToNode = this._idToNode = {};
+var stack = [this.profileHead];
+while (stack.length) {
+var node = stack.pop();
+idToNode[node.id] = node;
+for (var i = 0; i < node.children.length; i++)
+stack.push(node.children[i]);
+}
+},
+
+
 _injectIdleTimeNode: function(profile)
 {
 var idleTime = profile.idleTime;
@@ -2365,6 +2408,7 @@
 WebInspector.CPUProfileType = function()
 {
 WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebInspector.UIString("Collect JavaScript CPU Profile"));
+InspectorBackend.registerProfilerDispatcher(this);
 this._recording = false;
 WebInspector.CPUProfileType.instance = this;
 }
@@ -2372,6 +2416,12 @@
 WebInspector.CPUProfileType.TypeId = "CPU";
 
 WebInspector.CPUProfileType.prototype = {
+
+fileExtension: function()
+{
+return ".cpuprofile";
+},
+
 get buttonTooltip()
 {
 return this._recording ? WebInspector.UIString("Stop CPU profiling.") : WebInspector.UIString("Start CPU profiling.");
@@ -2399,6 +2449,12 @@
 return WebInspector.UIString("CPU profiles show where the execution time is spent in your page's JavaScript functions.");
 },
 
+
+addProfileHeader: function(profileHeader)
+{
+this.addProfile(this.createProfile(profileHeader));
+},
+
 isRecordingProfile: function()
 {
 return this._recording;
@@ -2417,6 +2473,7 @@
 ProfilerAgent.stop();
 },
 
+
 setRecordingProfile: function(isProfiling)
 {
 this._recording = isProfiling;
@@ -2435,6 +2492,44 @@
 return new WebInspector.CPUProfileHeader(this, profile.title, profile.uid);
 },
 
+
+removeProfile: function(profile)
+{
+WebInspector.ProfileType.prototype.removeProfile.call(this, profile);
+if (!profile.isTemporary)
+ProfilerAgent.removeProfile(this.id, profile.uid);
+},
+
+
+_requestProfilesFromBackend: function(populateCallback)
+{
+ProfilerAgent.getProfileHeaders(populateCallback);
+},
+
+
+resetProfiles: function()
+{
+this._reset();
+},
+
+
+addHeapSnapshotChunk: function(uid, chunk)
+{
+throw new Error("Never called");
+},
+
+
+finishHeapSnapshot: function(uid)
+{
+throw new Error("Never called");
+},
+
+
+reportHeapSnapshotProgress: function(done, total)
+{
+throw new Error("Never called");
+},
+
 __proto__: WebInspector.ProfileType.prototype
 }
 
@@ -2445,6 +2540,53 @@
 }
 
 WebInspector.CPUProfileHeader.prototype = {
+onTransferStarted: function()
+{
+this._jsonifiedProfile = "";
+this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026 %s", Number.bytesToString(this._jsonifiedProfile.length));
+},
+
+
+onChunkTransferred: function(reader)
+{
+this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026 %d\%", Number.bytesToString(this._jsonifiedProfile.length));
+},
+
+onTransferFinished: function()
+{
+
+this.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026");
+this._profile = JSON.parse(this._jsonifiedProfile);
+this._jsonifiedProfile = null;
+this.sidebarElement.subtitle = WebInspector.UIString("Loaded");
+this.isTemporary = false;
+},
+
+
+onError: function(reader, e)
+{
+switch(e.target.error.code) {
+case e.target.error.NOT_FOUND_ERR:
+this.sidebarElement.subtitle = WebInspector.UIString("'%s' not found.", reader.fileName());
+break;
+case e.target.error.NOT_READABLE_ERR:
+this.sidebarElement.subtitle = WebInspector.UIString("'%s' is not readable", reader.fileName());
+break;
+case e.target.error.ABORT_ERR:
+break;
+default:
+this.sidebarElement.subtitle = WebInspector.UIString("'%s' error %d", reader.fileName(), e.target.error.code);
+}
+},
+
+
+write: function(text)
+{
+this._jsonifiedProfile += text;
+},
+
+close: function() { },
+
 
 createSidebarTreeElement: function()
 {
@@ -2457,6 +2599,53 @@
 return new WebInspector.CPUProfileView(this);
 },
 
+
+canSaveToFile: function()
+{
+return true;
+},
+
+saveToFile: function()
+{
+var fileOutputStream = new WebInspector.FileOutputStream();
+
+
+function getCPUProfileCallback(error, profile)
+{
+if (error) {
+fileOutputStream.close();
+return;
+}
+
+if (!profile.head) {
+
+fileOutputStream.close();
+return;
+}
+
+fileOutputStream.write(JSON.stringify(profile), fileOutputStream.close.bind(fileOutputStream));
+}
+
+function onOpen()
+{
+ProfilerAgent.getCPUProfile(this.uid, getCPUProfileCallback.bind(this));
+}
+
+this._fileName = this._fileName || "CPU-" + new Date().toISO8601Compact() + this._profileType.fileExtension();
+fileOutputStream.open(this._fileName, onOpen.bind(this));
+},
+
+
+loadFromFile: function(file)
+{
+this.title = file.name;
+this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
+this.sidebarElement.wait = true;
+
+var fileReader = new WebInspector.ChunkedFileReader(file, 10000000, this);
+fileReader.start(this);
+},
+
 __proto__: WebInspector.ProfileHeader.prototype
 }
 ;
@@ -2522,14 +2711,16 @@
 
 this.showTimeAsPercent = WebInspector.settings.createSetting("selectorProfilerShowTimeAsPercent", true);
 
-var columns = { "selector": { title: WebInspector.UIString("Selector"), width: "550px", sortable: true },
-"source": { title: WebInspector.UIString("Source"), width: "100px", sortable: true },
-"time": { title: WebInspector.UIString("Total"), width: "72px", sort: "descending", sortable: true },
-"matches": { title: WebInspector.UIString("Matches"), width: "72px", sortable: true } };
+var columns = [
+{id: "selector", title: WebInspector.UIString("Selector"), width: "550px", sortable: true},
+{id: "source", title: WebInspector.UIString("Source"), width: "100px", sortable: true},
+{id: "time", title: WebInspector.UIString("Total"), width: "72px", sort: WebInspector.DataGrid.Order.Descending, sortable: true},
+{id: "matches", title: WebInspector.UIString("Matches"), width: "72px", sortable: true}
+];
 
 this.dataGrid = new WebInspector.DataGrid(columns);
 this.dataGrid.element.addStyleClass("selector-profile-view");
-this.dataGrid.addEventListener("sorting changed", this._sortProfile, this);
+this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortProfile, this);
 this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
 this.dataGrid.show(this.element);
 
@@ -2620,12 +2811,12 @@
 
 _sortProfile: function()
 {
-var sortAscending = this.dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+var sortAscending = this.dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier();
 
 function selectorComparator(a, b)
 {
-var result = b.rawData.selector.localeCompare(a.rawData.selector);
+var result = b.rawData.selector.compareTo(a.rawData.selector);
 return sortAscending ? -result : result;
 }
 
@@ -2633,7 +2824,7 @@
 {
 var aRawData = a.rawData;
 var bRawData = b.rawData;
-var result = bRawData.url.localeCompare(aRawData.url);
+var result = bRawData.url.compareTo(aRawData.url);
 if (!result)
 result = bRawData.lineNumber - aRawData.lineNumber;
 return sortAscending ? -result : result;
@@ -2712,13 +2903,13 @@
 },
 
 
-buttonClicked: function(profilesPanel)
+buttonClicked: function()
 {
 if (this._recording) {
-this._stopRecordingProfile(profilesPanel);
+this._stopRecordingProfile();
 return false;
 } else {
-this._startRecordingProfile(profilesPanel);
+this._startRecordingProfile();
 return true;
 }
 },
@@ -2730,7 +2921,7 @@
 
 get description()
 {
-return WebInspector.UIString("CSS selector profiles show how long the selector matching has taken in total and how many times a certain selector has matched DOM elements (the results are approximate due to matching algorithm optimizations.)");
+return WebInspector.UIString("CSS selector profiles show how long the selector matching has taken in total and how many times a certain selector has matched DOM elements. The results are approximate due to matching algorithm optimizations.");
 },
 
 reset: function()
@@ -2743,16 +2934,13 @@
 this._recording = isProfiling;
 },
 
-
-_startRecordingProfile: function(profilesPanel)
+_startRecordingProfile: function()
 {
 this._recording = true;
 CSSAgent.startSelectorProfiler();
-profilesPanel.setRecordingProfile(WebInspector.CSSSelectorProfileType.TypeId, true);
 },
 
-
-_stopRecordingProfile: function(profilesPanel)
+_stopRecordingProfile: function()
 {
 
 function callback(error, profile)
@@ -2762,9 +2950,7 @@
 
 var uid = this._profileUid++;
 var title = WebInspector.UIString("Profile %d", uid) + String.sprintf(" (%s)", Number.secondsToString(profile.totalTime / 1000));
-var profileHeader = new WebInspector.CSSProfileHeader(this, title, uid, profile);
-profilesPanel.addProfileHeader(profileHeader);
-profilesPanel.setRecordingProfile(WebInspector.CSSSelectorProfileType.TypeId, false);
+this.addProfile(new WebInspector.CSSProfileHeader(this, title, uid, profile));
 }
 
 this._recording = false;
@@ -2809,6 +2995,629 @@
 
 
 
+WebInspector.FlameChart = function(cpuProfileView)
+{
+WebInspector.View.call(this);
+this.registerRequiredCSS("flameChart.css");
+this.element.className = "fill";
+this.element.id = "cpu-flame-chart";
+
+this._overviewContainer = this.element.createChild("div", "overview-container");
+this._overviewGrid = new WebInspector.OverviewGrid("flame-chart");
+this._overviewContainer.appendChild(this._overviewGrid.element);
+this._overviewCalculator = new WebInspector.FlameChart.OverviewCalculator();
+this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged, this._onWindowChanged, this);
+this._overviewCanvas = this._overviewContainer.createChild("canvas");
+
+this._chartContainer = this.element.createChild("div", "chart-container");
+this._timelineGrid = new WebInspector.TimelineGrid();
+this._chartContainer.appendChild(this._timelineGrid.element);
+this._calculator = new WebInspector.FlameChart.Calculator();
+
+this._canvas = this._chartContainer.createChild("canvas");
+WebInspector.installDragHandle(this._canvas, this._startCanvasDragging.bind(this), this._canvasDragging.bind(this), this._endCanvasDragging.bind(this), "col-resize");
+
+this._cpuProfileView = cpuProfileView;
+this._windowLeft = 0.0;
+this._windowRight = 1.0;
+this._barHeight = 15;
+this._minWidth = 1;
+this._paddingLeft = 15;
+this._canvas.addEventListener("mousewheel", this._onMouseWheel.bind(this), false);
+this.element.addEventListener("click", this._onClick.bind(this), false);
+this._popoverHelper = new WebInspector.PopoverHelper(this._chartContainer, this._getPopoverAnchor.bind(this), this._showPopover.bind(this));
+this._popoverHelper.setTimeout(250);
+this._linkifier = new WebInspector.Linkifier();
+this._highlightedNodeIndex = -1;
+
+if (!WebInspector.FlameChart._colorGenerator)
+WebInspector.FlameChart._colorGenerator = new WebInspector.FlameChart.ColorGenerator();
+}
+
+
+WebInspector.FlameChart.Calculator = function()
+{
+}
+
+WebInspector.FlameChart.Calculator.prototype = {
+
+_updateBoundaries: function(flameChart)
+{
+this._minimumBoundaries = flameChart._windowLeft * flameChart._timelineData.totalTime;
+this._maximumBoundaries = flameChart._windowRight * flameChart._timelineData.totalTime;
+this.paddingLeft = flameChart._paddingLeft;
+this._width = flameChart._canvas.width - this.paddingLeft;
+this._timeToPixel = this._width / this.boundarySpan();
+},
+
+
+computePosition: function(time)
+{
+return (time - this._minimumBoundaries) * this._timeToPixel + this.paddingLeft;
+},
+
+formatTime: function(value)
+{
+return Number.secondsToString((value + this._minimumBoundaries) / 1000);
+},
+
+maximumBoundary: function()
+{
+return this._maximumBoundaries;
+},
+
+minimumBoundary: function()
+{
+return this._minimumBoundaries;
+},
+
+zeroTime: function()
+{
+return 0;
+},
+
+boundarySpan: function()
+{
+return this._maximumBoundaries - this._minimumBoundaries;
+}
+}
+
+
+WebInspector.FlameChart.OverviewCalculator = function()
+{
+}
+
+WebInspector.FlameChart.OverviewCalculator.prototype = {
+
+_updateBoundaries: function(flameChart)
+{
+this._minimumBoundaries = 0;
+this._maximumBoundaries = flameChart._timelineData.totalTime;
+this._xScaleFactor = flameChart._canvas.width / flameChart._timelineData.totalTime;
+},
+
+
+computePosition: function(time)
+{
+return (time - this._minimumBoundaries) * this._xScaleFactor;
+},
+
+formatTime: function(value)
+{
+return Number.secondsToString((value + this._minimumBoundaries) / 1000);
+},
+
+maximumBoundary: function()
+{
+return this._maximumBoundaries;
+},
+
+minimumBoundary: function()
+{
+return this._minimumBoundaries;
+},
+
+zeroTime: function()
+{
+return this._minimumBoundaries;
+},
+
+boundarySpan: function()
+{
+return this._maximumBoundaries - this._minimumBoundaries;
+}
+}
+
+WebInspector.FlameChart.Events = {
+SelectedNode: "SelectedNode"
+}
+
+
+WebInspector.FlameChart.ColorGenerator = function()
+{
+this._colorPairs = {};
+this._currentColorIndex = 0;
+}
+
+WebInspector.FlameChart.ColorGenerator.prototype = {
+
+_colorPairForID: function(id)
+{
+var colorPairs = this._colorPairs;
+var colorPair = colorPairs[id];
+if (!colorPair) {
+var currentColorIndex = ++this._currentColorIndex;
+var hue = (currentColorIndex * 5 + 11 * (currentColorIndex % 2)) % 360;
+colorPairs[id] = colorPair = {highlighted: "hsla(" + hue + ", 100%, 33%, 0.7)", normal: "hsla(" + hue + ", 100%, 66%, 0.7)"};
+}
+return colorPair;
+}
+}
+
+
+WebInspector.FlameChart.Entry = function(colorPair, depth, duration, startTime, node)
+{
+this.colorPair = colorPair;
+this.depth = depth;
+this.duration = duration;
+this.startTime = startTime;
+this.node = node;
+this.selfTime = 0;
+}
+
+WebInspector.FlameChart.prototype = {
+
+selectRange: function(timeLeft, timeRight)
+{
+this._overviewGrid.setWindow(timeLeft / this._totalTime, timeRight / this._totalTime);
+},
+
+_onWindowChanged: function(event)
+{
+this._hidePopover();
+this._scheduleUpdate();
+},
+
+_startCanvasDragging: function(event)
+{
+if (!this._timelineData)
+return false;
+this._isDragging = true;
+this._dragStartPoint = event.pageX;
+this._dragStartWindowLeft = this._windowLeft;
+this._dragStartWindowRight = this._windowRight;
+this._hidePopover();
+return true;
+},
+
+_canvasDragging: function(event)
+{
+var pixelShift = this._dragStartPoint - event.pageX;
+var windowShift = pixelShift / this._totalPixels;
+
+var windowLeft = Math.max(0, this._dragStartWindowLeft + windowShift);
+if (windowLeft === this._windowLeft)
+return;
+windowShift = windowLeft - this._dragStartWindowLeft;
+
+var windowRight = Math.min(1, this._dragStartWindowRight + windowShift);
+if (windowRight === this._windowRight)
+return;
+windowShift = windowRight - this._dragStartWindowRight;
+this._overviewGrid.setWindow(this._dragStartWindowLeft + windowShift, this._dragStartWindowRight + windowShift);
+},
+
+_endCanvasDragging: function()
+{
+this._isDragging = false;
+},
+
+_calculateTimelineData: function()
+{
+if (this._cpuProfileView.samples)
+return this._calculateTimelineDataForSamples();
+
+if (this._timelineData)
+return this._timelineData;
+
+if (!this._cpuProfileView.profileHead)
+return null;
+
+var index = 0;
+var entries = [];
+
+function appendReversedArray(toArray, fromArray)
+{
+for (var i = fromArray.length - 1; i >= 0; --i)
+toArray.push(fromArray[i]);
+}
+
+var stack = [];
+appendReversedArray(stack, this._cpuProfileView.profileHead.children);
+
+var levelOffsets =   ([0]);
+var levelExitIndexes =   ([0]);
+var colorGenerator = WebInspector.FlameChart._colorGenerator;
+
+while (stack.length) {
+var level = levelOffsets.length - 1;
+var node = stack.pop();
+var offset = levelOffsets[level];
+
+var colorPair = colorGenerator._colorPairForID(node.functionName + ":" + node.url + ":" + node.lineNumber);
+
+entries.push(new WebInspector.FlameChart.Entry(colorPair, level, node.totalTime, offset, node));
+
+++index;
+
+levelOffsets[level] += node.totalTime;
+if (node.children.length) {
+levelExitIndexes.push(stack.length);
+levelOffsets.push(offset + node.selfTime / 2);
+appendReversedArray(stack, node.children);
+}
+
+while (stack.length === levelExitIndexes[levelExitIndexes.length - 1]) {
+levelOffsets.pop();
+levelExitIndexes.pop();
+}
+}
+
+this._timelineData = {
+entries: entries,
+totalTime: this._cpuProfileView.profileHead.totalTime,
+}
+
+return this._timelineData;
+},
+
+_calculateTimelineDataForSamples: function()
+{
+if (this._timelineData)
+return this._timelineData;
+
+if (!this._cpuProfileView.profileHead)
+return null;
+
+var samples = this._cpuProfileView.samples;
+var idToNode = this._cpuProfileView._idToNode;
+var samplesCount = samples.length;
+
+var index = 0;
+var entries =   ([]);
+
+var openIntervals = [];
+var stackTrace = [];
+var colorGenerator = WebInspector.FlameChart._colorGenerator;
+for (var sampleIndex = 0; sampleIndex < samplesCount; sampleIndex++) {
+var node = idToNode[samples[sampleIndex]];
+stackTrace.length = 0;
+while (node) {
+stackTrace.push(node);
+node = node.parent;
+}
+stackTrace.pop(); 
+
+var depth = 0;
+node = stackTrace.pop();
+var intervalIndex;
+while (node && depth < openIntervals.length && node === openIntervals[depth].node) {
+intervalIndex = openIntervals[depth].index;
+entries[intervalIndex].duration += 1;
+node = stackTrace.pop();
+++depth;
+}
+if (depth < openIntervals.length)
+openIntervals.length = depth;
+if (!node) {
+entries[intervalIndex].selfTime += 1;
+continue;
+}
+
+while (node) {
+var colorPair = colorGenerator._colorPairForID(node.functionName + ":" + node.url + ":" + node.lineNumber);
+
+entries.push(new WebInspector.FlameChart.Entry(colorPair, depth, 1, sampleIndex, node));
+openIntervals.push({node: node, index: index});
+++index;
+
+node = stackTrace.pop();
+++depth;
+}
+entries[entries.length - 1].selfTime += 1;
+}
+
+this._timelineData = {
+entries: entries,
+totalTime: samplesCount,
+};
+
+return this._timelineData;
+},
+
+_getPopoverAnchor: function(element, event)
+{
+if (this._isDragging)
+return null;
+
+var nodeIndex = this._coordinatesToNodeIndex(event.offsetX, event.offsetY);
+
+this._highlightedNodeIndex = nodeIndex;
+this.update();
+
+if (nodeIndex === -1)
+return null;
+
+var anchorBox = new AnchorBox();
+this._entryToAnchorBox(this._timelineData.entries[nodeIndex], anchorBox);
+anchorBox.x += event.pageX - event.offsetX;
+anchorBox.y += event.pageY - event.offsetY;
+
+return anchorBox;
+},
+
+_showPopover: function(anchor, popover)
+{
+if (this._isDragging)
+return;
+var entry = this._timelineData.entries[this._highlightedNodeIndex];
+var node = entry.node;
+if (!node)
+return;
+var contentHelper = new WebInspector.PopoverContentHelper(node.functionName);
+if (this._cpuProfileView.samples) {
+contentHelper.appendTextRow(WebInspector.UIString("Self time"), Number.secondsToString(entry.selfTime / 1000, true));
+contentHelper.appendTextRow(WebInspector.UIString("Total time"), Number.secondsToString(entry.duration / 1000, true));
+}
+contentHelper.appendTextRow(WebInspector.UIString("Aggregated self time"), Number.secondsToString(node.selfTime / 1000, true));
+contentHelper.appendTextRow(WebInspector.UIString("Aggregated total time"), Number.secondsToString(node.totalTime / 1000, true));
+if (node.numberOfCalls)
+contentHelper.appendTextRow(WebInspector.UIString("Number of calls"), node.numberOfCalls);
+if (node.url) {
+var link = this._linkifier.linkifyLocation(node.url, node.lineNumber);
+contentHelper.appendElementRow("Location", link);
+}
+
+popover.show(contentHelper._contentTable, anchor);
+},
+
+_hidePopover: function()
+{
+this._popoverHelper.hidePopover();
+this._linkifier.reset();
+},
+
+_onClick: function(e)
+{
+if (this._highlightedNodeIndex === -1)
+return;
+var node = this._timelineData.entries[this._highlightedNodeIndex].node;
+this.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode, node);
+},
+
+_onMouseWheel: function(e)
+{
+var zoomFactor = (e.wheelDelta > 0) ? 0.9 : 1.1;
+var windowPoint = (this._pixelWindowLeft + e.offsetX) / this._totalPixels;
+var overviewReferencePoint = Math.floor(windowPoint * this._pixelWindowWidth);
+this._overviewGrid.zoom(zoomFactor, overviewReferencePoint);
+this._hidePopover();
+},
+
+
+_coordinatesToNodeIndex: function(x, y)
+{
+var timelineData = this._timelineData;
+if (!timelineData)
+return -1;
+var timelineEntries = timelineData.entries;
+var cursorTime = (x + this._pixelWindowLeft - this._paddingLeft) * this._pixelToTime;
+var cursorLevel = Math.floor((this._canvas.height - y) / this._barHeight);
+
+for (var i = 0; i < timelineEntries.length; ++i) {
+if (cursorTime < timelineEntries[i].startTime)
+return -1;
+if (cursorTime < (timelineEntries[i].startTime + timelineEntries[i].duration)
+&& cursorLevel === timelineEntries[i].depth)
+return i;
+}
+return -1;
+},
+
+onResize: function()
+{
+this._updateOverviewCanvas = true;
+this._hidePopover();
+this._scheduleUpdate();
+},
+
+_drawOverviewCanvas: function(width, height)
+{
+this._overviewCanvas.width = width;
+this._overviewCanvas.height = height;
+
+if (!this._timelineData)
+return;
+
+var timelineEntries = this._timelineData.entries;
+
+var drawData = new Uint8Array(width);
+var scaleFactor = width / this._totalTime;
+
+for (var nodeIndex = 0; nodeIndex < timelineEntries.length; ++nodeIndex) {
+var entry = timelineEntries[nodeIndex];
+var start = Math.floor(entry.startTime * scaleFactor);
+var finish = Math.floor((entry.startTime + entry.duration) * scaleFactor);
+for (var x = start; x < finish; ++x)
+drawData[x] = Math.max(drawData[x], entry.depth + 1);
+}
+
+var context = this._overviewCanvas.getContext("2d");
+var yScaleFactor = 2;
+context.lineWidth = 0.5;
+context.strokeStyle = "rgba(20,0,0,0.8)";
+context.fillStyle="rgba(214,225,254, 0.8)";
+context.moveTo(0, height - 1);
+for (var x = 0; x < width; ++x)
+context.lineTo(x, height - drawData[x] * yScaleFactor - 1);
+context.lineTo(width - 1, height - 1);
+context.lineTo(0, height - 1);
+context.fill();
+context.stroke();
+context.closePath();
+},
+
+
+_entryToAnchorBox: function(entry, anchorBox)
+{
+anchorBox.x = Math.floor(entry.startTime * this._timeToPixel) - this._pixelWindowLeft + this._paddingLeft;
+anchorBox.y = this._canvas.height - (entry.depth + 1) * this._barHeight;
+anchorBox.width = Math.floor(entry.duration * this._timeToPixel);
+anchorBox.height = this._barHeight;
+if (anchorBox.x < 0) {
+anchorBox.width += anchorBox.x;
+anchorBox.x = 0;
+}
+anchorBox.width = Number.constrain(anchorBox.width, 0, this._canvas.width - anchorBox.x);
+},
+
+
+draw: function(width, height)
+{
+var timelineData = this._calculateTimelineData();
+if (!timelineData)
+return;
+var timelineEntries = timelineData.entries;
+this._canvas.height = height;
+this._canvas.width = width;
+var barHeight = this._barHeight;
+
+var context = this._canvas.getContext("2d");
+var textPaddingLeft = 2;
+context.font = (barHeight - 3) + "px sans-serif";
+context.textBaseline = "top";
+this._dotsWidth = context.measureText("\u2026").width;
+var visibleTimeLeft = this._timeWindowLeft - this._paddingLeftTime;
+
+var anchorBox = new AnchorBox();
+for (var i = 0; i < timelineEntries.length; ++i) {
+var entry = timelineEntries[i];
+var startTime = entry.startTime;
+if (startTime > this._timeWindowRight)
+break;
+if ((startTime + entry.duration) < visibleTimeLeft)
+continue;
+this._entryToAnchorBox(entry, anchorBox);
+if (anchorBox.width < this._minWidth)
+continue;
+
+var colorPair = entry.colorPair;
+var color;
+if (this._highlightedNodeIndex === i)
+color =  colorPair.highlighted;
+else
+color = colorPair.normal;
+
+context.beginPath();
+context.rect(anchorBox.x, anchorBox.y, anchorBox.width - 1, anchorBox.height - 1);
+context.fillStyle = color;
+context.fill();
+
+var xText = Math.max(0, anchorBox.x);
+var widthText = anchorBox.width - textPaddingLeft + anchorBox.x - xText;
+var title = this._prepareTitle(context, entry.node.functionName, widthText);
+if (title) {
+context.fillStyle = "#333";
+context.fillText(title, xText + textPaddingLeft, anchorBox.y - 1);
+}
+}
+},
+
+_prepareTitle: function(context, title, maxSize)
+{
+if (maxSize < this._dotsWidth)
+return null;
+var titleWidth = context.measureText(title).width;
+if (maxSize > titleWidth)
+return title;
+maxSize -= this._dotsWidth;
+var dotRegExp=/[\.\$]/g;
+var match = dotRegExp.exec(title);
+if (!match) {
+var visiblePartSize = maxSize / titleWidth;
+var newTextLength = Math.floor(title.length * visiblePartSize) + 1;
+var minTextLength = 4;
+if (newTextLength < minTextLength)
+return null;
+var substring;
+do {
+--newTextLength;
+substring = title.substring(0, newTextLength);
+} while (context.measureText(substring).width > maxSize);
+return title.substring(0, newTextLength) + "\u2026";
+}
+while (match) {
+var substring = title.substring(match.index + 1);
+var width = context.measureText(substring).width;
+if (maxSize > width)
+return "\u2026" + substring;
+match = dotRegExp.exec(title);
+}
+},
+
+_scheduleUpdate: function()
+{
+if (this._updateTimerId)
+return;
+this._updateTimerId = setTimeout(this.update.bind(this), 10);
+},
+
+_updateBoundaries: function()
+{
+this._windowLeft = this._overviewGrid.windowLeft();
+this._windowRight = this._overviewGrid.windowRight();
+this._windowWidth = this._windowRight - this._windowLeft;
+
+this._totalTime = this._timelineData.totalTime;
+this._timeWindowLeft = this._windowLeft * this._totalTime;
+this._timeWindowRight = this._windowRight * this._totalTime;
+
+this._pixelWindowWidth = this._chartContainer.clientWidth;
+this._totalPixels = Math.floor(this._pixelWindowWidth / this._windowWidth);
+this._pixelWindowLeft = Math.floor(this._totalPixels * this._windowLeft);
+this._pixelWindowRight = Math.floor(this._totalPixels * this._windowRight);
+
+this._timeToPixel = this._totalPixels / this._totalTime;
+this._pixelToTime = this._totalTime / this._totalPixels;
+this._paddingLeftTime = this._paddingLeft / this._timeToPixel;
+},
+
+update: function()
+{
+this._updateTimerId = 0;
+if (!this._timelineData)
+this._calculateTimelineData();
+if (!this._timelineData)
+return;
+this._updateBoundaries();
+this.draw(this._chartContainer.clientWidth, this._chartContainer.clientHeight);
+this._calculator._updateBoundaries(this);
+this._overviewCalculator._updateBoundaries(this);
+this._timelineGrid.element.style.width = this.element.clientWidth;
+this._timelineGrid.updateDividers(this._calculator);
+this._overviewGrid.updateDividers(this._overviewCalculator);
+if (this._updateOverviewCanvas) {
+this._drawOverviewCanvas(this._overviewContainer.clientWidth, this._overviewContainer.clientHeight);
+this._updateOverviewCanvas = false;
+}
+},
+
+__proto__: WebInspector.View.prototype
+};
+;
+
+
+
 WebInspector.HeapSnapshotArraySlice = function(array, start, end)
 {
 this._array = array;
@@ -3082,11 +3891,6 @@
 }
 
 WebInspector.HeapSnapshotNode.prototype = {
-isUserObject: function()
-{
-return true;
-},
-
 distance: function()
 {
 return this._snapshot._nodeDistances[this.nodeIndex / this._snapshot._nodeFieldCount];
@@ -3255,6 +4059,10 @@
 this._metaNode = profile.snapshot.meta;
 this._strings = profile.strings;
 
+this._rootNodeIndex = 0;
+if (profile.snapshot.root_index)
+this._rootNodeIndex = profile.snapshot.root_index;
+
 this._snapshotDiffs = {};
 this._aggregatesForDiff = null;
 
@@ -3269,6 +4077,7 @@
 this.node_types = [];
 this.edge_fields = [];
 this.edge_types = [];
+this.type_strings = {};
 
 
 this.fields = [];
@@ -3290,7 +4099,6 @@
 _init: function()
 {
 var meta = this._metaNode;
-this._rootNodeIndex = 0;
 
 this._nodeTypeOffset = meta.node_fields.indexOf("type");
 this._nodeNameOffset = meta.node_fields.indexOf("name");
@@ -3527,9 +4335,9 @@
 return this._aggregatesForDiff;
 },
 
-canHaveDistanceOne: function(node)
+distanceForUserRoot: function(node)
 {
-return true;
+return 1;
 },
 
 _calculateDistances: function()
@@ -3542,9 +4350,10 @@
 var nodesToVisitLength = 0;
 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (this.canHaveDistanceOne(node)) {
+var distance = this.distanceForUserRoot(node);
+if (distance !== -1) {
 nodesToVisit[nodesToVisitLength++] = node.nodeIndex;
-distances[node.nodeIndex / nodeFieldCount] = 1;
+distances[node.nodeIndex / nodeFieldCount] = distance;
 }
 }
 this._bfs(nodesToVisit, nodesToVisitLength, distances);
@@ -3779,8 +4588,21 @@
 }
 }
 
-if (postOrderIndex !== nodeCount)
+if (postOrderIndex !== nodeCount) {
+var dumpNode = this.rootNode();
+for (var i = 0; i < nodeCount; ++i) {
+if (painted[i] !== black) {
+dumpNode.nodeIndex = i * nodeFieldCount;
+console.log(JSON.stringify(dumpNode.serialize()));
+var retainers = dumpNode.retainers();
+while (retainers) {
+console.log("edgeName: " + retainers.item().name() + " nodeClassName: " + retainers.item().node().className());
+retainers = retainers.item().node().retainers();
+}
+}
+}
 throw new Error("Postordering failed. " + (nodeCount - postOrderIndex) + " hanging nodes");
+}
 
 return {postOrderIndex2NodeOrdinal: postOrderIndex2NodeOrdinal, nodeOrdinal2PostOrderIndex: nodeOrdinal2PostOrderIndex};
 },
@@ -4110,16 +4932,34 @@
 return parsedFilter.bind(this);
 },
 
-createEdgesProvider: function(nodeIndex, filter)
+createEdgesProvider: function(nodeIndex, showHiddenData)
 {
 var node = this.createNode(nodeIndex);
-return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.edges());
+var filter = this.containmentEdgesFilter(showHiddenData);
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
 },
 
-createRetainingEdgesProvider: function(nodeIndex, filter)
+createEdgesProviderForTest: function(nodeIndex, filter)
 {
 var node = this.createNode(nodeIndex);
-return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.retainers());
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
+},
+
+retainingEdgesFilter: function(showHiddenData)
+{
+return null;
+},
+
+containmentEdgesFilter: function(showHiddenData)
+{
+return null;
+},
+
+createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
+{
+var node = this.createNode(nodeIndex);
+var filter = this.retainingEdgesFilter(showHiddenData);
+return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.retainers());
 },
 
 createAddedNodesProvider: function(baseSnapshotId, className)
@@ -4134,12 +4974,14 @@
 return new WebInspector.HeapSnapshotNodesProvider(this, null, nodeIndexes);
 },
 
+classNodesFilter: function()
+{
+return null;
+},
+
 createNodesProviderForClass: function(className, aggregatesKey)
 {
-function filter(node) {
-return node.isUserObject();
-}
-return new WebInspector.HeapSnapshotNodesProvider(this, filter, this.aggregates(false, aggregatesKey)[className].idxs);
+return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesFilter(), this.aggregates(false, aggregatesKey)[className].idxs);
 },
 
 createNodesProviderForDominator: function(nodeIndex)
@@ -4297,7 +5139,7 @@
 
 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator = function(fieldNames)
 {
-return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
+return {fieldName1: fieldNames[0], ascending1: fieldNames[1], fieldName2: fieldNames[2], ascending2: fieldNames[3]};
 }
 
 
@@ -4454,7 +5296,7 @@
 
 this._populatedAndSorted = false;
 this.addEventListener("sorting complete", this._sortingComplete, this);
-this.addEventListener("sorting changed", this.sortingChanged, this);
+this.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this.sortingChanged, this);
 }
 
 WebInspector.HeapSnapshotSortableDataGrid.Events = {
@@ -4507,13 +5349,13 @@
 {
 profilesPanel.showObject(node.snapshotNodeId, "Dominators");
 }
-contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInDominatorsView.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Dominators view" : "Reveal in Dominators View"), revealInDominatorsView.bind(this));
 } else if (node instanceof WebInspector.HeapSnapshotDominatorObjectNode) {
 function revealInSummaryView()
 {
 profilesPanel.showObject(node.snapshotNodeId, "Summary");
 }
-contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInSummaryView.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Summary view" : "Reveal in Summary View"), revealInSummaryView.bind(this));
 }
 },
 
@@ -4578,8 +5420,8 @@
 
 sortingChanged: function()
 {
-var sortAscending = this.sortOrder === "ascending";
-var sortColumnIdentifier = this.sortColumnIdentifier;
+var sortAscending = this.isSortOrderAscending();
+var sortColumnIdentifier = this.sortColumnIdentifier();
 if (this._lastSortColumnIdentifier === sortColumnIdentifier && this._lastSortAscending === sortAscending)
 return;
 this._lastSortColumnIdentifier = sortColumnIdentifier;
@@ -4806,11 +5648,11 @@
 
 WebInspector.HeapSnapshotContainmentDataGrid = function(columns)
 {
-columns = columns || {
-object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true },
-shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
-retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true, sort: "descending" }
-};
+columns = columns || [
+{id: "object", title: WebInspector.UIString("Object"), disclosure: true, sortable: true},
+{id: "shallowSize", title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true},
+{id: "retainedSize", title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true, sort: WebInspector.DataGrid.Order.Descending}
+];
 WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
 }
 
@@ -4837,15 +5679,19 @@
 WebInspector.HeapSnapshotRetainmentDataGrid = function()
 {
 this.showRetainingEdges = true;
-var columns = {
-object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true },
-shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
-retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true },
-distance: { title: WebInspector.UIString("Distance"), width: "80px", sortable: true, sort: "ascending" }
-};
+var columns = [
+{id: "object", title: WebInspector.UIString("Object"), disclosure: true, sortable: true},
+{id: "shallowSize", title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true},
+{id: "retainedSize", title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true},
+{id: "distance", title: WebInspector.UIString("Distance"), width: "80px", sortable: true, sort: WebInspector.DataGrid.Order.Ascending}
+];
 WebInspector.HeapSnapshotContainmentDataGrid.call(this, columns);
 }
 
+WebInspector.HeapSnapshotRetainmentDataGrid.Events = {
+ExpandRetainersComplete: "ExpandRetainersComplete"
+}
+
 WebInspector.HeapSnapshotRetainmentDataGrid.prototype = {
 _sortFields: function(sortColumn, sortAscending)
 {
@@ -4864,6 +5710,28 @@
 this.resetSortingCache();
 },
 
+
+setDataSource: function(snapshot, nodeIndex)
+{
+WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource.call(this, snapshot, nodeIndex);
+
+var dataGrid = this;
+var maxExpandLevels = 20;
+
+function populateComplete()
+{
+this.removeEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete, populateComplete, this);
+this.expand();
+if (--maxExpandLevels > 0 && this.children.length > 0 && (!this._distance || this._distance > 2)) {
+var retainer = this.children[0];
+retainer.addEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete, populateComplete, retainer);
+retainer.populate();
+} else
+dataGrid.dispatchEventToListeners(WebInspector.HeapSnapshotRetainmentDataGrid.Events.ExpandRetainersComplete);
+}
+this.rootNode().addEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete, populateComplete, this.rootNode());
+},
+
 __proto__: WebInspector.HeapSnapshotContainmentDataGrid.prototype
 }
 
@@ -4871,13 +5739,13 @@
 
 WebInspector.HeapSnapshotConstructorsDataGrid = function()
 {
-var columns = {
-object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
-distance: { title: WebInspector.UIString("Distance"), width: "90px", sortable: true },
-count: { title: WebInspector.UIString("Objects Count"), width: "90px", sortable: true },
-shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
-retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
-};
+var columns = [
+{id: "object", title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true},
+{id: "distance", title: WebInspector.UIString("Distance"), width: "90px", sortable: true},
+{id: "count", title: WebInspector.UIString("Objects Count"), width: "90px", sortable: true},
+{id: "shallowSize", title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true},
+{id: "retainedSize", title: WebInspector.UIString("Retained Size"), width: "120px", sort: WebInspector.DataGrid.Order.Descending, sortable: true}
+];
 WebInspector.HeapSnapshotViewportDataGrid.call(this, columns);
 this._profileIndex = -1;
 this._topLevelNodes = [];
@@ -4973,15 +5841,15 @@
 
 WebInspector.HeapSnapshotDiffDataGrid = function()
 {
-var columns = {
-object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
-addedCount: { title: WebInspector.UIString("# New"), width: "72px", sortable: true },
-removedCount: { title: WebInspector.UIString("# Deleted"), width: "72px", sortable: true },
-countDelta: { title: "# Delta", width: "64px", sortable: true },
-addedSize: { title: WebInspector.UIString("Alloc. Size"), width: "72px", sortable: true, sort: "descending" },
-removedSize: { title: WebInspector.UIString("Freed Size"), width: "72px", sortable: true },
-sizeDelta: { title: "Size Delta", width: "72px", sortable: true }
-};
+var columns = [
+{id: "object", title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true},
+{id: "addedCount", title: WebInspector.UIString("# New"), width: "72px", sortable: true},
+{id: "removedCount", title: WebInspector.UIString("# Deleted"), width: "72px", sortable: true},
+{id: "countDelta", title: "# Delta", width: "64px", sortable: true},
+{id: "addedSize", title: WebInspector.UIString("Alloc. Size"), width: "72px", sortable: true, sort: WebInspector.DataGrid.Order.Descending},
+{id: "removedSize", title: WebInspector.UIString("Freed Size"), width: "72px", sortable: true},
+{id: "sizeDelta", title: "Size Delta", width: "72px", sortable: true}
+];
 WebInspector.HeapSnapshotViewportDataGrid.call(this, columns);
 }
 
@@ -5051,11 +5919,11 @@
 
 WebInspector.HeapSnapshotDominatorsDataGrid = function()
 {
-var columns = {
-object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true },
-shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
-retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
-};
+var columns = [
+{id: "object", title: WebInspector.UIString("Object"), disclosure: true, sortable: true},
+{id: "shallowSize", title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true},
+{id: "retainedSize", title: WebInspector.UIString("Retained Size"), width: "120px", sort: WebInspector.DataGrid.Order.Descending, sortable: true}
+];
 WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
 this._objectIdToSelect = null;
 }
@@ -5138,7 +6006,10 @@
 this._savedChildren = null;
 
 this._retrievedChildrenRanges = [];
-this.addEventListener("populate", this._populate, this);
+}
+
+WebInspector.HeapSnapshotGridNode.Events = {
+PopulateComplete: "PopulateComplete"
 }
 
 WebInspector.HeapSnapshotGridNode.prototype = {
@@ -5226,15 +6097,19 @@
 percentSpan.className = "percent-column";
 percentSpan.textContent = this.data[percentColumn];
 div.appendChild(percentSpan);
+div.addStyleClass("heap-snapshot-multiple-values");
 }
 cell.appendChild(div);
 }
 return cell;
 },
 
-_populate: function(event)
+populate: function(event)
 {
-this.removeEventListener("populate", this._populate, this);
+if (this._populated)
+return;
+this._populated = true;
+
 function sorted()
 {
 this._populateChildren();
@@ -5245,7 +6120,7 @@
 expandWithoutPopulate: function(callback)
 {
 
-this.removeEventListener("populate", this._populate, this);
+this._populated = true;
 this.expand();
 this._provider().sortAndRewind(this.comparator(), callback);
 },
@@ -5370,7 +6245,7 @@
 
 if (afterPopulate)
 afterPopulate();
-this.dispatchEventToListeners("populate complete");
+this.dispatchEventToListeners(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete);
 }
 serializeNextChunk.call(this);
 },
@@ -5427,6 +6302,7 @@
 if (!node)
 return;
 this._name = node.name;
+this._displayName = node.displayName;
 this._type = node.type;
 this._distance = node.distance;
 this._shallowSize = node.selfSize;
@@ -5435,7 +6311,7 @@
 this.snapshotNodeIndex = node.nodeIndex;
 if (this._type === "string")
 this._reachableFromWindow = true;
-else if (this._type === "object" && this.isWindow(this._name)) {
+else if (this._type === "object" && this._name.startsWith("Window")) {
 this._name = this.shortenWindowURL(this._name, false);
 this._reachableFromWindow = true;
 } else if (node.canBeQueried)
@@ -5460,19 +6336,31 @@
 var div = document.createElement("div");
 div.className = "source-code event-properties";
 div.style.overflow = "visible";
+
 var data = this.data["object"];
 if (this._prefixObjectCell)
 this._prefixObjectCell(div, data);
+
 var valueSpan = document.createElement("span");
 valueSpan.className = "value console-formatted-" + data.valueStyle;
 valueSpan.textContent = data.value;
 div.appendChild(valueSpan);
+
+if (this.data.displayName) {
+var nameSpan = document.createElement("span");
+nameSpan.className = "name console-formatted-name";
+nameSpan.textContent = " " + this.data.displayName;
+div.appendChild(nameSpan);
+}
+
 var idSpan = document.createElement("span");
 idSpan.className = "console-formatted-id";
 idSpan.textContent = " @" + data["nodeId"];
 div.appendChild(idSpan);
+
 if (this._postfixObjectCell)
 this._postfixObjectCell(div, data);
+
 cell.appendChild(div);
 cell.addStyleClass("disclosure");
 if (this.depth)
@@ -5521,6 +6409,7 @@
 valueStyle += " detached-dom-tree-node";
 data["object"] = { valueStyle: valueStyle, value: value, nodeId: this.snapshotNodeId };
 
+data["displayName"] = this._displayName;
 data["distance"] =  this._distance;
 data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize);
 data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize);
@@ -5542,7 +6431,7 @@
 else
 callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Not available")));
 }
-ProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId), objectGroupName, formatResult);
+HeapProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId), objectGroupName, formatResult);
 }
 },
 
@@ -5565,11 +6454,6 @@
 this._provider().isEmpty(isEmptyCallback.bind(this));
 },
 
-isWindow: function(fullName)
-{
-return fullName.substr(0, 9) === "Window";
-},
-
 shortenWindowURL: function(fullName, hasObjectId)
 {
 var startPos = fullName.indexOf("/");
@@ -5609,16 +6493,11 @@
 {
 var tree = this._dataGrid;
 var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get();
-var filter = "function(edge) {\n" +
-"    return !edge.isInvisible()\n" +
-"        && (" + !tree.showRetainingEdges + " || (edge.node().id() !== 1 && !edge.node().isSynthetic() && !edge.isWeak()))\n" +
-"        && (" + showHiddenData + " || (!edge.isHidden() && !edge.node().isHidden()));\n" +
-"}\n";
 var snapshot = this._isFromBaseSnapshot ? tree.baseSnapshot : tree.snapshot;
 if (this.showRetainingEdges)
-return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex, filter);
+return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex, showHiddenData);
 else
-return snapshot.createEdgesProvider(this.snapshotNodeIndex, filter);
+return snapshot.createEdgesProvider(this.snapshotNodeIndex, showHiddenData);
 },
 
 _findAncestorWithSameSnapshotNodeId: function()
@@ -5651,8 +6530,8 @@
 
 comparator: function()
 {
-var sortAscending = this._dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
+var sortAscending = this._dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier();
 var sortFields = {
 object: ["!edgeName", sortAscending, "retainedSize", false],
 count: ["!edgeName", true, "retainedSize", false],
@@ -5725,10 +6604,7 @@
 var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get();
 return this._baseSnapshotOrSnapshot.createEdgesProvider(
 this.snapshotNodeIndex,
-"function(edge) {" +
-"    return !edge.isInvisible()" +
-"        && (" + showHiddenData + " || (!edge.isHidden() && !edge.node().isHidden()));" +
-"}");
+showHiddenData);
 },
 
 _createChildNode: function(item)
@@ -5748,8 +6624,8 @@
 
 comparator: function()
 {
-var sortAscending = this._dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
+var sortAscending = this._dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier();
 var sortFields = {
 object: ["!edgeName", sortAscending, "retainedSize", false],
 distance: ["distance", sortAscending, "retainedSize", false],
@@ -5764,7 +6640,7 @@
 
 _emptyData: function()
 {
-return {count:"", countDelta:"", sizeDelta: ""};
+return {count: "", countDelta: "", sizeDelta: ""};
 },
 
 _enhanceData: function(data)
@@ -5859,8 +6735,8 @@
 
 comparator: function()
 {
-var sortAscending = this._dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
+var sortAscending = this._dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier();
 var sortFields = {
 object: ["id", sortAscending, "retainedSize", false],
 distance: ["distance", true, "retainedSize", false],
@@ -6028,8 +6904,8 @@
 
 comparator: function()
 {
-var sortAscending = this._dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
+var sortAscending = this._dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier();
 var sortFields = {
 object: ["id", sortAscending, "selfSize", false],
 addedCount: ["selfSize", sortAscending, "id", true],
@@ -6130,8 +7006,8 @@
 
 comparator: function()
 {
-var sortAscending = this._dataGrid.sortOrder === "ascending";
-var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
+var sortAscending = this._dataGrid.isSortOrderAscending();
+var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier();
 var sortFields = {
 object: ["id", sortAscending, "retainedSize", false],
 shallowSize: ["selfSize", sortAscending, "id", true],
@@ -6176,9 +7052,10 @@
 this._parseStringsArray();
 },
 
-buildSnapshot: function()
+buildSnapshot: function(constructorName)
 {
-var result = new WebInspector.JSHeapSnapshot(this._snapshot);
+var constructor = WebInspector[constructorName];
+var result = new constructor(this._snapshot);
 this._reset();
 return result;
 },
@@ -6459,12 +7336,11 @@
 }
 
 WebInspector.HeapSnapshotWorker.prototype = {
-createObject: function(constructorName)
+createLoader: function(snapshotConstructorName, proxyConstructor)
 {
-var proxyConstructorFunction = this._findFunction(constructorName + "Proxy");
 var objectId = this._nextObjectId++;
-var proxy = new proxyConstructorFunction(this, objectId);
-this._postMessage({callId: this._nextCallId++, disposition: "create", objectId: objectId, methodName: constructorName});
+var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, snapshotConstructorName, proxyConstructor);
+this._postMessage({callId: this._nextCallId++, disposition: "create", objectId: objectId, methodName: "WebInspector.HeapSnapshotLoader"});
 return proxy;
 },
 
@@ -6487,23 +7363,22 @@
 this._postMessage({callId: callId, disposition: "getter", objectId: objectId, methodName: getterName});
 },
 
-callFactoryMethod: function(callback, objectId, methodName, proxyConstructorName)
+callFactoryMethod: function(callback, objectId, methodName, proxyConstructor)
 {
 var callId = this._nextCallId++;
 var methodArguments = Array.prototype.slice.call(arguments, 4);
 var newObjectId = this._nextObjectId++;
-var proxyConstructorFunction = this._findFunction(proxyConstructorName);
 if (callback) {
 function wrapCallback(remoteResult)
 {
-callback(remoteResult ? new proxyConstructorFunction(this, newObjectId) : null);
+callback(remoteResult ? new proxyConstructor(this, newObjectId) : null);
 }
 this._callbacks[callId] = wrapCallback.bind(this);
 this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
 return null;
 } else {
 this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
-return new proxyConstructorFunction(this, newObjectId);
+return new proxyConstructor(this, newObjectId);
 }
 },
 
@@ -6599,7 +7474,7 @@
 },
 
 
-callFactoryMethod: function(callback, methodName, proxyConstructorName, var_args)
+callFactoryMethod: function(callback, methodName, proxyConstructor, var_args)
 {
 return this._callWorker("callFactoryMethod", Array.prototype.slice.call(arguments, 0));
 },
@@ -6621,9 +7496,11 @@
 };
 
 
-WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId)
+WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, snapshotConstructorName, proxyConstructor)
 {
 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
+this._snapshotConstructorName = snapshotConstructorName;
+this._proxyConstructor = proxyConstructor;
 this._pendingSnapshotConsumers = [];
 }
 
@@ -6644,7 +7521,7 @@
 {
 function buildSnapshot()
 {
-this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", "WebInspector.HeapSnapshotProxy");
+this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", this._proxyConstructor, this._snapshotConstructorName);
 }
 function updateStaticData(snapshotProxy)
 {
@@ -6696,39 +7573,39 @@
 this.callMethod(callback, "dominatorIdsForNode", nodeIndex);
 },
 
-createEdgesProvider: function(nodeIndex, filter)
+createEdgesProvider: function(nodeIndex, showHiddenData)
 {
-return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
+return this.callFactoryMethod(null, "createEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData);
 },
 
-createRetainingEdgesProvider: function(nodeIndex, filter)
+createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
 {
-return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
+return this.callFactoryMethod(null, "createRetainingEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData);
 },
 
 createAddedNodesProvider: function(baseSnapshotId, className)
 {
-return this.callFactoryMethod(null, "createAddedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", baseSnapshotId, className);
+return this.callFactoryMethod(null, "createAddedNodesProvider", WebInspector.HeapSnapshotProviderProxy, baseSnapshotId, className);
 },
 
 createDeletedNodesProvider: function(nodeIndexes)
 {
-return this.callFactoryMethod(null, "createDeletedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndexes);
+return this.callFactoryMethod(null, "createDeletedNodesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndexes);
 },
 
 createNodesProvider: function(filter)
 {
-return this.callFactoryMethod(null, "createNodesProvider", "WebInspector.HeapSnapshotProviderProxy", filter);
+return this.callFactoryMethod(null, "createNodesProvider", WebInspector.HeapSnapshotProviderProxy, filter);
 },
 
 createNodesProviderForClass: function(className, aggregatesKey)
 {
-return this.callFactoryMethod(null, "createNodesProviderForClass", "WebInspector.HeapSnapshotProviderProxy", className, aggregatesKey);
+return this.callFactoryMethod(null, "createNodesProviderForClass", WebInspector.HeapSnapshotProviderProxy, className, aggregatesKey);
 },
 
 createNodesProviderForDominator: function(nodeIndex)
 {
-return this.callFactoryMethod(null, "createNodesProviderForDominator", "WebInspector.HeapSnapshotProviderProxy", nodeIndex);
+return this.callFactoryMethod(null, "createNodesProviderForDominator", WebInspector.HeapSnapshotProviderProxy, nodeIndex);
 },
 
 dispose: function()
@@ -6771,6 +7648,21 @@
 
 
 
+WebInspector.NativeHeapSnapshotProxy = function(worker, objectId)
+{
+WebInspector.HeapSnapshotProxy.call(this, worker, objectId);
+}
+
+WebInspector.NativeHeapSnapshotProxy.prototype = {
+images: function(callback)
+{
+this.callMethod(callback, "images");
+},
+
+__proto__: WebInspector.HeapSnapshotProxy.prototype
+}
+
+
 WebInspector.HeapSnapshotProviderProxy = function(worker, objectId)
 {
 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
@@ -6811,8 +7703,7 @@
 this.element.addStyleClass("heap-snapshot-view");
 
 this.parent = parent;
-this.parent.addEventListener("profile added", this._updateBaseOptions, this);
-this.parent.addEventListener("profile added", this._updateFilterOptions, this);
+this.parent.addEventListener("profile added", this._onProfileHeaderAdded, this);
 
 this.viewsContainer = document.createElement("div");
 this.viewsContainer.addStyleClass("views-container");
@@ -6871,7 +7762,7 @@
 this.retainmentView.show(this.element);
 this.retainmentDataGrid.reset();
 
-this.dataGrid = this.constructorsDataGrid;
+this.dataGrid =   (this.constructorsDataGrid);
 this.currentView = this.constructorsView;
 
 this.viewSelectElement = document.createElement("select");
@@ -6891,6 +7782,7 @@
 }
 
 this._profileUid = profile.uid;
+this._profileTypeId = profile.profileType().id;
 
 this.baseSelectElement = document.createElement("select");
 this.baseSelectElement.className = "status-bar-item";
@@ -6956,12 +7848,12 @@
 
 get profile()
 {
-return this.parent.getProfile(WebInspector.HeapSnapshotProfileType.TypeId, this._profileUid);
+return this.parent.getProfile(this._profileTypeId, this._profileUid);
 },
 
 get baseProfile()
 {
-return this.parent.getProfile(WebInspector.HeapSnapshotProfileType.TypeId, this._baseProfileUid);
+return this.parent.getProfile(this._profileTypeId, this._baseProfileUid);
 },
 
 wasShown: function()
@@ -7193,15 +8085,7 @@
 
 _profiles: function()
 {
-return this.parent.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
-},
-
-processLoadedSnapshot: function(profile, snapshot)
-{
-profile.nodes = snapshot.nodes;
-profile.strings = snapshot.strings;
-var s = new WebInspector.HeapSnapshot(profile);
-profile.sidebarElement.subtitle = Number.bytesToString(s.totalSize);
+return this.parent.getProfileType(this._profileTypeId).getProfiles();
 },
 
 
@@ -7455,6 +8339,7 @@
 this.viewsContainer.style.bottom = (height + this.retainmentViewHeader.clientHeight) + "px";
 this.retainmentView.element.style.height = height + "px";
 this.retainmentViewHeader.style.bottom = height + "px";
+this.currentView.doResize();
 },
 
 _updateBaseOptions: function()
@@ -7467,8 +8352,8 @@
 for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
 var baseOption = document.createElement("option");
 var title = list[i].title;
-if (!title.indexOf(UserInitiatedProfileName))
-title = WebInspector.UIString("Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
+if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
+title = WebInspector.UIString("Snapshot %d", WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title));
 baseOption.label = title;
 this.baseSelectElement.appendChild(baseOption);
 }
@@ -7493,17 +8378,27 @@
 var profile = list[i];
 var filterOption = document.createElement("option");
 var title = list[i].title;
-if (!title.indexOf(UserInitiatedProfileName)) {
+if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) {
+var profileIndex = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title);
 if (!i)
-title = WebInspector.UIString("Objects allocated before Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
+title = WebInspector.UIString("Objects allocated before Snapshot %d", profileIndex);
 else
-title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", title.substring(UserInitiatedProfileName.length + 1) - 1, title.substring(UserInitiatedProfileName.length + 1));
+title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", profileIndex - 1, profileIndex);
 }
 filterOption.label = title;
 this.filterSelectElement.appendChild(filterOption);
 }
 },
 
+
+_onProfileHeaderAdded: function(event)
+{
+if (!event.data || event.data.type !== this._profileTypeId)
+return;
+this._updateBaseOptions();
+this._updateFilterOptions();
+},
+
 __proto__: WebInspector.View.prototype
 }
 
@@ -7512,20 +8407,33 @@
 WebInspector.HeapSnapshotProfileType = function()
 {
 WebInspector.ProfileType.call(this, WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("Take Heap Snapshot"));
+InspectorBackend.registerHeapProfilerDispatcher(this);
 }
 
 WebInspector.HeapSnapshotProfileType.TypeId = "HEAP";
 
 WebInspector.HeapSnapshotProfileType.prototype = {
+
+fileExtension: function()
+{
+return ".heapsnapshot";
+},
+
 get buttonTooltip()
 {
 return WebInspector.UIString("Take heap snapshot.");
 },
 
 
-buttonClicked: function(profilesPanel)
+isInstantProfile: function()
 {
-profilesPanel.takeHeapSnapshot();
+return true;
+},
+
+
+buttonClicked: function()
+{
+this._takeHeapSnapshot();
 return false;
 },
 
@@ -7552,6 +8460,65 @@
 return new WebInspector.HeapProfileHeader(this, profile.title, profile.uid, profile.maxJSObjectId || 0);
 },
 
+_takeHeapSnapshot: function()
+{
+var temporaryProfile = this.findTemporaryProfile();
+if (!temporaryProfile)
+this.addProfile(this.createTemporaryProfile());
+HeapProfilerAgent.takeHeapSnapshot(true, function() {});
+WebInspector.userMetrics.ProfilesHeapProfileTaken.record();
+},
+
+
+addProfileHeader: function(profileHeader)
+{
+this.addProfile(this.createProfile(profileHeader));
+},
+
+
+addHeapSnapshotChunk: function(uid, chunk)
+{
+var profile = this._profilesIdMap[this._makeKey(uid)];
+if (profile)
+profile.transferChunk(chunk);
+},
+
+
+finishHeapSnapshot: function(uid)
+{
+var profile = this._profilesIdMap[this._makeKey(uid)];
+if (profile)
+profile.finishHeapSnapshot();
+},
+
+
+reportHeapSnapshotProgress: function(done, total)
+{
+var profile = this.findTemporaryProfile();
+if (profile)
+this.dispatchEventToListeners(WebInspector.ProfileType.Events.ProgressUpdated, {"profile": profile, "done": done, "total": total});
+},
+
+
+resetProfiles: function()
+{
+this._reset();
+},
+
+
+removeProfile: function(profile)
+{
+WebInspector.ProfileType.prototype.removeProfile.call(this, profile);
+if (!profile.isTemporary)
+HeapProfilerAgent.removeProfile(profile.uid);
+},
+
+
+_requestProfilesFromBackend: function(populateCallback)
+{
+HeapProfilerAgent.getProfileHeaders(populateCallback);
+},
+
 __proto__: WebInspector.ProfileType.prototype
 }
 
@@ -7580,11 +8547,6 @@
 return new WebInspector.HeapSnapshotView(profilesPanel, this);
 },
 
-snapshotProxy: function()
-{
-return this._snapshotProxy;
-},
-
 
 load: function(callback)
 {
@@ -7600,12 +8562,27 @@
 this._setupWorker();
 this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
 this.sidebarElement.wait = true;
-ProfilerAgent.getProfile(this.profileType().id, this.uid);
+this.startSnapshotTransfer();
 }
 var loaderProxy =   (this._receiver);
 loaderProxy.addConsumer(callback);
 },
 
+startSnapshotTransfer: function()
+{
+HeapProfilerAgent.getHeapSnapshot(this.uid);
+},
+
+snapshotConstructorName: function()
+{
+return "JSHeapSnapshot";
+},
+
+snapshotProxyConstructor: function()
+{
+return WebInspector.HeapSnapshotProxy;
+},
+
 _setupWorker: function()
 {
 function setProfileWait(event)
@@ -7614,11 +8591,12 @@
 }
 var worker = new WebInspector.HeapSnapshotWorker();
 worker.addEventListener("wait", setProfileWait, this);
-var loaderProxy = worker.createObject("WebInspector.HeapSnapshotLoader");
+var loaderProxy = worker.createLoader(this.snapshotConstructorName(), this.snapshotProxyConstructor());
 loaderProxy.addConsumer(this._snapshotReceived.bind(this));
 this._receiver = loaderProxy;
 },
 
+
 dispose: function()
 {
 if (this._receiver)
@@ -7630,7 +8608,7 @@
 
 _updateTransferProgress: function(value, maxValue)
 {
-var percentValue = ((maxValue ? (value / maxValue) : 0) * 100).toFixed(2);
+var percentValue = ((maxValue ? (value / maxValue) : 0) * 100).toFixed(0);
 if (this._savingToFile)
 this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", percentValue);
 else
@@ -7695,20 +8673,14 @@
 this._receiver = fileOutputStream;
 this._savedChunks = 0;
 this._updateTransferProgress(0, this._totalNumberOfChunks);
-ProfilerAgent.getProfile(this.profileType().id, this.uid);
+HeapProfilerAgent.getHeapSnapshot(this.uid);
 }
 this._savingToFile = true;
-this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot";
+this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + this._profileType.fileExtension();
 fileOutputStream.open(this._fileName, onOpen.bind(this));
 },
 
 
-canLoadFromFile: function()
-{
-return false;
-},
-
-
 loadFromFile: function(file)
 {
 this.title = file.name;
@@ -7868,6 +8840,38 @@
 return new WebInspector.JSHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
 },
 
+classNodesFilter: function()
+{
+function filter(node)
+{
+return node.isUserObject();
+}
+return filter;
+},
+
+containmentEdgesFilter: function(showHiddenData)
+{
+function filter(edge) {
+if (edge.isInvisible())
+return false;
+if (showHiddenData)
+return true;
+return !edge.isHidden() && !edge.node().isHidden();
+}
+return filter;
+},
+
+retainingEdgesFilter: function(showHiddenData)
+{
+var containmentEdgesFilter = this.containmentEdgesFilter(showHiddenData);
+function filter(edge) {
+if (!containmentEdgesFilter(edge))
+return false;
+return edge.node().id() !== 1 && !edge.node().isSynthetic() && !edge.isWeak();
+}
+return filter;
+},
+
 dispose: function()
 {
 WebInspector.HeapSnapshot.prototype.dispose.call(this);
@@ -7909,9 +8913,13 @@
 this._markPageOwnedNodes();
 },
 
-canHaveDistanceOne: function(node)
+distanceForUserRoot: function(node)
 {
-return node.isWindow();
+if (node.isWindow())
+return 1;
+if (node.isDocumentDOMTreesRoot())
+return 0;
+return -1;
 },
 
 userObjectsMapAndFlag: function()
@@ -7933,7 +8941,7 @@
 var detachedDOMTreesRoot;
 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (node.isDetachedDOMTreesRoot()) {
+if (node.name() === "(Detached DOM trees)") {
 detachedDOMTreesRoot = node;
 break;
 }
@@ -7942,9 +8950,10 @@
 if (!detachedDOMTreesRoot)
 return;
 
+var detachedDOMTreeRE = /^Detached DOM tree/;
 for (var iter = detachedDOMTreesRoot.edges(); iter.hasNext(); iter.next()) {
 var node = iter.edge.node();
-if (node.isDetachedDOMTree()) {
+if (detachedDOMTreeRE.test(node.className())) {
 for (var edgesIter = node.edges(); edgesIter.hasNext(); edgesIter.next())
 this._flags[edgesIter.edge.node().nodeIndex / this._nodeFieldCount] |= flag;
 }
@@ -8001,6 +9010,7 @@
 _markPageOwnedNodes: function()
 {
 var edgeShortcutType = this._edgeShortcutType;
+var edgeElementType = this._edgeElementType;
 var edgeToNodeOffset = this._edgeToNodeOffset;
 var edgeTypeOffset = this._edgeTypeOffset;
 var edgeFieldsCount = this._edgeFieldsCount;
@@ -8022,15 +9032,22 @@
 var nodesToVisitLength = 0;
 
 var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount;
+var node = this.rootNode();
 for (var edgeIndex = firstEdgeIndexes[rootNodeOrdinal], endEdgeIndex = firstEdgeIndexes[rootNodeOrdinal + 1];
 edgeIndex < endEdgeIndex;
 edgeIndex += edgeFieldsCount) {
-if (containmentEdges[edgeIndex + edgeTypeOffset] === edgeShortcutType) {
-var nodeOrdinal = containmentEdges[edgeIndex + edgeToNodeOffset] / nodeFieldCount;
+var edgeType = containmentEdges[edgeIndex + edgeTypeOffset];
+var nodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset];
+if (edgeType === edgeElementType) {
+node.nodeIndex = nodeIndex;
+if (!node.isDocumentDOMTreesRoot())
+continue;
+} else if (edgeType !== edgeShortcutType)
+continue;
+var nodeOrdinal = nodeIndex / nodeFieldCount;
 nodesToVisit[nodesToVisitLength++] = nodeOrdinal;
 flags[nodeOrdinal] |= visitedMarker;
 }
-}
 
 while (nodesToVisitLength) {
 var nodeOrdinal = nodesToVisit[--nodesToVisitLength];
@@ -8079,12 +9096,12 @@
 var type = this.type();
 switch (type) {
 case "hidden":
-return WebInspector.UIString("(system)");
+return "(system)";
 case "object":
 case "native":
 return this.name();
 case "code":
-return WebInspector.UIString("(compiled code)");
+return "(compiled code)";
 default:
 return "(" + type + ")";
 }
@@ -8122,15 +9139,9 @@
 return windowRE.test(this.name());
 },
 
-isDetachedDOMTreesRoot: function()
+isDocumentDOMTreesRoot: function()
 {
-return this.name() === "(Detached DOM trees)";
-},
-
-isDetachedDOMTree: function()
-{
-const detachedDOMTreeRE = /^Detached DOM tree/;
-return detachedDOMTreeRE.test(this.className());
+return this.isSynthetic() && this.name() === "(Document DOM trees)";
 },
 
 serialize: function()
@@ -8262,9 +9273,237 @@
 return new WebInspector.JSHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
 },
 
-isElement: function()
+isHidden: function()
 {
-return this._edge().isElement();
+return this._edge().isHidden();
+},
+
+isInternal: function()
+{
+return this._edge().isInternal();
+},
+
+isInvisible: function()
+{
+return this._edge().isInvisible();
+},
+
+isShortcut: function()
+{
+return this._edge().isShortcut();
+},
+
+isWeak: function()
+{
+return this._edge().isWeak();
+},
+
+__proto__: WebInspector.HeapSnapshotRetainerEdge.prototype
+}
+
+;
+
+
+
+WebInspector.NativeHeapSnapshot = function(profile)
+{
+WebInspector.HeapSnapshot.call(this, profile);
+this._nodeObjectType = this._metaNode.type_strings["object"];
+this._edgeWeakType = this._metaNode.type_strings["weak"];
+this._edgeElementType = this._metaNode.type_strings["property"];
+}
+
+WebInspector.NativeHeapSnapshot.prototype = {
+createNode: function(nodeIndex)
+{
+return new WebInspector.NativeHeapSnapshotNode(this, nodeIndex);
+},
+
+createEdge: function(edges, edgeIndex)
+{
+return new WebInspector.NativeHeapSnapshotEdge(this, edges, edgeIndex);
+},
+
+createRetainingEdge: function(retainedNodeIndex, retainerIndex)
+{
+return new WebInspector.NativeHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
+},
+
+_markInvisibleEdges: function()
+{
+},
+
+_calculateFlags: function()
+{
+},
+
+userObjectsMapAndFlag: function()
+{
+return null;
+},
+
+images: function()
+{
+var aggregatesByClassName = this.aggregates(false, "allObjects");
+var result = [];
+var cachedImages = aggregatesByClassName["WebCore::CachedImage"];
+function getImageName(node)
+{
+return node.name();
+}
+this._addNodes(cachedImages, getImageName, result);
+
+var canvases = aggregatesByClassName["WebCore::HTMLCanvasElement"];
+function getCanvasName(node)
+{
+return "HTMLCanvasElement";
+}
+this._addNodes(canvases, getCanvasName, result);
+return result;
+},
+
+_addNodes: function(classData, nameResolver, result)
+{
+if (!classData)
+return;
+var node = this.rootNode();
+for (var i = 0; i < classData.idxs.length; i++) {
+node.nodeIndex = classData.idxs[i];
+result.push({
+name: nameResolver(node),
+size: node.retainedSize(),
+});
+}
+},
+
+__proto__: WebInspector.HeapSnapshot.prototype
+};
+
+
+WebInspector.NativeHeapSnapshotNode = function(snapshot, nodeIndex)
+{
+WebInspector.HeapSnapshotNode.call(this, snapshot, nodeIndex)
+}
+
+WebInspector.NativeHeapSnapshotNode.prototype = {
+className: function()
+{
+return this._snapshot._strings[this.classIndex()];
+},
+
+classIndex: function()
+{
+return this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeTypeOffset];
+},
+
+id: function()
+{
+return this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeIdOffset];
+},
+
+name: function()
+{
+return this._snapshot._strings[this._snapshot._nodes[this.nodeIndex + this._snapshot._nodeNameOffset]];;
+},
+
+serialize: function()
+{
+return {
+id: this.id(),
+name: this.className(),
+displayName: this.name(),
+distance: this.distance(),
+nodeIndex: this.nodeIndex,
+retainedSize: this.retainedSize(),
+selfSize: this.selfSize(),
+type: this._snapshot._nodeObjectType
+};
+},
+
+isHidden: function()
+{
+return false;
+},
+
+isSynthetic: function()
+{
+return false;
+},
+
+__proto__: WebInspector.HeapSnapshotNode.prototype
+};
+
+
+WebInspector.NativeHeapSnapshotEdge = function(snapshot, edges, edgeIndex)
+{
+WebInspector.HeapSnapshotEdge.call(this, snapshot, edges, edgeIndex);
+}
+
+WebInspector.NativeHeapSnapshotEdge.prototype = {
+clone: function()
+{
+return new WebInspector.NativeHeapSnapshotEdge(this._snapshot, this._edges, this.edgeIndex);
+},
+
+hasStringName: function()
+{
+return true;
+},
+
+isHidden: function()
+{
+return false;
+},
+
+isWeak: function()
+{
+return false;
+},
+
+isInternal: function()
+{
+return false;
+},
+
+isInvisible: function()
+{
+return false;
+},
+
+isShortcut: function()
+{
+return false;
+},
+
+name: function()
+{
+return this._snapshot._strings[this._nameOrIndex()];
+},
+
+toString: function()
+{
+return  "NativeHeapSnapshotEdge: " + this.name();
+},
+
+_nameOrIndex: function()
+{
+return this._edges.item(this.edgeIndex + this._snapshot._edgeNameOffset);
+},
+
+__proto__: WebInspector.HeapSnapshotEdge.prototype
+};
+
+
+
+WebInspector.NativeHeapSnapshotRetainerEdge = function(snapshot, retainedNodeIndex, retainerIndex)
+{
+WebInspector.HeapSnapshotRetainerEdge.call(this, snapshot, retainedNodeIndex, retainerIndex);
+}
+
+WebInspector.NativeHeapSnapshotRetainerEdge.prototype = {
+clone: function()
+{
+return new WebInspector.NativeHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
 },
 
 isHidden: function()
@@ -8299,216 +9538,6 @@
 
 
 
-
-WebInspector.NativeHeapGraph = function(rawGraph)
-{
-this._rawGraph = rawGraph;
-
-this._nodeFieldCount = 5;
-this._nodeTypeOffset = 0;
-this._nodeClassNameOffset = 1;
-this._nodeNameOffset = 2;
-this._nodeSizeOffset = 3;
-this._nodeEdgeCountOffset = 4;
-this._nodeFirstEdgeOffset = this._nodeEdgeCountOffset;
-
-this._edgeFieldCount = 3;
-this._edgeTypeOffset = 0;
-this._edgeNameOffset = 1;
-this._edgeTargetOffset = 2;
-
-this._nodeCount = rawGraph.nodes.length / this._nodeFieldCount;
-this._nodes = rawGraph.nodes;
-this._edges = rawGraph.edges;
-this._strings = rawGraph.strings;
-
-this._rootNodeIndex = this._nodes.length - this._nodeFieldCount;
-this._calculateNodeEdgeIndexes();
-this._addDummyNode();
-}
-
-WebInspector.NativeHeapGraph.prototype = {
-root: function()
-{
-return new WebInspector.NativeHeapGraph.Node(this, this._rootNodeIndex);
-},
-
-_calculateNodeEdgeIndexes: function()
-{
-var nodes = this._nodes;
-var nodeFieldCount = this._nodeFieldCount;
-var nodeLength = nodes.length;
-var firstEdgeIndex = 0;
-for (var i = this._nodeEdgeCountOffset; i < nodeLength; i += nodeFieldCount) {
-var count = nodes[i];
-nodes[i] = firstEdgeIndex;
-firstEdgeIndex += count;
-}
-},
-
-_addDummyNode: function()
-{
-var firstEdgePosition = this._nodes.length + this._nodeFirstEdgeOffset;
-for (var i = 0; i < this._nodeFieldCount; i++)
-this._nodes.push(0);
-this._nodes[firstEdgePosition] = this._edges.length / this._edgeFieldCount;
-}
-}
-
-
-
-WebInspector.NativeHeapGraph.Edge = function(graph, position)
-{
-this._graph = graph;
-this._position = position;
-}
-
-WebInspector.NativeHeapGraph.Edge.prototype = {
-type: function()
-{
-return this._getStringField(this._graph._edgeTypeOffset);
-},
-
-name: function()
-{
-return this._getStringField(this._graph._edgeNameOffset);
-},
-
-target: function()
-{
-var edges = this._graph._edges;
-var targetPosition = edges[this._position + this._graph._edgeTargetOffset];
-return new WebInspector.NativeHeapGraph.Node(this._graph, targetPosition);
-},
-
-_getStringField: function(offset)
-{
-var typeIndex = this._graph._edges[this._position + offset];
-return this._graph._rawGraph.strings[typeIndex];
-},
-
-toString: function()
-{
-return "Edge#" + this._position + " -" + this.name() + "-> " + this.target();
-}
-
-}
-
-
-
-WebInspector.NativeHeapGraph.Node = function(graph, position)
-{
-this._graph = graph;
-this._position = position;
-}
-
-WebInspector.NativeHeapGraph.Node.prototype = {
-id: function()
-{
-return this._position / this._graph._nodeFieldCount;
-},
-
-type: function()
-{
-return this._getStringField(this._graph._nodeTypeOffset);
-},
-
-size: function()
-{
-return this._graph._nodes[this._position + this._graph._nodeSizeOffset];
-},
-
-className: function()
-{
-return this._getStringField(this._graph._nodeClassNameOffset);
-},
-
-name: function()
-{
-return this._getStringField(this._graph._nodeNameOffset);
-},
-
-hasReferencedNodes: function()
-{
-return this._afterLastEdgePosition() > this._firstEdgePoistion();
-},
-
-referencedNodes: function()
-{
-var edges = this._graph._edges;
-var nodes = this._graph._nodes;
-var edgeFieldCount = this._graph._edgeFieldCount;
-var nodeFieldCount = this._graph._nodeFieldCount;
-
-var firstEdgePosition = this._firstEdgePoistion();
-var afterLastEdgePosition = this._afterLastEdgePosition();
-var result = [];
-for (var i = firstEdgePosition + this._graph._edgeTargetOffset; i < afterLastEdgePosition; i += edgeFieldCount)
-result.push(new WebInspector.NativeHeapGraph.Node(this._graph, edges[i]));
-return result;
-},
-
-outgoingEdges: function()
-{
-var edges = this._graph._edges;
-var edgeFieldCount = this._graph._edgeFieldCount;
-
-var firstEdgePosition = this._firstEdgePoistion();
-var afterLastEdgePosition = this._afterLastEdgePosition();
-var result = [];
-for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount)
-result.push(new WebInspector.NativeHeapGraph.Edge(this._graph, i));
-return result;
-},
-
-targetOfEdge: function(edgeName)
-{
-return this.targetsOfAllEdges(edgeName)[0];
-},
-
-targetsOfAllEdges: function(edgeName)
-{
-var edges = this._graph._edges;
-var edgeFieldCount = this._graph._edgeFieldCount;
-
-var firstEdgePosition = this._firstEdgePoistion();
-var afterLastEdgePosition = this._afterLastEdgePosition();
-
-var edge = new WebInspector.NativeHeapGraph.Edge(this._graph, firstEdgePosition)
-var result = [];
-for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount) {
-edge._position = i;
-if (edge.name() === edgeName)
-result.push(edge.target());
-}
-return result;
-},
-
-_firstEdgePoistion: function()
-{
-return this._graph._nodes[this._position + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
-},
-
-_afterLastEdgePosition: function()
-{
-return this._graph._nodes[this._position + this._graph._nodeFieldCount + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
-},
-
-_getStringField: function(offset)
-{
-var typeIndex = this._graph._nodes[this._position + offset];
-return this._graph._rawGraph.strings[typeIndex];
-},
-
-toString: function()
-{
-return "Node#" + this.id() + " " + this.name() + "(" + this.className() + ")";
-}
-}
-;
-
-
-
 WebInspector.NativeMemorySnapshotView = function(profile)
 {
 WebInspector.View.call(this);
@@ -8517,71 +9546,32 @@
 this.element.addStyleClass("native-snapshot-view");
 this._containmentDataGrid = new WebInspector.NativeSnapshotDataGrid(profile);
 this._containmentDataGrid.show(this.element);
-
-this._heapGraphDataGrid = new WebInspector.NativeHeapGraphDataGrid(profile._graph);
-
-this._viewSelectElement = document.createElement("select");
-this._viewSelectElement.className = "status-bar-item";
-this._viewSelectElement.addEventListener("change", this._onSelectedViewChanged.bind(this), false);
-
-this._views = [{title: "Aggregated", view: this._containmentDataGrid},
-{title: "Graph", view: this._heapGraphDataGrid}];
-this._currentViewIndex = 0;
-for (var i = 0; i < this._views.length; ++i) {
-var view = this._views[i];
-var option = document.createElement("option");
-option.label = WebInspector.UIString(view.title);
-this._viewSelectElement.appendChild(option);
-}
 }
 
 WebInspector.NativeMemorySnapshotView.prototype = {
-_onSelectedViewChanged: function(event)
-{
-var index = event.target.selectedIndex;
-if (index === this._currentViewIndex)
-return;
-
-var currentView = this._views[this._currentViewIndex].view;
-currentView.detach();
-
-this._currentViewIndex = index;
-var selectedView = this._views[index].view;
-selectedView.show(this.element);
-},
-
-get statusBarItems()
-{
-var span = document.createElement("span");
-span.className = "status-bar-select-container";
-span.appendChild(this._viewSelectElement);
-return [span];
-},
-
 __proto__: WebInspector.View.prototype
 }
 
 
 
-
 WebInspector.NativeSnapshotDataGrid = function(profile)
 {
-var columns = {
-name: { title: WebInspector.UIString("Object"), width: "200px", disclosure: true, sortable: true },
-size: { title: WebInspector.UIString("Size"), sortable: true, sort: "descending" },
-};
+var columns = [
+{id: "name", title: WebInspector.UIString("Object"), width: "200px", disclosure: true, sortable: true},
+{id: "size", title: WebInspector.UIString("Size"), sortable: true, sort: WebInspector.DataGrid.Order.Descending},
+];
 WebInspector.DataGrid.call(this, columns);
 this._profile = profile;
-this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile._memoryBlock);
+this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile);
 if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get()) {
 this.setRootNode(new WebInspector.DataGridNode(null, true));
 this.rootNode().appendChild(this._totalNode)
 this._totalNode.expand();
 } else {
 this.setRootNode(this._totalNode);
-this._totalNode._populate();
+this._totalNode.populate();
 }
-this.addEventListener("sorting changed", this.sortingChanged.bind(this), this);
+this.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this.sortingChanged.bind(this), this);
 }
 
 WebInspector.NativeSnapshotDataGrid.prototype = {
@@ -8590,7 +9580,8 @@
 var expandedNodes = {};
 this._totalNode._storeState(expandedNodes);
 this._totalNode.removeChildren();
-this._totalNode._populate();
+this._totalNode._populated = false;
+this._totalNode.populate();
 this._totalNode._shouldRefreshChildren = true;
 this._totalNode._restoreState(expandedNodes);
 },
@@ -8598,8 +9589,8 @@
 
 _sortingFunction: function(nodeA, nodeB)
 {
-var sortColumnIdentifier = this.sortColumnIdentifier;
-var sortAscending = this.sortOrder === "ascending";
+var sortColumnIdentifier = this.sortColumnIdentifier();
+var sortAscending = this.isSortOrderAscending();
 var field1 = nodeA[sortColumnIdentifier];
 var field2 = nodeB[sortColumnIdentifier];
 var result = field1 < field2 ? -1 : (field1 > field2 ? 1 : 0);
@@ -8612,15 +9603,14 @@
 }
 
 
-WebInspector.NativeSnapshotNode = function(nodeData, rootMemoryBlock)
+WebInspector.NativeSnapshotNode = function(nodeData, profile)
 {
 this._nodeData = nodeData;
-this._rootMemoryBlock = rootMemoryBlock;
+this._profile = profile;
 var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(nodeData);
 var data = { name: viewProperties._description, size: this._nodeData.size };
-var hasChildren = !!nodeData.children && nodeData.children.length !== 0;
+var hasChildren = this._addChildrenFromGraph();
 WebInspector.DataGridNode.call(this, data, hasChildren);
-this.addEventListener("populate", this._populate, this);
 }
 
 WebInspector.NativeSnapshotNode.prototype = {
@@ -8675,7 +9665,7 @@
 }
 
 var sizeKB = this._nodeData.size / 1024;
-var totalSize = this._rootMemoryBlock.size;
+var totalSize = this._profile._memoryBlock.size;
 var percentage = this._nodeData.size / totalSize  * 100;
 
 var cell = document.createElement("td");
@@ -8708,65 +9698,52 @@
 return cell;
 },
 
-_populate: function() {
-this.removeEventListener("populate", this._populate, this);
+populate: function() {
+if (this._populated)
+return;
+this._populated = true;
+if (this._nodeData.children)
+this._addChildren();
+},
+
+_addChildren: function()
+{
 this._nodeData.children.sort(this.dataGrid._sortingFunction.bind(this.dataGrid));
 
 for (var node in this._nodeData.children) {
 var nodeData = this._nodeData.children[node];
-this._addChildrenFromGraph(nodeData);
 if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other")
-this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._rootMemoryBlock));
+this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._profile));
 }
 },
 
-
-_addChildrenFromGraph: function(memoryBlock)
+_addChildrenFromGraph: function()
 {
+var memoryBlock = this._nodeData;
 if (memoryBlock.children)
-return;
-if (memoryBlock.name !== "Image" || this._nodeData.name !== "MemoryCache")
-return;
+return memoryBlock.children.length > 0;
+if (memoryBlock.name === "Image") {
+this._addImageDetails();
+return true;
+}
+return false;
+},
 
+_addImageDetails: function()
+{
 
-var graph = this.dataGrid._profile._graph;
-var roots = graph.root().referencedNodes();
-var memoryCache;
-for (var i = 0; i < roots.length; i++) {
-var root = roots[i];
-if (root.className() === "MemoryCache") {
-memoryCache = root;
-break;
+function didLoad(proxy)
+{
+function didReceiveImages(result)
+{
+this._nodeData.children = result;
+if (this.expanded)
+this._addChildren();
 }
+proxy.images(didReceiveImages.bind(this));
+
 }
-var edges = memoryCache.outgoingEdges();
-var cachedImages = [];
-for (var i = 0; i < edges.length; i++) {
-var target = edges[i].target();
-if (target.className() === "CachedImage") {
-var cachedImage = {
-name: target.name(),
-size: target.size(),
-children: []
-};
-cachedImages.push(cachedImage);
-var image = target.targetOfEdge("m_image");
-if (image.className() === "BitmapImage") {
-var frames = image.targetsOfAllEdges("m_frame");
-for (var j = 0; j < frames.length; j++) {
-var pixels = frames[j].targetOfEdge("pixels");
-if (pixels) {
-cachedImage.size += pixels.size();
-cachedImage.children.push({
-name: "Bitmap pixels",
-size: pixels.size()
-});
-}
-}
-}
-}
-}
-memoryBlock.children = cachedImages;
+this._profile.load(didLoad.bind(this));
 },
 
 __proto__: WebInspector.DataGridNode.prototype
@@ -8774,122 +9751,247 @@
 
 
 
-WebInspector.NativeHeapGraphDataGrid = function(nativeHeapGraph)
+WebInspector.MemoryAgentDispatcher = function()
 {
-var columns = {
-id: { title: WebInspector.UIString("id"), width: "80px", disclosure: true, sortable: true },
-type: { title: WebInspector.UIString("Type"), width: "200px", sortable: true },
-className: { title: WebInspector.UIString("Class name"), width: "200px", sortable: true },
-name: { title: WebInspector.UIString("Name"), width: "200px", sortable: true },
-size: { title: WebInspector.UIString("Size"), sortable: true, sort: "descending" },
-};
-WebInspector.DataGrid.call(this, columns);
-this._nativeHeapGraph = nativeHeapGraph;
-this._root = new WebInspector.NativeHeapGraphDataGridRoot(this._nativeHeapGraph);
-this.setRootNode(this._root);
-this._root._populate();
+InspectorBackend.registerMemoryDispatcher(this);
+this._currentProfileHeader = null;
 }
 
-WebInspector.NativeHeapGraphDataGrid.prototype = {
-__proto__: WebInspector.DataGrid.prototype
-}
-
-
-
-WebInspector.NativeHeapGraphDataGridRoot = function(graph)
+WebInspector.MemoryAgentDispatcher.instance = function()
 {
-WebInspector.DataGridNode.call(this, { id: "root" }, true);
-this._graph = graph;
-this.addEventListener("populate", this._populate, this);
+if (!WebInspector.MemoryAgentDispatcher._instance)
+WebInspector.MemoryAgentDispatcher._instance = new WebInspector.MemoryAgentDispatcher();
+return WebInspector.MemoryAgentDispatcher._instance;
 }
 
-WebInspector.NativeHeapGraphDataGridRoot.prototype = {
-_populate: function() {
-this.removeEventListener("populate", this._populate, this);
-var roots = this._graph.root().referencedNodes();
-for (var i = 0; i < roots.length; i++)
-this.appendChild(new WebInspector.NativeHeapGraphDataGridNode(roots[i]));
+WebInspector.MemoryAgentDispatcher.prototype = {
+
+addNativeSnapshotChunk: function(chunk)
+{
+if (this._currentProfileHeader)
+this._currentProfileHeader.addNativeSnapshotChunk(chunk);
 },
 
-__proto__: WebInspector.DataGridNode.prototype
-}
-
-
-
-WebInspector.NativeHeapGraphDataGridNode = function(node)
+_onRemoveProfileHeader: function(event)
 {
-var data = {
-id: node.id(),
-size: node.size(),
-type: node.type(),
-className: node.className(),
-name: node.name(),
+if (event.data === this._currentProfileHeader)
+this._currentProfileHeader = null;
+}
 };
-WebInspector.DataGridNode.call(this, data, node.hasReferencedNodes());
-this._node = node;
-this.addEventListener("populate", this._populate, this);
+
+
+
+WebInspector.NativeProfileTypeBase = function(profileHeaderConstructor, id, name)
+{
+WebInspector.ProfileType.call(this, id, name);
+this._profileHeaderConstructor = profileHeaderConstructor;
+this._nextProfileUid = 1;
+this.addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader,
+WebInspector.MemoryAgentDispatcher.prototype._onRemoveProfileHeader,
+WebInspector.MemoryAgentDispatcher.instance());
 }
 
-WebInspector.NativeHeapGraphDataGridNode.prototype = {
-_populate: function() {
-this.removeEventListener("populate", this._populate, this);
-var children = this._node.referencedNodes();
-for (var i = 0; i < children.length; i++)
-this.appendChild(new WebInspector.NativeHeapGraphDataGridNode(children[i]));
+WebInspector.NativeProfileTypeBase.prototype = {
+
+isInstantProfile: function()
+{
+return true;
 },
 
-__proto__: WebInspector.DataGridNode.prototype
+
+buttonClicked: function()
+{
+if (WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader)
+return false;
+
+var profileHeader = new this._profileHeaderConstructor(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid);
+++this._nextProfileUid;
+profileHeader.isTemporary = true;
+this.addProfile(profileHeader);
+WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader = profileHeader;
+profileHeader.load(function() { });
+
+
+
+function didReceiveMemorySnapshot(error, memoryBlock, graphMetaInformation)
+{
+console.assert(this === WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader);
+WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader = null;
+this._didReceiveMemorySnapshot(error, memoryBlock, graphMetaInformation);
 }
+MemoryAgent.getProcessMemoryDistribution(true, didReceiveMemorySnapshot.bind(profileHeader));
+return false;
+},
+
+
+removeProfile: function(profile)
+{
+if (WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader === profile)
+WebInspector.MemoryAgentDispatcher.instance()._currentProfileHeader = null;
+WebInspector.ProfileType.prototype.removeProfile.call(this, profile);
+},
+
+
+createTemporaryProfile: function(title)
+{
+title = title || WebInspector.UIString("Snapshotting\u2026");
+return new this._profileHeaderConstructor(this, title);
+},
+
+
+createProfile: function(profile)
+{
+return new this._profileHeaderConstructor(this, profile.title, -1);
+},
+
+__proto__: WebInspector.ProfileType.prototype
+}
+
+
+WebInspector.NativeSnapshotProfileType = function()
+{
+WebInspector.NativeProfileTypeBase.call(this, WebInspector.NativeSnapshotProfileHeader,  WebInspector.NativeSnapshotProfileType.TypeId, WebInspector.UIString("Take Native Heap Snapshot"));
+}
+
+WebInspector.NativeSnapshotProfileType.TypeId = "NATIVE_SNAPSHOT";
+
+WebInspector.NativeSnapshotProfileType.prototype = {
+get buttonTooltip()
+{
+return WebInspector.UIString("Capture native heap graph.");
+},
+
+get treeItemTitle()
+{
+return WebInspector.UIString("NATIVE SNAPSHOT");
+},
+
+get description()
+{
+return WebInspector.UIString("Native memory snapshot profiles show native heap graph.");
+},
+
+__proto__: WebInspector.NativeProfileTypeBase.prototype
+}
+
+
+
+WebInspector.NativeSnapshotProfileHeader = function(type, title, uid)
+{
+WebInspector.HeapProfileHeader.call(this, type, title, uid, 0);
+this._strings = [];
+this._nodes = [];
+this._edges = [];
+this._baseToRealNodeId = [];
+}
+
+WebInspector.NativeSnapshotProfileHeader.prototype = {
+
+createView: function(profilesPanel)
+{
+return new WebInspector.NativeHeapSnapshotView(profilesPanel, this);
+},
+
+startSnapshotTransfer: function()
+{
+},
+
+snapshotConstructorName: function()
+{
+return "NativeHeapSnapshot";
+},
+
+snapshotProxyConstructor: function()
+{
+return WebInspector.NativeHeapSnapshotProxy;
+},
+
+addNativeSnapshotChunk: function(chunk)
+{
+this._strings = this._strings.concat(chunk.strings);
+this._nodes = this._nodes.concat(chunk.nodes);
+this._edges = this._edges.concat(chunk.edges);
+this._baseToRealNodeId = this._baseToRealNodeId.concat(chunk.baseToRealNodeId);
+},
+
+
+_didReceiveMemorySnapshot: function(error, memoryBlock, graphMetaInformation)
+{
+var metaInformation =   (graphMetaInformation);
+this.isTemporary = false;
+
+var edgeFieldCount = metaInformation.edge_fields.length;
+var nodeFieldCount = metaInformation.node_fields.length;
+var nodeIdFieldOffset = metaInformation.node_fields.indexOf("id");
+var toNodeIdFieldOffset = metaInformation.edge_fields.indexOf("to_node");
+
+var baseToRealNodeIdMap = {};
+for (var i = 0; i < this._baseToRealNodeId.length; i += 2)
+baseToRealNodeIdMap[this._baseToRealNodeId[i]] = this._baseToRealNodeId[i + 1];
+
+var nodeId2NodeIndex = {};
+for (var i = nodeIdFieldOffset; i < this._nodes.length; i += nodeFieldCount)
+nodeId2NodeIndex[this._nodes[i]] = i - nodeIdFieldOffset;
+
+
+var edges = this._edges;
+for (var i = toNodeIdFieldOffset; i < edges.length; i += edgeFieldCount) {
+if (edges[i] in baseToRealNodeIdMap)
+edges[i] = baseToRealNodeIdMap[edges[i]];
+edges[i] = nodeId2NodeIndex[edges[i]];
+}
+
+var heapSnapshot = {
+"snapshot": {
+"meta": metaInformation,
+node_count: this._nodes.length / nodeFieldCount,
+edge_count: this._edges.length / edgeFieldCount,
+root_index: this._nodes.length - nodeFieldCount
+},
+nodes: this._nodes,
+edges: this._edges,
+strings: this._strings
+};
+
+var chunk = JSON.stringify(heapSnapshot);
+this.transferChunk(chunk);
+this.finishHeapSnapshot();
+},
+
+__proto__: WebInspector.HeapProfileHeader.prototype
+}
+
+
+
+WebInspector.NativeHeapSnapshotView = function(parent, profile)
+{
+this._profile = profile;
+WebInspector.HeapSnapshotView.call(this, parent, profile);
+}
+
+
+WebInspector.NativeHeapSnapshotView.prototype = {
+get profile()
+{
+return this._profile;
+},
+
+__proto__: WebInspector.HeapSnapshotView.prototype
+};
 
 
 
 WebInspector.NativeMemoryProfileType = function()
 {
-WebInspector.ProfileType.call(this, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Take Native Memory Snapshot"));
-this._nextProfileUid = 1;
+WebInspector.NativeProfileTypeBase.call(this, WebInspector.NativeMemoryProfileHeader, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Capture Native Memory Distribution"));
 }
 
-WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY";
+WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY_DISTRIBUTION";
 
 WebInspector.NativeMemoryProfileType.prototype = {
 get buttonTooltip()
 {
-return WebInspector.UIString("Take native memory snapshot.");
-},
-
-
-buttonClicked: function(profilesPanel)
-{
-var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid);
-++this._nextProfileUid;
-profileHeader.isTemporary = true;
-profilesPanel.addProfileHeader(profileHeader);
-
-function didReceiveMemorySnapshot(error, memoryBlock, graph)
-{
-if (memoryBlock.size && memoryBlock.children) {
-var knownSize = 0;
-for (var i = 0; i < memoryBlock.children.length; i++) {
-var size = memoryBlock.children[i].size;
-if (size)
-knownSize += size;
-}
-var otherSize = memoryBlock.size - knownSize;
-
-if (otherSize) {
-memoryBlock.children.push({
-name: "Other",
-size: otherSize
-});
-}
-}
-profileHeader._memoryBlock = memoryBlock;
-profileHeader._graph = new WebInspector.NativeHeapGraph(graph);
-profileHeader.isTemporary = false;
-profileHeader.sidebarElement.subtitle = Number.bytesToString( (memoryBlock.size));
-}
-MemoryAgent.getProcessMemoryDistribution(true, didReceiveMemorySnapshot.bind(this));
-return false;
+return WebInspector.UIString("Capture native memory distribution.");
 },
 
 get treeItemTitle()
@@ -8899,29 +10001,16 @@
 
 get description()
 {
-return WebInspector.UIString("Native memory snapshot profiles show memory distribution among browser subsystems");
+return WebInspector.UIString("Native memory snapshot profiles show memory distribution among browser subsystems.");
 },
 
-
-createTemporaryProfile: function(title)
-{
-title = title || WebInspector.UIString("Snapshotting\u2026");
-return new WebInspector.NativeMemoryProfileHeader(this, title);
-},
-
-
-createProfile: function(profile)
-{
-return new WebInspector.NativeMemoryProfileHeader(this, profile.title, -1);
-},
-
-__proto__: WebInspector.ProfileType.prototype
+__proto__: WebInspector.NativeProfileTypeBase.prototype
 }
 
 
 WebInspector.NativeMemoryProfileHeader = function(type, title, uid)
 {
-WebInspector.ProfileHeader.call(this, type, title, uid);
+WebInspector.NativeSnapshotProfileHeader.call(this, type, title, uid);
 
 
 this._memoryBlock = null;
@@ -8940,7 +10029,37 @@
 return new WebInspector.NativeMemorySnapshotView(this);
 },
 
-__proto__: WebInspector.ProfileHeader.prototype
+
+_updateSnapshotStatus: function()
+{
+WebInspector.NativeSnapshotProfileHeader.prototype._updateSnapshotStatus.call(this);
+this.sidebarElement.subtitle = Number.bytesToString(  (this._memoryBlock.size));
+},
+
+
+_didReceiveMemorySnapshot: function(error, memoryBlock, graphMetaInformation)
+{
+WebInspector.NativeSnapshotProfileHeader.prototype._didReceiveMemorySnapshot.call(this, error, memoryBlock, graphMetaInformation);
+if (memoryBlock.size && memoryBlock.children) {
+var knownSize = 0;
+for (var i = 0; i < memoryBlock.children.length; i++) {
+var size = memoryBlock.children[i].size;
+if (size)
+knownSize += size;
+}
+var otherSize = memoryBlock.size - knownSize;
+
+if (otherSize) {
+memoryBlock.children.push({
+name: "Other",
+size: otherSize
+});
+}
+}
+this._memoryBlock = memoryBlock;
+},
+
+__proto__: WebInspector.NativeSnapshotProfileHeader.prototype
 }
 
 
@@ -8966,13 +10085,13 @@
 addBlock("hsl(  0,  0%,  60%)", "ProcessPrivateMemory", "Total");
 addBlock("hsl(  0,  0%,  80%)", "OwnersTypePlaceholder", "OwnersTypePlaceholder");
 addBlock("hsl(  0,  0%,  60%)", "Other", "Other");
-addBlock("hsl(220, 80%,  70%)", "Page", "Page structures");
+addBlock("hsl(220, 80%,  70%)", "Image", "Images");
 addBlock("hsl(100, 60%,  50%)", "JSHeap", "JavaScript heap");
 addBlock("hsl( 90, 40%,  80%)", "JSExternalResources", "JavaScript external resources");
-addBlock("hsl( 90, 60%,  80%)", "JSExternalArrays", "JavaScript external arrays");
-addBlock("hsl( 90, 60%,  80%)", "JSExternalStrings", "JavaScript external strings");
+addBlock("hsl( 90, 60%,  80%)", "CSS", "CSS");
+addBlock("hsl(  0, 50%,  60%)", "DOM", "DOM");
 addBlock("hsl(  0, 80%,  60%)", "WebInspector", "Inspector data");
-addBlock("hsl( 36, 90%,  50%)", "MemoryCache", "Memory cache resources");
+addBlock("hsl( 36, 90%,  50%)", "Resources", "Resources");
 addBlock("hsl( 40, 80%,  80%)", "GlyphCache", "Glyph cache resources");
 addBlock("hsl( 35, 80%,  80%)", "DOMStorageCache", "DOM storage cache");
 addBlock("hsl( 60, 80%,  60%)", "RenderTree", "Render tree");
@@ -8988,125 +10107,6 @@
 return new WebInspector.MemoryBlockViewProperties("inherit", memoryBlock.name, memoryBlock.name);
 }
 
-
-
-WebInspector.NativeMemoryBarChart = function()
-{
-WebInspector.View.call(this);
-this.registerRequiredCSS("nativeMemoryProfiler.css");
-this._memorySnapshot = null;
-this.element = document.createElement("div");
-this._table = this.element.createChild("table");
-this._divs = {};
-var row = this._table.insertRow();
-this._totalDiv = row.insertCell().createChild("div");
-this._totalDiv.addStyleClass("memory-bar-chart-total");
-row.insertCell();
-}
-
-WebInspector.NativeMemoryBarChart.prototype = {
-_updateStats: function()
-{
-
-
-function didReceiveMemorySnapshot(error, memoryBlock, graph)
-{
-if (memoryBlock.size && memoryBlock.children) {
-var knownSize = 0;
-for (var i = 0; i < memoryBlock.children.length; i++) {
-var size = memoryBlock.children[i].size;
-if (size)
-knownSize += size;
-}
-var otherSize = memoryBlock.size - knownSize;
-
-if (otherSize) {
-memoryBlock.children.push({
-name: "Other",
-size: otherSize
-});
-}
-}
-this._memorySnapshot = memoryBlock;
-this._updateView();
-}
-MemoryAgent.getProcessMemoryDistribution(false, didReceiveMemorySnapshot.bind(this));
-},
-
-
-willHide: function()
-{
-clearInterval(this._timerId);
-},
-
-
-wasShown: function()
-{
-this._timerId = setInterval(this._updateStats.bind(this), 1000);
-},
-
-_updateView: function()
-{
-var memoryBlock = this._memorySnapshot;
-if (!memoryBlock)
-return;
-
-var MB = 1024 * 1024;
-var maxSize = 100 * MB;
-for (var i = 0; i < memoryBlock.children.length; ++i)
-maxSize = Math.max(maxSize, memoryBlock.children[i].size);
-var maxBarLength = 500;
-var barLengthSizeRatio = maxBarLength / maxSize;
-
-for (var i = memoryBlock.children.length - 1; i >= 0 ; --i) {
-var child = memoryBlock.children[i];
-var name = child.name;
-var divs = this._divs[name];
-if (!divs) {
-var row = this._table.insertRow();
-var nameDiv = row.insertCell(-1).createChild("div");
-var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
-var title = viewProperties._description;
-nameDiv.textContent = title;
-nameDiv.addStyleClass("memory-bar-chart-name");
-var barCell = row.insertCell(-1);
-var barDiv = barCell.createChild("div");
-barDiv.addStyleClass("memory-bar-chart-bar");
-viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
-barDiv.style.backgroundColor = viewProperties._fillStyle;
-var unusedDiv = barDiv.createChild("div");
-unusedDiv.addStyleClass("memory-bar-chart-unused");
-var percentDiv = barDiv.createChild("div");
-percentDiv.addStyleClass("memory-bar-chart-percent");
-var sizeDiv = barCell.createChild("div");
-sizeDiv.addStyleClass("memory-bar-chart-size");
-divs = this._divs[name] = { barDiv: barDiv, unusedDiv: unusedDiv, percentDiv: percentDiv, sizeDiv: sizeDiv };
-}
-var unusedSize = 0;
-if (!!child.children) {
-var unusedName = name + ".Unused";
-for (var j = 0; j < child.children.length; ++j) {
-if (child.children[j].name === unusedName) {
-unusedSize = child.children[j].size;
-break;
-}
-}
-}
-var unusedLength = unusedSize * barLengthSizeRatio;
-var barLength = child.size * barLengthSizeRatio;
-
-divs.barDiv.style.width = barLength + "px";
-divs.unusedDiv.style.width = unusedLength + "px";
-divs.percentDiv.textContent = barLength > 20 ? (child.size / memoryBlock.size * 100).toFixed(0) + "%" : "";
-divs.sizeDiv.textContent = (child.size / MB).toFixed(1) + "\u2009MB";
-}
-
-var memoryBlockViewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(memoryBlock);
-this._totalDiv.textContent = memoryBlockViewProperties._description + ": " + (memoryBlock.size / MB).toFixed(1) + "\u2009MB";
-},
-
-__proto__: WebInspector.View.prototype
-}
 ;
 
 
@@ -9116,56 +10116,27 @@
 WebInspector.View.call(this);
 
 this._panel = profilesPanel;
-this._profileRunning = false;
 
 this.element.addStyleClass("profile-launcher-view");
 this.element.addStyleClass("panel-enabler-view");
 
-this._contentElement = document.createElement("div");
-this._contentElement.className = "profile-launcher-view-content";
-this.element.appendChild(this._contentElement);
-
-var header = this._contentElement.createChild("h1");
-header.textContent = WebInspector.UIString("Select profiling type");
-
-this._profileTypeSelectorForm = this._contentElement.createChild("form");
-
-if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
-this._nativeMemoryElement = document.createElement("div");
-this._contentElement.appendChild(this._nativeMemoryElement);
-this._nativeMemoryLiveChart = new WebInspector.NativeMemoryBarChart();
-this._nativeMemoryLiveChart.show(this._nativeMemoryElement);
-}
-
-this._contentElement.createChild("div", "flexible-space");
+this._contentElement = this.element.createChild("div", "profile-launcher-view-content");
+this._innerContentElement = this._contentElement.createChild("div");
 
 this._controlButton = this._contentElement.createChild("button", "control-profiling");
 this._controlButton.addEventListener("click", this._controlButtonClicked.bind(this), false);
-this._updateControls();
-}
-
-WebInspector.ProfileLauncherView.EventTypes = {
-ProfileTypeSelected: "profile-type-selected"
 }
 
 WebInspector.ProfileLauncherView.prototype = {
 
 addProfileType: function(profileType)
 {
-var checked = !this._profileTypeSelectorForm.children.length;
-var labelElement = this._profileTypeSelectorForm.createChild("label");
-labelElement.textContent = profileType.name;
-var optionElement = document.createElement("input");
-labelElement.insertBefore(optionElement, labelElement.firstChild);
-optionElement.type = "radio";
-optionElement.name = "profile-type";
-if (checked) {
-optionElement.checked = checked;
-this.dispatchEventToListeners(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
-}
-optionElement.addEventListener("change", this._profileTypeChanged.bind(this, profileType), false);
-var descriptionElement = labelElement.createChild("p");
+var descriptionElement = this._innerContentElement.createChild("h1");
 descriptionElement.textContent = profileType.description;
+var decorationElement = profileType.decorationElement();
+if (decorationElement)
+this._innerContentElement.appendChild(decorationElement);
+this._isInstantProfile = profileType.isInstantProfile();
 },
 
 _controlButtonClicked: function()
@@ -9175,23 +10146,18 @@
 
 _updateControls: function()
 {
-if (this._isProfiling) {
-this._profileTypeSelectorForm.disabled = true;
+if (this._isInstantProfile) {
+this._controlButton.removeStyleClass("running");
+this._controlButton.textContent = WebInspector.UIString("Take Snapshot");
+} else if (this._isProfiling) {
 this._controlButton.addStyleClass("running");
 this._controlButton.textContent = WebInspector.UIString("Stop");
 } else {
-this._profileTypeSelectorForm.disabled = false;
 this._controlButton.removeStyleClass("running");
 this._controlButton.textContent = WebInspector.UIString("Start");
 }
 },
 
-
-_profileTypeChanged: function(profileType, event)
-{
-this.dispatchEventToListeners(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
-},
-
 profileStarted: function()
 {
 this._isProfiling = true;
@@ -9206,15 +10172,96 @@
 
 __proto__: WebInspector.View.prototype
 }
+
+
+
+WebInspector.MultiProfileLauncherView = function(profilesPanel)
+{
+WebInspector.ProfileLauncherView.call(this, profilesPanel);
+
+var header = this._innerContentElement.createChild("h1");
+header.textContent = WebInspector.UIString("Select profiling type");
+
+this._profileTypeSelectorForm = this._innerContentElement.createChild("form");
+
+this._innerContentElement.createChild("div", "flexible-space");
+}
+
+WebInspector.MultiProfileLauncherView.EventTypes = {
+ProfileTypeSelected: "profile-type-selected"
+}
+
+WebInspector.MultiProfileLauncherView.prototype = {
+
+addProfileType: function(profileType)
+{
+var checked = !this._profileTypeSelectorForm.children.length;
+var labelElement = this._profileTypeSelectorForm.createChild("label");
+labelElement.textContent = profileType.name;
+var optionElement = document.createElement("input");
+labelElement.insertBefore(optionElement, labelElement.firstChild);
+optionElement.type = "radio";
+optionElement.name = "profile-type";
+optionElement.style.hidden = true;
+if (checked) {
+optionElement.checked = checked;
+this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
+}
+optionElement.addEventListener("change", this._profileTypeChanged.bind(this, profileType), false);
+var descriptionElement = labelElement.createChild("p");
+descriptionElement.textContent = profileType.description;
+var decorationElement = profileType.decorationElement();
+if (decorationElement)
+labelElement.appendChild(decorationElement);
+},
+
+_controlButtonClicked: function()
+{
+this._panel.toggleRecordButton();
+},
+
+_updateControls: function()
+{
+WebInspector.ProfileLauncherView.prototype._updateControls.call(this);
+var items = this._profileTypeSelectorForm.elements;
+for (var i = 0; i < items.length; ++i) {
+if (items[i].type === "radio")
+items[i].disabled = this._isProfiling;
+}
+},
+
+
+_profileTypeChanged: function(profileType, event)
+{
+this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
+this._isInstantProfile = profileType.isInstantProfile();
+this._updateControls();
+},
+
+profileStarted: function()
+{
+this._isProfiling = true;
+this._updateControls();
+},
+
+profileFinished: function()
+{
+this._isProfiling = false;
+this._updateControls();
+},
+
+__proto__: WebInspector.ProfileLauncherView.prototype
+}
+
 ;
 
 
 
-WebInspector.TopDownProfileDataGridNode = function(  profileView,   profileNode,   owningTree)
+WebInspector.TopDownProfileDataGridNode = function(profileNode, owningTree)
 {
-var hasChildren = (profileNode.children && profileNode.children.length);
+var hasChildren = !!(profileNode.children && profileNode.children.length);
 
-WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren);
+WebInspector.ProfileDataGridNode.call(this, profileNode, owningTree, hasChildren);
 
 this._remainingChildren = profileNode.children;
 }
@@ -9226,7 +10273,7 @@
 var childrenLength = children.length;
 
 for (var i = 0; i < childrenLength; ++i)
-this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.profileView, children[i], this.tree));
+this.appendChild(new WebInspector.TopDownProfileDataGridNode(children[i], this.tree));
 
 this._remainingChildren = null;
 },
@@ -9234,7 +10281,7 @@
 _exclude: function(aCallUID)
 {
 if (this._remainingChildren)
-this._populate();
+this.populate();
 
 this._save();
 
@@ -9254,41 +10301,43 @@
 }
 
 
-WebInspector.TopDownProfileDataGridTree = function(  profileView,   profileNode)
+WebInspector.TopDownProfileDataGridTree = function(profileView, rootProfileNode)
 {
-WebInspector.ProfileDataGridTree.call(this, profileView, profileNode);
+WebInspector.ProfileDataGridTree.call(this, profileView, rootProfileNode);
 
-this._remainingChildren = profileNode.children;
+this._remainingChildren = rootProfileNode.children;
 
-var any =  this;
-var node =  any;
-WebInspector.TopDownProfileDataGridNode.prototype._populate.call(node);
+var any =  (this);
+var node =  (any);
+WebInspector.TopDownProfileDataGridNode.prototype.populate.call(node);
 }
 
 WebInspector.TopDownProfileDataGridTree.prototype = {
-focus: function(  profileDataGrideNode)
+
+focus: function(profileDataGridNode)
 {
-if (!profileDataGrideNode)
+if (!profileDataGridNode)
 return;
 
 this._save();
-profileDataGrideNode.savePosition();
+profileDataGridNode.savePosition();
 
-this.children = [profileDataGrideNode];
-this.totalTime = profileDataGrideNode.totalTime;
+this.children = [profileDataGridNode];
+this.totalTime = profileDataGridNode.totalTime;
 },
 
-exclude: function(  profileDataGrideNode)
+
+exclude: function(profileDataGridNode)
 {
-if (!profileDataGrideNode)
+if (!profileDataGridNode)
 return;
 
 this._save();
 
-var excludedCallUID = profileDataGrideNode.callUID;
+var excludedCallUID = profileDataGridNode.callUID;
 
-var any =  this;
-var node =  any;
+var any =  (this);
+var node =  (any);
 WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(node, excludedCallUID);
 
 if (this.lastComparator)
@@ -9326,43 +10375,54 @@
 this._linkifier = new WebInspector.Linkifier();
 this._splitView = new WebInspector.SplitView(false, "canvasProfileViewSplitLocation", 300);
 
-var columns = { 0: {}, 1: {}, 2: {} };
-columns[0].title = "#";
-columns[0].sortable = true;
-columns[0].width = "5%";
-columns[1].title = WebInspector.UIString("Call");
-columns[1].sortable = true;
-columns[1].width = "75%";
-columns[2].title = WebInspector.UIString("Location");
-columns[2].sortable = true;
-columns[2].width = "20%";
+var replayImageContainer = this._splitView.firstElement();
+replayImageContainer.id = "canvas-replay-image-container";
+this._replayImageElement = replayImageContainer.createChild("image", "canvas-replay-image");
+this._debugInfoElement = replayImageContainer.createChild("div", "canvas-debug-info hidden");
+this._spinnerIcon = replayImageContainer.createChild("img", "canvas-spinner-icon hidden");
+
+var replayInfoContainer = this._splitView.secondElement();
+var controlsContainer = replayInfoContainer.createChild("div", "status-bar");
+var logGridContainer = replayInfoContainer.createChild("div", "canvas-replay-log");
+
+this._createControlButton(controlsContainer, "canvas-replay-first-step", WebInspector.UIString("First call."), this._onReplayFirstStepClick.bind(this));
+this._createControlButton(controlsContainer, "canvas-replay-prev-step", WebInspector.UIString("Previous call."), this._onReplayStepClick.bind(this, false));
+this._createControlButton(controlsContainer, "canvas-replay-next-step", WebInspector.UIString("Next call."), this._onReplayStepClick.bind(this, true));
+this._createControlButton(controlsContainer, "canvas-replay-prev-draw", WebInspector.UIString("Previous drawing call."), this._onReplayDrawingCallClick.bind(this, false));
+this._createControlButton(controlsContainer, "canvas-replay-next-draw", WebInspector.UIString("Next drawing call."), this._onReplayDrawingCallClick.bind(this, true));
+this._createControlButton(controlsContainer, "canvas-replay-last-step", WebInspector.UIString("Last call."), this._onReplayLastStepClick.bind(this));
+
+this._replayContextSelector = new WebInspector.StatusBarComboBox(this._onReplayContextChanged.bind(this));
+this._replayContextSelector.createOption("<screenshot auto>", WebInspector.UIString("Show screenshot of the last replayed resource."), "");
+controlsContainer.appendChild(this._replayContextSelector.element);
+
+
+this._replayContexts = {};
+
+this._currentResourceStates = {};
+
+var columns = [
+{title: "#", sortable: true, width: "5%"},
+{title: WebInspector.UIString("Call"), sortable: true, width: "75%", disclosure: true},
+{title: WebInspector.UIString("Location"), sortable: true, width: "20%"}
+];
 
 this._logGrid = new WebInspector.DataGrid(columns);
 this._logGrid.element.addStyleClass("fill");
-this._logGrid.show(this._splitView.secondElement());
+this._logGrid.show(logGridContainer);
 this._logGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._replayTraceLog.bind(this));
 
-var replayImageContainer = this._splitView.firstElement();
-replayImageContainer.id = "canvas-replay-image-container";
-
-this._replayImageElement = document.createElement("image");
-this._replayImageElement.id = "canvas-replay-image";
-
-replayImageContainer.appendChild(this._replayImageElement);
-this._debugInfoElement = document.createElement("div");
-replayImageContainer.appendChild(this._debugInfoElement);
-
 this._splitView.show(this.element);
-
-this._enableWaitIcon(true);
-CanvasAgent.getTraceLog(this._traceLogId, 0, this._didReceiveTraceLog.bind(this));
+this._requestTraceLog(0);
 }
 
+
+WebInspector.CanvasProfileView.TraceLogPollingInterval = 500;
+
 WebInspector.CanvasProfileView.prototype = {
 dispose: function()
 {
 this._linkifier.reset();
-CanvasAgent.dropTraceLog(this._traceLogId);
 },
 
 get statusBarItems()
@@ -9382,64 +10442,291 @@
 },
 
 
-_enableWaitIcon: function(enable)
+_createControlButton: function(parent, className, title, clickCallback)
 {
-function showWaitIcon()
-{
-this._replayImageElement.className = "wait";
-this._debugInfoElement.textContent = "";
-delete this._showWaitIconTimer;
-}
-
-if (enable && this._replayImageElement.src && !this._showWaitIconTimer)
-this._showWaitIconTimer = setTimeout(showWaitIcon.bind(this), 250);
-else {
-if (this._showWaitIconTimer) {
-clearTimeout(this._showWaitIconTimer);
-delete this._showWaitIconTimer;
-}
-this._replayImageElement.className = enable ? "wait" : "";
-this._debugInfoElement.textContent = "";
-}
+var button = new WebInspector.StatusBarButton(title, className);
+button.element.addEventListener("click", clickCallback, false);
+parent.appendChild(button.element);
 },
 
-_replayTraceLog: function()
+_onReplayContextChanged: function()
 {
-var callNode = this._logGrid.selectedNode;
-if (!callNode)
-return;
-var time = Date.now();
-function didReplayTraceLog(error, dataURL)
+
+function didReceiveResourceState(error, resourceState)
 {
 this._enableWaitIcon(false);
 if (error)
 return;
+
+this._currentResourceStates[resourceState.id] = resourceState;
+
+var selectedContextId = this._replayContextSelector.selectedOption().value;
+if (selectedContextId === resourceState.id)
+this._replayImageElement.src = resourceState.imageURL;
+}
+
+var selectedContextId = this._replayContextSelector.selectedOption().value || "auto";
+var resourceState = this._currentResourceStates[selectedContextId];
+if (resourceState)
+this._replayImageElement.src = resourceState.imageURL;
+else {
+this._enableWaitIcon(true);
+this._replayImageElement.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; 
+CanvasAgent.getResourceState(this._traceLogId, selectedContextId, didReceiveResourceState.bind(this));
+}
+},
+
+
+_onReplayStepClick: function(forward)
+{
+var selectedNode = this._logGrid.selectedNode;
+if (!selectedNode)
+return;
+var nextNode = forward ? selectedNode.traverseNextNode(false) : selectedNode.traversePreviousNode(false);
+(nextNode || selectedNode).revealAndSelect();
+},
+
+
+_onReplayDrawingCallClick: function(forward)
+{
+var selectedNode = this._logGrid.selectedNode;
+if (!selectedNode)
+return;
+var nextNode = selectedNode;
+while (nextNode) {
+var sibling = forward ? nextNode.nextSibling : nextNode.previousSibling;
+if (sibling) {
+nextNode = sibling;
+if (nextNode.hasChildren || nextNode.call.isDrawingCall)
+break;
+} else {
+nextNode = nextNode.parent;
+if (!forward)
+break;
+}
+}
+if (!nextNode && forward)
+this._onReplayLastStepClick();
+else
+(nextNode || selectedNode).revealAndSelect();
+},
+
+_onReplayFirstStepClick: function()
+{
+var firstNode = this._logGrid.rootNode().children[0];
+if (firstNode)
+firstNode.revealAndSelect();
+},
+
+_onReplayLastStepClick: function()
+{
+var lastNode = this._logGrid.rootNode().children.peekLast();
+if (!lastNode)
+return;
+while (lastNode.expanded) {
+var lastChild = lastNode.children.peekLast();
+if (!lastChild)
+break;
+lastNode = lastChild;
+}
+lastNode.revealAndSelect();
+},
+
+
+_enableWaitIcon: function(enable)
+{
+this._spinnerIcon.enableStyleClass("hidden", !enable);
+this._debugInfoElement.enableStyleClass("hidden", enable);
+},
+
+_replayTraceLog: function()
+{
+if (this._pendingReplayTraceLogEvent)
+return;
+var index = this._selectedCallIndex();
+if (index === -1 || index === this._lastReplayCallIndex)
+return;
+this._lastReplayCallIndex = index;
+this._pendingReplayTraceLogEvent = true;
+var time = Date.now();
+
+function didReplayTraceLog(error, resourceState)
+{
+delete this._pendingReplayTraceLogEvent;
+
+if (index !== this._selectedCallIndex()) {
+this._replayTraceLog();
+return;
+}
+
+this._enableWaitIcon(false);
+if (error)
+return;
+
+this._currentResourceStates = {};
+this._currentResourceStates["auto"] = resourceState;
+this._currentResourceStates[resourceState.id] = resourceState;
+
 this._debugInfoElement.textContent = "Replay time: " + (Date.now() - time) + "ms";
-this._replayImageElement.src = dataURL;
+this._onReplayContextChanged();
 }
 this._enableWaitIcon(true);
-CanvasAgent.replayTraceLog(this._traceLogId, callNode.index, didReplayTraceLog.bind(this));
+CanvasAgent.replayTraceLog(this._traceLogId, index, didReplayTraceLog.bind(this));
 },
 
+
 _didReceiveTraceLog: function(error, traceLog)
 {
 this._enableWaitIcon(false);
-this._logGrid.rootNode().removeChildren();
 if (error || !traceLog)
 return;
+var callNodes = [];
 var calls = traceLog.calls;
-for (var i = 0, n = calls.length; i < n; ++i)
-this._logGrid.rootNode().appendChild(this._createCallNode(i, calls[i]));
-var lastNode = this._logGrid.rootNode().children[calls.length - 1];
-if (lastNode) {
-lastNode.reveal();
-lastNode.select();
+var index = traceLog.startOffset;
+for (var i = 0, n = calls.length; i < n; ++i) {
+var call = calls[i];
+this._requestReplayContextInfo(call.contextId);
+var gridNode = this._createCallNode(index++, call);
+callNodes.push(gridNode);
+}
+this._appendCallNodes(callNodes);
+if (traceLog.alive)
+setTimeout(this._requestTraceLog.bind(this, index), WebInspector.CanvasProfileView.TraceLogPollingInterval);
+else
+this._flattenSingleFrameNode();
+this._profile._updateCapturingStatus(traceLog);
+this._onReplayLastStepClick(); 
+},
+
+
+_requestTraceLog: function(offset)
+{
+this._enableWaitIcon(true);
+CanvasAgent.getTraceLog(this._traceLogId, offset, undefined, this._didReceiveTraceLog.bind(this));
+},
+
+
+_requestReplayContextInfo: function(contextId)
+{
+if (this._replayContexts[contextId])
+return;
+this._replayContexts[contextId] = true;
+
+function didReceiveResourceInfo(error, resourceInfo)
+{
+if (error) {
+delete this._replayContexts[contextId];
+return;
+}
+this._replayContextSelector.createOption(resourceInfo.description, WebInspector.UIString("Show screenshot of this context's canvas."), contextId);
+}
+CanvasAgent.getResourceInfo(contextId, didReceiveResourceInfo.bind(this));
+},
+
+
+_selectedCallIndex: function()
+{
+var node = this._logGrid.selectedNode;
+return node ? this._peekLastRecursively(node).index : -1;
+},
+
+
+_peekLastRecursively: function(node)
+{
+var lastChild;
+while ((lastChild = node.children.peekLast()))
+node =   (lastChild);
+return node;
+},
+
+
+_appendCallNodes: function(callNodes)
+{
+var rootNode = this._logGrid.rootNode();
+var frameNode =   (rootNode.children.peekLast());
+if (frameNode && this._peekLastRecursively(frameNode).call.isFrameEndCall)
+frameNode = null;
+for (var i = 0, n = callNodes.length; i < n; ++i) {
+if (!frameNode) {
+var index = rootNode.children.length;
+var data = {};
+data[0] = "";
+data[1] = "Frame #" + (index + 1);
+data[2] = "";
+frameNode = new WebInspector.DataGridNode(data);
+frameNode.selectable = true;
+rootNode.appendChild(frameNode);
+}
+var nextFrameCallIndex = i + 1;
+while (nextFrameCallIndex < n && !callNodes[nextFrameCallIndex - 1].call.isFrameEndCall)
+++nextFrameCallIndex;
+this._appendCallNodesToFrameNode(frameNode, callNodes, i, nextFrameCallIndex);
+i = nextFrameCallIndex - 1;
+frameNode = null;
 }
 },
 
+
+_appendCallNodesToFrameNode: function(frameNode, callNodes, fromIndex, toIndex)
+{
+var self = this;
+function appendDrawCallGroup()
+{
+var index = self._drawCallGroupsCount || 0;
+var data = {};
+data[0] = "";
+data[1] = "Draw call group #" + (index + 1);
+data[2] = "";
+var node = new WebInspector.DataGridNode(data);
+node.selectable = true;
+self._drawCallGroupsCount = index + 1;
+frameNode.appendChild(node);
+return node;
+}
+
+function splitDrawCallGroup(drawCallGroup)
+{
+var splitIndex = 0;
+var splitNode;
+while ((splitNode = drawCallGroup.children[splitIndex])) {
+if (splitNode.call.isDrawingCall)
+break;
+++splitIndex;
+}
+var newDrawCallGroup = appendDrawCallGroup();
+var lastNode;
+while ((lastNode = drawCallGroup.children[splitIndex + 1]))
+newDrawCallGroup.appendChild(lastNode);
+return newDrawCallGroup;
+}
+
+var drawCallGroup = frameNode.children.peekLast();
+var groupHasDrawCall = false;
+if (drawCallGroup) {
+for (var i = 0, n = drawCallGroup.children.length; i < n; ++i) {
+if (drawCallGroup.children[i].call.isDrawingCall) {
+groupHasDrawCall = true;
+break;
+}
+}
+} else
+drawCallGroup = appendDrawCallGroup();
+
+for (var i = fromIndex; i < toIndex; ++i) {
+var node = callNodes[i];
+drawCallGroup.appendChild(node);
+if (node.call.isDrawingCall) {
+if (groupHasDrawCall)
+drawCallGroup = splitDrawCallGroup(drawCallGroup);
+else
+groupHasDrawCall = true;
+}
+}
+},
+
+
 _createCallNode: function(index, call)
 {
-var traceLogItem = document.createElement("div");
 var data = {};
 data[0] = index + 1;
 data[1] = call.functionName || "context." + call.property;
@@ -9451,21 +10738,35 @@
 data[2] = this._linkifier.linkifyLocation(call.sourceURL, lineNumber, columnNumber);
 }
 
-if (call.arguments)
-data[1] += "(" + call.arguments.join(", ") + ")";
-else
-data[1] += " = " + call.value;
+if (call.arguments) {
+var args = call.arguments.map(function(argument) {
+return argument.description;
+});
+data[1] += "(" + args.join(", ") + ")";
+} else
+data[1] += " = " + call.value.description;
 
 if (typeof call.result !== "undefined")
-data[1] += " => " + call.result;
+data[1] += " => " + call.result.description;
 
 var node = new WebInspector.DataGridNode(data);
-node.call = call;
 node.index = index;
 node.selectable = true;
+node.call = call;
 return node;
 },
 
+_flattenSingleFrameNode: function()
+{
+var rootNode = this._logGrid.rootNode();
+if (rootNode.children.length !== 1)
+return;
+var frameNode = rootNode.children[0];
+while (frameNode.children[0])
+rootNode.appendChild(frameNode.children[0]);
+rootNode.removeChild(frameNode);
+},
+
 __proto__: WebInspector.View.prototype
 }
 
@@ -9474,32 +10775,111 @@
 {
 WebInspector.ProfileType.call(this, WebInspector.CanvasProfileType.TypeId, WebInspector.UIString("Capture Canvas Frame"));
 this._nextProfileUid = 1;
+this._recording = false;
+this._lastProfileHeader = null;
 
-CanvasAgent.enable();
+this._capturingModeSelector = new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));
+this._capturingModeSelector.element.title = WebInspector.UIString("Canvas capture mode.");
+this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"), WebInspector.UIString("Capture a single canvas frame."), "");
+this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"), WebInspector.UIString("Capture consecutive canvas frames."), "1");
+
+
+this._frameOptions = {};
+
+
+this._framesWithCanvases = {};
+
+this._frameSelector = new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));
+this._frameSelector.element.title = WebInspector.UIString("Frame containing the canvases to capture.");
+this._frameSelector.element.addStyleClass("hidden");
+WebInspector.runtimeModel.contextLists().forEach(this._addFrame, this);
+WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded, this._frameAdded, this);
+WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved, this._frameRemoved, this);
+
+this._decorationElement = document.createElement("div");
+this._decorationElement.addStyleClass("profile-canvas-decoration");
+this._decorationElement.addStyleClass("hidden");
+this._decorationElement.textContent = WebInspector.UIString("There is an uninstrumented canvas on the page. Reload the page to instrument it.");
+var reloadPageButton = this._decorationElement.createChild("button");
+reloadPageButton.type = "button";
+reloadPageButton.textContent = WebInspector.UIString("Reload");
+reloadPageButton.addEventListener("click", this._onReloadPageButtonClick.bind(this), false);
+
+this._dispatcher = new WebInspector.CanvasDispatcher(this);
+
+
+CanvasAgent.enable(this._updateDecorationElement.bind(this));
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._updateDecorationElement, this);
 }
 
 WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE";
 
 WebInspector.CanvasProfileType.prototype = {
+get statusBarItems()
+{
+return [this._capturingModeSelector.element, this._frameSelector.element];
+},
+
 get buttonTooltip()
 {
-return WebInspector.UIString("Capture Canvas Frame.");
+if (this._isSingleFrameMode())
+return WebInspector.UIString("Capture next canvas frame.");
+else
+return this._recording ? WebInspector.UIString("Stop capturing canvas frames.") : WebInspector.UIString("Start capturing canvas frames.");
 },
 
 
-buttonClicked: function(profilesPanel)
+buttonClicked: function()
 {
-var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid);
-++this._nextProfileUid;
-profileHeader.isTemporary = true;
-profilesPanel.addProfileHeader(profileHeader);
-function didStartCapturingFrame(error, traceLogId)
-{
-profileHeader._traceLogId = traceLogId;
-profileHeader.isTemporary = false;
+if (this._recording) {
+this._recording = false;
+this._stopFrameCapturing();
+} else if (this._isSingleFrameMode()) {
+this._recording = false;
+this._runSingleFrameCapturing();
+} else {
+this._recording = true;
+this._startFrameCapturing();
 }
-CanvasAgent.captureFrame(didStartCapturingFrame.bind(this));
-return false;
+return this._recording;
+},
+
+_runSingleFrameCapturing: function()
+{
+var frameId = this._selectedFrameId();
+CanvasAgent.captureFrame(frameId, this._didStartCapturingFrame.bind(this, frameId));
+},
+
+_startFrameCapturing: function()
+{
+var frameId = this._selectedFrameId();
+CanvasAgent.startCapturing(frameId, this._didStartCapturingFrame.bind(this, frameId));
+},
+
+_stopFrameCapturing: function()
+{
+if (!this._lastProfileHeader)
+return;
+var profileHeader = this._lastProfileHeader;
+var traceLogId = profileHeader.traceLogId();
+this._lastProfileHeader = null;
+function didStopCapturing()
+{
+profileHeader._updateCapturingStatus();
+}
+CanvasAgent.stopCapturing(traceLogId, didStopCapturing.bind(this));
+},
+
+
+_didStartCapturingFrame: function(frameId, error, traceLogId)
+{
+if (error || this._lastProfileHeader && this._lastProfileHeader.traceLogId() === traceLogId)
+return;
+var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid, traceLogId, frameId);
+++this._nextProfileUid;
+this._lastProfileHeader = profileHeader;
+this.addProfile(profileHeader);
+profileHeader._updateCapturingStatus();
 },
 
 get treeItemTitle()
@@ -9513,12 +10893,32 @@
 },
 
 
-reset: function()
+decorationElement: function()
 {
+return this._decorationElement;
+},
+
+
+_reset: function()
+{
+WebInspector.ProfileType.prototype._reset.call(this);
 this._nextProfileUid = 1;
 },
 
 
+removeProfile: function(profile)
+{
+WebInspector.ProfileType.prototype.removeProfile.call(this, profile);
+if (this._recording && profile === this._lastProfileHeader)
+this._recording = false;
+},
+
+setRecordingProfile: function(isProfiling)
+{
+this._recording = isProfiling;
+},
+
+
 createTemporaryProfile: function(title)
 {
 title = title || WebInspector.UIString("Capturing\u2026");
@@ -9531,16 +10931,145 @@
 return new WebInspector.CanvasProfileHeader(this, profile.title, -1);
 },
 
+_updateDecorationElement: function()
+{
+
+function callback(error, result)
+{
+var hideWarning = (error || !result);
+this._decorationElement.enableStyleClass("hidden", hideWarning);
+}
+CanvasAgent.hasUninstrumentedCanvases(callback.bind(this));
+},
+
+
+_onReloadPageButtonClick: function(event)
+{
+PageAgent.reload(event.shiftKey);
+},
+
+
+_isSingleFrameMode: function()
+{
+return !this._capturingModeSelector.selectedOption().value;
+},
+
+
+_frameAdded: function(event)
+{
+var contextList =   (event.data);
+this._addFrame(contextList);
+},
+
+
+_addFrame: function(contextList)
+{
+var frameId = contextList.frameId;
+var option = document.createElement("option");
+option.text = contextList.displayName;
+option.title = contextList.url;
+option.value = frameId;
+
+this._frameOptions[frameId] = option;
+
+if (this._framesWithCanvases[frameId]) {
+this._frameSelector.addOption(option);
+this._dispatchViewUpdatedEvent();
+}
+},
+
+
+_frameRemoved: function(event)
+{
+var contextList =   (event.data);
+var frameId = contextList.frameId;
+var option = this._frameOptions[frameId];
+if (option && this._framesWithCanvases[frameId]) {
+this._frameSelector.removeOption(option);
+this._dispatchViewUpdatedEvent();
+}
+delete this._frameOptions[frameId];
+delete this._framesWithCanvases[frameId];
+},
+
+
+_contextCreated: function(frameId)
+{
+if (this._framesWithCanvases[frameId])
+return;
+this._framesWithCanvases[frameId] = true;
+var option = this._frameOptions[frameId];
+if (option) {
+this._frameSelector.addOption(option);
+this._dispatchViewUpdatedEvent();
+}
+},
+
+
+_traceLogsRemoved: function(frameId, traceLogId)
+{
+var sidebarElementsToDelete = [];
+var sidebarElements =   ((this.treeElement && this.treeElement.children) || []);
+for (var i = 0, n = sidebarElements.length; i < n; ++i) {
+var header =   (sidebarElements[i].profile);
+if (!header)
+continue;
+if (frameId && frameId !== header.frameId())
+continue;
+if (traceLogId && traceLogId !== header.traceLogId())
+continue;
+sidebarElementsToDelete.push(sidebarElements[i]);
+}
+for (var i = 0, n = sidebarElementsToDelete.length; i < n; ++i)
+sidebarElementsToDelete[i].ondelete();
+},
+
+
+_selectedFrameId: function()
+{
+var option = this._frameSelector.selectedOption();
+return option ? option.value : undefined;
+},
+
+_dispatchViewUpdatedEvent: function()
+{
+this._frameSelector.element.enableStyleClass("hidden", this._frameSelector.size() <= 1);
+this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated);
+},
+
 __proto__: WebInspector.ProfileType.prototype
 }
 
 
-WebInspector.CanvasProfileHeader = function(type, title, uid)
+WebInspector.CanvasDispatcher = function(profileType)
+{
+this._profileType = profileType;
+InspectorBackend.registerCanvasDispatcher(this);
+}
+
+WebInspector.CanvasDispatcher.prototype = {
+
+contextCreated: function(frameId)
+{
+this._profileType._contextCreated(frameId);
+},
+
+
+traceLogsRemoved: function(frameId, traceLogId)
+{
+this._profileType._traceLogsRemoved(frameId, traceLogId);
+}
+}
+
+
+WebInspector.CanvasProfileHeader = function(type, title, uid, traceLogId, frameId)
 {
 WebInspector.ProfileHeader.call(this, type, title, uid);
 
-
-this._traceLogId = null;
+this._traceLogId = traceLogId || "";
+this._frameId = frameId;
+this._alive = true;
+this._traceLogSize = 0;
 }
 
 WebInspector.CanvasProfileHeader.prototype = {
@@ -9551,6 +11080,12 @@
 },
 
 
+frameId: function()
+{
+return this._frameId;
+},
+
+
 createSidebarTreeElement: function()
 {
 return new WebInspector.ProfileSidebarTreeElement(this, WebInspector.UIString("Trace Log %d"), "profile-sidebar-tree-item");
@@ -9562,6 +11097,50 @@
 return new WebInspector.CanvasProfileView(this);
 },
 
+
+dispose: function()
+{
+if (this._traceLogId) {
+CanvasAgent.dropTraceLog(this._traceLogId);
+clearTimeout(this._requestStatusTimer);
+this._alive = false;
+}
+},
+
+
+_updateCapturingStatus: function(traceLog)
+{
+if (!this.sidebarElement || !this._traceLogId)
+return;
+
+if (traceLog) {
+this._alive = traceLog.alive;
+this._traceLogSize = traceLog.totalAvailableCalls;
+}
+
+this.sidebarElement.subtitle = this._alive ? WebInspector.UIString("Capturing\u2026 %d calls", this._traceLogSize) : WebInspector.UIString("Captured %d calls", this._traceLogSize);
+this.sidebarElement.wait = this._alive;
+
+if (this._alive) {
+clearTimeout(this._requestStatusTimer);
+this._requestStatusTimer = setTimeout(this._requestCapturingStatus.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
+}
+},
+
+_requestCapturingStatus: function()
+{
+
+function didReceiveTraceLog(error, traceLog)
+{
+if (error)
+return;
+this._alive = traceLog.alive;
+this._traceLogSize = traceLog.totalAvailableCalls;
+this._updateCapturingStatus();
+}
+CanvasAgent.getTraceLog(this._traceLogId, 0, 0, didReceiveTraceLog.bind(this));
+},
+
 __proto__: WebInspector.ProfileHeader.prototype
 }
 ;
diff --git a/resources/inspector/ResourcesPanel.js b/resources/inspector/ResourcesPanel.js
index 4101ae8..108b114 100644
--- a/resources/inspector/ResourcesPanel.js
+++ b/resources/inspector/ResourcesPanel.js
@@ -167,24 +167,20 @@
 
 _createDataGrid: function()
 {
-var columns = { 0: {}, 1: {}, 2: {} };
-columns[0].title = WebInspector.UIString("Resource");
-columns[0].sort = "ascending";
-columns[0].sortable = true;
-columns[1].title = WebInspector.UIString("Type");
-columns[1].sortable = true;
-columns[2].title = WebInspector.UIString("Size");
-columns[2].aligned = "right";
-columns[2].sortable = true;
+var columns = [
+{title: WebInspector.UIString("Resource"), sort: WebInspector.DataGrid.Order.Ascending, sortable: true},
+{title: WebInspector.UIString("Type"), sortable: true},
+{title: WebInspector.UIString("Size"), align: WebInspector.DataGrid.Align.Right, sortable: true}
+];
 this._dataGrid = new WebInspector.DataGrid(columns);
 this._dataGrid.show(this.element);
-this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
+this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._populateDataGrid, this);
 },
 
 _populateDataGrid: function()
 {
 var selectedResource = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.resource : null;
-var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1;
 
 function numberCompare(field, resource1, resource2)
 {
@@ -196,7 +192,7 @@
 }
 
 var comparator;
-switch (parseInt(this._dataGrid.sortColumnIdentifier, 10)) {
+switch (parseInt(this._dataGrid.sortColumnIdentifier(), 10)) {
 case 0: comparator = localeCompare.bind(this, "name"); break;
 case 1: comparator = localeCompare.bind(this, "type"); break;
 case 2: comparator = numberCompare.bind(this, "size"); break;
@@ -250,11 +246,12 @@
 
 
 
-WebInspector.DOMStorageItemsView = function(domStorage)
+WebInspector.DOMStorageItemsView = function(domStorage, domStorageModel)
 {
 WebInspector.View.call(this);
 
 this.domStorage = domStorage;
+this.domStorageModel = domStorageModel;
 
 this.element.addStyleClass("storage-view");
 this.element.addStyleClass("table");
@@ -265,6 +262,11 @@
 
 this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
 this.refreshButton.addEventListener("click", this._refreshButtonClicked, this);
+
+this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemsCleared, this._domStorageItemsCleared, this);
+this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemRemoved, this._domStorageItemRemoved, this);
+this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemAdded, this._domStorageItemAdded, this);
+this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemUpdated, this._domStorageItemUpdated, this);
 }
 
 WebInspector.DOMStorageItemsView.prototype = {
@@ -275,7 +277,7 @@
 
 wasShown: function()
 {
-this.update();
+this._update();
 },
 
 willHide: function()
@@ -283,49 +285,131 @@
 this.deleteButton.visible = false;
 },
 
-update: function()
+
+_domStorageItemsCleared: function(event)
 {
-this.detachChildViews();
-this.domStorage.getEntries(this._showDOMStorageEntries.bind(this));
+if (!this.isShowing() || !this._dataGrid)
+return;
+
+this._dataGrid.rootNode().removeChildren();
+this._dataGrid.addCreationNode(false);
+this.deleteButton.visible = false;
+event.consume(true);
 },
 
-_showDOMStorageEntries: function(error, entries)
+
+_domStorageItemRemoved: function(event)
+{
+if (!this.isShowing() || !this._dataGrid)
+return;
+
+var storageData = event.data;
+var rootNode = this._dataGrid.rootNode();
+var children = rootNode.children;
+
+event.consume(true);
+
+for (var i = 0; i < children.length; ++i) {
+var childNode = children[i];
+if (childNode.data.key === storageData.key) {
+rootNode.removeChild(childNode);
+this.deleteButton.visible = (children.length > 1);
+return;
+}
+}
+},
+
+
+_domStorageItemAdded: function(event)
+{
+if (!this.isShowing() || !this._dataGrid)
+return;
+
+var storageData = event.data;
+var rootNode = this._dataGrid.rootNode();
+var children = rootNode.children;
+
+event.consume(true);
+this.deleteButton.visible = true;
+
+for (var i = 0; i < children.length; ++i)
+if (children[i].data.key === storageData.key)
+return;
+
+var childNode = new WebInspector.DataGridNode({key: storageData.key, value: storageData.newValue}, false);
+rootNode.insertChild(childNode, children.length - 1);
+},
+
+
+_domStorageItemUpdated: function(event)
+{
+if (!this.isShowing() || !this._dataGrid)
+return;
+
+var storageData = event.data;
+var rootNode = this._dataGrid.rootNode();
+var children = rootNode.children;
+
+event.consume(true);
+
+var keyFound = false;
+for (var i = 0; i < children.length; ++i) {
+var childNode = children[i];
+if (childNode.data.key === storageData.key) {
+if (keyFound) {
+rootNode.removeChild(childNode);
+return;
+}
+keyFound = true;
+if (childNode.data.value !== storageData.newValue) {
+childNode.data.value = storageData.newValue;
+childNode.refresh();
+childNode.select();
+childNode.reveal();
+}
+this.deleteButton.visible = true;
+}
+}
+},
+
+_update: function()
+{
+this.detachChildViews();
+this.domStorage.getItems(this._showDOMStorageItems.bind(this));
+},
+
+_showDOMStorageItems: function(error, items)
 {
 if (error)
 return;
 
-this._dataGrid = this._dataGridForDOMStorageEntries(entries);
+this._dataGrid = this._dataGridForDOMStorageItems(items);
 this._dataGrid.show(this.element);
-this._dataGrid.autoSizeColumns(10);
-this.deleteButton.visible = true;
+this.deleteButton.visible = (this._dataGrid.rootNode().children.length > 1);
 },
 
-_dataGridForDOMStorageEntries: function(entries)
+_dataGridForDOMStorageItems: function(items)
 {
-var columns = {};
-columns[0] = {};
-columns[1] = {};
-columns[0].title = WebInspector.UIString("Key");
-columns[1].title = WebInspector.UIString("Value");
+var columns = [
+{id: "key", title: WebInspector.UIString("Key"), editable: true, weight: 50},
+{id: "value", title: WebInspector.UIString("Value"), editable: true, weight: 50}
+];
 
 var nodes = [];
 
 var keys = [];
-var length = entries.length;
-for (var i = 0; i < entries.length; i++) {
-var data = {};
-
-var key = entries[i][0];
-data[0] = key;
-var value = entries[i][1];
-data[1] = value;
-var node = new WebInspector.DataGridNode(data, false);
+var length = items.length;
+for (var i = 0; i < items.length; i++) {
+var key = items[i][0];
+var value = items[i][1];
+var node = new WebInspector.DataGridNode({key: key, value: value}, false);
 node.selectable = true;
 nodes.push(node);
 keys.push(key);
 }
 
 var dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
+dataGrid.setName("DOMStorageItemsView");
 length = nodes.length;
 for (var i = 0; i < length; ++i)
 dataGrid.rootNode().appendChild(nodes[i]);
@@ -341,26 +425,36 @@
 return;
 
 this._deleteCallback(this._dataGrid.selectedNode);
+this._dataGrid.changeNodeAfterDeletion();
 },
 
 _refreshButtonClicked: function(event)
 {
-this.update();
+this._update();
 },
 
 _editingCallback: function(editingNode, columnIdentifier, oldText, newText)
 {
 var domStorage = this.domStorage;
-if (columnIdentifier === 0) {
+if ("key" === columnIdentifier) {
 if (oldText)
 domStorage.removeItem(oldText);
+domStorage.setItem(newText, editingNode.data.value);
+this._removeDupes(editingNode);
+} else
+domStorage.setItem(editingNode.data.key, newText);
+},
 
-domStorage.setItem(newText, editingNode.data[1]);
-} else {
-domStorage.setItem(editingNode.data[0], newText);
+
+_removeDupes: function(masterNode)
+{
+var rootNode = this._dataGrid.rootNode();
+var children = rootNode.children;
+for (var i = children.length - 1; i >= 0; --i) {
+var childNode = children[i];
+if ((childNode.data.key === masterNode.data.key) && (masterNode !== childNode))
+rootNode.removeChild(childNode);
 }
-
-this.update();
 },
 
 _deleteCallback: function(node)
@@ -369,9 +463,7 @@
 return;
 
 if (this.domStorage)
-this.domStorage.removeItem(node.data[0]);
-
-this.update();
+this.domStorage.removeItem(node.data.key);
 },
 
 __proto__: WebInspector.View.prototype
@@ -493,7 +585,7 @@
 var trimmedQuery = query.trim();
 
 if (dataGrid) {
-dataGrid.element.addStyleClass("inline");
+dataGrid.renderInline();
 this._appendViewQueryResult(trimmedQuery, dataGrid);
 dataGrid.autoSizeColumns(5);
 }
@@ -625,31 +717,16 @@
 WebInspector.DirectoryContentView = function()
 {
 const indexes = WebInspector.DirectoryContentView.columnIndexes;
-var columns = {};
-columns[indexes.Name] = {};
-columns[indexes.Name].title = WebInspector.UIString("Name");
-columns[indexes.Name].sort = "ascending";
-columns[indexes.Name].sortable = true;
-columns[indexes.Name].width = "20%";
-columns[indexes.URL] = {};
-columns[indexes.URL].title = WebInspector.UIString("URL");
-columns[indexes.URL].sortable = true;
-columns[indexes.URL].width = "20%";
-columns[indexes.Type] = {};
-columns[indexes.Type].title = WebInspector.UIString("Type");
-columns[indexes.Type].sortable = true;
-columns[indexes.Type].width = "15%";
-columns[indexes.Size] = {};
-columns[indexes.Size].title = WebInspector.UIString("Size");
-columns[indexes.Size].sortable = true;
-columns[indexes.Size].width = "10%";
-columns[indexes.ModificationTime] = {};
-columns[indexes.ModificationTime].title = WebInspector.UIString("Modification Time");
-columns[indexes.ModificationTime].sortable = true;
-columns[indexes.ModificationTime].width = "25%";
+var columns = [
+{id: indexes.Name, title: WebInspector.UIString("Name"), sortable: true, sort: WebInspector.DataGrid.Order.Ascending, width: "20%"},
+{id: indexes.URL, title: WebInspector.UIString("URL"), sortable: true, width: "20%"},
+{id: indexes.Type, title: WebInspector.UIString("Type"), sortable: true, width: "15%"},
+{id: indexes.Size, title: WebInspector.UIString("Size"), sortable: true, width: "10%"},
+{id: indexes.ModificationTime, title: WebInspector.UIString("Modification Time"), sortable: true, width: "25%"}
+];
 
 WebInspector.DataGrid.call(this, columns);
-this.addEventListener("sorting changed", this._sort, this);
+this.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sort, this);
 }
 
 WebInspector.DirectoryContentView.columnIndexes = {
@@ -672,8 +749,8 @@
 
 _sort: function()
 {
-var column =   (this.sortColumnIdentifier);
-this.sortNodes(WebInspector.DirectoryContentView.Node.comparator(column, this.sortOrder === "descending"), false);
+var column =   (this.sortColumnIdentifier());
+this.sortNodes(WebInspector.DirectoryContentView.Node.comparator(column, !this.isSortOrderAscending()), false);
 },
 
 __proto__: WebInspector.DataGrid.prototype
@@ -736,12 +813,12 @@
 
 function nameCompare(x, y)
 {
-return reverseFactor * x._entry.name.localeCompare(y._entry.name);
+return reverseFactor * x._entry.name.compareTo(y._entry.name);
 }
 
 function typeCompare(x, y)
 {
-return reverseFactor * (x._entry.mimeType || "").localeCompare(y._entry.mimeType || "");
+return reverseFactor * (x._entry.mimeType || "").compareTo(y._entry.mimeType || "");
 }
 
 function sizeCompare(x, y)
@@ -861,6 +938,9 @@
 this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
 this._refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 
+this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear object store"), "clear-storage-status-bar-item");
+this._clearButton.addEventListener("click", this._clearButtonClicked, this);
+
 this._pageSize = 50;
 this._skipCount = 0;
 
@@ -872,22 +952,14 @@
 
 _createDataGrid: function()
 {
-var columns = {};
-columns["number"] = {};
-columns["number"].title = WebInspector.UIString("#");
-columns["number"].width = "50px";
-
 var keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPath;
-columns["key"] = {};
-columns["key"].titleDOMFragment = this._keyColumnHeaderFragment(WebInspector.UIString("Key"), keyPath);
 
-if (this._isIndex) {
-columns["primaryKey"] = {};
-columns["primaryKey"].titleDOMFragment = this._keyColumnHeaderFragment(WebInspector.UIString("Primary key"), this._objectStore.keyPath);
-}
-
-columns["value"] = {};
-columns["value"].title = WebInspector.UIString("Value");
+var columns = [];
+columns.push({id: "number", title: WebInspector.UIString("#"), width: "50px"});
+columns.push({id: "key", titleDOMFragment: this._keyColumnHeaderFragment(WebInspector.UIString("Key"), keyPath)});
+if (this._isIndex)
+columns.push({id: "primaryKey", titleDOMFragment: this._keyColumnHeaderFragment(WebInspector.UIString("Primary key"), this._objectStore.keyPath)});
+columns.push({id: "value", title: WebInspector.UIString("Value")});
 
 var dataGrid = new WebInspector.DataGrid(columns);
 return dataGrid;
@@ -1020,6 +1092,8 @@
 var key = this._parseKey(this._keyInputElement.value);
 var pageSize = this._pageSize;
 var skipCount = this._skipCount;
+this._refreshButton.setEnabled(false);
+this._clearButton.setEnabled(!this._isIndex);
 
 if (!force && this._lastKey === key && this._lastPageSize === pageSize && this._lastSkipCount === skipCount)
 return;
@@ -1035,6 +1109,7 @@
 
 function callback(entries, hasMore)
 {
+this._refreshButton.setEnabled(true);
 this.clear();
 this._entries = entries;
 for (var i = 0; i < entries.length; ++i) {
@@ -1065,9 +1140,19 @@
 this._updateData(true);
 },
 
+_clearButtonClicked: function(event)
+{
+function cleared() {
+this._clearButton.setEnabled(true);
+this._updateData(true);
+}
+this._clearButton.setEnabled(false);
+this._model.clearObjectStore(this._databaseId, this._objectStore.name, cleared.bind(this));
+},
+
 get statusBarItems()
 {
-return [this._refreshButton.element];
+return [this._refreshButton.element, this._clearButton.element];
 },
 
 clear: function()
@@ -1145,7 +1230,7 @@
 {
 WebInspector.View.call(this);
 
-this._innerView = null;
+this._innerView =   (null);
 this._file = file;
 this._content = null;
 }
@@ -1255,7 +1340,7 @@
 
 WebInspector.FileSystemView = function(fileSystem)
 {
-WebInspector.SidebarView.call(this, WebInspector.SidebarView.SidebarPosition.Left, "FileSystemViewSidebarWidth");
+WebInspector.SidebarView.call(this, WebInspector.SidebarView.SidebarPosition.Start, "FileSystemViewSidebarWidth");
 this.element.addStyleClass("file-system-view");
 this.element.addStyleClass("storage-view");
 
@@ -1383,7 +1468,7 @@
 while (newEntryIndex < entries.length && oldChildIndex < oldChildren.length) {
 var newEntry = entries[newEntryIndex];
 var oldChild = oldChildren[oldChildIndex];
-var order = newEntry.name.localeCompare(oldChild._entry.name);
+var order = newEntry.name.compareTo(oldChild._entry.name);
 
 if (order === 0) {
 if (oldChild._entry.isDirectory)
@@ -1476,7 +1561,7 @@
 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["application-cache-storage-tree-item"]);
 this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
 
-if (Preferences.exposeFileSystemInspection && WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) {
+if (WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) {
 this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElement(this);
 this.sidebarTree.appendChild(this.fileSystemListTreeElement);
 }
@@ -1514,10 +1599,6 @@
 
 WebInspector.databaseModel.databases().forEach(this._addDatabase.bind(this));
 WebInspector.databaseModel.addEventListener(WebInspector.DatabaseModel.Events.DatabaseAdded, this._databaseAdded, this);
-
-WebInspector.domStorageModel.storages().forEach(this._addDOMStorage.bind(this));
-WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageAdded, this._domStorageAdded, this);
-WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageUpdated, this._domStorageUpdated, this);
 }
 
 WebInspector.ResourcesPanel.prototype = {
@@ -1536,6 +1617,7 @@
 {
 if (!this._initialized && this.isShowing() && this._cachedResourcesWereLoaded) {
 this._populateResourceTree();
+this._populateDOMStorageTree();
 this._populateApplicationCacheTree();
 this._initDefaultSelection();
 this._initialized = true;
@@ -1593,7 +1675,7 @@
 this.sessionStorageListTreeElement.removeChildren();
 this.cookieListTreeElement.removeChildren();
 
-if (this.visibleView)
+if (this.visibleView && !(this.visibleView instanceof WebInspector.StorageCategoryView))
 this.visibleView.detach();
 
 this.storageViewStatusBarItemsContainer.removeChildren();
@@ -1732,6 +1814,8 @@
 
 _addDOMStorage: function(domStorage)
 {
+console.assert(!this._domStorageTreeElements.get(domStorage));
+
 var domStorageTreeElement = new WebInspector.DOMStorageTreeElement(this, domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
 this._domStorageTreeElements.put(domStorage, domStorageTreeElement);
 if (domStorage.isLocalStorage)
@@ -1741,6 +1825,28 @@
 },
 
 
+_domStorageRemoved: function(event)
+{
+var domStorage =   (event.data);
+this._removeDOMStorage(domStorage);
+},
+
+
+_removeDOMStorage: function(domStorage)
+{
+var treeElement = this._domStorageTreeElements.get(domStorage);
+if (!treeElement)
+return;
+var wasSelected = treeElement.selected;
+var parentListTreeElement = treeElement.parent;
+parentListTreeElement.removeChild(treeElement);
+if (wasSelected)
+parentListTreeElement.select();
+this._domStorageTreeElements.remove(treeElement);
+this._domStorageViews.remove(domStorage);
+},
+
+
 selectDatabase: function(database)
 {
 if (database) {
@@ -1851,7 +1957,7 @@
 var view;
 view = this._domStorageViews.get(domStorage);
 if (!view) {
-view = new WebInspector.DOMStorageItemsView(domStorage);
+view = new WebInspector.DOMStorageItemsView(domStorage, WebInspector.domStorageModel);
 this._domStorageViews.put(domStorage, view);
 }
 
@@ -1869,6 +1975,12 @@
 this._innerShowView(view);
 },
 
+
+clearCookies: function(cookieDomain)
+{
+this._cookieViews[cookieDomain].clear();
+},
+
 showApplicationCache: function(frameId)
 {
 if (!this._applicationCacheViews[frameId])
@@ -1952,13 +2064,11 @@
 database.getTableNames(tableNamesCallback);
 },
 
-
-_domStorageUpdated: function(event)
+_populateDOMStorageTree: function()
 {
-var storage =   (event.data);
-var view = this._domStorageViews.get(storage);
-if (this.visibleView && view === this.visibleView)
-view.update();
+WebInspector.domStorageModel.storages().forEach(this._addDOMStorage.bind(this));
+WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageAdded, this._domStorageAdded, this);
+WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, this._domStorageRemoved, this);
 },
 
 _populateApplicationCacheTree: function()
@@ -2315,8 +2425,10 @@
 }
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
+if (!selectedByUser)
+return;
 var itemURL = this.itemURL;
 if (itemURL)
 WebInspector.settings.resourcesLastSelectedItem.set(itemURL);
@@ -2373,9 +2485,9 @@
 return "category://" + this._categoryName;
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel.showCategoryView(this._categoryName);
 },
 
@@ -2427,9 +2539,9 @@
 return "frame://" + encodeURI(this.displayName);
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel.showCategoryView(this.displayName);
 
 this.listItemElement.removeStyleClass("hovered");
@@ -2532,9 +2644,9 @@
 return this._resource.url;
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel._showResourceView(this._resource);
 },
 
@@ -2696,9 +2808,9 @@
 return "database://" + encodeURI(this._database.name);
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel._showDatabase(this._database);
 },
 
@@ -2737,9 +2849,9 @@
 return "database://" + encodeURI(this._database.name) + "/" + encodeURI(this._tableName);
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel._showDatabase(this._database, this._tableName);
 },
 
@@ -2870,7 +2982,7 @@
 _handleContextMenuEvent: function(event)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
-contextMenu.appendItem(WebInspector.UIString("Refresh FileSystem List"), this._refreshFileSystem.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Refresh FileSystem list" : "Refresh FileSystem List"), this._refreshFileSystem.bind(this));
 contextMenu.show();
 },
 
@@ -2943,7 +3055,7 @@
 contextMenu.show();
 },
 
-_refreshIndexedDB: function(event)
+_refreshIndexedDB: function()
 {
 this._model.refreshDatabaseNames();
 },
@@ -2984,9 +3096,9 @@
 this.tooltip = WebInspector.UIString("Version") + ": " + this._database.version;
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 if (!this._view)
 this._view = new WebInspector.IDBDatabaseView(this._database);
 
@@ -3026,6 +3138,27 @@
 return "indexedDB://" + this._databaseId.securityOrigin + "/" + this._databaseId.name + "/" + this._objectStore.name;
 },
 
+onattach: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+},
+
+_handleContextMenuEvent: function(event)
+{
+var contextMenu = new WebInspector.ContextMenu(event);
+contextMenu.appendItem(WebInspector.UIString("Clear"), this._clearObjectStore.bind(this));
+contextMenu.show();
+},
+
+_clearObjectStore: function()
+{
+function callback() {
+this.update(this._objectStore);
+}
+this._model.clearObjectStore(this._databaseId, this._objectStore.name, callback.bind(this));
+},
+
 
 update: function(objectStore)
 {
@@ -3074,9 +3207,9 @@
 this.tooltip = tooltipString
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 if (!this._view)
 this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, null);
 
@@ -3142,9 +3275,9 @@
 this.tooltip = tooltipLines.join("\n");
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 if (!this._view)
 this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, this._index);
 
@@ -3163,19 +3296,19 @@
 
 WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
 {
-WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), ["domstorage-storage-tree-item", className]);
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.securityOrigin ? domStorage.securityOrigin : WebInspector.UIString("Local Files"), ["domstorage-storage-tree-item", className]);
 this._domStorage = domStorage;
 }
 
 WebInspector.DOMStorageTreeElement.prototype = {
 get itemURL()
 {
-return "storage://" + this._domStorage.domain + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
+return "storage://" + this._domStorage.securityOrigin + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel._showDOMStorage(this._domStorage);
 },
 
@@ -3195,9 +3328,29 @@
 return "cookies://" + this._cookieDomain;
 },
 
-onselect: function()
+onattach: function()
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+},
+
+
+_handleContextMenuEvent: function(event)
+{
+var contextMenu = new WebInspector.ContextMenu(event);
+contextMenu.appendItem(WebInspector.UIString("Clear"), this._clearCookies.bind(this));
+contextMenu.show();
+},
+
+
+_clearCookies: function(domain)
+{
+this._storagePanel.clearCookies(this._cookieDomain);
+},
+
+onselect: function(selectedByUser)
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel.showCookies(this, this._cookieDomain);
 },
 
@@ -3224,9 +3377,9 @@
 return this._manifestURL;
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel.showCategoryView(this._manifestURL);
 },
 
@@ -3274,9 +3427,9 @@
 this._refreshTitles();
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._storagePanel.showApplicationCache(this._frameId);
 },
 
@@ -3302,16 +3455,16 @@
 return "filesystem://" + this._fileSystem.name;
 },
 
-onselect: function()
+onselect: function(selectedByUser)
 {
-WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
 this._fileSystemView = new WebInspector.FileSystemView(this._fileSystem);
 this._storagePanel.showFileSystem(this._fileSystemView);
 },
 
 clear: function()
 {
-if (this.fileSystemView && this._storagePanel.visibleView == this.fileSystemView)
+if (this.fileSystemView && this._storagePanel.visibleView === this.fileSystemView)
 this._storagePanel.closeVisibleView();
 },
 
@@ -3360,7 +3513,7 @@
 if (this._lastTreeElement !== currentTreeElement || this._lastIndex === -1)
 return this._searchResult(currentTreeElement, 0);
 
-if (this._lastIndex == currentTreeElement.searchMatchesCount - 1)
+if (this._lastIndex === currentTreeElement.searchMatchesCount - 1)
 return this._searchResult(this._traverser.next(currentTreeElement), 0, this._currentMatchIndex % this._matchesCount + 1);
 
 return this._searchResult(currentTreeElement, this._lastIndex + 1, this._currentMatchIndex + 1);
diff --git a/resources/inspector/ScriptFormatterWorker.js b/resources/inspector/ScriptFormatterWorker.js
index 5b182e3..774c5fb 100644
--- a/resources/inspector/ScriptFormatterWorker.js
+++ b/resources/inspector/ScriptFormatterWorker.js
@@ -143,6 +143,8 @@
 
 WebInspector.SourceTokenizer = function()
 {
+
+this.tokenType = null;
 }
 
 WebInspector.SourceTokenizer.prototype = {
@@ -170,6 +172,7 @@
 this.condition.lexCondition = lexCondition;
 },
 
+
 _charAt: function(cursor)
 {
 return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
@@ -179,6 +182,7 @@
 {
 },
 
+
 nextToken: function(cursor)
 {
 }
@@ -195,6 +199,7 @@
 };
 }
 
+
 WebInspector.SourceTokenizer.Registry.getInstance = function()
 {
 if (!WebInspector.SourceTokenizer.Registry._instance)
@@ -203,6 +208,7 @@
 }
 
 WebInspector.SourceTokenizer.Registry.prototype = {
+
 getTokenizer: function(mimeType)
 {
 if (!this._tokenizerConstructors[mimeType])
@@ -1037,6 +1043,12 @@
 "class", "enum", "export", "extends", "import", "super", "get", "set", "with"
 ].keySet();
 
+WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties = {
+"NaN": "javascript-nan",
+"undefined": "javascript-undef",
+"Infinity": "javascript-inf"
+};
+
 WebInspector.SourceJavaScriptTokenizer.prototype = {
 createInitialCondition: function()
 {
@@ -1128,69 +1140,73 @@
 case this.case_DIV:
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych <= '(') {
-if (yych <= '#') {
-if (yych <= ' ') { gotoCase = 15; continue; };
-if (yych <= '!') { gotoCase = 17; continue; };
-if (yych <= '"') { gotoCase = 19; continue; };
+if (yych <= '\'') {
+if (yych <= '"') {
+if (yych <= String.fromCharCode(0x1F)) { gotoCase = 15; continue; };
+if (yych <= ' ') { gotoCase = 17; continue; };
+if (yych <= '!') { gotoCase = 19; continue; };
+{ gotoCase = 21; continue; };
 } else {
-if (yych <= '%') {
-if (yych <= '$') { gotoCase = 20; continue; };
-{ gotoCase = 22; continue; };
+if (yych <= '$') {
+if (yych >= '$') { gotoCase = 22; continue; };
 } else {
-if (yych <= '&') { gotoCase = 23; continue; };
-if (yych <= '\'') { gotoCase = 24; continue; };
-{ gotoCase = 25; continue; };
+if (yych <= '%') { gotoCase = 24; continue; };
+if (yych <= '&') { gotoCase = 25; continue; };
+{ gotoCase = 26; continue; };
 }
 }
 } else {
 if (yych <= ',') {
-if (yych <= ')') { gotoCase = 26; continue; };
-if (yych <= '*') { gotoCase = 28; continue; };
-if (yych <= '+') { gotoCase = 29; continue; };
-{ gotoCase = 25; continue; };
+if (yych <= ')') {
+if (yych <= '(') { gotoCase = 27; continue; };
+{ gotoCase = 28; continue; };
+} else {
+if (yych <= '*') { gotoCase = 30; continue; };
+if (yych <= '+') { gotoCase = 31; continue; };
+{ gotoCase = 27; continue; };
+}
 } else {
 if (yych <= '.') {
-if (yych <= '-') { gotoCase = 30; continue; };
-{ gotoCase = 31; continue; };
+if (yych <= '-') { gotoCase = 32; continue; };
+{ gotoCase = 33; continue; };
 } else {
-if (yych <= '/') { gotoCase = 32; continue; };
-if (yych <= '0') { gotoCase = 34; continue; };
-{ gotoCase = 36; continue; };
+if (yych <= '/') { gotoCase = 34; continue; };
+if (yych <= '0') { gotoCase = 36; continue; };
+{ gotoCase = 38; continue; };
 }
 }
 }
 } else {
 if (yych <= '\\') {
 if (yych <= '>') {
-if (yych <= ';') { gotoCase = 25; continue; };
-if (yych <= '<') { gotoCase = 37; continue; };
-if (yych <= '=') { gotoCase = 38; continue; };
-{ gotoCase = 39; continue; };
+if (yych <= ';') { gotoCase = 27; continue; };
+if (yych <= '<') { gotoCase = 39; continue; };
+if (yych <= '=') { gotoCase = 40; continue; };
+{ gotoCase = 41; continue; };
 } else {
 if (yych <= '@') {
-if (yych <= '?') { gotoCase = 25; continue; };
+if (yych <= '?') { gotoCase = 27; continue; };
 } else {
-if (yych <= 'Z') { gotoCase = 20; continue; };
-if (yych <= '[') { gotoCase = 25; continue; };
-{ gotoCase = 40; continue; };
+if (yych <= 'Z') { gotoCase = 22; continue; };
+if (yych <= '[') { gotoCase = 27; continue; };
+{ gotoCase = 42; continue; };
 }
 }
 } else {
 if (yych <= 'z') {
 if (yych <= '^') {
-if (yych <= ']') { gotoCase = 25; continue; };
-{ gotoCase = 41; continue; };
+if (yych <= ']') { gotoCase = 27; continue; };
+{ gotoCase = 43; continue; };
 } else {
-if (yych != '`') { gotoCase = 20; continue; };
+if (yych != '`') { gotoCase = 22; continue; };
 }
 } else {
 if (yych <= '|') {
-if (yych <= '{') { gotoCase = 25; continue; };
-{ gotoCase = 42; continue; };
+if (yych <= '{') { gotoCase = 27; continue; };
+{ gotoCase = 44; continue; };
 } else {
-if (yych <= '~') { gotoCase = 25; continue; };
-if (yych >= 0x80) { gotoCase = 20; continue; };
+if (yych <= '~') { gotoCase = 27; continue; };
+if (yych >= 0x80) { gotoCase = 22; continue; };
 }
 }
 }
@@ -1201,8 +1217,14 @@
 { this.tokenType = null; return cursor; }
 case 17:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 115; continue; };
+yych = this._charAt(cursor);
+{ gotoCase = 119; continue; };
 case 18:
+{this.tokenType = "whitespace"; return cursor; }
+case 19:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 117; continue; };
+case 20:
 this.setLexCondition(this._lexConditions.NODIV);
 {
 var token = this._line.charAt(cursorOnEnter);
@@ -1210,472 +1232,476 @@
 this.tokenType = "block-start";
 else if (token === "}")
 this.tokenType = "block-end";
+else if (token === "(")
+this.tokenType = "brace-start";
 else this.tokenType = null;
 return cursor;
 }
-case 19:
+case 21:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych == '\n') { gotoCase = 16; continue; };
 if (yych == '\r') { gotoCase = 16; continue; };
-{ gotoCase = 107; continue; };
-case 20:
+{ gotoCase = 109; continue; };
+case 22:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 50; continue; };
-case 21:
+{ gotoCase = 52; continue; };
+case 23:
 {
 var token = this._line.substring(cursorOnEnter, cursor);
-if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
 this.tokenType = "javascript-keyword";
 else
 this.tokenType = "javascript-ident";
 return cursor;
 }
-case 22:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 23:
-yych = this._charAt(++cursor);
-if (yych == '&') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
 case 24:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 25:
+yych = this._charAt(++cursor);
+if (yych == '&') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 26:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych == '\n') { gotoCase = 16; continue; };
 if (yych == '\r') { gotoCase = 16; continue; };
-{ gotoCase = 96; continue; };
-case 25:
+{ gotoCase = 98; continue; };
+case 27:
 yych = this._charAt(++cursor);
-{ gotoCase = 18; continue; };
-case 26:
-++cursor;
-{ this.tokenType = null; return cursor; }
+{ gotoCase = 20; continue; };
 case 28:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 29:
-yych = this._charAt(++cursor);
-if (yych == '+') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+++cursor;
+{ this.tokenType = "brace-end"; return cursor; }
 case 30:
 yych = this._charAt(++cursor);
-if (yych == '-') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 31:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 18; continue; };
-if (yych <= '9') { gotoCase = 89; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '+') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 32:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 33:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 20; continue; };
+if (yych <= '9') { gotoCase = 91; continue; };
+{ gotoCase = 20; continue; };
+case 34:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '.') {
-if (yych == '*') { gotoCase = 78; continue; };
+if (yych == '*') { gotoCase = 80; continue; };
 } else {
-if (yych <= '/') { gotoCase = 80; continue; };
-if (yych == '=') { gotoCase = 77; continue; };
+if (yych <= '/') { gotoCase = 82; continue; };
+if (yych == '=') { gotoCase = 79; continue; };
 }
-case 33:
+case 35:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = null; return cursor; }
-case 34:
+case 36:
 yyaccept = 3;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'E') {
 if (yych <= '/') {
-if (yych == '.') { gotoCase = 63; continue; };
+if (yych == '.') { gotoCase = 65; continue; };
 } else {
-if (yych <= '7') { gotoCase = 72; continue; };
-if (yych >= 'E') { gotoCase = 62; continue; };
+if (yych <= '7') { gotoCase = 74; continue; };
+if (yych >= 'E') { gotoCase = 64; continue; };
 }
 } else {
 if (yych <= 'd') {
-if (yych == 'X') { gotoCase = 74; continue; };
+if (yych == 'X') { gotoCase = 76; continue; };
 } else {
-if (yych <= 'e') { gotoCase = 62; continue; };
-if (yych == 'x') { gotoCase = 74; continue; };
-}
-}
-case 35:
-{ this.tokenType = "javascript-number"; return cursor; }
-case 36:
-yyaccept = 3;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych <= '9') {
-if (yych == '.') { gotoCase = 63; continue; };
-if (yych <= '/') { gotoCase = 35; continue; };
-{ gotoCase = 60; continue; };
-} else {
-if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 35; continue; };
-{ gotoCase = 62; continue; };
-} else {
-if (yych == 'e') { gotoCase = 62; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= 'e') { gotoCase = 64; continue; };
+if (yych == 'x') { gotoCase = 76; continue; };
 }
 }
 case 37:
-yych = this._charAt(++cursor);
-if (yych <= ';') { gotoCase = 18; continue; };
-if (yych <= '<') { gotoCase = 59; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+{ this.tokenType = "javascript-number"; return cursor; }
 case 38:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 58; continue; };
-{ gotoCase = 18; continue; };
+yyaccept = 3;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 65; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+{ gotoCase = 62; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 37; continue; };
+{ gotoCase = 64; continue; };
+} else {
+if (yych == 'e') { gotoCase = 64; continue; };
+{ gotoCase = 37; continue; };
+}
+}
 case 39:
 yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 18; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-if (yych <= '>') { gotoCase = 56; continue; };
-{ gotoCase = 18; continue; };
+if (yych <= ';') { gotoCase = 20; continue; };
+if (yych <= '<') { gotoCase = 61; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 40:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == 'u') { gotoCase = 44; continue; };
-{ gotoCase = 16; continue; };
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 60; continue; };
+{ gotoCase = 20; continue; };
 case 41:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych <= '<') { gotoCase = 20; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+if (yych <= '>') { gotoCase = 58; continue; };
+{ gotoCase = 20; continue; };
 case 42:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-if (yych != '|') { gotoCase = 18; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 46; continue; };
+{ gotoCase = 16; continue; };
 case 43:
 yych = this._charAt(++cursor);
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 44:
 yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 46; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 46; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 46; continue; };
-}
+if (yych == '=') { gotoCase = 45; continue; };
+if (yych != '|') { gotoCase = 20; continue; };
 case 45:
+yych = this._charAt(++cursor);
+{ gotoCase = 20; continue; };
+case 46:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 48; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 48; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 48; continue; };
+}
+case 47:
 cursor = YYMARKER;
 if (yyaccept <= 1) {
 if (yyaccept <= 0) {
 { gotoCase = 16; continue; };
 } else {
-{ gotoCase = 21; continue; };
+{ gotoCase = 23; continue; };
 }
 } else {
 if (yyaccept <= 2) {
-{ gotoCase = 33; continue; };
-} else {
 { gotoCase = 35; continue; };
-}
-}
-case 46:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 47; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+{ gotoCase = 37; continue; };
 }
-case 47:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 48; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
 }
 case 48:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 49; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 49:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 50; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 50:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 51; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 51:
 yyaccept = 1;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 50:
+case 52:
 if (yych <= '[') {
 if (yych <= '/') {
-if (yych == '$') { gotoCase = 49; continue; };
-{ gotoCase = 21; continue; };
+if (yych == '$') { gotoCase = 51; continue; };
+{ gotoCase = 23; continue; };
 } else {
-if (yych <= '9') { gotoCase = 49; continue; };
-if (yych <= '@') { gotoCase = 21; continue; };
-if (yych <= 'Z') { gotoCase = 49; continue; };
-{ gotoCase = 21; continue; };
+if (yych <= '9') { gotoCase = 51; continue; };
+if (yych <= '@') { gotoCase = 23; continue; };
+if (yych <= 'Z') { gotoCase = 51; continue; };
+{ gotoCase = 23; continue; };
 }
 } else {
 if (yych <= '_') {
-if (yych <= '\\') { gotoCase = 51; continue; };
-if (yych <= '^') { gotoCase = 21; continue; };
-{ gotoCase = 49; continue; };
+if (yych <= '\\') { gotoCase = 53; continue; };
+if (yych <= '^') { gotoCase = 23; continue; };
+{ gotoCase = 51; continue; };
 } else {
-if (yych <= '`') { gotoCase = 21; continue; };
-if (yych <= 'z') { gotoCase = 49; continue; };
-if (yych <= String.fromCharCode(0x7F)) { gotoCase = 21; continue; };
-{ gotoCase = 49; continue; };
+if (yych <= '`') { gotoCase = 23; continue; };
+if (yych <= 'z') { gotoCase = 51; continue; };
+if (yych <= String.fromCharCode(0x7F)) { gotoCase = 23; continue; };
+{ gotoCase = 51; continue; };
 }
 }
-case 51:
-++cursor;
-yych = this._charAt(cursor);
-if (yych != 'u') { gotoCase = 45; continue; };
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 53; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 53:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 54; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 54:
+if (yych != 'u') { gotoCase = 47; continue; };
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 55; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 55:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 49; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 49; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 49; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 56; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 56:
-yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 18; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-if (yych >= '?') { gotoCase = 18; continue; };
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 57; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 57:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 51; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 51; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 51; continue; };
+{ gotoCase = 47; continue; };
+}
 case 58:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 59:
+if (yych <= '<') { gotoCase = 20; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+if (yych >= '?') { gotoCase = 20; continue; };
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 60:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 61:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 62:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 63; continue; };
-if (yych <= '/') { gotoCase = 35; continue; };
-{ gotoCase = 60; continue; };
+if (yych == '.') { gotoCase = 65; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+{ gotoCase = 62; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 35; continue; };
+if (yych <= 'D') { gotoCase = 37; continue; };
 } else {
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
 }
-case 62:
+case 64:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych == '+') { gotoCase = 69; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '+') { gotoCase = 71; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 69; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 70; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 71; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 72; continue; };
+{ gotoCase = 47; continue; };
 }
-case 63:
+case 65:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 63; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 65; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 65; continue; };
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych <= 'E') { gotoCase = 67; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
-case 65:
+case 67:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 45; continue; };
+if (yych != '+') { gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 66; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 67; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 68; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 69; continue; };
+{ gotoCase = 47; continue; };
 }
-case 66:
+case 68:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 67:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 67; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 69:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 70:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 70; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 69; continue; };
+{ gotoCase = 37; continue; };
+case 71:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 72:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '7') { gotoCase = 72; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 72; continue; };
+{ gotoCase = 37; continue; };
 case 74:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 75; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 75:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '7') { gotoCase = 74; continue; };
+{ gotoCase = 37; continue; };
+case 76:
+yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 75; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 75; continue; };
-if (yych <= '`') { gotoCase = 35; continue; };
-if (yych <= 'f') { gotoCase = 75; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= 'F') { gotoCase = 77; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 77:
-yych = this._charAt(++cursor);
-{ gotoCase = 33; continue; };
-case 78:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 85; continue; };
-{ gotoCase = 78; continue; };
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 77; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 85; continue; };
-if (yych == '*') { gotoCase = 83; continue; };
-{ gotoCase = 78; continue; };
+if (yych <= 'F') { gotoCase = 77; continue; };
+if (yych <= '`') { gotoCase = 37; continue; };
+if (yych <= 'f') { gotoCase = 77; continue; };
+{ gotoCase = 37; continue; };
 }
+case 79:
+yych = this._charAt(++cursor);
+{ gotoCase = 35; continue; };
 case 80:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 82; continue; };
-if (yych != '\r') { gotoCase = 80; continue; };
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 87; continue; };
+{ gotoCase = 80; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 87; continue; };
+if (yych == '*') { gotoCase = 85; continue; };
+{ gotoCase = 80; continue; };
+}
 case 82:
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 83:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '*') { gotoCase = 83; continue; };
-if (yych == '/') { gotoCase = 87; continue; };
-{ gotoCase = 78; continue; };
+if (yych == '\n') { gotoCase = 84; continue; };
+if (yych != '\r') { gotoCase = 82; continue; };
+case 84:
+{ this.tokenType = "javascript-comment"; return cursor; }
 case 85:
 ++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 85; continue; };
+if (yych == '/') { gotoCase = 89; continue; };
+{ gotoCase = 80; continue; };
+case 87:
+++cursor;
 this.setLexCondition(this._lexConditions.COMMENT);
 { this.tokenType = "javascript-comment"; return cursor; }
-case 87:
+case 89:
 ++cursor;
 { this.tokenType = "javascript-comment"; return cursor; }
-case 89:
+case 91:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 89; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 91; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 91; continue; };
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych <= 'E') { gotoCase = 93; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
-case 91:
+case 93:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 45; continue; };
+if (yych != '+') { gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 92; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 93; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 94; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 95; continue; };
+{ gotoCase = 47; continue; };
 }
-case 92:
+case 94:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 93:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 93; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 95:
 ++cursor;
 yych = this._charAt(cursor);
-case 96:
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 95; continue; };
+{ gotoCase = 37; continue; };
+case 97:
+++cursor;
+yych = this._charAt(cursor);
+case 98:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 45; continue; };
-if (yych <= '\f') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\n') { gotoCase = 47; continue; };
+if (yych <= '\f') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 95; continue; };
-{ gotoCase = 98; continue; };
+if (yych <= '&') { gotoCase = 97; continue; };
+{ gotoCase = 100; continue; };
 } else {
-if (yych != '\\') { gotoCase = 95; continue; };
+if (yych != '\\') { gotoCase = 97; continue; };
 }
 }
 ++cursor;
@@ -1683,112 +1709,112 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 45; continue; };
-{ gotoCase = 101; continue; };
+if (yych <= '\t') { gotoCase = 47; continue; };
+{ gotoCase = 103; continue; };
 } else {
-if (yych == '\r') { gotoCase = 101; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\r') { gotoCase = 103; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 95; continue; };
-if (yych <= '&') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych <= '"') { gotoCase = 97; continue; };
+if (yych <= '&') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych == '\\') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\\') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 95; continue; };
-if (yych <= 'e') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych <= 'b') { gotoCase = 97; continue; };
+if (yych <= 'e') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych == 'n') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == 'n') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych == 's') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 100; continue; };
-if (yych <= 'v') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'u') { gotoCase = 102; continue; };
+if (yych <= 'v') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 }
-case 98:
+case 100:
 ++cursor;
 { this.tokenType = "javascript-string"; return cursor; }
-case 100:
+case 102:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 103; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 105; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 103; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 103; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 105; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 105; continue; };
+{ gotoCase = 47; continue; };
 }
-case 101:
+case 103:
 ++cursor;
 this.setLexCondition(this._lexConditions.SSTRING);
 { this.tokenType = "javascript-string"; return cursor; }
-case 103:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 104; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 104:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 105; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 105:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 95; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 106; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 106:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 107; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
 case 107:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 97; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
+}
+case 108:
+++cursor;
+yych = this._charAt(cursor);
+case 109:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 45; continue; };
-if (yych <= '\f') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\n') { gotoCase = 47; continue; };
+if (yych <= '\f') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 106; continue; };
-{ gotoCase = 98; continue; };
+if (yych <= '!') { gotoCase = 108; continue; };
+{ gotoCase = 100; continue; };
 } else {
-if (yych != '\\') { gotoCase = 106; continue; };
+if (yych != '\\') { gotoCase = 108; continue; };
 }
 }
 ++cursor;
@@ -1796,1052 +1822,1072 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 45; continue; };
-{ gotoCase = 110; continue; };
+if (yych <= '\t') { gotoCase = 47; continue; };
+{ gotoCase = 112; continue; };
 } else {
-if (yych == '\r') { gotoCase = 110; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\r') { gotoCase = 112; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 106; continue; };
-if (yych <= '&') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych <= '"') { gotoCase = 108; continue; };
+if (yych <= '&') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych == '\\') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\\') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 106; continue; };
-if (yych <= 'e') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych <= 'b') { gotoCase = 108; continue; };
+if (yych <= 'e') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych == 'n') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == 'n') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych == 's') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 109; continue; };
-if (yych <= 'v') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'u') { gotoCase = 111; continue; };
+if (yych <= 'v') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 }
-case 109:
+case 111:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 112; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 114; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 112; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 112; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 114; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 114; continue; };
+{ gotoCase = 47; continue; };
 }
-case 110:
+case 112:
 ++cursor;
 this.setLexCondition(this._lexConditions.DSTRING);
 { this.tokenType = "javascript-string"; return cursor; }
-case 112:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 113; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 113:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 114; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 114:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 106; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 115; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 115:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 43; continue; };
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 116; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 116:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 108; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
+}
+case 117:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 118:
+++cursor;
+yych = this._charAt(cursor);
+case 119:
+if (yych == ' ') { gotoCase = 118; continue; };
 { gotoCase = 18; continue; };
 
 case this.case_DSTRING:
 yych = this._charAt(cursor);
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 120; continue; };
-if (yych <= '\f') { gotoCase = 119; continue; };
-{ gotoCase = 120; continue; };
+if (yych == '\n') { gotoCase = 124; continue; };
+if (yych <= '\f') { gotoCase = 123; continue; };
+{ gotoCase = 124; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 119; continue; };
-{ gotoCase = 122; continue; };
+if (yych <= '!') { gotoCase = 123; continue; };
+{ gotoCase = 126; continue; };
 } else {
-if (yych == '\\') { gotoCase = 124; continue; };
-{ gotoCase = 119; continue; };
+if (yych == '\\') { gotoCase = 128; continue; };
+{ gotoCase = 123; continue; };
 }
 }
-case 118:
+case 122:
 { this.tokenType = "javascript-string"; return cursor; }
-case 119:
+case 123:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 126; continue; };
-case 120:
+{ gotoCase = 130; continue; };
+case 124:
 ++cursor;
-case 121:
+case 125:
 { this.tokenType = null; return cursor; }
-case 122:
+case 126:
 ++cursor;
-case 123:
+case 127:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = "javascript-string"; return cursor; }
-case 124:
+case 128:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 125; continue; };
-if (yych <= '&') { gotoCase = 121; continue; };
+if (yych == '"') { gotoCase = 129; continue; };
+if (yych <= '&') { gotoCase = 125; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 121; continue; };
+if (yych <= '[') { gotoCase = 125; continue; };
 } else {
-if (yych != 'b') { gotoCase = 121; continue; };
+if (yych != 'b') { gotoCase = 125; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych >= 'g') { gotoCase = 121; continue; };
+if (yych >= 'g') { gotoCase = 125; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 125; continue; };
-if (yych <= 'q') { gotoCase = 121; continue; };
+if (yych <= 'n') { gotoCase = 129; continue; };
+if (yych <= 'q') { gotoCase = 125; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 121; continue; };
+if (yych <= 's') { gotoCase = 125; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 127; continue; };
-if (yych >= 'w') { gotoCase = 121; continue; };
+if (yych <= 'u') { gotoCase = 131; continue; };
+if (yych >= 'w') { gotoCase = 125; continue; };
 }
 }
 }
-case 125:
+case 129:
 yyaccept = 0;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 126:
+case 130:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 118; continue; };
-if (yych <= '\f') { gotoCase = 125; continue; };
-{ gotoCase = 118; continue; };
+if (yych == '\n') { gotoCase = 122; continue; };
+if (yych <= '\f') { gotoCase = 129; continue; };
+{ gotoCase = 122; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 125; continue; };
-{ gotoCase = 133; continue; };
+if (yych <= '!') { gotoCase = 129; continue; };
+{ gotoCase = 137; continue; };
 } else {
-if (yych == '\\') { gotoCase = 132; continue; };
-{ gotoCase = 125; continue; };
+if (yych == '\\') { gotoCase = 136; continue; };
+{ gotoCase = 129; continue; };
 }
 }
-case 127:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych <= '9') { gotoCase = 129; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 129; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych <= 'f') { gotoCase = 129; continue; };
-}
-case 128:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 118; continue; };
-} else {
-{ gotoCase = 121; continue; };
-}
-case 129:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych >= ':') { gotoCase = 128; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 130; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych >= 'g') { gotoCase = 128; continue; };
-}
-case 130:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych >= ':') { gotoCase = 128; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 131; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych >= 'g') { gotoCase = 128; continue; };
-}
 case 131:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych <= '9') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych <= '9') { gotoCase = 133; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 125; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych <= 'f') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'F') { gotoCase = 133; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych <= 'f') { gotoCase = 133; continue; };
 }
 case 132:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 122; continue; };
+} else {
+{ gotoCase = 125; continue; };
+}
+case 133:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych >= ':') { gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 134; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych >= 'g') { gotoCase = 132; continue; };
+}
+case 134:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych >= ':') { gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 135; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych >= 'g') { gotoCase = 132; continue; };
+}
+case 135:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych <= '9') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 129; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych <= 'f') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
+}
+case 136:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 125; continue; };
-if (yych <= '&') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych == '"') { gotoCase = 129; continue; };
+if (yych <= '&') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= '[') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
-if (yych == 'b') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych == 'b') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych <= 'f') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'f') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 125; continue; };
-if (yych <= 'q') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= 'n') { gotoCase = 129; continue; };
+if (yych <= 'q') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= 's') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 127; continue; };
-if (yych <= 'v') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'u') { gotoCase = 131; continue; };
+if (yych <= 'v') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 }
 }
 }
-case 133:
+case 137:
 ++cursor;
 yych = this._charAt(cursor);
-{ gotoCase = 123; continue; };
+{ gotoCase = 127; continue; };
 
 case this.case_NODIV:
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych <= '(') {
-if (yych <= '#') {
-if (yych <= ' ') { gotoCase = 136; continue; };
-if (yych <= '!') { gotoCase = 138; continue; };
-if (yych <= '"') { gotoCase = 140; continue; };
-} else {
-if (yych <= '%') {
-if (yych <= '$') { gotoCase = 141; continue; };
-{ gotoCase = 143; continue; };
-} else {
-if (yych <= '&') { gotoCase = 144; continue; };
-if (yych <= '\'') { gotoCase = 145; continue; };
+if (yych <= '\'') {
+if (yych <= '"') {
+if (yych <= String.fromCharCode(0x1F)) { gotoCase = 140; continue; };
+if (yych <= ' ') { gotoCase = 142; continue; };
+if (yych <= '!') { gotoCase = 144; continue; };
 { gotoCase = 146; continue; };
+} else {
+if (yych <= '$') {
+if (yych >= '$') { gotoCase = 147; continue; };
+} else {
+if (yych <= '%') { gotoCase = 149; continue; };
+if (yych <= '&') { gotoCase = 150; continue; };
+{ gotoCase = 151; continue; };
 }
 }
 } else {
 if (yych <= ',') {
-if (yych <= ')') { gotoCase = 147; continue; };
-if (yych <= '*') { gotoCase = 149; continue; };
-if (yych <= '+') { gotoCase = 150; continue; };
-{ gotoCase = 146; continue; };
+if (yych <= ')') {
+if (yych <= '(') { gotoCase = 152; continue; };
+{ gotoCase = 153; continue; };
+} else {
+if (yych <= '*') { gotoCase = 155; continue; };
+if (yych <= '+') { gotoCase = 156; continue; };
+{ gotoCase = 152; continue; };
+}
 } else {
 if (yych <= '.') {
-if (yych <= '-') { gotoCase = 151; continue; };
-{ gotoCase = 152; continue; };
+if (yych <= '-') { gotoCase = 157; continue; };
+{ gotoCase = 158; continue; };
 } else {
-if (yych <= '/') { gotoCase = 153; continue; };
-if (yych <= '0') { gotoCase = 154; continue; };
-{ gotoCase = 156; continue; };
+if (yych <= '/') { gotoCase = 159; continue; };
+if (yych <= '0') { gotoCase = 160; continue; };
+{ gotoCase = 162; continue; };
 }
 }
 }
 } else {
 if (yych <= '\\') {
 if (yych <= '>') {
-if (yych <= ';') { gotoCase = 146; continue; };
-if (yych <= '<') { gotoCase = 157; continue; };
-if (yych <= '=') { gotoCase = 158; continue; };
-{ gotoCase = 159; continue; };
+if (yych <= ';') { gotoCase = 152; continue; };
+if (yych <= '<') { gotoCase = 163; continue; };
+if (yych <= '=') { gotoCase = 164; continue; };
+{ gotoCase = 165; continue; };
 } else {
 if (yych <= '@') {
-if (yych <= '?') { gotoCase = 146; continue; };
+if (yych <= '?') { gotoCase = 152; continue; };
 } else {
-if (yych <= 'Z') { gotoCase = 141; continue; };
-if (yych <= '[') { gotoCase = 146; continue; };
-{ gotoCase = 160; continue; };
+if (yych <= 'Z') { gotoCase = 147; continue; };
+if (yych <= '[') { gotoCase = 152; continue; };
+{ gotoCase = 166; continue; };
 }
 }
 } else {
 if (yych <= 'z') {
 if (yych <= '^') {
-if (yych <= ']') { gotoCase = 146; continue; };
-{ gotoCase = 161; continue; };
+if (yych <= ']') { gotoCase = 152; continue; };
+{ gotoCase = 167; continue; };
 } else {
-if (yych != '`') { gotoCase = 141; continue; };
+if (yych != '`') { gotoCase = 147; continue; };
 }
 } else {
 if (yych <= '|') {
-if (yych <= '{') { gotoCase = 146; continue; };
-{ gotoCase = 162; continue; };
+if (yych <= '{') { gotoCase = 152; continue; };
+{ gotoCase = 168; continue; };
 } else {
-if (yych <= '~') { gotoCase = 146; continue; };
-if (yych >= 0x80) { gotoCase = 141; continue; };
+if (yych <= '~') { gotoCase = 152; continue; };
+if (yych >= 0x80) { gotoCase = 147; continue; };
 }
 }
 }
 }
-case 136:
+case 140:
 ++cursor;
-case 137:
+case 141:
 { this.tokenType = null; return cursor; }
-case 138:
+case 142:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 260; continue; };
-case 139:
+yych = this._charAt(cursor);
+{ gotoCase = 268; continue; };
+case 143:
+{this.tokenType = "whitespace"; return cursor; }
+case 144:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 266; continue; };
+case 145:
 {
 var token = this._line.charAt(cursorOnEnter);
 if (token === "{")
 this.tokenType = "block-start";
 else if (token === "}")
 this.tokenType = "block-end";
+else if (token === "(")
+this.tokenType = "brace-start";
 else this.tokenType = null;
 return cursor;
 }
-case 140:
+case 146:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-if (yych == '\n') { gotoCase = 137; continue; };
-if (yych == '\r') { gotoCase = 137; continue; };
-{ gotoCase = 252; continue; };
-case 141:
+if (yych == '\n') { gotoCase = 141; continue; };
+if (yych == '\r') { gotoCase = 141; continue; };
+{ gotoCase = 258; continue; };
+case 147:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 170; continue; };
-case 142:
+{ gotoCase = 176; continue; };
+case 148:
 this.setLexCondition(this._lexConditions.DIV);
 {
 var token = this._line.substring(cursorOnEnter, cursor);
-if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
 this.tokenType = "javascript-keyword";
 else
 this.tokenType = "javascript-ident";
 return cursor;
 }
-case 143:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 144:
-yych = this._charAt(++cursor);
-if (yych == '&') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 145:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == '\n') { gotoCase = 137; continue; };
-if (yych == '\r') { gotoCase = 137; continue; };
-{ gotoCase = 241; continue; };
-case 146:
-yych = this._charAt(++cursor);
-{ gotoCase = 139; continue; };
-case 147:
-++cursor;
-this.setLexCondition(this._lexConditions.DIV);
-{ this.tokenType = null; return cursor; }
 case 149:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 150:
 yych = this._charAt(++cursor);
-if (yych == '+') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+if (yych == '&') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 151:
-yych = this._charAt(++cursor);
-if (yych == '-') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 141; continue; };
+if (yych == '\r') { gotoCase = 141; continue; };
+{ gotoCase = 247; continue; };
 case 152:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 139; continue; };
-if (yych <= '9') { gotoCase = 234; continue; };
-{ gotoCase = 139; continue; };
+{ gotoCase = 145; continue; };
 case 153:
+++cursor;
+this.setLexCondition(this._lexConditions.DIV);
+{ this.tokenType = "brace-end"; return cursor; }
+case 155:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 156:
+yych = this._charAt(++cursor);
+if (yych == '+') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 157:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 158:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 145; continue; };
+if (yych <= '9') { gotoCase = 240; continue; };
+{ gotoCase = 145; continue; };
+case 159:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 137; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '\n') { gotoCase = 141; continue; };
+{ gotoCase = 203; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 137; continue; };
-if (yych <= ')') { gotoCase = 197; continue; };
-{ gotoCase = 202; continue; };
+if (yych <= '\r') { gotoCase = 141; continue; };
+if (yych <= ')') { gotoCase = 203; continue; };
+{ gotoCase = 208; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 204; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '/') { gotoCase = 210; continue; };
+{ gotoCase = 203; continue; };
 } else {
-if (yych <= '[') { gotoCase = 200; continue; };
-if (yych <= '\\') { gotoCase = 199; continue; };
-if (yych <= ']') { gotoCase = 137; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '[') { gotoCase = 206; continue; };
+if (yych <= '\\') { gotoCase = 205; continue; };
+if (yych <= ']') { gotoCase = 141; continue; };
+{ gotoCase = 203; continue; };
 }
 }
-case 154:
+case 160:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'E') {
 if (yych <= '/') {
-if (yych == '.') { gotoCase = 183; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
 } else {
-if (yych <= '7') { gotoCase = 192; continue; };
-if (yych >= 'E') { gotoCase = 182; continue; };
+if (yych <= '7') { gotoCase = 198; continue; };
+if (yych >= 'E') { gotoCase = 188; continue; };
 }
 } else {
 if (yych <= 'd') {
-if (yych == 'X') { gotoCase = 194; continue; };
+if (yych == 'X') { gotoCase = 200; continue; };
 } else {
-if (yych <= 'e') { gotoCase = 182; continue; };
-if (yych == 'x') { gotoCase = 194; continue; };
+if (yych <= 'e') { gotoCase = 188; continue; };
+if (yych == 'x') { gotoCase = 200; continue; };
 }
 }
-case 155:
+case 161:
 this.setLexCondition(this._lexConditions.DIV);
 { this.tokenType = "javascript-number"; return cursor; }
-case 156:
+case 162:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 183; continue; };
-if (yych <= '/') { gotoCase = 155; continue; };
-{ gotoCase = 180; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+{ gotoCase = 186; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 155; continue; };
-{ gotoCase = 182; continue; };
+if (yych <= 'D') { gotoCase = 161; continue; };
+{ gotoCase = 188; continue; };
 } else {
-if (yych == 'e') { gotoCase = 182; continue; };
-{ gotoCase = 155; continue; };
+if (yych == 'e') { gotoCase = 188; continue; };
+{ gotoCase = 161; continue; };
 }
 }
-case 157:
-yych = this._charAt(++cursor);
-if (yych <= ';') { gotoCase = 139; continue; };
-if (yych <= '<') { gotoCase = 179; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 158:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 178; continue; };
-{ gotoCase = 139; continue; };
-case 159:
-yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 139; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-if (yych <= '>') { gotoCase = 176; continue; };
-{ gotoCase = 139; continue; };
-case 160:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == 'u') { gotoCase = 164; continue; };
-{ gotoCase = 137; continue; };
-case 161:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 162:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-if (yych != '|') { gotoCase = 139; continue; };
 case 163:
 yych = this._charAt(++cursor);
-{ gotoCase = 139; continue; };
+if (yych <= ';') { gotoCase = 145; continue; };
+if (yych <= '<') { gotoCase = 185; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 164:
 yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 166; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 166; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 166; continue; };
-}
+if (yych == '=') { gotoCase = 184; continue; };
+{ gotoCase = 145; continue; };
 case 165:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 145; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+if (yych <= '>') { gotoCase = 182; continue; };
+{ gotoCase = 145; continue; };
+case 166:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 170; continue; };
+{ gotoCase = 141; continue; };
+case 167:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 168:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+if (yych != '|') { gotoCase = 145; continue; };
+case 169:
+yych = this._charAt(++cursor);
+{ gotoCase = 145; continue; };
+case 170:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 172; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 172; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 172; continue; };
+}
+case 171:
 cursor = YYMARKER;
 if (yyaccept <= 1) {
 if (yyaccept <= 0) {
-{ gotoCase = 137; continue; };
+{ gotoCase = 141; continue; };
 } else {
-{ gotoCase = 142; continue; };
+{ gotoCase = 148; continue; };
 }
 } else {
 if (yyaccept <= 2) {
-{ gotoCase = 155; continue; };
+{ gotoCase = 161; continue; };
 } else {
-{ gotoCase = 217; continue; };
+{ gotoCase = 223; continue; };
 }
 }
-case 166:
+case 172:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 167; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 173; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 167:
+case 173:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 168; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 174; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 168:
+case 174:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 169; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 175; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 169:
+case 175:
 yyaccept = 1;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 170:
+case 176:
 if (yych <= '[') {
 if (yych <= '/') {
-if (yych == '$') { gotoCase = 169; continue; };
-{ gotoCase = 142; continue; };
+if (yych == '$') { gotoCase = 175; continue; };
+{ gotoCase = 148; continue; };
 } else {
-if (yych <= '9') { gotoCase = 169; continue; };
-if (yych <= '@') { gotoCase = 142; continue; };
-if (yych <= 'Z') { gotoCase = 169; continue; };
-{ gotoCase = 142; continue; };
+if (yych <= '9') { gotoCase = 175; continue; };
+if (yych <= '@') { gotoCase = 148; continue; };
+if (yych <= 'Z') { gotoCase = 175; continue; };
+{ gotoCase = 148; continue; };
 }
 } else {
 if (yych <= '_') {
-if (yych <= '\\') { gotoCase = 171; continue; };
-if (yych <= '^') { gotoCase = 142; continue; };
-{ gotoCase = 169; continue; };
+if (yych <= '\\') { gotoCase = 177; continue; };
+if (yych <= '^') { gotoCase = 148; continue; };
+{ gotoCase = 175; continue; };
 } else {
-if (yych <= '`') { gotoCase = 142; continue; };
-if (yych <= 'z') { gotoCase = 169; continue; };
-if (yych <= String.fromCharCode(0x7F)) { gotoCase = 142; continue; };
-{ gotoCase = 169; continue; };
+if (yych <= '`') { gotoCase = 148; continue; };
+if (yych <= 'z') { gotoCase = 175; continue; };
+if (yych <= String.fromCharCode(0x7F)) { gotoCase = 148; continue; };
+{ gotoCase = 175; continue; };
 }
 }
-case 171:
+case 177:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych != 'u') { gotoCase = 165; continue; };
+if (yych != 'u') { gotoCase = 171; continue; };
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 173; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 179; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 173:
+case 179:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 174; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 180; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 174:
+case 180:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 181; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 181:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 175; continue; };
+{ gotoCase = 171; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 175; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 175; continue; };
+{ gotoCase = 171; continue; };
 }
-case 175:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 169; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 169; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 169; continue; };
-{ gotoCase = 165; continue; };
-}
-case 176:
+case 182:
 yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 139; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-if (yych >= '?') { gotoCase = 139; continue; };
+if (yych <= '<') { gotoCase = 145; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+if (yych >= '?') { gotoCase = 145; continue; };
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 178:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 184:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 179:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 185:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 180:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 186:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 183; continue; };
-if (yych <= '/') { gotoCase = 155; continue; };
-{ gotoCase = 180; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+{ gotoCase = 186; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 155; continue; };
+if (yych <= 'D') { gotoCase = 161; continue; };
 } else {
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
 }
-case 182:
+case 188:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych == '+') { gotoCase = 189; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '+') { gotoCase = 195; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 189; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 190; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 195; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 196; continue; };
+{ gotoCase = 171; continue; };
 }
-case 183:
+case 189:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 183; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 189; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 185; continue; };
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych <= 'E') { gotoCase = 191; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
-case 185:
+case 191:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 165; continue; };
+if (yych != '+') { gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 186; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 187; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 192; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 193; continue; };
+{ gotoCase = 171; continue; };
 }
-case 186:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 187:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 187; continue; };
-{ gotoCase = 155; continue; };
-case 189:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 190:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 190; continue; };
-{ gotoCase = 155; continue; };
 case 192:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 193:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '7') { gotoCase = 192; continue; };
-{ gotoCase = 155; continue; };
-case 194:
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 193; continue; };
+{ gotoCase = 161; continue; };
+case 195:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 196:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 196; continue; };
+{ gotoCase = 161; continue; };
+case 198:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '7') { gotoCase = 198; continue; };
+{ gotoCase = 161; continue; };
+case 200:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 195; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 201; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 195:
+case 201:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 195; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 201; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 195; continue; };
-if (yych <= '`') { gotoCase = 155; continue; };
-if (yych <= 'f') { gotoCase = 195; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= 'F') { gotoCase = 201; continue; };
+if (yych <= '`') { gotoCase = 161; continue; };
+if (yych <= 'f') { gotoCase = 201; continue; };
+{ gotoCase = 161; continue; };
 }
-case 197:
+case 203:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '.') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 197; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\t') { gotoCase = 203; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych <= '/') { gotoCase = 220; continue; };
-if (yych <= 'Z') { gotoCase = 197; continue; };
-{ gotoCase = 228; continue; };
+if (yych <= '/') { gotoCase = 226; continue; };
+if (yych <= 'Z') { gotoCase = 203; continue; };
+{ gotoCase = 234; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 227; continue; };
-if (yych <= ']') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\\') { gotoCase = 233; continue; };
+if (yych <= ']') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
 }
 }
-case 199:
+case 205:
 yych = this._charAt(++cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
-case 200:
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
+case 206:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 200; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 206; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 215; continue; };
-if (yych <= ']') { gotoCase = 213; continue; };
-{ gotoCase = 200; continue; };
+if (yych <= '\\') { gotoCase = 221; continue; };
+if (yych <= ']') { gotoCase = 219; continue; };
+{ gotoCase = 206; continue; };
 }
 }
-case 202:
+case 208:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 209; continue; };
-{ gotoCase = 202; continue; };
+if (yych == '\n') { gotoCase = 215; continue; };
+{ gotoCase = 208; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 209; continue; };
-if (yych == '*') { gotoCase = 207; continue; };
-{ gotoCase = 202; continue; };
+if (yych <= '\r') { gotoCase = 215; continue; };
+if (yych == '*') { gotoCase = 213; continue; };
+{ gotoCase = 208; continue; };
 }
-case 204:
+case 210:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 206; continue; };
-if (yych != '\r') { gotoCase = 204; continue; };
-case 206:
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 207:
-++cursor;
-yych = this._charAt(cursor);
-if (yych == '*') { gotoCase = 207; continue; };
-if (yych == '/') { gotoCase = 211; continue; };
-{ gotoCase = 202; continue; };
-case 209:
-++cursor;
-this.setLexCondition(this._lexConditions.COMMENT);
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 211:
-++cursor;
+if (yych == '\n') { gotoCase = 212; continue; };
+if (yych != '\r') { gotoCase = 210; continue; };
+case 212:
 { this.tokenType = "javascript-comment"; return cursor; }
 case 213:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 213; continue; };
+if (yych == '/') { gotoCase = 217; continue; };
+{ gotoCase = 208; continue; };
+case 215:
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 217:
+++cursor;
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 219:
+++cursor;
+yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 213; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 219; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 213; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 219; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 213; continue; };
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 219; continue; };
 } else {
-if (yych <= '[') { gotoCase = 218; continue; };
-if (yych <= '\\') { gotoCase = 216; continue; };
-{ gotoCase = 213; continue; };
+if (yych <= '[') { gotoCase = 224; continue; };
+if (yych <= '\\') { gotoCase = 222; continue; };
+{ gotoCase = 219; continue; };
 }
 }
-case 215:
+case 221:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
-case 216:
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
+case 222:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych != '\r') { gotoCase = 213; continue; };
-case 217:
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych != '\r') { gotoCase = 219; continue; };
+case 223:
 this.setLexCondition(this._lexConditions.REGEX);
 { this.tokenType = "javascript-regexp"; return cursor; }
-case 218:
+case 224:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 218; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 224; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 225; continue; };
-if (yych <= ']') { gotoCase = 223; continue; };
-{ gotoCase = 218; continue; };
+if (yych <= '\\') { gotoCase = 231; continue; };
+if (yych <= ']') { gotoCase = 229; continue; };
+{ gotoCase = 224; continue; };
 }
 }
-case 220:
+case 226:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'h') {
-if (yych == 'g') { gotoCase = 220; continue; };
+if (yych == 'g') { gotoCase = 226; continue; };
 } else {
-if (yych <= 'i') { gotoCase = 220; continue; };
-if (yych == 'm') { gotoCase = 220; continue; };
+if (yych <= 'i') { gotoCase = 226; continue; };
+if (yych == 'm') { gotoCase = 226; continue; };
 }
 { this.tokenType = "javascript-regexp"; return cursor; }
-case 223:
+case 229:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 223; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 229; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 223; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 229; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 223; continue; };
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 229; continue; };
 } else {
-if (yych <= '[') { gotoCase = 218; continue; };
-if (yych <= '\\') { gotoCase = 226; continue; };
-{ gotoCase = 223; continue; };
-}
-}
-case 225:
-++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
-case 226:
-yyaccept = 3;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 223; continue; };
-case 227:
-yyaccept = 3;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 197; continue; };
-case 228:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 228; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
-} else {
+if (yych <= '[') { gotoCase = 224; continue; };
 if (yych <= '\\') { gotoCase = 232; continue; };
-if (yych >= '^') { gotoCase = 228; continue; };
+{ gotoCase = 229; continue; };
 }
 }
-case 230:
+case 231:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 230; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 230; continue; };
-{ gotoCase = 197; continue; };
-}
-} else {
-if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 230; continue; };
-} else {
-if (yych <= '[') { gotoCase = 228; continue; };
-if (yych <= '\\') { gotoCase = 233; continue; };
-{ gotoCase = 230; continue; };
-}
-}
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 case 232:
-++cursor;
+yyaccept = 3;
+YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 229; continue; };
 case 233:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 230; continue; };
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 203; continue; };
 case 234:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 234; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 238; continue; };
+if (yych >= '^') { gotoCase = 234; continue; };
+}
+}
+case 236:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 236; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 236; continue; };
+{ gotoCase = 203; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 236; continue; };
+} else {
+if (yych <= '[') { gotoCase = 234; continue; };
+if (yych <= '\\') { gotoCase = 239; continue; };
+{ gotoCase = 236; continue; };
+}
+}
+case 238:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+case 239:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 236; continue; };
+case 240:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 234; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 240; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 236; continue; };
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych <= 'E') { gotoCase = 242; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
-case 236:
+case 242:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 165; continue; };
+if (yych != '+') { gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 237; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 238; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 243; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 244; continue; };
+{ gotoCase = 171; continue; };
 }
-case 237:
+case 243:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 238:
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 244:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 238; continue; };
-{ gotoCase = 155; continue; };
-case 240:
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 244; continue; };
+{ gotoCase = 161; continue; };
+case 246:
 ++cursor;
 yych = this._charAt(cursor);
-case 241:
+case 247:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych <= '\f') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych <= '\f') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 240; continue; };
-{ gotoCase = 243; continue; };
+if (yych <= '&') { gotoCase = 246; continue; };
+{ gotoCase = 249; continue; };
 } else {
-if (yych != '\\') { gotoCase = 240; continue; };
+if (yych != '\\') { gotoCase = 246; continue; };
 }
 }
 ++cursor;
@@ -2849,552 +2895,558 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 165; continue; };
-{ gotoCase = 246; continue; };
+if (yych <= '\t') { gotoCase = 171; continue; };
+{ gotoCase = 252; continue; };
 } else {
-if (yych == '\r') { gotoCase = 246; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 252; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 240; continue; };
-if (yych <= '&') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych <= '"') { gotoCase = 246; continue; };
+if (yych <= '&') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych == '\\') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\\') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 240; continue; };
-if (yych <= 'e') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych <= 'b') { gotoCase = 246; continue; };
+if (yych <= 'e') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych == 'n') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == 'n') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych == 's') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 245; continue; };
-if (yych <= 'v') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'u') { gotoCase = 251; continue; };
+if (yych <= 'v') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 }
 }
-case 243:
-++cursor;
-{ this.tokenType = "javascript-string"; return cursor; }
-case 245:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 248; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 248; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 248; continue; };
-{ gotoCase = 165; continue; };
-}
-case 246:
-++cursor;
-this.setLexCondition(this._lexConditions.SSTRING);
-{ this.tokenType = "javascript-string"; return cursor; }
-case 248:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 249; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
 case 249:
 ++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 250; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
-case 250:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 240; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
-}
+{ this.tokenType = "javascript-string"; return cursor; }
 case 251:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 254; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 254; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 254; continue; };
+{ gotoCase = 171; continue; };
+}
 case 252:
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych <= '\f') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= '"') {
-if (yych <= '!') { gotoCase = 251; continue; };
-{ gotoCase = 243; continue; };
-} else {
-if (yych != '\\') { gotoCase = 251; continue; };
-}
-}
 ++cursor;
-yych = this._charAt(cursor);
-if (yych <= 'a') {
-if (yych <= '!') {
-if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 165; continue; };
-{ gotoCase = 255; continue; };
-} else {
-if (yych == '\r') { gotoCase = 255; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 251; continue; };
-if (yych <= '&') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych == '\\') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-}
-} else {
-if (yych <= 'q') {
-if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 251; continue; };
-if (yych <= 'e') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych == 'n') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= 't') {
-if (yych == 's') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych <= 'u') { gotoCase = 254; continue; };
-if (yych <= 'v') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-}
-}
+this.setLexCondition(this._lexConditions.SSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
 case 254:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 257; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 257; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 257; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 255; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
 case 255:
 ++cursor;
-this.setLexCondition(this._lexConditions.DSTRING);
-{ this.tokenType = "javascript-string"; return cursor; }
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 256; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 256:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 246; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
+}
 case 257:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 258; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
 case 258:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych <= '\f') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 259; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 257; continue; };
+{ gotoCase = 249; continue; };
+} else {
+if (yych != '\\') { gotoCase = 257; continue; };
 }
-case 259:
+}
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 171; continue; };
+{ gotoCase = 261; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 251; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 261; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 257; continue; };
+if (yych <= '&') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych == '\\') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 257; continue; };
+if (yych <= 'e') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych == 'n') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 260; continue; };
+if (yych <= 'v') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+}
 }
 case 260:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 263; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 263; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 263; continue; };
+{ gotoCase = 171; continue; };
+}
+case 261:
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 263:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 264; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 264:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 265; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 265:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 257; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+case 266:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 267:
+++cursor;
+yych = this._charAt(cursor);
+case 268:
+if (yych == ' ') { gotoCase = 267; continue; };
+{ gotoCase = 143; continue; };
 
 case this.case_REGEX:
 yych = this._charAt(cursor);
 if (yych <= '.') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 264; continue; };
-{ gotoCase = 265; continue; };
+if (yych <= '\t') { gotoCase = 272; continue; };
+{ gotoCase = 273; continue; };
 } else {
-if (yych == '\r') { gotoCase = 265; continue; };
-{ gotoCase = 264; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych <= '/') { gotoCase = 267; continue; };
-if (yych <= 'Z') { gotoCase = 264; continue; };
-{ gotoCase = 269; continue; };
-} else {
-if (yych <= '\\') { gotoCase = 270; continue; };
-if (yych <= ']') { gotoCase = 265; continue; };
-{ gotoCase = 264; continue; };
-}
-}
-case 263:
-{ this.tokenType = "javascript-regexp"; return cursor; }
-case 264:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\r') { gotoCase = 273; continue; };
 { gotoCase = 272; continue; };
-case 265:
-++cursor;
-case 266:
-{ this.tokenType = null; return cursor; }
-case 267:
-++cursor;
-yych = this._charAt(cursor);
-{ gotoCase = 278; continue; };
-case 268:
-this.setLexCondition(this._lexConditions.NODIV);
-{ this.tokenType = "javascript-regexp"; return cursor; }
-case 269:
-yyaccept = 1;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 266; continue; };
-if (yych <= '\f') { gotoCase = 276; continue; };
-{ gotoCase = 266; continue; };
-} else {
-if (yych <= '*') {
-if (yych <= ')') { gotoCase = 276; continue; };
-{ gotoCase = 266; continue; };
-} else {
-if (yych == '/') { gotoCase = 266; continue; };
-{ gotoCase = 276; continue; };
-}
-}
-case 270:
-yych = this._charAt(++cursor);
-if (yych == '\n') { gotoCase = 266; continue; };
-if (yych == '\r') { gotoCase = 266; continue; };
-case 271:
-yyaccept = 0;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-case 272:
-if (yych <= '.') {
-if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 271; continue; };
-{ gotoCase = 263; continue; };
-} else {
-if (yych == '\r') { gotoCase = 263; continue; };
-{ gotoCase = 271; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych <= '/') { gotoCase = 277; continue; };
-if (yych <= 'Z') { gotoCase = 271; continue; };
-{ gotoCase = 275; continue; };
+if (yych <= '/') { gotoCase = 275; continue; };
+if (yych <= 'Z') { gotoCase = 272; continue; };
+{ gotoCase = 277; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 273; continue; };
-if (yych <= ']') { gotoCase = 263; continue; };
-{ gotoCase = 271; continue; };
+if (yych <= '\\') { gotoCase = 278; continue; };
+if (yych <= ']') { gotoCase = 273; continue; };
+{ gotoCase = 272; continue; };
 }
 }
+case 271:
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 272:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 280; continue; };
 case 273:
 ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych != '\r') { gotoCase = 271; continue; };
 case 274:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 263; continue; };
-} else {
-{ gotoCase = 266; continue; };
-}
+{ this.tokenType = null; return cursor; }
 case 275:
 ++cursor;
 yych = this._charAt(cursor);
+{ gotoCase = 286; continue; };
 case 276:
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 274; continue; };
-if (yych <= ')') { gotoCase = 275; continue; };
-{ gotoCase = 274; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych == '/') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
-} else {
-if (yych <= '\\') { gotoCase = 281; continue; };
-if (yych <= ']') { gotoCase = 279; continue; };
-{ gotoCase = 275; continue; };
-}
-}
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-regexp"; return cursor; }
 case 277:
-++cursor;
-yych = this._charAt(cursor);
-case 278:
-if (yych <= 'h') {
-if (yych == 'g') { gotoCase = 277; continue; };
-{ gotoCase = 268; continue; };
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych <= '\f') { gotoCase = 284; continue; };
+{ gotoCase = 274; continue; };
 } else {
-if (yych <= 'i') { gotoCase = 277; continue; };
-if (yych == 'm') { gotoCase = 277; continue; };
-{ gotoCase = 268; continue; };
+if (yych <= '*') {
+if (yych <= ')') { gotoCase = 284; continue; };
+{ gotoCase = 274; continue; };
+} else {
+if (yych == '/') { gotoCase = 274; continue; };
+{ gotoCase = 284; continue; };
 }
+}
+case 278:
+yych = this._charAt(++cursor);
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych == '\r') { gotoCase = 274; continue; };
 case 279:
 yyaccept = 0;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 263; continue; };
-{ gotoCase = 279; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 263; continue; };
-if (yych <= ')') { gotoCase = 279; continue; };
+case 280:
+if (yych <= '.') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 279; continue; };
 { gotoCase = 271; continue; };
+} else {
+if (yych == '\r') { gotoCase = 271; continue; };
+{ gotoCase = 279; continue; };
 }
 } else {
-if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 277; continue; };
-{ gotoCase = 279; continue; };
+if (yych <= '[') {
+if (yych <= '/') { gotoCase = 285; continue; };
+if (yych <= 'Z') { gotoCase = 279; continue; };
+{ gotoCase = 283; continue; };
 } else {
-if (yych <= '[') { gotoCase = 275; continue; };
-if (yych <= '\\') { gotoCase = 282; continue; };
+if (yych <= '\\') { gotoCase = 281; continue; };
+if (yych <= ']') { gotoCase = 271; continue; };
 { gotoCase = 279; continue; };
 }
 }
 case 281:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych == '\r') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych != '\r') { gotoCase = 279; continue; };
 case 282:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 271; continue; };
+} else {
+{ gotoCase = 274; continue; };
+}
+case 283:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych == '\r') { gotoCase = 274; continue; };
+case 284:
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 282; continue; };
+if (yych <= ')') { gotoCase = 283; continue; };
+{ gotoCase = 282; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 289; continue; };
+if (yych <= ']') { gotoCase = 287; continue; };
+{ gotoCase = 283; continue; };
+}
+}
+case 285:
+++cursor;
+yych = this._charAt(cursor);
+case 286:
+if (yych <= 'h') {
+if (yych == 'g') { gotoCase = 285; continue; };
+{ gotoCase = 276; continue; };
+} else {
+if (yych <= 'i') { gotoCase = 285; continue; };
+if (yych == 'm') { gotoCase = 285; continue; };
+{ gotoCase = 276; continue; };
+}
+case 287:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 271; continue; };
+{ gotoCase = 287; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 271; continue; };
+if (yych <= ')') { gotoCase = 287; continue; };
 { gotoCase = 279; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 285; continue; };
+{ gotoCase = 287; continue; };
+} else {
+if (yych <= '[') { gotoCase = 283; continue; };
+if (yych <= '\\') { gotoCase = 290; continue; };
+{ gotoCase = 287; continue; };
+}
+}
+case 289:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych == '\r') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+case 290:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych == '\r') { gotoCase = 282; continue; };
+{ gotoCase = 287; continue; };
 
 case this.case_SSTRING:
 yych = this._charAt(cursor);
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 287; continue; };
-if (yych <= '\f') { gotoCase = 286; continue; };
-{ gotoCase = 287; continue; };
+if (yych == '\n') { gotoCase = 295; continue; };
+if (yych <= '\f') { gotoCase = 294; continue; };
+{ gotoCase = 295; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 286; continue; };
-{ gotoCase = 289; continue; };
+if (yych <= '&') { gotoCase = 294; continue; };
+{ gotoCase = 297; continue; };
 } else {
-if (yych == '\\') { gotoCase = 291; continue; };
-{ gotoCase = 286; continue; };
+if (yych == '\\') { gotoCase = 299; continue; };
+{ gotoCase = 294; continue; };
 }
 }
-case 285:
+case 293:
 { this.tokenType = "javascript-string"; return cursor; }
-case 286:
+case 294:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 293; continue; };
-case 287:
+{ gotoCase = 301; continue; };
+case 295:
 ++cursor;
-case 288:
+case 296:
 { this.tokenType = null; return cursor; }
-case 289:
+case 297:
 ++cursor;
-case 290:
+case 298:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = "javascript-string"; return cursor; }
-case 291:
+case 299:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 292; continue; };
-if (yych <= '&') { gotoCase = 288; continue; };
+if (yych == '"') { gotoCase = 300; continue; };
+if (yych <= '&') { gotoCase = 296; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 288; continue; };
+if (yych <= '[') { gotoCase = 296; continue; };
 } else {
-if (yych != 'b') { gotoCase = 288; continue; };
+if (yych != 'b') { gotoCase = 296; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych >= 'g') { gotoCase = 288; continue; };
+if (yych >= 'g') { gotoCase = 296; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 292; continue; };
-if (yych <= 'q') { gotoCase = 288; continue; };
+if (yych <= 'n') { gotoCase = 300; continue; };
+if (yych <= 'q') { gotoCase = 296; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 288; continue; };
+if (yych <= 's') { gotoCase = 296; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 294; continue; };
-if (yych >= 'w') { gotoCase = 288; continue; };
-}
-}
-}
-case 292:
-yyaccept = 0;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-case 293:
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 285; continue; };
-if (yych <= '\f') { gotoCase = 292; continue; };
-{ gotoCase = 285; continue; };
-} else {
-if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 292; continue; };
-{ gotoCase = 300; continue; };
-} else {
-if (yych == '\\') { gotoCase = 299; continue; };
-{ gotoCase = 292; continue; };
-}
-}
-case 294:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych <= '9') { gotoCase = 296; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 296; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych <= 'f') { gotoCase = 296; continue; };
-}
-case 295:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 285; continue; };
-} else {
-{ gotoCase = 288; continue; };
-}
-case 296:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych >= ':') { gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 297; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych >= 'g') { gotoCase = 295; continue; };
-}
-case 297:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych >= ':') { gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 298; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych >= 'g') { gotoCase = 295; continue; };
-}
-case 298:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych <= '9') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 292; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych <= 'f') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-}
-case 299:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= 'e') {
-if (yych <= '\'') {
-if (yych == '"') { gotoCase = 292; continue; };
-if (yych <= '&') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych == 'b') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-}
-}
-} else {
-if (yych <= 'r') {
-if (yych <= 'm') {
-if (yych <= 'f') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-} else {
-if (yych <= 'n') { gotoCase = 292; continue; };
-if (yych <= 'q') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-}
-} else {
-if (yych <= 't') {
-if (yych <= 's') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych <= 'u') { gotoCase = 294; continue; };
-if (yych <= 'v') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
+if (yych <= 'u') { gotoCase = 302; continue; };
+if (yych >= 'w') { gotoCase = 296; continue; };
 }
 }
 }
 case 300:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 301:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 293; continue; };
+if (yych <= '\f') { gotoCase = 300; continue; };
+{ gotoCase = 293; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 300; continue; };
+{ gotoCase = 308; continue; };
+} else {
+if (yych == '\\') { gotoCase = 307; continue; };
+{ gotoCase = 300; continue; };
+}
+}
+case 302:
 ++cursor;
 yych = this._charAt(cursor);
-{ gotoCase = 290; continue; };
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych <= '9') { gotoCase = 304; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 304; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych <= 'f') { gotoCase = 304; continue; };
+}
+case 303:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 293; continue; };
+} else {
+{ gotoCase = 296; continue; };
+}
+case 304:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych >= ':') { gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 305; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych >= 'g') { gotoCase = 303; continue; };
+}
+case 305:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych >= ':') { gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 306; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych >= 'g') { gotoCase = 303; continue; };
+}
+case 306:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych <= '9') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 300; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych <= 'f') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+case 307:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 300; continue; };
+if (yych <= '&') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych == 'b') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 300; continue; };
+if (yych <= 'q') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 302; continue; };
+if (yych <= 'v') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+}
+}
+case 308:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 298; continue; };
 }
 
 }
diff --git a/resources/inspector/ScriptsPanel.js b/resources/inspector/ScriptsPanel.js
index 01209ed..2d07149 100644
--- a/resources/inspector/ScriptsPanel.js
+++ b/resources/inspector/ScriptsPanel.js
@@ -7,6 +7,7 @@
 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, showSourceLineDelegate)
 {
 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+this.registerRequiredCSS("breakpointsList.css");
 
 this._breakpointManager = breakpointManager;
 this._showSourceLineDelegate = showSourceLineDelegate;
@@ -37,7 +38,9 @@
 {
 var contextMenu = new WebInspector.ContextMenu(event);
 var breakpointActive = WebInspector.debuggerModel.breakpointsActive();
-var breakpointActiveTitle = WebInspector.UIString(breakpointActive ? "Deactivate Breakpoints" : "Activate Breakpoints");
+var breakpointActiveTitle = breakpointActive ?
+WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deactivate breakpoints" : "Deactivate Breakpoints") :
+WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activate breakpoints" : "Activate Breakpoints");
 contextMenu.appendItem(breakpointActiveTitle, WebInspector.debuggerModel.setBreakpointsActive.bind(WebInspector.debuggerModel, !breakpointActive));
 contextMenu.show();
 },
@@ -67,7 +70,7 @@
 checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpoint), false);
 element.appendChild(checkbox);
 
-var labelElement = document.createTextNode(WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber));
+var labelElement = document.createTextNode(uiLocation.linkText());
 element.appendChild(labelElement);
 
 var snippetElement = document.createElement("div");
@@ -97,8 +100,7 @@
 breakpointItem.checkbox = checkbox;
 this._items.put(breakpoint, breakpointItem);
 
-if (!this.expanded)
-this.expanded = true;
+this.expand();
 },
 
 
@@ -149,7 +151,7 @@
 {
 var breakpoints = this._items.values();
 var contextMenu = new WebInspector.ContextMenu(event);
-contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
 if (breakpoints.length > 1) {
 var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");
 contextMenu.appendItem(removeAllTitle, this._breakpointManager.removeAllBreakpoints.bind(this._breakpointManager));
@@ -157,7 +159,9 @@
 
 contextMenu.appendSeparator();
 var breakpointActive = WebInspector.debuggerModel.breakpointsActive();
-var breakpointActiveTitle = WebInspector.UIString(breakpointActive ? "Deactivate Breakpoints" : "Activate Breakpoints");
+var breakpointActiveTitle = breakpointActive ?
+WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deactivate breakpoints" : "Deactivate Breakpoints") :
+WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activate breakpoints" : "Activate Breakpoints");
 contextMenu.appendItem(breakpointActiveTitle, WebInspector.debuggerModel.setBreakpointsActive.bind(WebInspector.debuggerModel, !breakpointActive));
 
 function enabledBreakpointCount(breakpoints)
@@ -214,7 +218,7 @@
 
 _compareBreakpoints: function(b1, b2)
 {
-return this._compare(b1.url, b2.url) || this._compare(b1.lineNumber, b2.lineNumber);
+return this._compare(b1.uiSourceCode.originURL(), b2.uiSourceCode.originURL()) || this._compare(b1.lineNumber, b2.lineNumber);
 },
 
 reset: function()
@@ -252,7 +256,7 @@
 _emptyElementContextMenu: function(event)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
-contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._addButtonClicked.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add breakpoint" : "Add Breakpoint"), this._addButtonClicked.bind(this));
 contextMenu.show();
 },
 
@@ -261,7 +265,7 @@
 if (event)
 event.consume();
 
-this.expanded = true;
+this.expand();
 
 var inputElementContainer = document.createElement("p");
 inputElementContainer.className = "breakpoint-condition";
@@ -351,8 +355,8 @@
 }
 var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");
 
-contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._addButtonClicked.bind(this));
-contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add breakpoint" : "Add Breakpoint"), this._addButtonClicked.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), removeBreakpoint.bind(this));
 contextMenu.appendItem(removeAllTitle, removeAllBreakpoints.bind(this));
 contextMenu.show();
 },
@@ -394,7 +398,7 @@
 var element = this._breakpointElements[url];
 if (!element)
 return;
-this.expanded = true;
+this.expand();
 element.addStyleClass("breakpoint-hit");
 this._highlightedElement = element;
 },
@@ -432,6 +436,7 @@
 WebInspector.EventListenerBreakpointsSidebarPane = function()
 {
 WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Breakpoints"));
+this.registerRequiredCSS("breakpointsList.css");
 
 this.categoriesElement = document.createElement("ol");
 this.categoriesElement.tabIndex = 0;
@@ -589,7 +594,7 @@
 var breakpointItem = this._breakpointItems[eventName];
 if (!breakpointItem)
 return;
-this.expanded = true;
+this.expand();
 breakpointItem.parent.element.expand();
 breakpointItem.element.listItemElement.addStyleClass("breakpoint-hit");
 this._highlightedElement = breakpointItem.element.listItemElement;
@@ -642,6 +647,7 @@
 update: function(callFrames)
 {
 this.bodyElement.removeChildren();
+delete this._statusMessageElement;
 this.placards = [];
 
 if (!callFrames) {
@@ -669,22 +675,27 @@
 }
 },
 
-_selectNextCallFrameOnStack: function()
+
+_selectNextCallFrameOnStack: function(event)
 {
 var index = this._selectedCallFrameIndex();
 if (index == -1)
-return;
+return true;
 this._selectedPlacardByIndex(index + 1);
+return true;
 },
 
-_selectPreviousCallFrameOnStack: function()
+
+_selectPreviousCallFrameOnStack: function(event)
 {
 var index = this._selectedCallFrameIndex();
 if (index == -1)
-return;
+return true;
 this._selectedPlacardByIndex(index - 1);
+return true;
 },
 
+
 _selectedPlacardByIndex: function(index)
 {
 if (index < 0 || index >= this.placards.length)
@@ -692,6 +703,7 @@
 this._placardSelected(this.placards[index])
 },
 
+
 _selectedCallFrameIndex: function()
 {
 if (!this._model.selectedCallFrame())
@@ -769,7 +781,7 @@
 WebInspector.CallStackSidebarPane.Placard.prototype = {
 _update: function(uiLocation)
 {
-this.subtitle = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber).trimMiddle(100);
+this.subtitle = uiLocation.linkText().trimMiddle(100);
 },
 
 _placardContextMenu: function(event)
@@ -777,10 +789,10 @@
 var contextMenu = new WebInspector.ContextMenu(event);
 
 if (WebInspector.debuggerModel.canSetScriptSource()) {
-contextMenu.appendItem(WebInspector.UIString("Restart Frame"), this._restartFrame.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Restart frame" : "Restart Frame"), this._restartFrame.bind(this));
 contextMenu.appendSeparator();
 }
-contextMenu.appendItem(WebInspector.UIString("Copy Stack Trace"), this._pane._copyStackTrace.bind(this._pane));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy stack trace" : "Copy Stack Trace"), this._pane._copyStackTrace.bind(this._pane));
 
 contextMenu.show();
 },
@@ -805,31 +817,27 @@
 xhr.send(null);
 
 this.element = document.createElement("div");
-this.element.className = "js-outline-dialog";
+this.element.className = "filtered-item-list-dialog";
 this.element.addEventListener("keydown", this._onKeyDown.bind(this), false);
-this.element.addEventListener("mousemove", this._onMouseMove.bind(this), false);
-this.element.addEventListener("click", this._onClick.bind(this), false);
 var styleElement = this.element.createChild("style");
 styleElement.type = "text/css";
 styleElement.textContent = xhr.responseText;
 
-this._itemElements = [];
-this._elementIndexes = new Map();
-this._elementHighlightChanges = new Map();
-
 this._promptElement = this.element.createChild("input", "monospace");
 this._promptElement.type = "text";
 this._promptElement.setAttribute("spellcheck", "false");
 
 this._progressElement = this.element.createChild("div", "progress");
 
-this._itemElementsContainer = document.createElement("div");
-this._itemElementsContainer.className = "container monospace";
-this._itemElementsContainer.addEventListener("scroll", this._onScroll.bind(this), false);
+this._filteredItems = [];
+this._viewportControl = new WebInspector.ViewportControl(this);
+this._itemElementsContainer = this._viewportControl.element;
+this._itemElementsContainer.addStyleClass("container");
+this._itemElementsContainer.addStyleClass("monospace");
+this._itemElementsContainer.addEventListener("click", this._onClick.bind(this), false);
 this.element.appendChild(this._itemElementsContainer);
 
 this._delegate = delegate;
-
 this._delegate.requestItems(this._itemsLoaded.bind(this));
 }
 
@@ -854,6 +862,8 @@
 focus: function()
 {
 WebInspector.setCurrentFocusElement(this._promptElement);
+if (this._filteredItems.length && this._viewportControl.lastVisibleIndex() === -1)
+this._viewportControl.refresh();
 },
 
 willHide: function()
@@ -861,29 +871,43 @@
 if (this._isHiding)
 return;
 this._isHiding = true;
+this._delegate.dispose();
 if (this._filterTimer)
 clearTimeout(this._filterTimer);
 },
 
+renderAsTwoRows: function()
+{
+this._renderAsTwoRows = true;
+},
+
 onEnter: function()
 {
-if (!this._selectedElement)
+if (!this._delegate.itemsCount())
 return;
-this._delegate.selectItem(this._elementIndexes.get(this._selectedElement), this._promptElement.value.trim());
+this._delegate.selectItem(this._filteredItems[this._selectedIndexInFiltered], this._promptElement.value.trim());
 },
 
 
-_itemsLoaded: function(index, chunkLength, chunkIndex, chunkCount)
+_itemsLoaded: function(loadedCount, totalCount)
 {
-for (var i = index; i < index + chunkLength; ++i)
-this._itemElementsContainer.appendChild(this._createItemElement(i));
-this._filterItems();
+this._loadedCount = loadedCount;
+this._totalCount = totalCount;
 
-if (chunkIndex === chunkCount)
+if (this._loadTimeout)
+return;
+this._loadTimeout = setTimeout(this._updateAfterItemsLoaded.bind(this), 100);
+},
+
+_updateAfterItemsLoaded: function()
+{
+delete this._loadTimeout;
+this._filterItems();
+if (this._loadedCount === this._totalCount)
 this._progressElement.style.backgroundImage = "";
 else {
 const color = "rgb(66, 129, 235)";
-const percent = ((chunkIndex / chunkCount) * 100) + "%";
+const percent = ((this._loadedCount / this._totalCount) * 100) + "%";
 this._progressElement.style.backgroundImage = "-webkit-linear-gradient(left, " + color + ", " + color + " " + percent + ",  transparent " + percent + ")";
 }
 },
@@ -891,144 +915,182 @@
 
 _createItemElement: function(index)
 {
-if (this._itemElements[index])
-return this._itemElements[index];
-
 var itemElement = document.createElement("div");
-itemElement.className = "item";
+itemElement.className = "filtered-item-list-dialog-item " + (this._renderAsTwoRows ? "two-rows" : "one-row");
 itemElement._titleElement = itemElement.createChild("span");
 itemElement._titleElement.textContent = this._delegate.itemTitleAt(index);
 itemElement._titleSuffixElement = itemElement.createChild("span");
-itemElement._subtitleElement = itemElement.createChild("span", "subtitle");
-itemElement._subtitleElement.textContent = this._delegate.itemSubtitleAt(index);
-this._elementIndexes.put(itemElement, index);
-this._itemElements.push(itemElement);
+itemElement._titleSuffixElement.textContent = this._delegate.itemSuffixAt(index);
+itemElement._subtitleElement = itemElement.createChild("div", "filtered-item-list-dialog-subtitle");
+itemElement._subtitleElement.textContent = this._delegate.itemSubtitleAt(index) || "\u200B";
+itemElement._index = index;
+
+var key = this._delegate.itemKeyAt(index);
+var ranges = [];
+var match;
+if (this._query) {
+var regex = this._createSearchRegex(this._query, true);
+while ((match = regex.exec(key)) !== null && match[0])
+ranges.push({ offset: match.index, length: regex.lastIndex - match.index });
+if (ranges.length)
+WebInspector.highlightRangesWithStyleClass(itemElement, ranges, "highlight");
+}
+if (index === this._filteredItems[this._selectedIndexInFiltered])
+itemElement.addStyleClass("selected");
+
 return itemElement;
 },
 
 
-_hideItemElement: function(itemElement)
+_createSearchRegex: function(query, isGlobal)
 {
-itemElement.style.display = "none";
+const toEscape = String.regexSpecialCharacters();
+var regexString = "";
+for (var i = 0; i < query.length; ++i) {
+var c = query.charAt(i);
+if (toEscape.indexOf(c) !== -1)
+c = "\\" + c;
+if (i)
+regexString += "[^" + c + "]*";
+regexString += c;
+}
+return new RegExp(regexString, "i" + (isGlobal ? "g" : ""));
 },
 
 
-_itemElementVisible: function(itemElement)
+_createScoringRegex: function(query, ignoreCase, camelCase)
 {
-return itemElement.style.display !== "none";
+if (!camelCase || (camelCase && ignoreCase))
+query = query.toUpperCase();
+var regexString = "";
+for (var i = 0; i < query.length; ++i) {
+var c = query.charAt(i);
+if (c < "A" || c > "Z")
+continue;
+if (regexString)
+regexString += camelCase ? "[^A-Z]*" : "[^-_ .]*[-_ .]";
+regexString += c;
+}
+if (!camelCase)
+regexString = "(?:^|[-_ .])" + regexString;
+return new RegExp(regexString, camelCase ? "" : "i");
 },
 
 
-_showItemElement: function(itemElement)
+setQuery: function(query)
 {
-itemElement.style.display = "";
-},
-
-
-_createSearchRegExp: function(query, isGlobal)
-{
-return this._innerCreateSearchRegExp(this._delegate.rewriteQuery(query), isGlobal);
-},
-
-
-_innerCreateSearchRegExp: function(query, isGlobal)
-{
-if (!query)
-return new RegExp(".*");
-query = query.trim();
-
-var ignoreCase = (query === query.toLowerCase());
-var regExpString = query.escapeForRegExp().replace(/\\\*/g, ".*").replace(/\\\?/g, ".")
-if (ignoreCase)
-regExpString = regExpString.replace(/(?!^)(\\\.|[_:-])/g, "[^._:-]*$1");
-else
-regExpString = regExpString.replace(/(?!^)(\\\.|[A-Z_:-])/g, "[^.A-Z_:-]*$1");
-regExpString = regExpString;
-return new RegExp(regExpString, (ignoreCase ? "i" : "") + (isGlobal ? "g" : ""));
+this._promptElement.value = query;
+this._scheduleFilter();
 },
 
 _filterItems: function()
 {
 delete this._filterTimer;
 
-var query = this._promptElement.value;
-query = query.trim();
-var regex = this._createSearchRegExp(query);
-
-var firstElement;
-for (var i = 0; i < this._itemElements.length; ++i) {
-var itemElement = this._itemElements[i];
-itemElement._titleSuffixElement.textContent = this._delegate.itemSuffixAt(i);
-if (regex.test(this._delegate.itemKeyAt(i))) {
-this._showItemElement(itemElement);
-if (!firstElement)
-firstElement = itemElement;
-} else
-this._hideItemElement(itemElement);
-}
-
-if (!this._selectedElement || !this._itemElementVisible(this._selectedElement))
-this._updateSelection(firstElement);
-
-if (query) {
-this._highlightItems(query);
+var query = this._delegate.rewriteQuery(this._promptElement.value.trim());
 this._query = query;
-} else {
-this._clearHighlight();
-delete this._query;
+
+var ignoreCase = (query === query.toLowerCase());
+
+var filterRegex = query ? this._createSearchRegex(query) : null;
+var camelCaseScoringRegex = query ? this._createScoringRegex(query, ignoreCase, true) : null;
+var underscoreScoringRegex = query ? this._createScoringRegex(query, ignoreCase, false) : null;
+
+var oldSelectedAbsoluteIndex = this._selectedIndexInFiltered ? this._filteredItems[this._selectedIndexInFiltered] : null;
+this._filteredItems = [];
+this._selectedIndexInFiltered = 0;
+
+var cachedKeys = new Array(this._delegate.itemsCount());
+var scores = query ? new Array(this._delegate.itemsCount()) : null;
+
+for (var i = 0; i < this._delegate.itemsCount(); ++i) {
+var key = this._delegate.itemKeyAt(i);
+if (filterRegex && !filterRegex.test(key))
+continue;
+cachedKeys[i] = key;
+this._filteredItems.push(i);
+
+if (!filterRegex)
+continue;
+
+var score = 0;
+if (underscoreScoringRegex.test(key))
+score += 10;
+if (camelCaseScoringRegex.test(key))
+score += ignoreCase ? 10 : 20;
+for (var j = 0; j < key.length && j < query.length; ++j) {
+if (key[j] === query[j])
+score++;
+if (key[j].toUpperCase() === query[j].toUpperCase())
+score++;
+else
+break;
 }
+scores[i] = score;
+}
+
+function compareFunction(index1, index2)
+{
+if (scores) {
+var score1 = scores[index1];
+var score2 = scores[index2];
+if (score1 > score2)
+return -1;
+if (score1 < score2)
+return 1;
+}
+var key1 = cachedKeys[index1];
+var key2 = cachedKeys[index2];
+return key1.compareTo(key2) || (index2 - index1);
+}
+
+const numberOfItemsToSort = 100;
+if (this._filteredItems.length > numberOfItemsToSort)
+this._filteredItems.sortRange(compareFunction.bind(this), 0, this._filteredItems.length - 1, numberOfItemsToSort);
+else
+this._filteredItems.sort(compareFunction.bind(this));
+
+for (var i = 0; i < this._filteredItems.length; ++i) {
+if (this._filteredItems[i] === oldSelectedAbsoluteIndex) {
+this._selectedIndexInFiltered = i;
+break;
+}
+}
+this._viewportControl.refresh();
+this._updateSelection(this._selectedIndexInFiltered, false);
 },
 
 _onKeyDown: function(event)
 {
-function nextItem(itemElement, isPageScroll, forward)
-{
-var scrollItemsLeft = isPageScroll && this._rowsPerViewport ? this._rowsPerViewport : 1;
-var candidate = itemElement;
-var lastVisibleCandidate = candidate;
-do {
-candidate = forward ? candidate.nextSibling : candidate.previousSibling;
-if (!candidate) {
-if (isPageScroll)
-return lastVisibleCandidate;
-else
-candidate = forward ? this._itemElementsContainer.firstChild : this._itemElementsContainer.lastChild;
-}
-if (!this._itemElementVisible(candidate))
-continue;
-lastVisibleCandidate = candidate;
---scrollItemsLeft;
-} while (scrollItemsLeft && candidate !== this._selectedElement);
+var newSelectedIndex = this._selectedIndexInFiltered;
 
-return candidate;
-}
-
-if (this._selectedElement) {
-var candidate;
 switch (event.keyCode) {
 case WebInspector.KeyboardShortcut.Keys.Down.code:
-candidate = nextItem.call(this, this._selectedElement, false, true);
+if (++newSelectedIndex >= this._filteredItems.length)
+newSelectedIndex = this._filteredItems.length - 1;
+this._updateSelection(newSelectedIndex, true);
+event.consume(true);
 break;
 case WebInspector.KeyboardShortcut.Keys.Up.code:
-candidate = nextItem.call(this, this._selectedElement, false, false);
+if (--newSelectedIndex < 0)
+newSelectedIndex = 0;
+this._updateSelection(newSelectedIndex, false);
+event.consume(true);
 break;
 case WebInspector.KeyboardShortcut.Keys.PageDown.code:
-candidate = nextItem.call(this, this._selectedElement, true, true);
+newSelectedIndex = Math.min(newSelectedIndex + this._viewportControl.rowsPerViewport(), this._filteredItems.length - 1);
+this._updateSelection(newSelectedIndex, true);
+event.consume(true);
 break;
 case WebInspector.KeyboardShortcut.Keys.PageUp.code:
-candidate = nextItem.call(this, this._selectedElement, true, false);
+newSelectedIndex = Math.max(newSelectedIndex - this._viewportControl.rowsPerViewport(), 0);
+this._updateSelection(newSelectedIndex, false);
+event.consume(true);
 break;
-}
-
-if (candidate) {
-this._updateSelection(candidate);
-event.preventDefault();
-return;
-}
-}
-
+default:
 if (event.keyIdentifier !== "Shift" && event.keyIdentifier !== "Ctrl" && event.keyIdentifier !== "Meta" && event.keyIdentifier !== "Left" && event.keyIdentifier !== "Right")
 this._scheduleFilter();
+}
 },
 
 _scheduleFilter: function()
@@ -1039,105 +1101,40 @@
 },
 
 
-_updateSelection: function(newSelectedElement)
-{
-if (this._selectedElement === newSelectedElement)
-return;
-if (this._selectedElement)
-this._selectedElement.removeStyleClass("selected");
-
-this._selectedElement = newSelectedElement;
-if (newSelectedElement) {
-newSelectedElement.addStyleClass("selected");
-newSelectedElement.scrollIntoViewIfNeeded(false);
-if (!this._itemHeight) {
-this._itemHeight = newSelectedElement.offsetHeight;
-this._rowsPerViewport = Math.floor(this._itemElementsContainer.offsetHeight / this._itemHeight);
-}
-}
+_updateSelection: function(index, makeLast)
+{ 
+var element = this._viewportControl.renderedElementAt(this._selectedIndexInFiltered);
+if (element)
+element.removeStyleClass("selected");
+this._viewportControl.scrollItemIntoView(index, makeLast);
+this._selectedIndexInFiltered = index;
+element = this._viewportControl.renderedElementAt(index);
+if (element)
+element.addStyleClass("selected");
 },
 
 _onClick: function(event)
 {
-var itemElement = event.target.enclosingNodeOrSelfWithClass("item");
+var itemElement = event.target.enclosingNodeOrSelfWithClass("filtered-item-list-dialog-item");
 if (!itemElement)
 return;
-this._updateSelection(itemElement);
-this._delegate.selectItem(this._elementIndexes.get(this._selectedElement), this._promptElement.value.trim());
+this._delegate.selectItem(itemElement._index, this._promptElement.value.trim());
 WebInspector.Dialog.hide();
 },
 
-_onMouseMove: function(event)
-{
-var itemElement = event.target.enclosingNodeOrSelfWithClass("item");
-if (!itemElement)
-return;
-this._updateSelection(itemElement);
-},
 
-_onScroll: function()
+itemCount: function()
 {
-if (this._query)
-this._highlightItems(this._query);
-else
-this._clearHighlight();
+return this._filteredItems.length;
 },
 
 
-_highlightItems: function(query)
+itemElement: function(index)
 {
-var regex = this._createSearchRegExp(query, true);
-for (var i = 0; i < this._delegate.itemsCount(); ++i) {
-var itemElement = this._itemElements[i];
-if (this._itemElementVisible(itemElement) && this._itemElementInViewport(itemElement))
-this._highlightItem(itemElement, regex);
-}
-},
-
-_clearHighlight: function()
-{
-for (var i = 0; i < this._delegate.itemsCount(); ++i)
-this._clearElementHighlight(this._itemElements[i]);
-},
-
-
-_clearElementHighlight: function(itemElement)
-{
-var changes = this._elementHighlightChanges.get(itemElement)
-if (changes) {
-WebInspector.revertDomChanges(changes);
-this._elementHighlightChanges.remove(itemElement);
-}
-},
-
-
-_highlightItem: function(itemElement, regex)
-{
-this._clearElementHighlight(itemElement);
-
-var key = this._delegate.itemKeyAt(this._elementIndexes.get(itemElement));
-var ranges = [];
-
-var match;
-while ((match = regex.exec(key)) !== null && match[0]) {
-ranges.push({ offset: match.index, length: regex.lastIndex - match.index });
-}
-
-var changes = [];
-WebInspector.highlightRangesWithStyleClass(itemElement, ranges, "highlight", changes);
-
-if (changes.length)
-this._elementHighlightChanges.put(itemElement, changes);
-},
-
-
-_itemElementInViewport: function(itemElement)
-{
-if (itemElement.offsetTop + this._itemHeight < this._itemElementsContainer.scrollTop)
-return false;
-if (itemElement.offsetTop > this._itemElementsContainer.scrollTop + this._itemHeight * (this._rowsPerViewport + 1))
-return false;
-return true;
+var delegateIndex = this._filteredItems[index];
+var element = this._createItemElement(delegateIndex);
+element._filteredIndex = index;
+return element;
 },
 
 __proto__: WebInspector.DialogDelegate.prototype
@@ -1172,6 +1169,8 @@
 
 
 rewriteQuery: function(query) { },
+
+dispose: function() { }
 }
 
 
@@ -1245,12 +1244,10 @@
 _didBuildOutlineChunk: function(callback, event)
 {
 var data = event.data;
-
-var index = this._functionItems.length;
 var chunk = data["chunk"];
 for (var i = 0; i < chunk.length; ++i)
 this._functionItems.push(chunk[i]);
-callback(index, chunk.length, data.index, data.total);
+callback(data.index, data.total);
 
 if (data.total === data.index && this._outlineWorker) {
 this._outlineWorker.terminate();
@@ -1273,35 +1270,45 @@
 return query;
 },
 
-__proto__: WebInspector.SelectionDialogContentProvider.prototype
-}
-
-
-WebInspector.OpenResourceDialog = function(panel, uiSourceCodeProvider)
+dispose: function()
 {
-WebInspector.SelectionDialogContentProvider.call(this);
-this._panel = panel;
+}
+}
 
-this._uiSourceCodes = uiSourceCodeProvider.uiSourceCodes();
 
-function filterOutEmptyURLs(uiSourceCode)
+WebInspector.SelectUISourceCodeDialog = function()
 {
-return !!uiSourceCode.parsedURL.lastPathComponent;
+var projects = WebInspector.workspace.projects().filter(this.filterProject.bind(this));
+this._uiSourceCodes = [];
+for (var i = 0; i < projects.length; ++i)
+this._uiSourceCodes = this._uiSourceCodes.concat(projects[i].uiSourceCodes().filter(this.filterUISourceCode.bind(this)));
+WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
 }
-this._uiSourceCodes = this._uiSourceCodes.filter(filterOutEmptyURLs);
 
-function compareFunction(uiSourceCode1, uiSourceCode2)
+WebInspector.SelectUISourceCodeDialog.prototype = {
+
+uiSourceCodeSelected: function(uiSourceCode, lineNumber)
 {
-return uiSourceCode1.parsedURL.lastPathComponent.localeCompare(uiSourceCode2.parsedURL.lastPathComponent);
-}
-this._uiSourceCodes.sort(compareFunction);
-}
 
-WebInspector.OpenResourceDialog.prototype = {
+},
+
+
+filterProject: function(project)
+{
+return true;
+
+},
+
+
+filterUISourceCode: function(uiSourceCode)
+{
+return uiSourceCode.name();
+},
+
 
 itemTitleAt: function(itemIndex)
 {
-return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
+return this._uiSourceCodes[itemIndex].name().trimEnd(100);
 },
 
 
@@ -1313,13 +1320,18 @@
 
 itemSubtitleAt: function(itemIndex)
 {
-return this._uiSourceCodes[itemIndex].parsedURL.folderPathComponents;
+var uiSourceCode = this._uiSourceCodes[itemIndex]
+var projectName = uiSourceCode.project().displayName();
+var path = uiSourceCode.path().slice();
+path.pop();
+path.unshift(projectName);
+return path.join("/");
 },
 
 
 itemKeyAt: function(itemIndex)
 {
-return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
+return this._uiSourceCodes[itemIndex].name();
 },
 
 
@@ -1331,7 +1343,8 @@
 
 requestItems: function(callback)
 {
-callback(0, this._uiSourceCodes.length, 1, 1);
+this._itemsLoaded = callback;
+this._itemsLoaded(1, 1);
 },
 
 
@@ -1339,7 +1352,7 @@
 {
 var lineNumberMatch = promptValue.match(/[^:]+\:([\d]*)$/);
 var lineNumber = lineNumberMatch ? Math.max(parseInt(lineNumberMatch[1], 10) - 1, 0) : 0;
-this._panel.showUISourceCode(this._uiSourceCodes[itemIndex], lineNumber);
+this.uiSourceCodeSelected(this._uiSourceCodes[itemIndex], lineNumber);
 },
 
 
@@ -1353,66 +1366,119 @@
 return lineNumberMatch ? lineNumberMatch[1] : query;
 },
 
-__proto__: WebInspector.SelectionDialogContentProvider.prototype
+
+_uiSourceCodeAdded: function(event)
+{
+var uiSourceCode =   (event.data);
+if (!this.filterUISourceCode(uiSourceCode))
+return;
+this._uiSourceCodes.push(uiSourceCode)
+this._itemsLoaded(1, 1);
+},
+
+dispose: function()
+{
+WebInspector.workspace.removeEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
+}
 }
 
 
-WebInspector.OpenResourceDialog.show = function(panel, uiSourceCodeProvider, relativeToElement)
+WebInspector.OpenResourceDialog = function(panel)
+{
+WebInspector.SelectUISourceCodeDialog.call(this);
+this._panel = panel;
+}
+
+WebInspector.OpenResourceDialog.prototype = {
+
+
+uiSourceCodeSelected: function(uiSourceCode, lineNumber)
+{
+this._panel.showUISourceCode(uiSourceCode, lineNumber);
+},
+
+
+filterProject: function(project)
+{
+return !project.isServiceProject();
+},
+
+__proto__: WebInspector.SelectUISourceCodeDialog.prototype
+}
+
+
+WebInspector.OpenResourceDialog.show = function(panel, relativeToElement)
 {
 if (WebInspector.Dialog.currentInstance())
 return;
 
-var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenResourceDialog(panel, uiSourceCodeProvider));
+var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenResourceDialog(panel));
+filteredItemSelectionDialog.renderAsTwoRows();
+WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog);
+}
+
+
+WebInspector.SelectUISourceCodeForProjectTypeDialog = function(type, callback)
+{
+this._type = type;
+WebInspector.SelectUISourceCodeDialog.call(this);
+this._callback = callback;
+}
+
+WebInspector.SelectUISourceCodeForProjectTypeDialog.prototype = {
+
+uiSourceCodeSelected: function(uiSourceCode, lineNumber)
+{
+this._callback(uiSourceCode);
+},
+
+
+filterProject: function(project)
+{
+return project.type() === this._type;
+},
+
+__proto__: WebInspector.SelectUISourceCodeDialog.prototype
+}
+
+
+WebInspector.SelectUISourceCodeForProjectTypeDialog.show = function(name, type, callback, relativeToElement)
+{
+if (WebInspector.Dialog.currentInstance())
+return;
+
+var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type, callback));
+filteredItemSelectionDialog.setQuery(name);
+filteredItemSelectionDialog.renderAsTwoRows();
 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog);
 }
 ;
 
 
 
-WebInspector.JavaScriptSourceFrame = function(scriptsPanel, uiSourceCode)
+WebInspector.UISourceCodeFrame = function(uiSourceCode)
 {
-this._scriptsPanel = scriptsPanel;
-this._breakpointManager = WebInspector.breakpointManager;
 this._uiSourceCode = uiSourceCode;
-
-var locations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);
-for (var i = 0; i < locations.length; ++i)
-this._breakpointAdded({data:locations[i]});
-
-WebInspector.SourceFrame.call(this, uiSourceCode);
-
-this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textEditor.element,
-this._getPopoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), this._onHidePopover.bind(this), true);
-
-this.textEditor.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
-
-this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick, this._handleGutterClick.bind(this), this);
-
-this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
-this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
-
+WebInspector.SourceFrame.call(this, this._uiSourceCode);
 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._onFormattedChanged, this);
 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this);
 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved, this._consoleMessageRemoved, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged, this._onSourceMappingChanged, this);
-
-this._updateScriptFile();
 }
 
-WebInspector.JavaScriptSourceFrame.prototype = {
-
+WebInspector.UISourceCodeFrame.prototype = {
 wasShown: function()
 {
 WebInspector.SourceFrame.prototype.wasShown.call(this);
+this._boundWindowFocused = this._windowFocused.bind(this);
+window.addEventListener("focus", this._boundWindowFocused, false);
+this._checkContentUpdated();
 },
 
 willHide: function()
 {
 WebInspector.SourceFrame.prototype.willHide.call(this);
-this._popoverHelper.hidePopover();
+window.removeEventListener("focus", this._boundWindowFocused, false);
+delete this._boundWindowFocused;
 },
 
 
@@ -1421,6 +1487,18 @@
 return this._uiSourceCode.isEditable();
 },
 
+_windowFocused: function(event)
+{
+this._checkContentUpdated();
+},
+
+_checkContentUpdated: function()
+{
+if (!this.loaded || !this.isShowing())
+return;
+this._uiSourceCode.checkContentUpdated();
+},
+
 
 commitEditing: function(text)
 {
@@ -1428,10 +1506,26 @@
 return;
 
 this._isCommittingEditing = true;
-this._uiSourceCode.commitWorkingCopy(function() { });
+this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this));
 delete this._isCommittingEditing;
 },
 
+onTextChanged: function(oldRange, newRange)
+{
+WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange);
+this._isSettingWorkingCopy = true;
+this._uiSourceCode.setWorkingCopy(this._textEditor.text());
+delete this._isSettingWorkingCopy;
+},
+
+_didEditContent: function(error)
+{
+if (error) {
+WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
+return;
+}
+},
+
 
 _onFormattedChanged: function(event)
 {
@@ -1452,14 +1546,86 @@
 this._innerSetContent(this._uiSourceCode.workingCopy());
 },
 
+
+onUISourceCodeContentChanged: function(content)
+{
+this.setContent(content, false, this._uiSourceCode.mimeType());
+},
+
+
 _innerSetContent: function(content)
 {
 if (this._isSettingWorkingCopy || this._isCommittingEditing)
 return;
-var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);
-for (var i = 0; i < breakpointLocations.length; ++i)
-breakpointLocations[i].breakpoint.remove();
-this.setContent(content, false, this._uiSourceCode.mimeType());
+this.onUISourceCodeContentChanged(content);
+},
+
+populateTextAreaContextMenu: function(contextMenu, lineNumber)
+{
+WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
+contextMenu.appendApplicableItems(this._uiSourceCode);
+contextMenu.appendSeparator();
+},
+
+dispose: function()
+{
+this.detach();
+},
+
+__proto__: WebInspector.SourceFrame.prototype
+}
+;
+
+
+
+WebInspector.JavaScriptSourceFrame = function(scriptsPanel, uiSourceCode)
+{
+this._scriptsPanel = scriptsPanel;
+this._breakpointManager = WebInspector.breakpointManager;
+this._uiSourceCode = uiSourceCode;
+
+WebInspector.UISourceCodeFrame.call(this, uiSourceCode);
+if (uiSourceCode.project().type() === WebInspector.projectTypes.Debugger)
+this.element.addStyleClass("source-frame-debugger-script");
+
+this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textEditor.element,
+this._getPopoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), this._onHidePopover.bind(this), true);
+
+this.textEditor.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
+
+this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick, this._handleGutterClick.bind(this), this);
+
+this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
+this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
+
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved, this._consoleMessageRemoved, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged, this._onSourceMappingChanged, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+
+this._updateScriptFile();
+}
+
+WebInspector.JavaScriptSourceFrame.prototype = {
+
+wasShown: function()
+{
+WebInspector.UISourceCodeFrame.prototype.wasShown.call(this);
+},
+
+willHide: function()
+{
+WebInspector.UISourceCodeFrame.prototype.willHide.call(this);
+this._popoverHelper.hidePopover();
+},
+
+
+onUISourceCodeContentChanged: function(content, contentEncoded, mimeType)
+{
+this._removeAllBreakpoints();
+WebInspector.UISourceCodeFrame.prototype.onUISourceCodeContentChanged.call(this, content);
 },
 
 populateLineGutterContextMenu: function(contextMenu, lineNumber)
@@ -1484,7 +1650,6 @@
 
 populateTextAreaContextMenu: function(contextMenu, lineNumber)
 {
-WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
 var selection = window.getSelection();
 if (selection.type === "Range" && !selection.isCollapsed) {
 var addToWatchLabel = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add to watch" : "Add to Watch");
@@ -1505,49 +1670,45 @@
 contextMenu.appendItem(liveEditLabel, liveEdit.bind(this));
 contextMenu.appendSeparator();
 }
-contextMenu.appendApplicableItems(this._uiSourceCode);
+WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
 },
 
-onTextChanged: function(oldRange, newRange)
+_workingCopyChanged: function(event)
 {
-WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange);
-this._isSettingWorkingCopy = true;
-this._uiSourceCode.setWorkingCopy(this._textEditor.text());
-delete this._isSettingWorkingCopy;
-},
-
-_willMergeToVM: function()
-{
-if (this._supportsEnabledBreakpointsWhileEditing())
+if (this._supportsEnabledBreakpointsWhileEditing() || this._scriptFile)
 return;
-this._preserveDecorations = true;
+
+if (this._uiSourceCode.isDirty())
+this._muteBreakpointsWhileEditing();
+else
+this._restoreBreakpointsAfterEditing();
+},
+
+_workingCopyCommitted: function(event)
+{
+if (this._supportsEnabledBreakpointsWhileEditing() || this._scriptFile)
+return;
+this._restoreBreakpointsAfterEditing();
 },
 
 _didMergeToVM: function()
 {
 if (this._supportsEnabledBreakpointsWhileEditing())
 return;
-delete this._preserveDecorations;
 this._restoreBreakpointsAfterEditing();
 },
 
-_willDivergeFromVM: function()
-{
-if (this._supportsEnabledBreakpointsWhileEditing())
-return;
-this._preserveDecorations = true;
-},
-
 _didDivergeFromVM: function()
 {
 if (this._supportsEnabledBreakpointsWhileEditing())
 return;
-delete this._preserveDecorations;
 this._muteBreakpointsWhileEditing();
 },
 
 _muteBreakpointsWhileEditing: function()
 {
+if (this._muted)
+return;
 for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) {
 var breakpointDecoration = this._textEditor.getAttribute(lineNumber, "breakpoint");
 if (!breakpointDecoration)
@@ -1555,15 +1716,17 @@
 this._removeBreakpointDecoration(lineNumber);
 this._addBreakpointDecoration(lineNumber, breakpointDecoration.condition, breakpointDecoration.enabled, true);
 }
+this._muted = true;
 },
 
 _supportsEnabledBreakpointsWhileEditing: function()
 {
-return this._uiSourceCode.isSnippet;
+return this._uiSourceCode.project().type() === WebInspector.projectTypes.Snippets;
 },
 
 _restoreBreakpointsAfterEditing: function()
 {
+delete this._muted;
 var breakpoints = {};
 
 for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) {
@@ -1575,12 +1738,7 @@
 }
 
 
-var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);
-var lineNumbers = {};
-for (var i = 0; i < breakpointLocations.length; ++i) {
-var breakpoint = breakpointLocations[i].breakpoint;
-breakpointLocations[i].breakpoint.remove();
-}
+this._removeAllBreakpoints();
 
 
 for (var lineNumberString in breakpoints) {
@@ -1592,57 +1750,45 @@
 }
 },
 
+_removeAllBreakpoints: function()
+{
+var breakpoints = this._breakpointManager.breakpointsForUISourceCode(this._uiSourceCode);
+for (var i = 0; i < breakpoints.length; ++i)
+breakpoints[i].remove();
+},
+
 _getPopoverAnchor: function(element, event)
 {
 if (!WebInspector.debuggerModel.isPaused())
 return null;
 if (window.getSelection().type === "Range")
 return null;
-var lineElement = element.enclosingNodeOrSelfWithClass("webkit-line-content");
-if (!lineElement)
+
+var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, event.y);
+if (!textPosition)
 return null;
 
-if (element.hasStyleClass("webkit-javascript-ident"))
-return element;
-
-if (element.hasStyleClass("source-frame-token"))
-return element;
-
-
-if (element.hasStyleClass("webkit-javascript-keyword"))
-return element.textContent === "this" ? element : null;
-
-if (element !== lineElement || lineElement.childElementCount)
+var token = this.textEditor.tokenAtTextPosition(textPosition.startLine, textPosition.startColumn);
+if (!token)
+return null;
+var lineNumber = textPosition.startLine;
+var line = this.textEditor.line(lineNumber);
+var tokenContent = line.substring(token.startColumn, token.endColumn + 1);
+if (token.type !== "javascript-ident" && (token.type !== "javascript-keyword" || tokenContent !== "this"))
 return null;
 
+var leftCorner = this.textEditor.cursorPositionToCoordinates(lineNumber, token.startColumn);
+var rightCorner = this.textEditor.cursorPositionToCoordinates(lineNumber, token.endColumn + 1);
+var anchorBox = new AnchorBox(leftCorner.x, leftCorner.y, rightCorner.x - leftCorner.x, leftCorner.height);
 
+anchorBox.token = token;
+anchorBox.lineNumber = lineNumber;
 
-var lineContent = lineElement.textContent;
-var ranges = [];
-var regex = new RegExp("[a-zA-Z_\$0-9]+", "g");
-var match;
-while (regex.lastIndex < lineContent.length && (match = regex.exec(lineContent)))
-ranges.push({offset: match.index, length: regex.lastIndex - match.index});
-
-
-var changes = [];
-this.textEditor.highlightRangesWithStyleClass(lineElement, ranges, "source-frame-token", changes);
-var lineOffsetLeft = lineElement.totalOffsetLeft();
-for (var child = lineElement.firstChild; child; child = child.nextSibling) {
-if (child.nodeType !== Node.ELEMENT_NODE || !child.hasStyleClass("source-frame-token"))
-continue;
-if (event.x > lineOffsetLeft + child.offsetLeft && event.x < lineOffsetLeft + child.offsetLeft + child.offsetWidth) {
-var text = child.textContent;
-return (text === "this" || !WebInspector.SourceJavaScriptTokenizer.Keywords[text]) ? child : null;
-}
-}
-return null;
+return anchorBox;
 },
 
-_resolveObjectForPopover: function(element, showCallback, objectGroupName)
+_resolveObjectForPopover: function(anchorBox, showCallback, objectGroupName)
 {
-this._highlightElement = this._highlightExpression(element);
-
 
 function showObjectPopover(result, wasThrown)
 {
@@ -1650,47 +1796,48 @@
 this._popoverHelper.hidePopover();
 return;
 }
-showCallback(WebInspector.RemoteObject.fromPayload(result), wasThrown, this._highlightElement);
+this._popoverAnchorBox = anchorBox;
+showCallback(WebInspector.RemoteObject.fromPayload(result), wasThrown, this._popoverAnchorBox);
 
-if (this._highlightElement)
-this._highlightElement.addStyleClass("source-frame-eval-expression");
+if (this._popoverAnchorBox) {
+var highlightRange = new WebInspector.TextRange(anchorBox.lineNumber, startHighlight, anchorBox.lineNumber, endHighlight);
+this._popoverAnchorBox._highlightDescriptor = this.textEditor.highlightRange(highlightRange, "source-frame-eval-expression");
+}
 }
 
 if (!WebInspector.debuggerModel.isPaused()) {
 this._popoverHelper.hidePopover();
 return;
 }
+
+var startHighlight = anchorBox.token.startColumn;
+var endHighlight = anchorBox.token.endColumn;
+var line = this.textEditor.line(anchorBox.lineNumber);
+while (startHighlight > 1 && line.charAt(startHighlight - 1) === '.')
+startHighlight = this.textEditor.tokenAtTextPosition(anchorBox.lineNumber, startHighlight - 2).startColumn;
+var evaluationText = line.substring(startHighlight, endHighlight + 1);
+
 var selectedCallFrame = WebInspector.debuggerModel.selectedCallFrame();
-selectedCallFrame.evaluate(this._highlightElement.textContent, objectGroupName, false, true, false, false, showObjectPopover.bind(this));
+selectedCallFrame.evaluate(evaluationText, objectGroupName, false, true, false, false, showObjectPopover.bind(this));
 },
 
 _onHidePopover: function()
 {
-
-var highlightElement = this._highlightElement;
-if (!highlightElement)
+if (!this._popoverAnchorBox)
 return;
-
-
-this.textEditor.hideHighlightedExpression(highlightElement);
-delete this._highlightElement;
-},
-
-
-_highlightExpression: function(element)
-{
-return this.textEditor.highlightExpression(element, { "webkit-javascript-ident": true, "source-frame-token": true, "webkit-javascript-keyword": true }, { ".": true });
+if (this._popoverAnchorBox._highlightDescriptor)
+this.textEditor.removeHighlight(this._popoverAnchorBox._highlightDescriptor);
+delete this._popoverAnchorBox;
 },
 
 
 _addBreakpointDecoration: function(lineNumber, condition, enabled, mutedWhileEditing)
 {
-if (this._preserveDecorations)
-return;
 var breakpoint = {
 condition: condition,
 enabled: enabled
 };
+
 this.textEditor.setAttribute(lineNumber, "breakpoint", breakpoint);
 
 var disabled = !enabled || mutedWhileEditing;
@@ -1699,8 +1846,6 @@
 
 _removeBreakpointDecoration: function(lineNumber)
 {
-if (this._preserveDecorations)
-return;
 this.textEditor.removeAttribute(lineNumber, "breakpoint");
 this.textEditor.removeBreakpoint(lineNumber);
 },
@@ -1799,12 +1944,23 @@
 return newLineNumber;
 },
 
+
+_shouldIgnoreExternalBreakpointEvents: function()
+{
+if (this._supportsEnabledBreakpointsWhileEditing())
+return false;
+if (this._muted)
+return true;
+return this._scriptFile && (this._scriptFile.isDivergingFromVM() || this._scriptFile.isMergingToVM());
+},
+
 _breakpointAdded: function(event)
 {
 var uiLocation =   (event.data.uiLocation);
-
 if (uiLocation.uiSourceCode !== this._uiSourceCode)
 return;
+if (this._shouldIgnoreExternalBreakpointEvents())
+return;
 
 var breakpoint =   (event.data.breakpoint);
 if (this.loaded)
@@ -1816,6 +1972,8 @@
 var uiLocation =   (event.data.uiLocation);
 if (uiLocation.uiSourceCode !== this._uiSourceCode)
 return;
+if (this._shouldIgnoreExternalBreakpointEvents())
+return;
 
 var breakpoint =   (event.data.breakpoint);
 var remainingBreakpoint = this._breakpointManager.findBreakpoint(this._uiSourceCode, uiLocation.lineNumber);
@@ -1851,17 +2009,18 @@
 _updateScriptFile: function()
 {
 if (this._scriptFile) {
-this._scriptFile.removeEventListener(WebInspector.ScriptFile.Events.WillMergeToVM, this._willMergeToVM, this);
 this._scriptFile.removeEventListener(WebInspector.ScriptFile.Events.DidMergeToVM, this._didMergeToVM, this);
-this._scriptFile.removeEventListener(WebInspector.ScriptFile.Events.WillDivergeFromVM, this._willDivergeFromVM, this);
 this._scriptFile.removeEventListener(WebInspector.ScriptFile.Events.DidDivergeFromVM, this._didDivergeFromVM, this);
+if (this._muted && !this._uiSourceCode.isDirty())
+this._restoreBreakpointsAfterEditing();
 }
 this._scriptFile = this._uiSourceCode.scriptFile();
 if (this._scriptFile) {
-this._scriptFile.addEventListener(WebInspector.ScriptFile.Events.WillMergeToVM, this._willMergeToVM, this);
 this._scriptFile.addEventListener(WebInspector.ScriptFile.Events.DidMergeToVM, this._didMergeToVM, this);
-this._scriptFile.addEventListener(WebInspector.ScriptFile.Events.WillDivergeFromVM, this._willDivergeFromVM, this);
 this._scriptFile.addEventListener(WebInspector.ScriptFile.Events.DidDivergeFromVM, this._didDivergeFromVM, this);
+
+if (this.loaded)
+this._scriptFile.checkMapping();
 }
 },
 
@@ -1871,26 +2030,28 @@
 this.setExecutionLine(this._executionLineNumber);
 
 var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);
-for (var i = 0; i < breakpointLocations.length; ++i) {
-var breakpoint = breakpointLocations[i].breakpoint;
-this._addBreakpointDecoration(breakpointLocations[i].uiLocation.lineNumber, breakpoint.condition(), breakpoint.enabled(), false);
-}
+for (var i = 0; i < breakpointLocations.length; ++i)
+this._breakpointAdded({data:breakpointLocations[i]});
 
 var messages = this._uiSourceCode.consoleMessages();
 for (var i = 0; i < messages.length; ++i) {
 var message = messages[i];
 this.addMessageToSource(message.lineNumber, message.originalMessage);
 }
+
+if (this._scriptFile)
+this._scriptFile.checkMapping();
 },
 
 
 _handleGutterClick: function(event)
 {
-if (this._uiSourceCode.isDirty() && !this._supportsEnabledBreakpointsWhileEditing())
+if (this._muted)
 return;
 
-var lineNumber = event.data.lineNumber;
-var eventObject =   (event.data.event);
+var eventData =   (event.data);
+var lineNumber = eventData.lineNumber;
+var eventObject =   (eventData.event);
 
 if (eventObject.button != 0 || eventObject.altKey || eventObject.ctrlKey || eventObject.metaKey)
 return;
@@ -1914,6 +2075,9 @@
 
 toggleBreakpointOnCurrentLine: function()
 {
+if (this._muted)
+return;
+
 var selection = this.textEditor.selection();
 if (!selection)
 return;
@@ -1927,7 +2091,7 @@
 
 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
 action: WebInspector.UserMetrics.UserActionNames.SetBreakpoint,
-url: this._uiSourceCode.url,
+url: this._uiSourceCode.originURL(),
 line: lineNumber,
 enabled: enabled
 });
@@ -1940,7 +2104,20 @@
 WebInspector.debuggerModel.continueToLocation(rawLocation);
 },
 
-__proto__: WebInspector.SourceFrame.prototype
+dispose: function()
+{
+this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
+this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved, this._consoleMessageRemoved, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged, this._onSourceMappingChanged, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+WebInspector.UISourceCodeFrame.prototype.dispose.call(this);
+},
+
+__proto__: WebInspector.UISourceCodeFrame.prototype
 }
 ;
 
@@ -2118,96 +2295,138 @@
 this.element.appendChild(scriptsOutlineElement);
 this.setDefaultFocusedElement(this._scriptsTree.element);
 
-this._folderTreeElements = {};
-this._scriptTreeElementsByUISourceCode = new Map();
 
-WebInspector.settings.showScriptFolders.addChangeListener(this._showScriptFoldersSettingChanged.bind(this));
+this._uiSourceCodeNodes = {};
+
+this._rootNode = new WebInspector.NavigatorRootTreeNode(this);
+this._rootNode.populate();
+
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
 }
 
-
 WebInspector.NavigatorView.Events = {
 ItemSelected: "ItemSelected",
 FileRenamed: "FileRenamed"
 }
 
+WebInspector.NavigatorView.iconClassForType = function(type)
+{
+if (type === WebInspector.NavigatorTreeOutline.Types.Domain)
+return "navigator-domain-tree-item";
+if (type === WebInspector.NavigatorTreeOutline.Types.FileSystem)
+return "navigator-folder-tree-item";
+return "navigator-folder-tree-item";
+}
+
 WebInspector.NavigatorView.prototype = {
 
 addUISourceCode: function(uiSourceCode)
 {
-if (this._scriptTreeElementsByUISourceCode.get(uiSourceCode))
-return;
-
-var scriptTreeElement = new WebInspector.NavigatorSourceTreeElement(this, uiSourceCode, "");
-this._scriptTreeElementsByUISourceCode.put(uiSourceCode, scriptTreeElement);
-this._updateScriptTitle(uiSourceCode);
-this._addUISourceCodeListeners(uiSourceCode);
-
-var folderTreeElement = this.getOrCreateFolderTreeElement(uiSourceCode);
-folderTreeElement.appendChild(scriptTreeElement);
-},
-
-_uiSourceCodeTitleChanged: function(event)
-{
-var uiSourceCode =   (event.target);
-this._updateScriptTitle(uiSourceCode)
-},
-
-_uiSourceCodeWorkingCopyChanged: function(event)
-{
-var uiSourceCode =   (event.target);
-this._updateScriptTitle(uiSourceCode)
-},
-
-_uiSourceCodeWorkingCopyCommitted: function(event)
-{
-var uiSourceCode =   (event.target);
-this._updateScriptTitle(uiSourceCode)
-},
-
-_uiSourceCodeFormattedChanged: function(event)
-{
-var uiSourceCode =   (event.target);
-this._updateScriptTitle(uiSourceCode);
+var node = this._getOrCreateUISourceCodeParentNode(uiSourceCode);
+var uiSourceCodeNode = new WebInspector.NavigatorUISourceCodeTreeNode(this, uiSourceCode);
+this._uiSourceCodeNodes[uiSourceCode.uri()] = uiSourceCodeNode;
+node.appendChild(uiSourceCodeNode);
+if (uiSourceCode.url === WebInspector.inspectedPageURL)
+this.revealUISourceCode(uiSourceCode);
 },
 
 
-_updateScriptTitle: function(uiSourceCode, ignoreIsDirty)
+_inspectedURLChanged: function(event)
 {
-var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-if (!scriptTreeElement)
-return;
+var nodes = Object.values(this._uiSourceCodeNodes);
+for (var i = 0; i < nodes.length; ++i) {
+var uiSourceCode = nodes[i].uiSourceCode();
+if (uiSourceCode.url === WebInspector.inspectedPageURL)
+this.revealUISourceCode(uiSourceCode);
+}
 
-var titleText;
-if (uiSourceCode.parsedURL.isValid) {
-titleText = uiSourceCode.parsedURL.lastPathComponent;
-if (uiSourceCode.parsedURL.queryParams)
-titleText += "?" + uiSourceCode.parsedURL.queryParams;
-} else if (uiSourceCode.parsedURL)
-titleText = uiSourceCode.parsedURL.url;
-if (!titleText)
-titleText = WebInspector.UIString("(program)");
-if (!ignoreIsDirty && uiSourceCode.isDirty())
-titleText = "*" + titleText;
-scriptTreeElement.titleText = titleText;
 },
 
 
-isScriptSourceAdded: function(uiSourceCode)
+_getProjectNode: function(project)
 {
-var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-return !!scriptTreeElement;
+if (!project.displayName())
+return this._rootNode;
+return this._rootNode.child(project.id());
 },
 
 
-revealUISourceCode: function(uiSourceCode)
+_createProjectNode: function(project)
 {
+var type = project.type() === WebInspector.projectTypes.FileSystem ? WebInspector.NavigatorTreeOutline.Types.FileSystem : WebInspector.NavigatorTreeOutline.Types.Domain;
+var projectNode = new WebInspector.NavigatorFolderTreeNode(this, project.id(), type, project.displayName());
+this._rootNode.appendChild(projectNode);
+return projectNode;
+},
+
+
+_getOrCreateProjectNode: function(project)
+{
+return this._getProjectNode(project) || this._createProjectNode(project);
+},
+
+
+_getFolderNode: function(parentNode, name)
+{
+return parentNode.child(name);
+},
+
+
+_createFolderNode: function(parentNode, name)
+{
+var folderNode = new WebInspector.NavigatorFolderTreeNode(this, name, WebInspector.NavigatorTreeOutline.Types.Folder, name);
+parentNode.appendChild(folderNode);
+return folderNode;
+},
+
+
+_getOrCreateFolderNode: function(parentNode, name)
+{
+return this._getFolderNode(parentNode, name) || this._createFolderNode(parentNode, name);
+},
+
+
+_getUISourceCodeParentNode: function(uiSourceCode)
+{
+var projectNode = this._getProjectNode(uiSourceCode.project());
+if (!projectNode)
+return null;
+var path = uiSourceCode.path();
+var parentNode = projectNode;
+for (var i = 0; i < path.length - 1; ++i) {
+parentNode = this._getFolderNode(parentNode, path[i]);
+if (!parentNode)
+return null;
+}
+return parentNode;
+},
+
+
+_getOrCreateUISourceCodeParentNode: function(uiSourceCode)
+{
+var projectNode = this._getOrCreateProjectNode(uiSourceCode.project());
+if (!projectNode)
+return null;
+var path = uiSourceCode.path();
+var parentNode = projectNode;
+for (var i = 0; i < path.length - 1; ++i) {
+parentNode = this._getOrCreateFolderNode(parentNode, path[i]);
+if (!parentNode)
+return null;
+}
+return parentNode;
+},
+
+
+revealUISourceCode: function(uiSourceCode, select)
+{
+var node = this._uiSourceCodeNodes[uiSourceCode.uri()];
+if (!node)
+return null;
 if (this._scriptsTree.selectedTreeElement)
 this._scriptsTree.selectedTreeElement.deselect();
-
 this._lastSelectedUISourceCode = uiSourceCode;
-
-var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-scriptTreeElement.revealAndSelect(true);
+node.reveal(select);
 },
 
 
@@ -2221,50 +2440,22 @@
 
 removeUISourceCode: function(uiSourceCode)
 {
-var treeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-while (treeElement) {
-var parent = treeElement.parent;
-if (parent) {
-if (treeElement instanceof WebInspector.NavigatorFolderTreeElement)
-delete this._folderTreeElements[treeElement.folderIdentifier];
-parent.removeChild(treeElement);
-if (parent.children.length)
+var parentNode = this._getUISourceCodeParentNode(uiSourceCode);
+if (!parentNode)
+return;
+var node = this._uiSourceCodeNodes[uiSourceCode.uri()];
+if (!node)
+return;
+delete this._uiSourceCodeNodes[uiSourceCode.uri()]
+parentNode.removeChild(node);
+node = parentNode;
+while (node) {
+parentNode = node.parent;
+if (!parentNode || !node.isEmpty())
 break;
+parentNode.removeChild(node);
+node = parentNode;
 }
-treeElement = parent;
-}
-this._scriptTreeElementsByUISourceCode.remove(uiSourceCode);
-this._removeUISourceCodeListeners(uiSourceCode);
-},
-
-
-_addUISourceCodeListeners: function(uiSourceCode)
-{
-uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this);
-uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this);
-uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this);
-uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this);
-},
-
-
-_removeUISourceCodeListeners: function(uiSourceCode)
-{
-uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this);
-uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this);
-uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this);
-uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this);
-},
-
-_showScriptFoldersSettingChanged: function()
-{
-var uiSourceCodes = this._scriptsTree.scriptTreeElements();
-this.reset();
-
-for (var i = 0; i < uiSourceCodes.length; ++i)
-this.addUISourceCode(uiSourceCodes[i]);
-
-if (this._lastSelectedUISourceCode)
-this.revealUISourceCode(this._lastSelectedUISourceCode);
 },
 
 _fileRenamed: function(uiSourceCode, newTitle)
@@ -2276,88 +2467,21 @@
 
 rename: function(uiSourceCode, callback)
 {
-var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-if (!scriptTreeElement)
-return;
-
-
-var treeOutlineElement = scriptTreeElement.treeOutline.element;
-WebInspector.markBeingEdited(treeOutlineElement, true);
-
-function commitHandler(element, newTitle, oldTitle)
-{
-if (newTitle && newTitle !== oldTitle)
-this._fileRenamed(uiSourceCode, newTitle);
-afterEditing.call(this, true);
-}
-
-function cancelHandler()
-{
-afterEditing.call(this, false);
-}
-
-
-function afterEditing(committed)
-{
-WebInspector.markBeingEdited(treeOutlineElement, false);
-this._updateScriptTitle(uiSourceCode);
-if (callback)
-callback(committed);
-}
-
-var editingConfig = new WebInspector.EditingConfig(commitHandler.bind(this), cancelHandler.bind(this));
-this._updateScriptTitle(uiSourceCode, true);
-WebInspector.startEditing(scriptTreeElement.titleElement, editingConfig);
-window.getSelection().setBaseAndExtent(scriptTreeElement.titleElement, 0, scriptTreeElement.titleElement, 1);
+var node = this._uiSourceCodeNodes[uiSourceCode.uri()];
+if (!node)
+return null;
+node.rename(callback);
 },
 
 reset: function()
 {
-var uiSourceCodes = this._scriptsTree.scriptTreeElements;
-for (var i = 0; i < uiSourceCodes.length; ++i)
-this._removeUISourceCodeListeners(uiSourceCodes[i]);
+for (var uri in this._uiSourceCodeNodes)
+this._uiSourceCodeNodes[uri].dispose();
 
 this._scriptsTree.stopSearch();
 this._scriptsTree.removeChildren();
-this._folderTreeElements = {};
-this._scriptTreeElementsByUISourceCode.clear();
-},
-
-
-createFolderTreeElement: function(parentFolderElement, folderIdentifier, domain, folderName)
-{
-var folderTreeElement = new WebInspector.NavigatorFolderTreeElement(folderIdentifier, domain, folderName);
-parentFolderElement.appendChild(folderTreeElement);
-this._folderTreeElements[folderIdentifier] = folderTreeElement;
-return folderTreeElement;
-},
-
-
-getOrCreateFolderTreeElement: function(uiSourceCode)
-{
-return this._getOrCreateFolderTreeElement(uiSourceCode.parsedURL.host, uiSourceCode.parsedURL.folderPathComponents);
-},
-
-
-_getOrCreateFolderTreeElement: function(domain, folderName)
-{
-var folderIdentifier = domain + "/" + folderName;
-
-if (this._folderTreeElements[folderIdentifier])
-return this._folderTreeElements[folderIdentifier];
-
-var showScriptFolders = WebInspector.settings.showScriptFolders.get();
-
-if ((!domain && !folderName) || !showScriptFolders)
-return this._scriptsTree;
-
-var parentFolderElement;
-if (!folderName)
-parentFolderElement = this._scriptsTree;
-else
-parentFolderElement = this._getOrCreateFolderTreeElement(domain, "");
-
-return this.createFolderTreeElement(parentFolderElement, folderIdentifier, domain, folderName);
+this._uiSourceCodeNodes = {};
+this._rootNode.reset();
 },
 
 handleContextMenu: function(event, uiSourceCode)
@@ -2384,20 +2508,30 @@
 this.searchInputElement = document.createElement("input");
 }
 
+WebInspector.NavigatorTreeOutline.Types = {
+Root: "Root",
+Domain: "Domain",
+Folder: "Folder",
+UISourceCode: "UISourceCode",
+FileSystem: "FileSystem"
+}
+
 WebInspector.NavigatorTreeOutline._treeElementsCompare = function compare(treeElement1, treeElement2)
 {
 
 function typeWeight(treeElement)
 {
-if (treeElement instanceof WebInspector.NavigatorFolderTreeElement) {
-if (treeElement.isDomain) {
+var type = treeElement.type();
+if (type === WebInspector.NavigatorTreeOutline.Types.Domain) {
 if (treeElement.titleText === WebInspector.inspectedPageDomain)
 return 1;
 return 2;
 }
+if (type === WebInspector.NavigatorTreeOutline.Types.FileSystem)
 return 3;
-}
+if (type === WebInspector.NavigatorTreeOutline.Types.Folder)
 return 4;
+return 5;
 }
 
 var typeWeight1 = typeWeight(treeElement1);
@@ -2411,7 +2545,7 @@
 else {
 var title1 = treeElement1.titleText;
 var title2 = treeElement2.titleText;
-result = title1.localeCompare(title2);
+result = title1.compareTo(title2);
 }
 return result;
 }
@@ -2446,8 +2580,9 @@
 }
 
 
-WebInspector.BaseNavigatorTreeElement = function(title, iconClasses, hasChildren, noIcon)
+WebInspector.BaseNavigatorTreeElement = function(type, title, iconClasses, hasChildren, noIcon)
 {
+this._type = type;
 TreeElement.call(this, "", null, hasChildren);
 this._titleText = title;
 this._iconClasses = iconClasses;
@@ -2479,7 +2614,6 @@
 this._titleTextNode.textContent = this._titleText;
 this.titleElement.appendChild(this._titleTextNode);
 this.listItemElement.appendChild(this.titleElement);
-this.expand();
 },
 
 onreveal: function()
@@ -2509,42 +2643,45 @@
 return this.titleText.match(new RegExp("^" + searchText.escapeForRegExp(), "i"));
 },
 
+
+type: function()
+{
+return this._type;
+},
+
 __proto__: TreeElement.prototype
 }
 
 
-WebInspector.NavigatorFolderTreeElement = function(folderIdentifier, domain, folderName)
+WebInspector.NavigatorFolderTreeElement = function(type, title)
 {
-this._folderIdentifier = folderIdentifier;
-this._folderName = folderName;
-
-var iconClass = this.isDomain ? "navigator-domain-tree-item" : "navigator-folder-tree-item";
-var title = this.isDomain ? domain : folderName.substring(1);
-
-WebInspector.BaseNavigatorTreeElement.call(this, title, [iconClass], true);
-this.tooltip = folderName;
+var iconClass = WebInspector.NavigatorView.iconClassForType(type);
+WebInspector.BaseNavigatorTreeElement.call(this, type, title, [iconClass], true);
 }
 
 WebInspector.NavigatorFolderTreeElement.prototype = {
-
-get folderIdentifier()
+onpopulate: function()
 {
-return this._folderIdentifier;
-},
-
-
-get isDomain()
-{
-return this._folderName === "";
+this._node.populate();
 },
 
 onattach: function()
 {
 WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this);
-if (this.isDomain && this.titleText != WebInspector.inspectedPageDomain)
 this.collapse();
-else
-this.expand();
+},
+
+
+setNode: function(node)
+{
+this._node = node;
+var paths = [];
+while (node && !node.isRoot()) {
+paths.push(node._title);
+node = node.parent;
+}
+paths.reverse();
+this.tooltip = paths.join("/");
 },
 
 __proto__: WebInspector.BaseNavigatorTreeElement.prototype
@@ -2553,10 +2690,10 @@
 
 WebInspector.NavigatorSourceTreeElement = function(navigatorView, uiSourceCode, title)
 {
-WebInspector.BaseNavigatorTreeElement.call(this, title, ["navigator-" + uiSourceCode.contentType().name() + "-tree-item"], false);
+WebInspector.BaseNavigatorTreeElement.call(this, WebInspector.NavigatorTreeOutline.Types.UISourceCode, title, ["navigator-" + uiSourceCode.contentType().name() + "-tree-item"], false);
 this._navigatorView = navigatorView;
 this._uiSourceCode = uiSourceCode;
-this.tooltip = uiSourceCode.url;
+this.tooltip = uiSourceCode.originURL();
 }
 
 WebInspector.NavigatorSourceTreeElement.prototype = {
@@ -2627,6 +2764,401 @@
 
 __proto__: WebInspector.BaseNavigatorTreeElement.prototype
 }
+
+
+WebInspector.NavigatorTreeNode = function(id)
+{
+this.id = id;
+this._children = {};
+}
+
+WebInspector.NavigatorTreeNode.prototype = {
+
+treeElement: function() { },
+
+dispose: function() { },
+
+
+isRoot: function()
+{
+return false;
+},
+
+
+hasChildren: function()
+{
+return true;
+},
+
+populate: function()
+{
+if (this.isPopulated())
+return;
+if (this.parent)
+this.parent.populate();
+this._populated = true;
+this.wasPopulated();
+},
+
+wasPopulated: function()
+{
+for (var id in this._children)
+this.treeElement().appendChild(this._children[id].treeElement());
+},
+
+didAddChild: function(node)
+{
+if (this.isPopulated())
+this.treeElement().appendChild(node.treeElement());
+},
+
+willRemoveChild: function(node)
+{
+if (this.isPopulated())
+this.treeElement().removeChild(node.treeElement());
+},
+
+isPopulated: function()
+{
+return this._populated;
+},
+
+isEmpty: function()
+{
+return this.children().length === 0;
+},
+
+child: function(id)
+{
+return this._children[id];
+},
+
+children: function()
+{
+return Object.values(this._children);
+},
+
+appendChild: function(node)
+{
+this._children[node.id] = node;
+node.parent = this;
+this.didAddChild(node);
+},
+
+removeChild: function(node)
+{
+this.willRemoveChild(node);
+delete this._children[node.id];
+delete node.parent;
+node.dispose();
+},
+
+reset: function()
+{
+this._children = {};
+}
+}
+
+
+WebInspector.NavigatorRootTreeNode = function(navigatorView)
+{
+WebInspector.NavigatorTreeNode.call(this, "");
+this._navigatorView = navigatorView;
+}
+
+WebInspector.NavigatorRootTreeNode.prototype = {
+
+isRoot: function()
+{
+return true;
+},
+
+
+treeElement: function()
+{
+return this._navigatorView._scriptsTree;
+},
+
+wasPopulated: function()
+{
+for (var id in this._children)
+this.treeElement().appendChild(this._children[id].treeElement());
+},
+
+didAddChild: function(node)
+{
+if (this.isPopulated())
+this.treeElement().appendChild(node.treeElement());
+},
+
+willRemoveChild: function(node)
+{
+if (this.isPopulated())
+this.treeElement().removeChild(node.treeElement());
+},
+
+__proto__: WebInspector.NavigatorTreeNode.prototype
+}
+
+
+WebInspector.NavigatorUISourceCodeTreeNode = function(navigatorView, uiSourceCode)
+{
+WebInspector.NavigatorTreeNode.call(this, uiSourceCode.name());
+this._navigatorView = navigatorView;
+this._uiSourceCode = uiSourceCode;
+}
+
+WebInspector.NavigatorUISourceCodeTreeNode.prototype = {
+
+uiSourceCode: function()
+{
+return this._uiSourceCode;
+},
+
+
+treeElement: function()
+{
+if (this._treeElement)
+return this._treeElement;
+
+this._treeElement = new WebInspector.NavigatorSourceTreeElement(this._navigatorView, this._uiSourceCode, "");
+this.updateTitle();
+
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._titleChanged, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._formattedChanged, this);
+
+return this._treeElement;
+},
+
+
+updateTitle: function(ignoreIsDirty)
+{
+if (!this._treeElement)
+return;
+
+var titleText = this._uiSourceCode.name().trimEnd(100);
+if (!titleText)
+titleText = WebInspector.UIString("(program)");
+if (!ignoreIsDirty && this._uiSourceCode.isDirty())
+titleText = "*" + titleText;
+this._treeElement.titleText = titleText;
+},
+
+
+hasChildren: function()
+{
+return false;
+},
+
+dispose: function()
+{
+if (!this._treeElement)
+return;
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._titleChanged, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._formattedChanged, this);
+},
+
+_titleChanged: function(event)
+{
+this.updateTitle();
+},
+
+_workingCopyChanged: function(event)
+{
+this.updateTitle();
+},
+
+_workingCopyCommitted: function(event)
+{
+this.updateTitle();
+},
+
+_formattedChanged: function(event)
+{
+this.updateTitle();
+},
+
+
+reveal: function(select)
+{
+this.parent.populate();
+this.parent.treeElement().expand();
+this._treeElement.reveal();
+if (select)
+this._treeElement.select();
+},
+
+
+rename: function(callback)
+{
+if (!this._treeElement)
+return;
+
+
+var treeOutlineElement = this._treeElement.treeOutline.element;
+WebInspector.markBeingEdited(treeOutlineElement, true);
+
+function commitHandler(element, newTitle, oldTitle)
+{
+if (newTitle && newTitle !== oldTitle)
+this._navigatorView._fileRenamed(this._uiSourceCode, newTitle);
+afterEditing.call(this, true);
+}
+
+function cancelHandler()
+{
+afterEditing.call(this, false);
+}
+
+
+function afterEditing(committed)
+{
+WebInspector.markBeingEdited(treeOutlineElement, false);
+this.updateTitle();
+if (callback)
+callback(committed);
+}
+
+var editingConfig = new WebInspector.EditingConfig(commitHandler.bind(this), cancelHandler.bind(this));
+this.updateTitle(true);
+WebInspector.startEditing(this._treeElement.titleElement, editingConfig);
+window.getSelection().setBaseAndExtent(this._treeElement.titleElement, 0, this._treeElement.titleElement, 1);
+},
+
+__proto__: WebInspector.NavigatorTreeNode.prototype
+}
+
+
+WebInspector.NavigatorFolderTreeNode = function(navigatorView, id, type, title)
+{
+WebInspector.NavigatorTreeNode.call(this, id);
+this._navigatorView = navigatorView;
+this._type = type;
+this._title = title;
+}
+
+WebInspector.NavigatorFolderTreeNode.prototype = {
+
+treeElement: function()
+{
+if (this._treeElement)
+return this._treeElement;
+this._treeElement = this._createTreeElement(this._title, this);
+return this._treeElement;
+},
+
+
+_createTreeElement: function(title, node)
+{
+var treeElement = new WebInspector.NavigatorFolderTreeElement(this._type, title);
+treeElement.setNode(node);
+return treeElement;
+},
+
+wasPopulated: function()
+{
+if (!this._treeElement || this._treeElement._node !== this)
+return;
+this._addChildrenRecursive();
+},
+
+_addChildrenRecursive: function()
+{
+for (var id in this._children) {
+var child = this._children[id];
+this.didAddChild(child);
+if (child instanceof WebInspector.NavigatorFolderTreeNode)
+child._addChildrenRecursive();
+}
+},
+
+_shouldMerge: function(node)
+{
+return this._type !== WebInspector.NavigatorTreeOutline.Types.Domain && node instanceof WebInspector.NavigatorFolderTreeNode;
+},
+
+didAddChild: function(node)
+{
+function titleForNode(node)
+{
+return node._title;
+}
+
+if (!this._treeElement)
+return;
+
+var children = this.children();
+
+if (children.length === 1 && this._shouldMerge(node)) {
+node._isMerged = true;
+this._treeElement.titleText = this._treeElement.titleText + "/" + node._title;
+node._treeElement = this._treeElement;
+this._treeElement.setNode(node);
+return;
+}
+
+var oldNode;
+if (children.length === 2)
+oldNode = children[0] !== node ? children[0] : children[1];
+if (oldNode && oldNode._isMerged) {
+delete oldNode._isMerged;
+var mergedToNodes = [];
+mergedToNodes.push(this);
+var treeNode = this;
+while (treeNode._isMerged) {
+treeNode = treeNode.parent;
+mergedToNodes.push(treeNode);
+}
+mergedToNodes.reverse();
+var titleText = mergedToNodes.map(titleForNode).join("/");
+
+var nodes = [];
+treeNode = oldNode;
+do {
+nodes.push(treeNode);
+children = treeNode.children();
+treeNode = children.length === 1 ? children[0] : null;
+} while (treeNode && treeNode._isMerged);
+
+if (!this.isPopulated()) {
+this._treeElement.titleText = titleText;
+this._treeElement.setNode(this);
+for (var i = 0; i < nodes.length; ++i) {
+delete nodes[i]._treeElement;
+delete nodes[i]._isMerged;
+}
+return;
+}
+var oldTreeElement = this._treeElement;
+var treeElement = this._createTreeElement(titleText, this);
+for (var i = 0; i < mergedToNodes.length; ++i)
+mergedToNodes[i]._treeElement = treeElement;
+oldTreeElement.parent.appendChild(treeElement);
+
+oldTreeElement.setNode(nodes[nodes.length - 1]);
+oldTreeElement.titleText = nodes.map(titleForNode).join("/");
+oldTreeElement.parent.removeChild(oldTreeElement);
+this._treeElement.appendChild(oldTreeElement);
+if (oldTreeElement.expanded)
+treeElement.expand();
+}
+if (this.isPopulated())
+this._treeElement.appendChild(node.treeElement());
+},
+
+willRemoveChild: function(node)
+{
+if (node._isMerged || !this.isPopulated())
+return;
+this._treeElement.removeChild(node._treeElement);
+},
+
+__proto__: WebInspector.NavigatorTreeNode.prototype
+}
 ;
 
 
@@ -2653,8 +3185,7 @@
 WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this));
 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._revisionAdded, this);
 WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
-WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, this._uiSourceCodeRemoved, this);
-WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
+WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
 
 this._statusElement = document.createElement("span");
 this._statusElement.textContent = WebInspector.UIString("Local modifications");
@@ -2675,12 +3206,12 @@
 
 _createUISourceCodeItem: function(uiSourceCode)
 {
-var uiSourceCodeItem = new TreeElement(uiSourceCode.parsedURL.displayName, null, true);
+var uiSourceCodeItem = new TreeElement(uiSourceCode.displayName(), null, true);
 uiSourceCodeItem.selectable = false;
 
 
 for (var i = 0; i < this._treeOutline.children.length; ++i) {
-if (this._treeOutline.children[i].title.localeCompare(uiSourceCode.parsedURL.displayName) > 0) {
+if (this._treeOutline.children[i].title.localeCompare(uiSourceCode.displayName()) > 0) {
 this._treeOutline.insertChild(uiSourceCodeItem, i);
 break;
 }
@@ -2759,10 +3290,10 @@
 this._uiSourceCodeItems.remove(uiSourceCode);
 },
 
-_reset: function()
+_projectWillReset: function(event)
 {
-this._treeOutline.removeChildren();
-this._uiSourceCodeItems.clear();
+var project = event.data;
+project.uiSourceCodes().forEach(this._removeUISourceCode.bind(this));
 },
 
 __proto__: WebInspector.View.prototype
@@ -2938,6 +3469,7 @@
 var subtitle = scope.object.description;
 var emptyPlaceholder = null;
 var extraProperties = null;
+var declarativeScope;
 
 switch (scope.type) {
 case "local":
@@ -2956,28 +3488,40 @@
 extraProperties.push(new WebInspector.RemoteObjectProperty("<exception>", WebInspector.RemoteObject.fromPayload(exceptionObject)));
 }
 }
+declarativeScope = true;
 break;
 case "closure":
 title = WebInspector.UIString("Closure");
 emptyPlaceholder = WebInspector.UIString("No Variables");
 subtitle = null;
+declarativeScope = true;
 break;
 case "catch":
 title = WebInspector.UIString("Catch");
 subtitle = null;
+declarativeScope = true;
 break;
 case "with":
 title = WebInspector.UIString("With Block");
+declarativeScope = false;
 break;
 case "global":
 title = WebInspector.UIString("Global");
+declarativeScope = false;
 break;
 }
 
 if (!title || title === subtitle)
 subtitle = null;
 
-var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scope.object), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
+var scopeRef;
+if (declarativeScope)
+scopeRef = new WebInspector.ScopeRef(i, callFrame.id, undefined);
+else
+scopeRef = undefined;
+
+
+var section = new WebInspector.ObjectPropertiesSection(WebInspector.ScopeRemoteObject.fromPayload(scope.object, scopeRef), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
 section.editInSelectedCallFrameWhenPaused = true;
 section.pane = this;
 
@@ -3079,11 +3623,11 @@
 },
 
 
-_snippetsNavigatorViewForUISourceCode: function(uiSourceCode)
+_navigatorViewForUISourceCode: function(uiSourceCode)
 {
 if (uiSourceCode.isContentScript)
 return this._contentScriptsView;
-else if (uiSourceCode.isSnippet)
+else if (uiSourceCode.project().type() === WebInspector.projectTypes.Snippets)
 return this._snippetsView;
 else
 return this._scriptsView;
@@ -3092,37 +3636,29 @@
 
 addUISourceCode: function(uiSourceCode)
 {
-this._snippetsNavigatorViewForUISourceCode(uiSourceCode).addUISourceCode(uiSourceCode);
+this._navigatorViewForUISourceCode(uiSourceCode).addUISourceCode(uiSourceCode);
 },
 
 
 removeUISourceCode: function(uiSourceCode)
 {
-this._snippetsNavigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSourceCode);
+this._navigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSourceCode);
 },
 
 
-isScriptSourceAdded: function(uiSourceCode)
+revealUISourceCode: function(uiSourceCode, select)
 {
-return this._snippetsNavigatorViewForUISourceCode(uiSourceCode).isScriptSourceAdded(uiSourceCode);
-},
-
-
-revealUISourceCode: function(uiSourceCode)
-{
-this._snippetsNavigatorViewForUISourceCode(uiSourceCode).revealUISourceCode(uiSourceCode);
+this._navigatorViewForUISourceCode(uiSourceCode).revealUISourceCode(uiSourceCode, select);
 if (uiSourceCode.isContentScript)
 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ContentScriptsTab);
-else if (uiSourceCode.isSnippet)
-this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.SnippetsTab);
-else
+else if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ScriptsTab);
 },
 
 
 rename: function(uiSourceCode, callback)
 {
-this._snippetsNavigatorViewForUISourceCode(uiSourceCode).rename(uiSourceCode, callback);
+this._navigatorViewForUISourceCode(uiSourceCode).rename(uiSourceCode, callback);
 },
 
 
@@ -3149,13 +3685,6 @@
 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.SnippetCreationRequested, event.data);
 },
 
-reset: function()
-{
-this._scriptsView.reset();
-this._contentScriptsView.reset();
-this._snippetsView.reset();
-},
-
 __proto__: WebInspector.Object.prototype
 }
 
@@ -3173,12 +3702,6 @@
 
 WebInspector.SnippetsNavigatorView.prototype = {
 
-getOrCreateFolderTreeElement: function(uiSourceCode)
-{
-return this._scriptsTree;
-},
-
-
 handleContextMenu: function(event, uiSourceCode)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
@@ -3193,29 +3716,28 @@
 },
 
 
-_handleEvaluateSnippet: function(uiSourceCode, event)
+_handleEvaluateSnippet: function(uiSourceCode)
 {
-if (!uiSourceCode.isSnippet)
+if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
 return;
 WebInspector.scriptSnippetModel.evaluateScriptSnippet(uiSourceCode);
 },
 
 
-_handleRenameSnippet: function(uiSourceCode, event)
+_handleRenameSnippet: function(uiSourceCode)
 {
 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemRenamingRequested, uiSourceCode);
 },
 
 
-_handleRemoveSnippet: function(uiSourceCode, event)
+_handleRemoveSnippet: function(uiSourceCode)
 {
-if (!uiSourceCode.isSnippet)
+if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
 return;
 WebInspector.scriptSnippetModel.deleteScriptSnippet(uiSourceCode);
 },
 
-
-_handleCreateSnippet: function(event)
+_handleCreateSnippet: function()
 {
 this._snippetCreationRequested();
 },
@@ -3231,12 +3753,12 @@
 
 
 
-WebInspector.ScriptsSearchScope = function(uiSourceCodeProvider)
+WebInspector.ScriptsSearchScope = function(workspace)
 {
 
 WebInspector.SearchScope.call(this)
 this._searchId = 0;
-this._uiSourceCodeProvider = uiSourceCodeProvider;
+this._workspace = workspace;
 }
 
 WebInspector.ScriptsSearchScope.prototype = {
@@ -3302,15 +3824,21 @@
 {
 function filterOutAnonymous(uiSourceCode)
 {
-return !!uiSourceCode.url;
+return !!uiSourceCode.originURL();
 }
 
 function comparator(a, b)
 {
-return a.url.localeCompare(b.url);   
+return a.originURL().compareTo(b.originURL());   
 }
 
-var uiSourceCodes = this._uiSourceCodeProvider.uiSourceCodes();
+var projects = this._workspace.projects();
+var uiSourceCodes = [];
+for (var i = 0; i < projects.length; ++i) {
+if (projects[i].isServiceProject())
+continue;
+uiSourceCodes = uiSourceCodes.concat(projects[i].uiSourceCodes());
+}
 
 uiSourceCodes = uiSourceCodes.filter(filterOutAnonymous);
 uiSourceCodes.sort(comparator);
@@ -3331,20 +3859,40 @@
 this._uiSourceCode = uiSourceCode;
 this._runButton = new WebInspector.StatusBarButton(WebInspector.UIString("Run"), "evaluate-snippet-status-bar-item");
 this._runButton.addEventListener("click", this._runButtonClicked, this);
+this.textEditor.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
+this._snippetsShortcuts = {};
+var runSnippetShortcutDescriptor = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+this._snippetsShortcuts[runSnippetShortcutDescriptor.key] = this._runSnippet.bind(this);
 }
 
 WebInspector.SnippetJavaScriptSourceFrame.prototype = {
 
 statusBarItems: function()
 {
-return [this._runButton.element];
+return [this._runButton.element].concat(WebInspector.JavaScriptSourceFrame.prototype.statusBarItems.call(this));
 },
 
 _runButtonClicked: function()
 {
+this._runSnippet();
+},
+
+_runSnippet: function()
+{
 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._uiSourceCode);
 },
 
+
+_onKeyDown: function(event)
+{
+var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+var handler = this._snippetsShortcuts[shortcutKey];
+if (handler) {
+handler(event);
+event.handled = true;
+}
+},
+
 __proto__: WebInspector.JavaScriptSourceFrame.prototype
 }
 ;
@@ -3407,18 +3955,18 @@
 function didGetAllStyleSheets(error, infos)
 {
 if (error) {
-callback(0, 0, 0, 0);
+callback(0, 0);
 return;
 }
 
 for (var i = 0; i < infos.length; ++i) {
 var info = infos[i];
-if (info.sourceURL === this._uiSourceCode.contentURL()) {
+if (info.sourceURL === this._uiSourceCode.url) {
 WebInspector.CSSStyleSheet.createForId(info.styleSheetId, didGetStyleSheet.bind(this));
 return;
 }
 }
-callback(0, 0, 0, 0);
+callback(0, 0);
 }
 
 CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));
@@ -3427,12 +3975,12 @@
 function didGetStyleSheet(styleSheet)
 {
 if (!styleSheet) {
-callback(0, 0, 0, 0);
+callback(0, 0);
 return;
 }
 
 this._rules = styleSheet.rules;
-callback(0, this._rules.length, 0, 1);
+callback(0, 1);
 }
 },
 
@@ -3451,7 +3999,9 @@
 return query;
 },
 
-__proto__: WebInspector.SelectionDialogContentProvider.prototype
+dispose: function()
+{
+}
 }
 ;
 
@@ -3471,6 +4021,8 @@
 this._delegate = delegate;
 
 this._tabbedPane = new WebInspector.TabbedPane();
+this._tabbedPane.setTabDelegate(new WebInspector.EditorContainerTabDelegate(this));
+
 this._tabbedPane.closeableTabs = true;
 this._tabbedPane.element.id = "scripts-editor-container-tabbed-pane";
 
@@ -3522,19 +4074,18 @@
 
 _addScrollAndSelectionListeners: function()
 {
-console.assert(this._currentFile);
-var sourceFrame = this._delegate.viewForFile(this._currentFile);
-sourceFrame.addEventListener(WebInspector.SourceFrame.Events.ScrollChanged, this._scrollChanged, this);
-sourceFrame.addEventListener(WebInspector.SourceFrame.Events.SelectionChanged, this._selectionChanged, this);
+if (!this._currentView)
+return;
+this._currentView.addEventListener(WebInspector.SourceFrame.Events.ScrollChanged, this._scrollChanged, this);
+this._currentView.addEventListener(WebInspector.SourceFrame.Events.SelectionChanged, this._selectionChanged, this);
 },
 
 _removeScrollAndSelectionListeners: function()
 {
-if (!this._currentFile)
+if (!this._currentView)
 return;
-var sourceFrame = this._delegate.viewForFile(this._currentFile);
-sourceFrame.removeEventListener(WebInspector.SourceFrame.Events.ScrollChanged, this._scrollChanged, this);
-sourceFrame.removeEventListener(WebInspector.SourceFrame.Events.SelectionChanged, this._selectionChanged, this);
+this._currentView.removeEventListener(WebInspector.SourceFrame.Events.ScrollChanged, this._scrollChanged, this);
+this._currentView.removeEventListener(WebInspector.SourceFrame.Events.SelectionChanged, this._selectionChanged, this);
 },
 
 _scrollChanged: function(event)
@@ -3565,6 +4116,7 @@
 if (userGesture)
 this._editorSelectedByUserAction();
 
+this._currentView = this.visibleView;
 this._addScrollAndSelectionListeners();
 
 this.dispatchEventToListeners(WebInspector.TabbedEditorContainer.Events.EditorSelected, this._currentFile);
@@ -3576,24 +4128,53 @@
 const maxDisplayNameLength = 30;
 const minDisplayQueryParamLength = 5;
 
-var title;
-var parsedURL = uiSourceCode.parsedURL;
-if (!parsedURL.isValid)
-title = parsedURL.url ? parsedURL.url.trimMiddle(maxDisplayNameLength) : WebInspector.UIString("(program)");
-else {
-var maxDisplayQueryParamLength = Math.max(minDisplayQueryParamLength, maxDisplayNameLength - parsedURL.lastPathComponent.length);
-var displayQueryParams = parsedURL.queryParams ? "?" + parsedURL.queryParams.trimEnd(maxDisplayQueryParamLength - 1) : "";
-var displayLastPathComponent = parsedURL.lastPathComponent.trimMiddle(maxDisplayNameLength - displayQueryParams.length);
-var displayName = displayLastPathComponent + displayQueryParams;
-title = displayName || WebInspector.UIString("(program)");
-}
-
+var title = uiSourceCode.name();
+title = title ? title.trimMiddle(maxDisplayNameLength) : WebInspector.UIString("(program)");
 if (uiSourceCode.isDirty())
 title += "*";
 return title;
 },
 
 
+_maybeCloseTab: function(id, nextTabId)
+{
+var uiSourceCode = this._files[id];
+var shouldPrompt = uiSourceCode.isDirty() && uiSourceCode.project().canSetFileContent();
+
+if (!shouldPrompt || confirm(WebInspector.UIString("Are you sure you want to close unsaved file: %s?", uiSourceCode.name()))) {
+uiSourceCode.resetWorkingCopy();
+if (nextTabId)
+this._tabbedPane.selectTab(nextTabId, true);
+this._tabbedPane.closeTab(id, true);
+return true;
+}
+return false;
+},
+
+
+_closeTabs: function(ids)
+{
+var dirtyTabs = [];
+var cleanTabs = [];
+for (var i = 0; i < ids.length; ++i) {
+var id = ids[i];
+var uiSourceCode = this._files[id];
+if (uiSourceCode.isDirty())
+dirtyTabs.push(id);
+else
+cleanTabs.push(id);
+}
+if (dirtyTabs.length)
+this._tabbedPane.selectTab(dirtyTabs[0], true);
+this._tabbedPane.closeTabs(cleanTabs, true);
+for (var i = 0; i < dirtyTabs.length; ++i) {
+var nextTabId = i + 1 < dirtyTabs.length ? dirtyTabs[i + 1] : null;
+if (!this._maybeCloseTab(dirtyTabs[i], nextTabId))
+break;
+}
+},
+
+
 addUISourceCode: function(uiSourceCode)
 {
 if (this._userSelectedFiles || this._loadedURIs[uiSourceCode.uri()])
@@ -3606,9 +4187,20 @@
 
 var tabId = this._tabIds.get(uiSourceCode) || this._appendFileTab(uiSourceCode, false);
 
+if (!this._currentFile)
+return;
 
-if (!index)
-this._innerShowFile(uiSourceCode, true);
+
+if (!index) {
+this._innerShowFile(uiSourceCode, false);
+return;
+}
+
+var currentProjectType = this._currentFile.project().type();
+var addedProjectType = uiSourceCode.project().type();
+var snippetsProjectType = WebInspector.projectTypes.Snippets;
+if (this._history.index(this._currentFile.uri()) && currentProjectType === snippetsProjectType && addedProjectType !== snippetsProjectType)
+this._innerShowFile(uiSourceCode, false);
 },
 
 
@@ -3623,6 +4215,7 @@
 var tabIds = [];
 for (var i = 0; i < uiSourceCodes.length; ++i) {
 var uiSourceCode = uiSourceCodes[i];
+delete this._loadedURIs[uiSourceCode.uri()];
 var tabId = this._tabIds.get(uiSourceCode);
 if (tabId)
 tabIds.push(tabId);
@@ -3660,7 +4253,7 @@
 
 _tooltipForFile: function(uiSourceCode)
 {
-return uiSourceCode.url;
+return uiSourceCode.originURL();
 },
 
 
@@ -3696,6 +4289,7 @@
 var uiSourceCode = this._files[tabId];
 if (this._currentFile === uiSourceCode) {
 this._removeScrollAndSelectionListeners();
+delete this._currentView;
 delete this._currentFile;
 }
 this._tabIds.remove(uiSourceCode);
@@ -3773,12 +4367,7 @@
 
 reset: function()
 {
-this._tabbedPane.closeAllTabs();
-this._tabIds = new Map();
-this._files = {};
-delete this._currentFile;
 delete this._userSelectedFiles;
-this._loadedURIs = {};
 },
 
 
@@ -3800,10 +4389,13 @@
 WebInspector.TabbedEditorContainer.HistoryItem = function(url, selectionRange, scrollLineNumber)
 {
 this.url = url;
+this._isSerializable = url.length < WebInspector.TabbedEditorContainer.HistoryItem.serializableUrlLengthLimit;
 this.selectionRange = selectionRange;
 this.scrollLineNumber = scrollLineNumber;
 }
 
+WebInspector.TabbedEditorContainer.HistoryItem.serializableUrlLengthLimit = 4096;
+
 
 WebInspector.TabbedEditorContainer.HistoryItem.fromObject = function (serializedHistoryItem)
 {
@@ -3815,6 +4407,8 @@
 
 serializeToObject: function()
 {
+if (!this._isSerializable)
+return null;
 var serializedHistoryItem = {};
 serializedHistoryItem.url = this.url;
 serializedHistoryItem.selectionRange = this.selectionRange;
@@ -3829,6 +4423,7 @@
 WebInspector.TabbedEditorContainer.History = function(items)
 {
 this._items = items;
+this._rebuildItemIndex();
 }
 
 
@@ -3844,13 +4439,21 @@
 
 index: function(url)
 {
-for (var i = 0; i < this._items.length; ++i) {
-if (this._items[i].url === url)
-return i;
-}
+var index = this._itemsIndex[url];
+if (typeof index === "number")
+return index;
 return -1;
 },
 
+_rebuildItemIndex: function()
+{
+this._itemsIndex = {};
+for (var i = 0; i < this._items.length; ++i) {
+console.assert(!this._itemsIndex.hasOwnProperty(this._items[i].url));
+this._itemsIndex[this._items[i].url] = i;
+}
+},
+
 
 selectionRange: function(url)
 {
@@ -3897,6 +4500,7 @@
 } else
 item = new WebInspector.TabbedEditorContainer.HistoryItem(urls[i]);
 this._items.unshift(item);
+this._rebuildItemIndex();
 }
 },
 
@@ -3904,8 +4508,10 @@
 remove: function(url)
 {
 var index = this.index(url);
-if (index !== -1)
+if (index !== -1) {
 this._items.splice(index, 1);
+this._rebuildItemIndex();
+}
 },
 
 
@@ -3918,95 +4524,31 @@
 _serializeToObject: function()
 {
 var serializedHistory = [];
-for (var i = 0; i < this._items.length; ++i)
-serializedHistory.push(this._items[i].serializeToObject());
+for (var i = 0; i < this._items.length; ++i) {
+var serializedItem = this._items[i].serializeToObject();
+if (serializedItem)
+serializedHistory.push(serializedItem);
+if (serializedHistory.length === WebInspector.TabbedEditorContainer.maximalPreviouslyViewedFilesCount)
+break;
+}
 return serializedHistory;
 },
 
 __proto__: WebInspector.Object.prototype
 }
-;
 
 
-
-WebInspector.UISourceCodeFrame = function(uiSourceCode)
+WebInspector.EditorContainerTabDelegate = function(editorContainer)
 {
-this._uiSourceCode = uiSourceCode;
-WebInspector.SourceFrame.call(this, this._uiSourceCode);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._onFormattedChanged, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this);
-this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this);
+this._editorContainer = editorContainer;
 }
 
-WebInspector.UISourceCodeFrame.prototype = {
+WebInspector.EditorContainerTabDelegate.prototype = {
 
-canEditSource: function()
+closeTabs: function(tabbedPane, ids)
 {
-return true;
-},
-
-
-commitEditing: function(text)
-{
-if (!this._uiSourceCode.isDirty())
-return;
-
-this._isCommittingEditing = true;
-this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this));
-delete this._isCommittingEditing;
-},
-
-onTextChanged: function(oldRange, newRange)
-{
-this._isSettingWorkingCopy = true;
-this._uiSourceCode.setWorkingCopy(this._textEditor.text());
-delete this._isSettingWorkingCopy;
-},
-
-_didEditContent: function(error)
-{
-if (error) {
-WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
-return;
+this._editorContainer._closeTabs(ids);
 }
-},
-
-
-_onFormattedChanged: function(event)
-{
-var content =   (event.data.content);
-this._textEditor.setReadOnly(this._uiSourceCode.formatted());
-this._innerSetContent(content);
-},
-
-
-_onWorkingCopyChanged: function(event)
-{
-this._innerSetContent(this._uiSourceCode.workingCopy());
-},
-
-
-_onWorkingCopyCommitted: function(event)
-{
-this._innerSetContent(this._uiSourceCode.workingCopy());
-},
-
-_innerSetContent: function(content)
-{
-if (this._isSettingWorkingCopy || this._isCommittingEditing)
-return;
-
-this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType());
-},
-
-populateTextAreaContextMenu: function(contextMenu, lineNumber)
-{
-WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
-contextMenu.appendApplicableItems(this._uiSourceCode);
-contextMenu.appendSeparator();
-},
-
-__proto__: WebInspector.SourceFrame.prototype
 }
 ;
 
@@ -4015,20 +4557,6 @@
 WebInspector.WatchExpressionsSidebarPane = function()
 {
 WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions"));
-}
-
-WebInspector.WatchExpressionsSidebarPane.prototype = {
-show: function()
-{
-this._visible = true;
-
-
-if (this._wasShown) {
-this._refreshExpressionsIfNeeded();
-return;
-}
-
-this._wasShown = true;
 
 this.section = new WebInspector.WatchExpressionsSection();
 this.bodyElement.appendChild(this.section.element);
@@ -4044,15 +4572,14 @@
 addButton.addEventListener("click", this._addButtonClicked.bind(this), false);
 this.titleElement.appendChild(addButton);
 addButton.title = WebInspector.UIString("Add watch expression");
+
 this._requiresUpdate = true;
+}
 
-if (WebInspector.settings.watchExpressions.get().length > 0)
-this.expanded = true;
-},
-
-hide: function()
+WebInspector.WatchExpressionsSidebarPane.prototype = {
+wasShown: function()
 {
-this._visible = false;
+this._refreshExpressionsIfNeeded();
 },
 
 reset: function()
@@ -4069,12 +4596,12 @@
 addExpression: function(expression)
 {
 this.section.addExpression(expression);
-this.expanded = true;
+this.expand();
 },
 
 _refreshExpressionsIfNeeded: function()
 {
-if (this._requiresUpdate && this._visible) {
+if (this._requiresUpdate && this.isShowing()) {
 this.section.update();
 delete this._requiresUpdate;
 } else
@@ -4084,7 +4611,7 @@
 _addButtonClicked: function(event)
 {
 event.consume();
-this.expanded = true;
+this.expand();
 this.section.addNewExpressionAndEdit();
 },
 
@@ -4152,7 +4679,7 @@
 properties.push(property);
 
 if (properties.length == propertyCount) {
-this.updateProperties(properties, WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressionsSection.CompareProperties);
+this.updateProperties(properties, [], WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressionsSection.CompareProperties);
 
 
 
@@ -4309,7 +4836,7 @@
 _emptyElementContextMenu: function(event)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
-contextMenu.appendItem(WebInspector.UIString("Add watch expression"), this.addNewExpressionAndEdit.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add watch expression" : "Add Watch Expression"), this.addNewExpressionAndEdit.bind(this));
 contextMenu.show();
 },
 
@@ -4381,11 +4908,11 @@
 populateContextMenu: function(contextMenu)
 {
 if (!this.isEditing()) {
-contextMenu.appendItem(WebInspector.UIString("Add watch expression"), this.treeOutline.section.addNewExpressionAndEdit.bind(this.treeOutline.section));
-contextMenu.appendItem(WebInspector.UIString("Delete watch expression"), this._deleteButtonClicked.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add watch expression" : "Add Watch Expression"), this.treeOutline.section.addNewExpressionAndEdit.bind(this.treeOutline.section));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete watch expression" : "Delete Watch Expression"), this._deleteButtonClicked.bind(this));
 }
 if (this.treeOutline.section.watchExpressions.length > 1)
-contextMenu.appendItem(WebInspector.UIString("Delete all watch expressions"), this._deleteAllButtonClicked.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete all watch expressions" : "Delete All Watch Expressions"), this._deleteAllButtonClicked.bind(this));
 },
 
 _contextMenu: function(event)
@@ -4492,12 +5019,10 @@
 this._enableWorkersCheckbox.addEventListener(this._autoattachToWorkersClicked.bind(this));
 this._enableWorkersCheckbox.checked = false;
 
-if (Preferences.sharedWorkersDebugNote) {
 var note = this.bodyElement.createChild("div");
 note.id = "shared-workers-list";
 note.addStyleClass("sidebar-label")
-note.textContent = Preferences.sharedWorkersDebugNote;
-}
+note.textContent = WebInspector.UIString("Shared workers can be inspected in the Task Manager");
 
 var separator = this.bodyElement.createChild("div", "sidebar-separator");
 separator.textContent = WebInspector.UIString("Dedicated worker inspectors");
@@ -4583,13 +5108,11 @@
 
 const initialDebugSidebarWidth = 225;
 const minimumDebugSidebarWidthPercent = 50;
-this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPosition.Right, initialDebugSidebarWidth);
+this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPosition.End, initialDebugSidebarWidth);
 this.splitView.element.id = "scripts-split-view";
 this.splitView.setMinimumSidebarWidth(Preferences.minScriptsSidebarWidth);
 this.splitView.setMinimumMainWidthPercent(minimumDebugSidebarWidthPercent);
 
-this.sidebarElement.appendChild(this.debugToolbar);
-
 this.debugSidebarResizeWidgetElement = document.createElement("div");
 this.debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-widget";
 this.splitView.installResizer(this.debugSidebarResizeWidgetElement);
@@ -4597,7 +5120,7 @@
 
 const initialNavigatorWidth = 225;
 const minimumViewsContainerWidthPercent = 50;
-this.editorView = new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Left, "scriptsPanelNavigatorSidebarWidth", initialNavigatorWidth);
+this.editorView = new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Start, "scriptsPanelNavigatorSidebarWidth", initialNavigatorWidth);
 this.editorView.element.tabIndex = 0;
 
 this.editorView.setMinimumSidebarWidth(Preferences.minScriptsSidebarWidth);
@@ -4627,47 +5150,20 @@
 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane();
 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(WebInspector.breakpointManager, this._showSourceLine.bind(this));
-this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane;
+this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.createProxy(this);
 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPane();
 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerBreakpointsSidebarPane();
 
-if (InspectorFrontendHost.canInspectWorkers() && !WebInspector.WorkerManager.isWorkerFrontend()) {
+if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFrontend()) {
 WorkerAgent.enable();
 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebInspector.workerManager);
 }
 
-this._debugSidebarContentsElement = document.createElement("div");
-this._debugSidebarContentsElement.id = "scripts-debug-sidebar-contents";
-this.sidebarElement.appendChild(this._debugSidebarContentsElement);
-
-for (var pane in this.sidebarPanes) {
-if (this.sidebarPanes[pane] === this.sidebarPanes.domBreakpoints)
-continue;
-this._debugSidebarContentsElement.appendChild(this.sidebarPanes[pane].element);
-}
-
-this.sidebarPanes.callstack.expanded = true;
-
-this.sidebarPanes.scopechain.expanded = true;
-this.sidebarPanes.jsBreakpoints.expanded = true;
-
 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this));
 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.EvaluateSelectionInConsole, this._evaluateSelectionInConsole.bind(this));
 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMember, this._showOutlineDialog.bind(this));
 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint, this._toggleBreakpoint.bind(this));
 
-var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
-var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
-var panelEnablerButton = WebInspector.UIString("Enable Debugging");
-
-this.panelEnablerView = new WebInspector.PanelEnablerView("scripts", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
-this.panelEnablerView.addEventListener("enable clicked", this._enableDebugging, this);
-
-this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-this.enableToggleButton.addEventListener("click", this._toggleDebugging, this);
-if (!Capabilities.debuggerCausesRecompilation)
-this.enableToggleButton.element.addStyleClass("hidden");
-
 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
 this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions, this);
 
@@ -4676,10 +5172,17 @@
 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatSource, this);
 
 this._scriptViewStatusBarItemsContainer = document.createElement("div");
-this._scriptViewStatusBarItemsContainer.style.display = "inline-block";
+this._scriptViewStatusBarItemsContainer.className = "inline-block";
+
+this._scriptViewStatusBarTextContainer = document.createElement("div");
+this._scriptViewStatusBarTextContainer.className = "inline-block";
 
 this._installDebuggerSidebarController();
 
+WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged, this._dockSideChanged.bind(this));
+WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));
+this._dockSideChanged();
+
 this._sourceFramesByUISourceCode = new Map();
 this._updateDebuggerButtons();
 this._pauseOnExceptionStateChanged();
@@ -4704,8 +5207,8 @@
 
 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
-this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, this._uiSourceCodeRemoved, this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset.bind(this), this);
+this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset.bind(this), this);
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
 
 WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._workspace));
 }
@@ -4713,12 +5216,18 @@
 WebInspector.ScriptsPanel.prototype = {
 get statusBarItems()
 {
-return [this.enableToggleButton.element, this._pauseOnExceptionButton.element, this._toggleFormatSourceButton.element, this._scriptViewStatusBarItemsContainer];
+return [this._pauseOnExceptionButton.element, this._toggleFormatSourceButton.element, this._scriptViewStatusBarItemsContainer];
+},
+
+
+statusBarText: function()
+{
+return this._scriptViewStatusBarTextContainer;
 },
 
 defaultFocusedElement: function()
 {
-return this._navigator.view.defaultFocusedElement();
+return this._editorContainer.view.defaultFocusedElement() || this._navigator.view.defaultFocusedElement();
 },
 
 get paused()
@@ -4729,9 +5238,6 @@
 wasShown: function()
 {
 WebInspector.Panel.prototype.wasShown.call(this);
-this._debugSidebarContentsElement.insertBefore(this.sidebarPanes.domBreakpoints.element, this.sidebarPanes.xhrBreakpoints.element);
-this.sidebarPanes.watchExpressions.show();
-
 this._navigatorController.wasShown();
 },
 
@@ -4753,12 +5259,13 @@
 {
 if (this._toggleFormatSourceButton.toggled)
 uiSourceCode.setFormatted(true);
-
-this._editorContainer.addUISourceCode(uiSourceCode);
+if (uiSourceCode.project().isServiceProject())
+return;
 this._navigator.addUISourceCode(uiSourceCode);
+this._editorContainer.addUISourceCode(uiSourceCode);
 
-if (this._currentUISourceCode && this._currentUISourceCode.isTemporary && this._currentUISourceCode !== uiSourceCode && this._currentUISourceCode.url === uiSourceCode.url) {
 var currentUISourceCode = this._currentUISourceCode;
+if (currentUISourceCode && currentUISourceCode.project().isServiceProject() && currentUISourceCode !== uiSourceCode && currentUISourceCode.url === uiSourceCode.url) {
 this._showFile(uiSourceCode);
 this._editorContainer.removeUISourceCode(currentUISourceCode);
 }
@@ -4767,9 +5274,17 @@
 _uiSourceCodeRemoved: function(event)
 {
 var uiSourceCode =   (event.data);
-this._editorContainer.removeUISourceCode(uiSourceCode);
-this._navigator.removeUISourceCode(uiSourceCode);
-this._removeSourceFrame(uiSourceCode);
+this._removeUISourceCodes([uiSourceCode]);
+},
+
+
+_removeUISourceCodes: function(uiSourceCodes)
+{
+for (var i = 0; i < uiSourceCodes.length; ++i) {
+this._navigator.removeUISourceCode(uiSourceCodes[i]);
+this._removeSourceFrame(uiSourceCodes[i]);
+}
+this._editorContainer.removeUISourceCodes(uiSourceCodes);
 },
 
 _consoleCommandEvaluatedInSelectedCallFrame: function(event)
@@ -4791,12 +5306,12 @@
 this.sidebarPanes.callstack.update(details.callFrames);
 
 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) {
-this.sidebarPanes.domBreakpoints.highlightBreakpoint(details.auxData);
+WebInspector.domBreakpointsSidebarPane.highlightBreakpoint(details.auxData);
 function didCreateBreakpointHitStatusMessage(element)
 {
 this.sidebarPanes.callstack.setStatus(element);
 }
-this.sidebarPanes.domBreakpoints.createBreakpointHitStatusMessage(details.auxData, didCreateBreakpointHitStatusMessage.bind(this));
+WebInspector.domBreakpointsSidebarPane.createBreakpointHitStatusMessage(details.auxData, didCreateBreakpointHitStatusMessage.bind(this));
 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.EventListener) {
 var eventName = details.auxData.eventName;
 this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(details.auxData.eventName);
@@ -4820,7 +5335,10 @@
 this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint);
 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a JavaScript breakpoint."));
 }
+if (details.callFrames.length) 
 details.callFrames[0].createLiveLocation(didGetUILocation.bind(this));
+else
+console.warn("ScriptsPanel paused, but callFrames.length is zero."); 
 }
 
 this._showDebuggerSidebar();
@@ -4846,26 +5364,22 @@
 
 _debuggerWasDisabled: function()
 {
-this._reset();
+this._debuggerReset();
 },
 
-_reset: function()
+_debuggerReset: function()
 {
-delete this.currentQuery;
-this.searchCanceled();
-
 this._debuggerResumed();
-
-delete this._currentUISourceCode;
-this._navigator.reset();
-this._editorContainer.reset();
-this._updateScriptViewStatusBarItems();
-this.sidebarPanes.jsBreakpoints.reset();
 this.sidebarPanes.watchExpressions.reset();
+},
 
-var uiSourceCodes = this._workspace.uiSourceCodes();
-for (var i = 0; i < uiSourceCodes.length; ++i)
-this._removeSourceFrame(uiSourceCodes[i]);
+_projectWillReset: function(event)
+{
+var project = event.data;
+var uiSourceCodes = project.uiSourceCodes();
+this._removeUISourceCodes(uiSourceCodes);
+if (project.type() === WebInspector.projectTypes.Network)
+this._editorContainer.reset();
 },
 
 get visibleView()
@@ -4876,12 +5390,16 @@
 _updateScriptViewStatusBarItems: function()
 {
 this._scriptViewStatusBarItemsContainer.removeChildren();
+this._scriptViewStatusBarTextContainer.removeChildren();
 
 var sourceFrame = this.visibleView;
 if (sourceFrame) {
 var statusBarItems = sourceFrame.statusBarItems() || [];
 for (var i = 0; i < statusBarItems.length; ++i)
 this._scriptViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+var statusBarText = sourceFrame.statusBarText();
+if (statusBarText)
+this._scriptViewStatusBarTextContainer.appendChild(statusBarText);
 }
 },
 
@@ -4889,13 +5407,11 @@
 {
 if (WebInspector.debuggerModel.debuggerEnabled() && anchor.uiSourceCode)
 return true;
-var uiSourceCodes = this._workspace.uiSourceCodes();
-for (var i = 0; i < uiSourceCodes.length; ++i) {
-if (uiSourceCodes[i].url === anchor.href) {
-anchor.uiSourceCode = uiSourceCodes[i];
+var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(anchor.href);
+if (uiSourceCode) {
+anchor.uiSourceCode = uiSourceCode;
 return true;
 }
-}
 return false;
 },
 
@@ -4920,7 +5436,7 @@
 
 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink,
-url: uiSourceCode.url,
+url: uiSourceCode.originURL(),
 lineNumber: lineNumber
 });
 },
@@ -4932,9 +5448,8 @@
 if (this._currentUISourceCode === uiSourceCode)
 return sourceFrame;
 this._currentUISourceCode = uiSourceCode;
-
-if (this._navigator.isScriptSourceAdded(uiSourceCode))
-this._navigator.revealUISourceCode(uiSourceCode);
+if (!uiSourceCode.project().isServiceProject())
+this._navigator.revealUISourceCode(uiSourceCode, true);
 this._editorContainer.showFile(uiSourceCode);
 this._updateScriptViewStatusBarItems();
 
@@ -4947,7 +5462,7 @@
 var sourceFrame;
 switch (uiSourceCode.contentType()) {
 case WebInspector.resourceTypes.Script:
-if (uiSourceCode.isSnippet)
+if (uiSourceCode.project().type() === WebInspector.projectTypes.Snippets)
 sourceFrame = new WebInspector.SnippetJavaScriptSourceFrame(this, uiSourceCode);
 else
 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceCode);
@@ -4983,7 +5498,7 @@
 if (!sourceFrame)
 return;
 this._sourceFramesByUISourceCode.remove(uiSourceCode);
-sourceFrame.detach();
+sourceFrame.dispose();
 },
 
 _clearCurrentExecutionLine: function()
@@ -5009,13 +5524,10 @@
 {
 var uiSourceCode = uiLocation.uiSourceCode;
 
-if (uiSourceCode.isTemporary) {
 if (this._currentUISourceCode && this._currentUISourceCode.scriptFile() && this._currentUISourceCode.scriptFile().isDivergingFromVM())
 return;
-this._editorContainer.addUISourceCode(uiSourceCode);
-if (uiSourceCode.formatted() !== this._toggleFormatSourceButton.toggled)
-uiSourceCode.setFormatted(this._toggleFormatSourceButton.toggled);
-}
+if (this._toggleFormatSourceButton.toggled && !uiSourceCode.formatted())
+uiSourceCode.setFormatted(true);
 var sourceFrame = this._showFile(uiSourceCode);
 sourceFrame.revealLine(uiLocation.lineNumber);
 sourceFrame.focus();
@@ -5085,35 +5597,29 @@
 _updateDebuggerButtons: function()
 {
 if (WebInspector.debuggerModel.debuggerEnabled()) {
-this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable.");
-this.enableToggleButton.toggled = true;
 this._pauseOnExceptionButton.visible = true;
-this.panelEnablerView.detach();
 } else {
-this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable.");
-this.enableToggleButton.toggled = false;
 this._pauseOnExceptionButton.visible = false;
-this.panelEnablerView.show(this.element);
 }
 
 if (this._paused) {
-this._updateButtonTitle(this.pauseButton, WebInspector.UIString("Resume script execution (%s)."))
-this.pauseButton.addStyleClass("paused");
+this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Resume script execution (%s)."))
+this._pauseButton.state = true;
 
-this.pauseButton.disabled = false;
-this.stepOverButton.disabled = false;
-this.stepIntoButton.disabled = false;
-this.stepOutButton.disabled = false;
+this._pauseButton.setEnabled(true);
+this._stepOverButton.setEnabled(true);
+this._stepIntoButton.setEnabled(true);
+this._stepOutButton.setEnabled(true);
 
 this.debuggerStatusElement.textContent = WebInspector.UIString("Paused");
 } else {
-this._updateButtonTitle(this.pauseButton, WebInspector.UIString("Pause script execution (%s)."))
-this.pauseButton.removeStyleClass("paused");
+this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pause script execution (%s)."))
+this._pauseButton.state = false;
 
-this.pauseButton.disabled = this._waitingToPause;
-this.stepOverButton.disabled = true;
-this.stepIntoButton.disabled = true;
-this.stepOutButton.disabled = true;
+this._pauseButton.setEnabled(!this._waitingToPause);
+this._stepOverButton.setEnabled(false);
+this._stepIntoButton.setEnabled(false);
+this._stepOutButton.setEnabled(false);
 
 if (this._waitingToPause)
 this.debuggerStatusElement.textContent = WebInspector.UIString("Pausing");
@@ -5129,7 +5635,7 @@
 this.sidebarPanes.callstack.update(null);
 this.sidebarPanes.scopechain.update(null);
 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();
-this.sidebarPanes.domBreakpoints.clearBreakpointHighlight();
+WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight();
 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight();
 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight();
 
@@ -5137,26 +5643,6 @@
 this._updateDebuggerButtons();
 },
 
-_enableDebugging: function()
-{
-this._toggleDebugging(this.panelEnablerView.alwaysEnabled);
-},
-
-_toggleDebugging: function(optionalAlways)
-{
-this._paused = false;
-this._waitingToPause = false;
-this._stepping = false;
-
-if (WebInspector.debuggerModel.debuggerEnabled()) {
-WebInspector.settings.debuggerEnabled.set(false);
-WebInspector.debuggerModel.disableDebugger();
-} else {
-WebInspector.settings.debuggerEnabled.set(!!optionalAlways);
-WebInspector.debuggerModel.enableDebugger();
-}
-},
-
 _togglePauseOnExceptions: function()
 {
 var nextStateMap = {};
@@ -5167,7 +5653,8 @@
 WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this._pauseOnExceptionButton.state]);
 },
 
-_togglePause: function()
+
+_togglePause: function(event)
 {
 if (this._paused) {
 this._paused = false;
@@ -5180,12 +5667,14 @@
 }
 
 this._clearInterface();
+return true;
 },
 
-_stepOverClicked: function()
+
+_stepOverClicked: function(event)
 {
 if (!this._paused)
-return;
+return true;
 
 this._paused = false;
 this._stepping = true;
@@ -5193,12 +5682,14 @@
 this._clearInterface();
 
 DebuggerAgent.stepOver();
+return true;
 },
 
-_stepIntoClicked: function()
+
+_stepIntoClicked: function(event)
 {
 if (!this._paused)
-return;
+return true;
 
 this._paused = false;
 this._stepping = true;
@@ -5206,12 +5697,14 @@
 this._clearInterface();
 
 DebuggerAgent.stepInto();
+return true;
 },
 
-_stepOutClicked: function()
+
+_stepOutClicked: function(event)
 {
 if (!this._paused)
-return;
+return true;
 
 this._paused = false;
 this._stepping = true;
@@ -5219,6 +5712,7 @@
 this._clearInterface();
 
 DebuggerAgent.stepOut();
+return true;
 },
 
 _toggleBreakpointsClicked: function(event)
@@ -5229,7 +5723,7 @@
 _breakpointsActiveStateChanged: function(event)
 {
 var active = event.data;
-this._toggleBreakpointsButton.toggled = active;
+this._toggleBreakpointsButton.toggled = !active;
 if (active) {
 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactivate breakpoints.");
 WebInspector.inspectorView.element.removeStyleClass("breakpoints-deactivated");
@@ -5241,11 +5735,14 @@
 }
 },
 
-_evaluateSelectionInConsole: function()
+
+_evaluateSelectionInConsole: function(event)
 {
 var selection = window.getSelection();
-if (selection.type === "Range" && !selection.isCollapsed)
+if (selection.type !== "Range" || selection.isCollapsed)
+return false;
 WebInspector.evaluateInConsole(selection.toString());
+return true;
 },
 
 _createDebugToolbar: function()
@@ -5259,29 +5756,29 @@
 
 
 handler = this._togglePause.bind(this);
-this.pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue);
-debugToolbar.appendChild(this.pauseButton);
+this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue);
+debugToolbar.appendChild(this._pauseButton.element);
 
 
 title = WebInspector.UIString("Step over next function call (%s).");
 handler = this._stepOverClicked.bind(this);
-this.stepOverButton = this._createButtonAndRegisterShortcuts("scripts-step-over", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver);
-debugToolbar.appendChild(this.stepOverButton);
+this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-step-over", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver);
+debugToolbar.appendChild(this._stepOverButton.element);
 
 
 title = WebInspector.UIString("Step into next function call (%s).");
 handler = this._stepIntoClicked.bind(this);
-this.stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-step-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto);
-debugToolbar.appendChild(this.stepIntoButton);
+this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-step-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto);
+debugToolbar.appendChild(this._stepIntoButton.element);
 
 
 title = WebInspector.UIString("Step out of current function (%s).");
 handler = this._stepOutClicked.bind(this);
-this.stepOutButton = this._createButtonAndRegisterShortcuts("scripts-step-out", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut);
-debugToolbar.appendChild(this.stepOutButton);
+this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-step-out", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut);
+debugToolbar.appendChild(this._stepOutButton.element);
 
-this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate breakpoints."), "toggle-breakpoints");
-this._toggleBreakpointsButton.toggled = true;
+this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints");
+this._toggleBreakpointsButton.toggled = false;
 this._toggleBreakpointsButton.addEventListener("click", this._toggleBreakpointsClicked, this);
 debugToolbar.appendChild(this._toggleBreakpointsButton.element);
 
@@ -5292,9 +5789,9 @@
 return debugToolbar;
 },
 
+
 _updateButtonTitle: function(button, buttonTitle)
 {
-button.buttonTitle = buttonTitle;
 var hasShortcuts = button.shortcuts && button.shortcuts.length;
 if (hasShortcuts)
 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].name]);
@@ -5305,17 +5802,11 @@
 
 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler, shortcuts)
 {
-var button = document.createElement("button");
-button.className = "status-bar-item";
-button.id = buttonId;
+var button = new WebInspector.StatusBarButton(buttonTitle, buttonId);
+button.element.addEventListener("click", handler, false);
 button.shortcuts = shortcuts;
 this._updateButtonTitle(button, buttonTitle);
-button.disabled = true;
-button.appendChild(document.createElement("img"));
-button.addEventListener("click", handler, false);
-
 this.registerShortcuts(shortcuts, handler);
-
 return button;
 },
 
@@ -5376,7 +5867,7 @@
 jumpToPreviousSearchResult: function()
 {
 if (!this._searchView)
-return false;
+return;
 
 if (this._searchView !== this.visibleView) {
 this.performSearch(this._searchQuery);
@@ -5420,10 +5911,12 @@
 for (var i = 0; i < uiSourceCodes.length; ++i)
 uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled);
 
+var currentFile = this._editorContainer.currentFile();
+
 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
 action: WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint,
 enabled: this._toggleFormatSourceButton.toggled,
-url: this._editorContainer.currentFile().url
+url: currentFile ? currentFile.originURL() : null
 });
 },
 
@@ -5432,33 +5925,38 @@
 this.sidebarPanes.watchExpressions.addExpression(expression);
 },
 
+
 _toggleBreakpoint: function()
 {
 var sourceFrame = this.visibleView;
 if (!sourceFrame)
-return;
+return false;
 
 if (sourceFrame instanceof WebInspector.JavaScriptSourceFrame) {
 var javaScriptSourceFrame =   (sourceFrame);
 javaScriptSourceFrame.toggleBreakpointOnCurrentLine();
-}            
+return true;
+}
+return false;
 },
 
-_showOutlineDialog: function()
+
+_showOutlineDialog: function(event)
 {
 var uiSourceCode = this._editorContainer.currentFile();
 if (!uiSourceCode)
-return;
+return false;
 
 switch (uiSourceCode.contentType()) {
 case WebInspector.resourceTypes.Document:
 case WebInspector.resourceTypes.Script:
 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSourceCode);
-break;
+return true;
 case WebInspector.resourceTypes.Stylesheet:
 WebInspector.StyleSheetOutlineDialog.show(this.visibleView, uiSourceCode);
-break;
+return true;
 }
+return false;
 },
 
 _installDebuggerSidebarController: function()
@@ -5507,9 +6005,10 @@
 {
 var uiSourceCode =   (event.data.uiSourceCode);
 var name =   (event.data.name);
-if (!uiSourceCode.isSnippet)
+if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
 return;
 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode, name);
+uiSourceCode.rename(name);
 },
 
 
@@ -5572,13 +6071,73 @@
 },
 
 
+_mapFileSystemToNetwork: function(uiSourceCode)
+{
+WebInspector.SelectUISourceCodeForProjectTypeDialog.show(uiSourceCode.name(), WebInspector.projectTypes.Network, mapFileSystemToNetwork.bind(this), this.editorView.mainElement)                
+
+
+function mapFileSystemToNetwork(networkUISourceCode)
+{
+this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
+}
+},
+
+
+_removeNetworkMapping: function(uiSourceCode)
+{
+if (confirm(WebInspector.UIString("Are you sure you want to remove network mapping?")))
+this._workspace.removeMapping(uiSourceCode);
+},
+
+
+_mapNetworkToFileSystem: function(networkUISourceCode)
+{
+WebInspector.SelectUISourceCodeForProjectTypeDialog.show(networkUISourceCode.name(), WebInspector.projectTypes.FileSystem, mapNetworkToFileSystem.bind(this), this.editorView.mainElement)                
+
+
+function mapNetworkToFileSystem(uiSourceCode)
+{
+this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
+}
+},
+
+
+_appendUISourceCodeMappingItems: function(contextMenu, uiSourceCode)
+{
+if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) {
+var hasMappings = !!uiSourceCode.url;
+if (!hasMappings)
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Map to network resource\u2026" : "Map to Network Resource\u2026"), this._mapFileSystemToNetwork.bind(this, uiSourceCode));
+else
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove network mapping" : "Remove Network Mapping"), this._removeNetworkMapping.bind(this, uiSourceCode));
+}
+
+if (uiSourceCode.project().type() === WebInspector.projectTypes.Network) {
+
+function filterProject(project)
+{
+return project.type() === WebInspector.projectTypes.FileSystem;
+}
+
+if (!this._workspace.projects().filter(filterProject).length)
+return;
+if (this._workspace.uiSourceCodeForURL(uiSourceCode.url) === uiSourceCode)
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Map to file system resource\u2026" : "Map to File System Resource\u2026"), this._mapNetworkToFileSystem.bind(this, uiSourceCode));
+}
+},
+
+
 _appendUISourceCodeItems: function(contextMenu, target)
 {
 if (!(target instanceof WebInspector.UISourceCode))
 return;
 
 var uiSourceCode =   (target);
-contextMenu.appendItem(WebInspector.UIString("Local modifications..."), this._showLocalHistory.bind(this, uiSourceCode));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Local modifications\u2026" : "Local Modifications\u2026"), this._showLocalHistory.bind(this, uiSourceCode));
+
+if (WebInspector.isolatedFileSystemManager.supportsFileSystems() && WebInspector.experimentsSettings.fileSystemProject.isEnabled())
+this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
+
 var resource = WebInspector.resourceForURL(uiSourceCode.url);
 if (resource && resource.request)
 contextMenu.appendApplicableItems(resource.request);
@@ -5609,12 +6168,70 @@
 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind(this));
 }
 
-contextMenu.appendItem(WebInspector.UIString("Show function definition"), revealFunction.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Show function definition" : "Show Function Definition"), revealFunction.bind(this));
 },
 
 showGoToSourceDialog: function()
 {
-WebInspector.OpenResourceDialog.show(this, this._workspace, this.editorView.mainElement);
+WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement);
+},
+
+_dockSideChanged: function()
+{
+var dockSide = WebInspector.dockController.dockSide();
+var vertically = dockSide === WebInspector.DockController.State.DockedToRight && WebInspector.settings.splitVerticallyWhenDockedToRight.get();
+this._splitVertically(vertically);
+},
+
+
+_splitVertically: function(vertically)
+{
+if (this.sidebarPaneView && vertically === !this.splitView.isVertical())
+return;
+
+if (this.sidebarPaneView)
+this.sidebarPaneView.detach();
+
+this.splitView.setVertical(!vertically);
+
+if (!vertically) {
+this.sidebarPaneView = new WebInspector.SidebarPaneStack();
+for (var pane in this.sidebarPanes)
+this.sidebarPaneView.addPane(this.sidebarPanes[pane]);
+
+this.sidebarElement.appendChild(this.debugToolbar);
+} else {
+this._showDebuggerSidebar();
+
+this.sidebarPaneView = new WebInspector.SplitView(true, this.name + "PanelSplitSidebarRatio", 0.5);
+
+var group1 = new WebInspector.SidebarPaneStack();
+group1.show(this.sidebarPaneView.firstElement());
+group1.element.id = "scripts-sidebar-stack-pane";
+group1.addPane(this.sidebarPanes.callstack);
+group1.addPane(this.sidebarPanes.jsBreakpoints);
+group1.addPane(this.sidebarPanes.domBreakpoints);
+group1.addPane(this.sidebarPanes.xhrBreakpoints);
+group1.addPane(this.sidebarPanes.eventListenerBreakpoints);
+group1.addPane(this.sidebarPanes.workerList);
+
+var group2 = new WebInspector.SidebarTabbedPane();
+group2.show(this.sidebarPaneView.secondElement());
+group2.addPane(this.sidebarPanes.scopechain);
+group2.addPane(this.sidebarPanes.watchExpressions);
+
+this.sidebarPaneView.firstElement().appendChild(this.debugToolbar);
+}
+
+this.sidebarPaneView.element.id = "scripts-debug-sidebar-contents";
+this.sidebarPaneView.show(this.splitView.sidebarElement);
+
+this.sidebarPanes.scopechain.expand();
+this.sidebarPanes.jsBreakpoints.expand();
+this.sidebarPanes.callstack.expand();
+
+if (WebInspector.settings.watchExpressions.get().length > 0)
+this.sidebarPanes.watchExpressions.expand();
 },
 
 __proto__: WebInspector.Panel.prototype
diff --git a/resources/inspector/TimelinePanel.js b/resources/inspector/TimelinePanel.js
index 8f31494..785433a 100644
--- a/resources/inspector/TimelinePanel.js
+++ b/resources/inspector/TimelinePanel.js
@@ -13,7 +13,7 @@
 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, this._onRecordsCleared, this);
 
 this._containerAnchor = timelinePanel.element.lastChild;
-this._memorySidebarView = new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Left, undefined, sidebarWidth);
+this._memorySidebarView = new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Start, undefined, sidebarWidth);
 this._memorySidebarView.sidebarElement.addStyleClass("sidebar");
 this._memorySidebarView.element.id = "memory-graphs-container";
 
@@ -21,8 +21,7 @@
 
 this._canvasContainer = this._memorySidebarView.mainElement;
 this._canvasContainer.id = "memory-graphs-canvas-container";
-this._currentValuesBar = this._canvasContainer.createChild("div");
-this._currentValuesBar.id = "counter-values-bar";
+this._createCurrentValuesBar();
 this._canvas = this._canvasContainer.createChild("canvas");
 this._canvas.id = "memory-counters-graph";
 this._lastMarkerXPosition = 0;
@@ -37,25 +36,13 @@
 
 
 this._memorySidebarView.sidebarElement.createChild("div", "sidebar-tree sidebar-tree-section").textContent = WebInspector.UIString("COUNTERS");
-function getDocumentCount(entry)
-{
-return entry.documentCount;
+this._counterUI = this._createCounterUIList();
 }
-function getNodeCount(entry)
-{
-return entry.nodeCount;
-}
-function getListenerCount(entry)
-{
-return entry.listenerCount;
-}
-this._counterUI = [
-new WebInspector.CounterUI(this, "Document Count", "Documents: %d", [100,0,0], getDocumentCount),
-new WebInspector.CounterUI(this, "DOM Node Count", "Nodes: %d", [0,100,0], getNodeCount),
-new WebInspector.CounterUI(this, "Event Listener Count", "Listeners: %d", [0,0,100], getListenerCount)
-];
 
-TimelineAgent.setIncludeMemoryDetails(true);
+
+WebInspector.MemoryStatistics.Counter = function(time)
+{
+this.time = time;
 }
 
 
@@ -99,26 +86,23 @@
 }
 
 
-WebInspector.CounterUI = function(memoryCountersPane, title, currentValueLabel, rgb, valueGetter)
+WebInspector.CounterUIBase = function(memoryCountersPane, title, graphColor, valueGetter)
 {
 this._memoryCountersPane = memoryCountersPane;
 this.valueGetter = valueGetter;
 var container = memoryCountersPane._memorySidebarView.sidebarElement.createChild("div", "memory-counter-sidebar-info");
-var swatchColor = "rgb(" + rgb.join(",") + ")";
+var swatchColor = graphColor;
 this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title), swatchColor);
 this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, this._toggleCounterGraph.bind(this));
 container.appendChild(this._swatch.element);
-this._range = this._swatch.element.createChild("span");
 
-this._value = memoryCountersPane._currentValuesBar.createChild("span", "memory-counter-value");
-this._value.style.color = swatchColor;
-this._currentValueLabel = currentValueLabel;
-
-this.graphColor = "rgba(" + rgb.join(",") + ",0.8)";
+this._value = null;
+this.graphColor =graphColor;
+this.strokeColor = graphColor;
 this.graphYValues = [];
 }
 
-WebInspector.CounterUI.prototype = {
+WebInspector.CounterUIBase.prototype = {
 _toggleCounterGraph: function(event)
 {
 if (this._swatch.checked)
@@ -128,70 +112,52 @@
 this._memoryCountersPane.refresh();
 },
 
-setRange: function(minValue, maxValue)
-{
-this._range.textContent = WebInspector.UIString("[ %d - %d ]", minValue, maxValue);
-},
-
 updateCurrentValue: function(countersEntry)
 {
-this._value.textContent =  WebInspector.UIString(this._currentValueLabel, this.valueGetter(countersEntry));
+this._value.textContent = Number.bytesToString(this.valueGetter(countersEntry));
 },
 
 clearCurrentValueAndMarker: function(ctx)
 {
 this._value.textContent = "";
-this.restoreImageUnderMarker(ctx);
 },
 
 get visible()
 {
 return this._swatch.checked;
 },
-
-saveImageUnderMarker: function(ctx, x, y, radius)
-{
-const w = radius + 1;
-var imageData = ctx.getImageData(x - w, y - w, 2 * w, 2 * w);
-this._imageUnderMarker = {
-x: x - w,
-y: y - w,
-imageData: imageData };
-},
-
-restoreImageUnderMarker: function(ctx)
-{
-if (!this.visible)
-return;
-if (this._imageUnderMarker)
-ctx.putImageData(this._imageUnderMarker.imageData, this._imageUnderMarker.x, this._imageUnderMarker.y);
-this.discardImageUnderMarker();
-},
-
-discardImageUnderMarker: function()
-{
-delete this._imageUnderMarker;
 }
-}
-
 
 WebInspector.MemoryStatistics.prototype = {
+_createCurrentValuesBar: function()
+{
+throw new Error("Not implemented");
+},
+
+_createCounterUIList: function()
+{
+throw new Error("Not implemented");
+},
+
 _onRecordsCleared: function()
 {
 this._counters = [];
 },
 
+
 setMainTimelineGrid: function(timelineGrid)
 {
 this._mainTimelineGrid = timelineGrid;
 },
 
+
 setTopPosition: function(top)
 {
 this._memorySidebarView.element.style.top = top + "px";
 this._updateSize();
 },
 
+
 setSidebarWidth: function(width)
 {
 if (this._ignoreSidebarResize)
@@ -201,6 +167,7 @@
 this._ignoreSidebarResize = false;
 },
 
+
 _sidebarResized: function(event)
 {
 if (this._ignoreSidebarResize)
@@ -210,32 +177,25 @@
 this._ignoreSidebarResize = false;
 },
 
+_canvasHeight: function()
+{
+throw new Error("Not implemented");
+},
+
 _updateSize: function()
 {
 var width = this._mainTimelineGrid.dividersElement.offsetWidth + 1;
 this._canvasContainer.style.width = width + "px";
 
-var height = this._canvasContainer.offsetHeight - this._currentValuesBar.offsetHeight;
+var height = this._canvasHeight();
 this._canvas.width = width;
 this._canvas.height = height;
 },
 
+
 _onRecordAdded: function(event)
 {
-var statistics = this._counters;
-function addStatistics(record)
-{
-var counters = record["counters"];
-if (!counters)
-return;
-statistics.push({
-time: record.endTime || record.startTime,
-documentCount: counters["documents"],
-nodeCount: counters["nodes"],
-listenerCount: counters["jsEventListeners"]
-});
-}
-WebInspector.TimelinePresentationModel.forAllRecords([event.data], null, addStatistics);
+throw new Error("Not implemented");
 },
 
 _draw: function()
@@ -245,8 +205,6 @@
 this._clear();
 
 this._setVerticalClip(10, this._canvas.height - 20);
-for (var i = 0; i < this._counterUI.length; i++)
-this._drawGraph(this._counterUI[i]);
 },
 
 _calculateVisibleIndexes: function()
@@ -277,6 +235,7 @@
 this._maxTime = end;
 },
 
+
 _onClick: function(event)
 {
 var x = event.x - event.target.offsetParent.offsetLeft;
@@ -286,20 +245,29 @@
 this._timelinePanel.revealRecordAt(counter.time / 1000);
 },
 
+
 _onMouseOut: function(event)
 {
 delete this._markerXPosition;
 
 var ctx = this._canvas.getContext("2d");
+this._clearCurrentValueAndMarker(ctx);
+},
+
+
+_clearCurrentValueAndMarker: function(ctx)
+{
 for (var i = 0; i < this._counterUI.length; i++)
 this._counterUI[i].clearCurrentValueAndMarker(ctx);
 },
 
+
 _onMouseOver: function(event)
 {
 this._onMouseMove(event);
 },
 
+
 _onMouseMove: function(event)
 {
 var x = event.x - event.target.offsetParent.offsetLeft
@@ -313,14 +281,21 @@
 return;
 if (this._markerXPosition === undefined)
 return;
+if (this._maximumIndex === -1)
+return;
 var i = this._recordIndexAt(this._markerXPosition);
 
-for (var j = 0; j < this._counterUI.length; j++)
-this._counterUI[j].updateCurrentValue(this._counters[i]);
+this._updateCurrentValue(this._counters[i]);
 
 this._highlightCurrentPositionOnGraphs(this._markerXPosition, i);
 },
 
+_updateCurrentValue: function(counterEntry)
+{
+for (var j = 0; j < this._counterUI.length; j++)
+this._counterUI[j].updateCurrentValue(counterEntry);
+},
+
 _recordIndexAt: function(x)
 {
 var i;
@@ -336,36 +311,18 @@
 _highlightCurrentPositionOnGraphs: function(x, index)
 {
 var ctx = this._canvas.getContext("2d");
-for (var i = 0; i < this._counterUI.length; i++) {
-var counterUI = this._counterUI[i];
-if (!counterUI.visible)
-continue;
-counterUI.restoreImageUnderMarker(ctx);
-}
+this._restoreImageUnderMarker(ctx);
+this._drawMarker(ctx, x, index);
+},
 
-const radius = 2;
-for (var i = 0; i < this._counterUI.length; i++) {
-var counterUI = this._counterUI[i];
-if (!counterUI.visible)
-continue;
-var y = counterUI.graphYValues[index];
-counterUI.saveImageUnderMarker(ctx, x, y, radius);
-}
+_restoreImageUnderMarker: function(ctx)
+{
+throw new Error("Not implemented");
+},
 
-for (var i = 0; i < this._counterUI.length; i++) {
-var counterUI = this._counterUI[i];
-if (!counterUI.visible)
-continue;
-var y = counterUI.graphYValues[index];
-ctx.beginPath();
-ctx.arc(x, y, radius, 0, Math.PI*2, true);
-ctx.lineWidth = 1;
-ctx.fillStyle = counterUI.graphColor;
-ctx.strokeStyle = counterUI.graphColor;
-ctx.fill();
-ctx.stroke();
-ctx.closePath();
-}
+_drawMarker: function(ctx, x, index)
+{
+throw new Error("Not implemented");
 },
 
 visible: function()
@@ -420,6 +377,206 @@
 this._counters[this._maximumIndex].x = width;
 },
 
+_clear: function() {
+var ctx = this._canvas.getContext("2d");
+ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+this._discardImageUnderMarker();
+},
+
+_discardImageUnderMarker: function()
+{
+throw new Error("Not implemented");
+}
+}
+
+;
+
+
+
+WebInspector.DOMCountersGraph = function(timelinePanel, model, sidebarWidth)
+{
+WebInspector.MemoryStatistics.call(this, timelinePanel, model, sidebarWidth);
+}
+
+
+WebInspector.DOMCounterUI = function(memoryCountersPane, title, currentValueLabel, rgb, valueGetter)
+{
+var swatchColor = "rgb(" + rgb.join(",") + ")";
+WebInspector.CounterUIBase.call(this, memoryCountersPane, title, swatchColor, valueGetter)
+this._range = this._swatch.element.createChild("span");
+
+this._value = memoryCountersPane._currentValuesBar.createChild("span", "memory-counter-value");
+this._value.style.color = swatchColor;
+this._currentValueLabel = currentValueLabel;
+
+this.graphColor = "rgba(" + rgb.join(",") + ",0.8)";
+this.graphYValues = [];
+}
+
+
+WebInspector.DOMCountersGraph.Counter = function(time, documentCount, nodeCount, listenerCount)
+{
+WebInspector.MemoryStatistics.Counter.call(this, time);
+this.documentCount = documentCount;
+this.nodeCount = nodeCount;
+this.listenerCount = listenerCount;
+}
+
+WebInspector.DOMCounterUI.prototype = {
+
+setRange: function(minValue, maxValue)
+{
+this._range.textContent = WebInspector.UIString("[ %d - %d ]", minValue, maxValue);
+},
+
+updateCurrentValue: function(countersEntry)
+{
+this._value.textContent =  WebInspector.UIString(this._currentValueLabel, this.valueGetter(countersEntry));
+},
+
+clearCurrentValueAndMarker: function(ctx)
+{
+this._value.textContent = "";
+this.restoreImageUnderMarker(ctx);
+},
+
+
+saveImageUnderMarker: function(ctx, x, y, radius)
+{
+const w = radius + 1;
+var imageData = ctx.getImageData(x - w, y - w, 2 * w, 2 * w);
+this._imageUnderMarker = {
+x: x - w,
+y: y - w,
+imageData: imageData
+};
+},
+
+
+restoreImageUnderMarker: function(ctx)
+{
+if (!this.visible)
+return;
+if (this._imageUnderMarker)
+ctx.putImageData(this._imageUnderMarker.imageData, this._imageUnderMarker.x, this._imageUnderMarker.y);
+this.discardImageUnderMarker();
+},
+
+discardImageUnderMarker: function()
+{
+delete this._imageUnderMarker;
+},
+
+__proto__: WebInspector.CounterUIBase.prototype
+}
+
+
+WebInspector.DOMCountersGraph.prototype = {
+_createCurrentValuesBar: function()
+{
+this._currentValuesBar = this._canvasContainer.createChild("div");
+this._currentValuesBar.id = "counter-values-bar";
+this._canvasContainer.addStyleClass("dom-counters");
+},
+
+
+_createCounterUIList: function()
+{
+function getDocumentCount(entry)
+{
+return entry.documentCount;
+}
+function getNodeCount(entry)
+{
+return entry.nodeCount;
+}
+function getListenerCount(entry)
+{
+return entry.listenerCount;
+}
+return [
+new WebInspector.DOMCounterUI(this, "Document Count", "Documents: %d", [100, 0, 0], getDocumentCount),
+new WebInspector.DOMCounterUI(this, "DOM Node Count", "Nodes: %d", [0, 100, 0], getNodeCount),
+new WebInspector.DOMCounterUI(this, "Event Listener Count", "Listeners: %d", [0, 0, 100], getListenerCount)
+];
+},
+
+_canvasHeight: function()
+{
+return this._canvasContainer.offsetHeight - this._currentValuesBar.offsetHeight;
+},
+
+
+_onRecordAdded: function(event)
+{
+function addStatistics(record)
+{
+var counters = record["counters"];
+if (!counters)
+return;
+this._counters.push(new WebInspector.DOMCountersGraph.Counter(
+record.endTime || record.startTime,
+counters["documents"],
+counters["nodes"],
+counters["jsEventListeners"]
+));
+}
+WebInspector.TimelinePresentationModel.forAllRecords([event.data], null, addStatistics.bind(this));
+},
+
+_draw: function()
+{
+WebInspector.MemoryStatistics.prototype._draw.call(this);
+for (var i = 0; i < this._counterUI.length; i++)
+this._drawGraph(this._counterUI[i]);
+},
+
+
+_restoreImageUnderMarker: function(ctx)
+{
+for (var i = 0; i < this._counterUI.length; i++) {
+var counterUI = this._counterUI[i];
+if (!counterUI.visible)
+continue;
+counterUI.restoreImageUnderMarker(ctx);
+}
+},
+
+
+_saveImageUnderMarker: function(ctx, x, index)
+{
+const radius = 2;
+for (var i = 0; i < this._counterUI.length; i++) {
+var counterUI = this._counterUI[i];
+if (!counterUI.visible)
+continue;
+var y = counterUI.graphYValues[index];
+counterUI.saveImageUnderMarker(ctx, x, y, radius);
+}
+},
+
+
+_drawMarker: function(ctx, x, index)
+{
+this._saveImageUnderMarker(ctx, x, index);
+const radius = 2;
+for (var i = 0; i < this._counterUI.length; i++) {
+var counterUI = this._counterUI[i];
+if (!counterUI.visible)
+continue;
+var y = counterUI.graphYValues[index];
+ctx.beginPath();
+ctx.arc(x, y, radius, 0, Math.PI * 2, true);
+ctx.lineWidth = 1;
+ctx.fillStyle = counterUI.graphColor;
+ctx.strokeStyle = counterUI.graphColor;
+ctx.fill();
+ctx.stroke();
+ctx.closePath();
+}
+},
+
+
 _drawGraph: function(counterUI)
 {
 var canvas = this._canvas;
@@ -454,12 +611,12 @@
 var yFactor = maxYRange ? height / (maxYRange) : 1;
 
 ctx.beginPath();
-var currentY = originY + (height - (valueGetter(this._counters[this._minimumIndex])- minValue) * yFactor);
+var currentY = originY + (height - (valueGetter(this._counters[this._minimumIndex]) - minValue) * yFactor);
 ctx.moveTo(0, currentY);
 for (var i = this._minimumIndex; i <= this._maximumIndex; i++) {
 var x = this._counters[i].x;
 ctx.lineTo(x, currentY);
-currentY = originY + (height - (valueGetter(this._counters[i])- minValue) * yFactor);
+currentY = originY + (height - (valueGetter(this._counters[i]) - minValue) * yFactor);
 ctx.lineTo(x, currentY);
 
 yValues[i] = currentY;
@@ -471,12 +628,307 @@
 ctx.closePath();
 },
 
-_clear: function() {
-var ctx = this._canvas.getContext("2d");
-ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+_discardImageUnderMarker: function()
+{
 for (var i = 0; i < this._counterUI.length; i++)
 this._counterUI[i].discardImageUnderMarker();
+},
+
+__proto__: WebInspector.MemoryStatistics.prototype
 }
+
+;
+
+
+
+WebInspector.NativeMemoryGraph = function(timelinePanel, model, sidebarWidth)
+{
+WebInspector.MemoryStatistics.call(this, timelinePanel, model, sidebarWidth);
+}
+
+
+WebInspector.NativeMemoryGraph.Counter = function(time, nativeCounters)
+{
+WebInspector.MemoryStatistics.Counter.call(this, time);
+this.nativeCounters = nativeCounters;
+}
+
+
+WebInspector.NativeMemoryCounterUI = function(memoryCountersPane, title, hsl, valueGetter)
+{
+var swatchColor = this._hslToString(hsl);
+WebInspector.CounterUIBase.call(this, memoryCountersPane, title, swatchColor, valueGetter);
+this._value = this._swatch.element.createChild("span", "memory-category-value");
+
+const borderLightnessDifference = 3;
+hsl[2] -= borderLightnessDifference;
+this.strokeColor = this._hslToString(hsl);
+this.graphYValues = [];
+}
+
+WebInspector.NativeMemoryCounterUI.prototype = {
+_hslToString: function(hsl)
+{
+return "hsl(" + hsl[0] + "," + hsl[1] + "%," + hsl[2] + "%)";
+},
+
+updateCurrentValue: function(countersEntry)
+{
+var bytes = this.valueGetter(countersEntry);
+var megabytes =  bytes / (1024 * 1024);
+this._value.textContent = WebInspector.UIString("%.1f\u2009MB", megabytes);
+},
+
+clearCurrentValueAndMarker: function(ctx)
+{
+this._value.textContent = "";
+},
+
+__proto__: WebInspector.CounterUIBase.prototype
+}
+
+
+WebInspector.NativeMemoryGraph.prototype = {
+_createCurrentValuesBar: function()
+{
+},
+
+_createCounterUIList: function()
+{
+var nativeCounters = [
+"JSExternalResources",
+"CSS",
+"GlyphCache",
+"Image",
+"Resources",
+"DOM",
+"Rendering",
+"Audio",
+"WebInspector",
+"JSHeap.Used",
+"JSHeap.Unused",
+"MallocWaste",
+"Other",
+"PrivateBytes",
+];
+
+
+function getCounterValue(name, entry)
+{
+return (entry.nativeCounters && entry.nativeCounters[name]) || 0;
+}
+
+var list = [];
+for (var i = nativeCounters.length - 1; i >= 0; i--) {
+var name = nativeCounters[i];
+if ("PrivateBytes" === name) {
+var counterUI = new WebInspector.NativeMemoryCounterUI(this, "Total", [0, 0, 0], getCounterValue.bind(this, name))
+this._privateBytesCounter = counterUI;
+} else {
+var counterUI = new WebInspector.NativeMemoryCounterUI(this, name, [i * 20, 65, 63], getCounterValue.bind(this, name))
+list.push(counterUI);
+}
+}
+return list.reverse();
+},
+
+_canvasHeight: function()
+{
+return this._canvasContainer.offsetHeight;
+},
+
+
+_onRecordAdded: function(event)
+{
+var statistics = this._counters;
+function addStatistics(record)
+{
+var nativeCounters = record["nativeHeapStatistics"];
+if (!nativeCounters)
+return;
+
+var knownSize = 0;
+for (var name in nativeCounters) {
+if (name === "PrivateBytes")
+continue;
+knownSize += nativeCounters[name];
+}
+nativeCounters["Other"] = nativeCounters["PrivateBytes"] - knownSize;
+
+statistics.push(new WebInspector.NativeMemoryGraph.Counter(
+record.endTime || record.startTime,
+nativeCounters
+));
+}
+WebInspector.TimelinePresentationModel.forAllRecords([event.data], null, addStatistics);
+},
+
+_draw: function()
+{
+WebInspector.MemoryStatistics.prototype._draw.call(this);
+
+var maxValue = this._maxCounterValue();
+this._resetTotalValues();
+
+var previousCounterUI;
+for (var i = 0; i < this._counterUI.length; i++) {
+this._drawGraph(this._counterUI[i], previousCounterUI, maxValue);
+if (this._counterUI[i].visible)
+previousCounterUI = this._counterUI[i];
+}
+},
+
+
+_clearCurrentValueAndMarker: function(ctx)
+{
+WebInspector.MemoryStatistics.prototype._clearCurrentValueAndMarker.call(this, ctx);
+this._privateBytesCounter.clearCurrentValueAndMarker(ctx);
+},
+
+_updateCurrentValue: function(counterEntry)
+{
+WebInspector.MemoryStatistics.prototype._updateCurrentValue.call(this, counterEntry);
+this._privateBytesCounter.updateCurrentValue(counterEntry);
+},
+
+
+_restoreImageUnderMarker: function(ctx)
+{
+if (this._imageUnderMarker)
+ctx.putImageData(this._imageUnderMarker.imageData, this._imageUnderMarker.x, this._imageUnderMarker.y);
+this._discardImageUnderMarker();
+},
+
+
+_saveImageUnderMarker: function(ctx, left, top, right, bottom)
+{
+var imageData = ctx.getImageData(left, top, right, bottom);
+this._imageUnderMarker = {
+x: left,
+y: top,
+imageData: imageData
+};
+},
+
+
+_drawMarker: function(ctx, x, index)
+{
+var left = this._counters[index].x;
+var right = index + 1 < this._counters.length ? this._counters[index + 1].x : left;
+var top = this._originY;
+top = 0;
+var bottom = top + this._clippedHeight;
+bottom += this._originY;
+
+this._saveImageUnderMarker(ctx, left, top, right, bottom);
+
+ctx.beginPath();
+ctx.moveTo(left, top);
+ctx.lineTo(right, top);
+ctx.lineTo(right, bottom);
+ctx.lineTo(left, bottom);
+ctx.lineWidth = 1;
+ctx.closePath();
+ctx.fillStyle = "rgba(220,220,220,0.3)";
+ctx.fill();
+},
+
+
+_maxCounterValue: function()
+{
+if (!this._counters.length)
+return 0;
+
+var valueGetter = this._privateBytesCounter.valueGetter;
+var result = 0;
+for (var i = this._minimumIndex; i < this._maximumIndex; i++) {
+var counter = this._counters[i];
+var value = valueGetter(counter);
+if (value > result)
+result = value;
+}
+return result;
+},
+
+_resetTotalValues: function()
+{
+for (var i = this._minimumIndex; i <= this._maximumIndex; i++) {
+var counter = this._counters[i];
+counter.total = 0;
+}
+},
+
+
+_drawGraph: function(counterUI, previousCounterUI, maxTotalValue)
+{
+var canvas = this._canvas;
+var ctx = canvas.getContext("2d");
+var width = canvas.width;
+var height = this._clippedHeight;
+var originY = this._originY;
+var valueGetter = counterUI.valueGetter;
+
+if (!this._counters.length)
+return;
+
+if (!counterUI.visible)
+return;
+
+for (var i = this._minimumIndex; i <= this._maximumIndex; i++) {
+var counter = this._counters[i];
+var value = valueGetter(counter);
+counter.total += value;
+}
+
+var yValues = counterUI.graphYValues;
+yValues.length = this._counters.length;
+
+var maxYRange =  maxTotalValue;
+var yFactor = maxYRange ? height / (maxYRange) : 1;
+
+ctx.beginPath();
+if (previousCounterUI) {
+var prevYValues = previousCounterUI.graphYValues;
+var currentY = prevYValues[this._maximumIndex];
+ctx.moveTo(width, currentY);
+var currentX = width;
+for (var i = this._maximumIndex - 1; i >= this._minimumIndex; i--) {
+currentY = prevYValues[i];
+currentX = this._counters[i].x;
+ctx.lineTo(currentX, currentY);
+}
+} else {
+var lastY = originY + height;
+ctx.moveTo(width, lastY);
+ctx.lineTo(0, lastY);
+}
+
+var currentY = originY + (height - this._counters[this._minimumIndex].total * yFactor);
+ctx.lineTo(0, currentY);
+for (var i = this._minimumIndex; i <= this._maximumIndex; i++) {
+var counter = this._counters[i];
+var x = counter.x;
+currentY = originY + (height - counter.total * yFactor);
+ctx.lineTo(x, currentY);
+
+yValues[i] = currentY;
+}
+ctx.lineTo(width, currentY);
+ctx.closePath();
+ctx.lineWidth = 1;
+
+ctx.strokeStyle = counterUI.strokeColor;
+ctx.fillStyle = counterUI.graphColor;
+ctx.fill();
+ctx.stroke();
+},
+
+_discardImageUnderMarker: function()
+{
+delete this._imageUnderMarker;
+},
+
+__proto__: WebInspector.MemoryStatistics.prototype
 }
 
 ;
@@ -507,6 +959,7 @@
 InvalidateLayout: "InvalidateLayout",
 Layout: "Layout",
 Paint: "Paint",
+Rasterize: "Rasterize",
 ScrollLayer: "ScrollLayer",
 DecodeImage: "DecodeImage",
 ResizeImage: "ResizeImage",
@@ -540,7 +993,12 @@
 
 RequestAnimationFrame: "RequestAnimationFrame",
 CancelAnimationFrame: "CancelAnimationFrame",
-FireAnimationFrame: "FireAnimationFrame"
+FireAnimationFrame: "FireAnimationFrame",
+
+WebSocketCreate : "WebSocketCreate",
+WebSocketSendHandshakeRequest : "WebSocketSendHandshakeRequest",
+WebSocketReceiveHandshakeResponse : "WebSocketReceiveHandshakeResponse",
+WebSocketDestroy : "WebSocketDestroy",
 }
 
 WebInspector.TimelineModel.Events = {
@@ -585,12 +1043,14 @@
 }
 
 WebInspector.TimelineModel.prototype = {
-startRecord: function()
+
+startRecord: function(includeDomCounters, includeNativeMemoryStatistics)
 {
 if (this._collectionEnabled)
 return;
 this.reset();
-WebInspector.timelineManager.start(30);
+var maxStackFrames = WebInspector.settings.timelineLimitStackFramesFlag.get() ? WebInspector.settings.timelineStackFramesToCapture.get() : 30;
+WebInspector.timelineManager.start(maxStackFrames, includeDomCounters, includeNativeMemoryStatistics);
 this._collectionEnabled = true;
 },
 
@@ -886,15 +1346,11 @@
 
 var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
 
-this._currentMode = WebInspector.TimelineOverviewPane.Mode.Events;
-
 this._overviewItems = {};
 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Events] = new WebInspector.SidebarTreeElement("timeline-overview-sidebar-events",
 WebInspector.UIString("Events"));
-if (Capabilities.timelineSupportsFrameInstrumentation) {
 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Frames] = new WebInspector.SidebarTreeElement("timeline-overview-sidebar-frames",
 WebInspector.UIString("Frames"));
-}
 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Memory] = new WebInspector.SidebarTreeElement("timeline-overview-sidebar-memory",
 WebInspector.UIString("Memory"));
 
@@ -904,48 +1360,26 @@
 topPaneSidebarTree.appendChild(item);
 }
 
-this._overviewItems[this._currentMode].revealAndSelect(false);
-
-this._overviewContainer = this.element.createChild("div", "fill");
-this._overviewContainer.id = "timeline-overview-container";
-
-this._overviewGrid = new WebInspector.TimelineGrid();
-this._overviewGrid.element.id = "timeline-overview-grid";
-this._overviewGrid.itemsGraphsElement.id = "timeline-overview-timelines";
-
-this._overviewContainer.appendChild(this._overviewGrid.element);
-
-this._heapGraph = new WebInspector.HeapGraph(this._model);
-this._heapGraph.element.id = "timeline-overview-memory";
-this._overviewGrid.element.insertBefore(this._heapGraph.element, this._overviewGrid.itemsGraphsElement);
-
-this._overviewWindow = new WebInspector.TimelineOverviewWindow(this._overviewContainer, this._overviewGrid.dividersLabelBarElement);
-this._overviewWindow.addEventListener(WebInspector.TimelineOverviewWindow.Events.WindowChanged, this._onWindowChanged, this);
+this._overviewGrid = new WebInspector.OverviewGrid("timeline");
+this.element.appendChild(this._overviewGrid.element);
 
 var separatorElement = document.createElement("div");
 separatorElement.id = "timeline-overview-separator";
 this.element.appendChild(separatorElement);
 
-this._categoryStrips = new WebInspector.TimelineCategoryStrips(this._model);
-this._overviewGrid.itemsGraphsElement.appendChild(this._categoryStrips.element);
+this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events);
 
 var categories = WebInspector.TimelinePresentationModel.categories();
 for (var category in categories)
 categories[category].addEventListener(WebInspector.TimelineCategory.Events.VisibilityChanged, this._onCategoryVisibilityChanged, this);
 
-this._overviewGrid.setScrollAndDividerTop(0, 0);
 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator();
 
 model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this);
 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, this._reset, this);
+this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged, this._onWindowChanged, this);
 }
 
-WebInspector.TimelineOverviewPane.MinSelectableSize = 12;
-
-WebInspector.TimelineOverviewPane.WindowScrollSpeedFactor = .3;
-
-WebInspector.TimelineOverviewPane.ResizerOffset = 3.5; 
-
 WebInspector.TimelineOverviewPane.Mode = {
 Events: "Events",
 Frames: "Frames",
@@ -972,43 +1406,39 @@
 {
 if (this._currentMode === newMode)
 return;
-
-this._currentMode = newMode;
-this._setFrameMode(this._currentMode === WebInspector.TimelineOverviewPane.Mode.Frames);
-switch (this._currentMode) {
-case WebInspector.TimelineOverviewPane.Mode.Events:
-case WebInspector.TimelineOverviewPane.Mode.Frames:
-this._heapGraph.hide();
-this._overviewGrid.itemsGraphsElement.removeStyleClass("hidden");
-break;
-case WebInspector.TimelineOverviewPane.Mode.Memory:
-this._overviewGrid.itemsGraphsElement.addStyleClass("hidden");
-this._heapGraph.show();
-}
-this._overviewItems[this._currentMode].revealAndSelect(false);
+this._innerSetMode(newMode);
 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.ModeChanged, this._currentMode);
 this._update();
 },
 
-_setFrameMode: function(enabled)
+_innerSetMode: function(newMode)
 {
-if (!enabled === !this._frameOverview)
-return;
-if (enabled) {
-this._frameOverview = new WebInspector.TimelineFrameOverview(this._model);
-this._frameOverview.show(this._overviewContainer);
-} else {
-this._frameOverview.detach();
-this._frameOverview = null;
-this._overviewGrid.itemsGraphsElement.removeStyleClass("hidden");
-this._categoryStrips.update();
+if (this._overviewControl)
+this._overviewControl.detach();
+
+this._currentMode = newMode;
+this._overviewControl = this._createOverviewControl();
+this._overviewControl.show(this._overviewGrid.element);
+this._overviewItems[this._currentMode].revealAndSelect(false);
+},
+
+
+_createOverviewControl: function()
+{
+switch (this._currentMode) {
+case WebInspector.TimelineOverviewPane.Mode.Events:
+return new WebInspector.TimelineEventOverview(this._model);
+case WebInspector.TimelineOverviewPane.Mode.Frames:
+return new WebInspector.TimelineFrameOverview(this._model);
+case WebInspector.TimelineOverviewPane.Mode.Memory:
+return new WebInspector.TimelineMemoryOverview(this._model);
 }
+throw new Error("Invalid overview mode: " + this._currentMode);
 },
 
 _onCategoryVisibilityChanged: function(event)
 {
-if (this._currentMode === WebInspector.TimelineOverviewPane.Mode.Events)
-this._categoryStrips.update();
+this._overviewControl.categoryVisibilityChanged();
 },
 
 _update: function()
@@ -1017,15 +1447,9 @@
 
 this._updateWindow();
 this._overviewCalculator.setWindow(this._model.minimumRecordTime(), this._model.maximumRecordTime());
-this._overviewCalculator.setDisplayWindow(0, this._overviewContainer.clientWidth);
+this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWidth());
 
-if (this._heapGraph.visible)
-this._heapGraph.update();
-else if (this._frameOverview)
-this._frameOverview.update();
-else
-this._categoryStrips.update();
-
+this._overviewControl.update();
 this._overviewGrid.updateDividers(this._overviewCalculator);
 this._updateEventDividers();
 },
@@ -1051,7 +1475,7 @@
 
 sidebarResized: function(width)
 {
-this._overviewContainer.style.left = width + "px";
+this._overviewGrid.element.style.left = width + "px";
 this._topPaneSidebarElement.style.width = width + "px";
 this._update();
 },
@@ -1059,18 +1483,19 @@
 
 addFrame: function(frame)
 {
-this._frameOverview.addFrame(frame);
+this._overviewControl.addFrame(frame);
 this._scheduleRefresh();
 },
 
 
 zoomToFrame: function(frame)
 {
-var window = this._frameOverview.framePosition(frame);
+var frameOverview =   (this._overviewControl);
+var window = frameOverview.framePosition(frame);
 if (!window)
 return;
 
-this._overviewWindow._setWindowPosition(window.start, window.end);
+this._overviewGrid.setWindowPosition(window.start, window.end);
 },
 
 _onRecordAdded: function(event)
@@ -1090,12 +1515,11 @@
 {
 this._windowStartTime = 0;
 this._windowEndTime = Infinity;
-this._overviewWindow.reset();
 this._overviewCalculator.reset();
+this._overviewGrid.reset();
 this._eventDividers = [];
 this._overviewGrid.updateDividers(this._overviewCalculator);
-if (this._frameOverview)
-this._frameOverview.reset();
+this._overviewControl.reset();
 this._update();
 },
 
@@ -1111,28 +1535,21 @@
 
 windowLeft: function()
 {
-return this._overviewWindow.windowLeft;
+return this._overviewGrid.windowLeft();
 },
 
 windowRight: function()
 {
-return this._overviewWindow.windowRight;
+return this._overviewGrid.windowRight();
 },
 
 _onWindowChanged: function()
 {
 if (this._ignoreWindowChangedEvent)
 return;
-if (this._frameOverview) {
-var times = this._frameOverview.getWindowTimes(this.windowLeft(), this.windowRight());
+var times = this._overviewControl.windowTimes(this.windowLeft(), this.windowRight());
 this._windowStartTime = times.startTime;
 this._windowEndTime = times.endTime;
-} else {
-var absoluteMin = this._model.minimumRecordTime();
-var absoluteMax = this._model.maximumRecordTime();
-this._windowStartTime = absoluteMin + (absoluteMax - absoluteMin) * this.windowLeft();
-this._windowEndTime = absoluteMin + (absoluteMax - absoluteMin) * this.windowRight();
-}
 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.WindowChanged);
 },
 
@@ -1151,16 +1568,10 @@
 var left = this._windowStartTime ? (this._windowStartTime - offset) / timeSpan : 0;
 var right = this._windowEndTime < Infinity ? (this._windowEndTime - offset) / timeSpan : 1;
 this._ignoreWindowChangedEvent = true;
-this._overviewWindow._setWindow(left, right);
+this._overviewGrid.setWindow(left, right);
 this._ignoreWindowChangedEvent = false;
 },
 
-
-setMinimumRecordDuration: function(value)
-{
-this._categoryStrips.setMinimumRecordDuration(value);
-},
-
 _scheduleRefresh: function()
 {
 if (this._refreshTimeout)
@@ -1174,244 +1585,6 @@
 }
 
 
-WebInspector.TimelineOverviewWindow = function(parentElement, dividersLabelBarElement)
-{
-this._parentElement = parentElement;
-this._dividersLabelBarElement = dividersLabelBarElement;
-
-WebInspector.installDragHandle(this._parentElement, this._startWindowSelectorDragging.bind(this), this._windowSelectorDragging.bind(this), this._endWindowSelectorDragging.bind(this), "ew-resize");
-WebInspector.installDragHandle(this._dividersLabelBarElement, this._startWindowDragging.bind(this), this._windowDragging.bind(this), this._endWindowDragging.bind(this), "ew-resize");
-
-this.windowLeft = 0.0;
-this.windowRight = 1.0;
-
-this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(this), true);
-this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.bind(this), true);
-
-this._overviewWindowElement = document.createElement("div");
-this._overviewWindowElement.className = "timeline-overview-window";
-parentElement.appendChild(this._overviewWindowElement);
-
-this._overviewWindowBordersElement = document.createElement("div");
-this._overviewWindowBordersElement.className = "timeline-overview-window-rulers";
-parentElement.appendChild(this._overviewWindowBordersElement);
-
-var overviewDividersBackground = document.createElement("div");
-overviewDividersBackground.className = "timeline-overview-dividers-background";
-parentElement.appendChild(overviewDividersBackground);
-
-this._leftResizeElement = document.createElement("div");
-this._leftResizeElement.className = "timeline-window-resizer";
-this._leftResizeElement.style.left = 0;
-parentElement.appendChild(this._leftResizeElement);
-WebInspector.installDragHandle(this._leftResizeElement, null, this._leftResizeElementDragging.bind(this), null, "ew-resize");
-
-this._rightResizeElement = document.createElement("div");
-this._rightResizeElement.className = "timeline-window-resizer timeline-window-resizer-right";
-this._rightResizeElement.style.right = 0;
-parentElement.appendChild(this._rightResizeElement);
-WebInspector.installDragHandle(this._rightResizeElement, null, this._rightResizeElementDragging.bind(this), null, "ew-resize");
-}
-
-WebInspector.TimelineOverviewWindow.Events = {
-WindowChanged: "WindowChanged"
-}
-
-WebInspector.TimelineOverviewWindow.prototype = {
-reset: function()
-{
-this.windowLeft = 0.0;
-this.windowRight = 1.0;
-
-this._overviewWindowElement.style.left = "0%";
-this._overviewWindowElement.style.width = "100%";
-this._overviewWindowBordersElement.style.left = "0%";
-this._overviewWindowBordersElement.style.right = "0%";
-this._leftResizeElement.style.left = "0%";
-this._rightResizeElement.style.left = "100%";
-},
-
-
-_leftResizeElementDragging: function(event)
-{
-this._resizeWindowLeft(event.pageX - this._parentElement.offsetLeft);
-event.preventDefault();
-},
-
-
-_rightResizeElementDragging: function(event)
-{
-this._resizeWindowRight(event.pageX - this._parentElement.offsetLeft);
-event.preventDefault();
-},
-
-
-_startWindowSelectorDragging: function(event)
-{
-var position = event.pageX - this._parentElement.offsetLeft;
-this._overviewWindowSelector = new WebInspector.TimelineOverviewPane.WindowSelector(this._parentElement, position);
-return true;
-},
-
-
-_windowSelectorDragging: function(event)
-{
-this._overviewWindowSelector._updatePosition(event.pageX - this._parentElement.offsetLeft);
-event.preventDefault();
-},
-
-
-_endWindowSelectorDragging: function(event)
-{
-var window = this._overviewWindowSelector._close(event.pageX - this._parentElement.offsetLeft);
-delete this._overviewWindowSelector;
-if (window.end === window.start) { 
-var middle = window.end;
-window.start = Math.max(0, middle - WebInspector.TimelineOverviewPane.MinSelectableSize / 2);
-window.end = Math.min(this._parentElement.clientWidth, middle + WebInspector.TimelineOverviewPane.MinSelectableSize / 2);
-} else if (window.end - window.start < WebInspector.TimelineOverviewPane.MinSelectableSize) {
-if (this._parentElement.clientWidth - window.end > WebInspector.TimelineOverviewPane.MinSelectableSize)
-window.end = window.start + WebInspector.TimelineOverviewPane.MinSelectableSize;
-else
-window.start = window.end - WebInspector.TimelineOverviewPane.MinSelectableSize;
-}
-this._setWindowPosition(window.start, window.end);
-},
-
-
-_startWindowDragging: function(event)
-{
-var windowLeft = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-this._dragOffset = windowLeft - event.pageX;
-return true;
-},
-
-
-_windowDragging: function(event)
-{
-var windowLeft = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-var start = this._dragOffset + event.pageX;
-this._moveWindow(start);
-event.preventDefault();
-},
-
-
-_endWindowDragging: function(event)
-{
-delete this._dragOffset;
-},
-
-
-_moveWindow: function(start)
-{
-var windowLeft = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-var windowRight = this._rightResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-var windowSize = windowRight - windowLeft;
-var end = start + windowSize;
-
-if (start < 0) {
-start = 0;
-end = windowSize;
-}
-
-if (end > this._parentElement.clientWidth) {
-end = this._parentElement.clientWidth;
-start = end - windowSize;
-}
-this._setWindowPosition(start, end);
-},
-
-
-_resizeWindowLeft: function(start)
-{
-
-if (start < 10)
-start = 0;
-else if (start > this._rightResizeElement.offsetLeft -  4)
-start = this._rightResizeElement.offsetLeft - 4;
-this._setWindowPosition(start, null);
-},
-
-
-_resizeWindowRight: function(end)
-{
-
-if (end > this._parentElement.clientWidth - 10)
-end = this._parentElement.clientWidth;
-else if (end < this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.MinSelectableSize)
-end = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.MinSelectableSize;
-this._setWindowPosition(null, end);
-},
-
-_resizeWindowMaximum: function()
-{
-this._setWindowPosition(0, this._parentElement.clientWidth);
-},
-
-
-_setWindow: function(left, right)
-{
-var clientWidth = this._parentElement.clientWidth;
-this._setWindowPosition(left * clientWidth, right * clientWidth);
-},
-
-
-_setWindowPosition: function(start, end)
-{
-var clientWidth = this._parentElement.clientWidth;
-const rulerAdjustment = 1 / clientWidth;
-if (typeof start === "number") {
-this.windowLeft = start / clientWidth;
-this._leftResizeElement.style.left = this.windowLeft * 100 + "%";
-this._overviewWindowElement.style.left = this.windowLeft * 100 + "%";
-this._overviewWindowBordersElement.style.left = (this.windowLeft - rulerAdjustment) * 100 + "%";
-}
-if (typeof end === "number") {
-this.windowRight = end / clientWidth;
-this._rightResizeElement.style.left = this.windowRight * 100 + "%";
-}
-this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%";
-this._overviewWindowBordersElement.style.right = (1 - this.windowRight + 2 * rulerAdjustment) * 100 + "%";
-this.dispatchEventToListeners(WebInspector.TimelineOverviewWindow.Events.WindowChanged);
-},
-
-
-_onMouseWheel: function(event)
-{
-const zoomFactor = 1.1;
-const mouseWheelZoomSpeed = 1 / 120;
-
-if (typeof event.wheelDeltaY === "number" && event.wheelDeltaY) {
-var referencePoint = event.pageX - this._parentElement.offsetLeft;
-this._zoom(Math.pow(zoomFactor, -event.wheelDeltaY * mouseWheelZoomSpeed), referencePoint);
-}
-if (typeof event.wheelDeltaX === "number" && event.wheelDeltaX) {
-var windowLeft = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-var start = windowLeft - Math.round(event.wheelDeltaX * WebInspector.TimelineOverviewPane.WindowScrollSpeedFactor);
-this._moveWindow(start);
-event.preventDefault();
-}
-},
-
-
-_zoom: function(factor, referencePoint)
-{
-var left = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-var right = this._rightResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.ResizerOffset;
-
-var delta = factor * (right - left);
-if (factor < 1 && delta < WebInspector.TimelineOverviewPane.MinSelectableSize)
-return;
-var max = this._parentElement.clientWidth;
-left = Math.max(0, Math.min(max - delta, referencePoint + (left - referencePoint) * factor));
-right = Math.min(max, left + delta);
-this._setWindowPosition(left, right);
-},
-
-__proto__: WebInspector.Object.prototype
-}
-
-
 WebInspector.TimelineOverviewCalculator = function()
 {
 }
@@ -1464,6 +1637,11 @@
 return this._minimumBoundary;
 },
 
+zeroTime: function()
+{
+return this._minimumBoundary;
+},
+
 boundarySpan: function()
 {
 return this._maximumBoundary - this._minimumBoundary;
@@ -1471,93 +1649,48 @@
 }
 
 
-WebInspector.TimelineOverviewPane.WindowSelector = function(parent, position)
+WebInspector.TimelineOverviewBase = function(model)
 {
-this._startPosition = position;
-this._width = parent.offsetWidth;
-this._windowSelector = document.createElement("div");
-this._windowSelector.className = "timeline-window-selector";
-this._windowSelector.style.left = this._startPosition + "px";
-this._windowSelector.style.right = this._width - this._startPosition +  + "px";
-parent.appendChild(this._windowSelector);
-}
-
-WebInspector.TimelineOverviewPane.WindowSelector.prototype = {
-_createSelectorElement: function(parent, left, width, height)
-{
-var selectorElement = document.createElement("div");
-selectorElement.className = "timeline-window-selector";
-selectorElement.style.left = left + "px";
-selectorElement.style.width = width + "px";
-selectorElement.style.top = "0px";
-selectorElement.style.height = height + "px";
-parent.appendChild(selectorElement);
-return selectorElement;
-},
-
-_close: function(position)
-{
-position = Math.max(0, Math.min(position, this._width));
-this._windowSelector.parentNode.removeChild(this._windowSelector);
-return this._startPosition < position ? {start: this._startPosition, end: position} : {start: position, end: this._startPosition};
-},
-
-_updatePosition: function(position)
-{
-position = Math.max(0, Math.min(position, this._width));
-if (position < this._startPosition) {
-this._windowSelector.style.left = position + "px";
-this._windowSelector.style.right = this._width - this._startPosition + "px";
-} else {
-this._windowSelector.style.left = this._startPosition + "px";
-this._windowSelector.style.right = this._width - position + "px";
-}
-}
-}
-
-
-WebInspector.HeapGraph = function(model)
-{
-this._canvas = document.createElement("canvas");
+WebInspector.View.call(this);
 this._model = model;
-
-this._maxHeapSizeLabel = document.createElement("div");
-this._maxHeapSizeLabel.addStyleClass("max");
-this._maxHeapSizeLabel.addStyleClass("memory-graph-label");
-this._minHeapSizeLabel = document.createElement("div");
-this._minHeapSizeLabel.addStyleClass("min");
-this._minHeapSizeLabel.addStyleClass("memory-graph-label");
-
-this._element = document.createElement("div");
-this._element.addStyleClass("hidden");
-this._element.appendChild(this._canvas);
-this._element.appendChild(this._maxHeapSizeLabel);
-this._element.appendChild(this._minHeapSizeLabel);
+this._canvas = this.element.createChild("canvas", "fill");
 }
 
-WebInspector.HeapGraph.prototype = {
+WebInspector.TimelineOverviewBase.prototype = {
+update: function() { },
+reset: function() { },
 
-get element()
+categoryVisibilityChanged: function() { },
+
+
+addFrame: function(frame) { },
+
+
+windowTimes: function(windowLeft, windowRight)
 {
-return this._element;
+var absoluteMin = this._model.minimumRecordTime();
+var absoluteMax = this._model.maximumRecordTime();
+return {
+startTime: absoluteMin + (absoluteMax - absoluteMin) * windowLeft,
+endTime: absoluteMin + (absoluteMax - absoluteMin) * windowRight
+};
 },
 
+__proto__: WebInspector.View.prototype
+}
 
-get visible()
+
+WebInspector.TimelineMemoryOverview = function(model)
 {
-return !this.element.hasStyleClass("hidden");
-},
+WebInspector.TimelineOverviewBase.call(this, model);
+this.element.id = "timeline-overview-memory";
+this.element.classList.add("fill");
 
-show: function()
-{
-this.element.removeStyleClass("hidden");
-},
+this._maxHeapSizeLabel = this.element.createChild("div", "max memory-graph-label");
+this._minHeapSizeLabel = this.element.createChild("div", "min memory-graph-label");
+}
 
-hide: function()
-{
-this.element.addStyleClass("hidden");
-},
-
+WebInspector.TimelineMemoryOverview.prototype = {
 update: function()
 {
 var records = this._model.records;
@@ -1635,59 +1768,59 @@
 ctx.fillStyle = "rgba(255,255,255,0.8)";
 ctx.fillRect(0, 0, this._canvas.width, this._canvas.height);
 },
+
+__proto__: WebInspector.TimelineOverviewBase.prototype
 }
 
 
-WebInspector.TimelineCategoryStrips = function(model)
+WebInspector.TimelineEventOverview = function(model)
 {
-this._model = model;
-this.element = document.createElement("canvas");
-this._context = this.element.getContext("2d");
-this._minimumRecordDuration = 0;
+WebInspector.TimelineOverviewBase.call(this, model);
+
+this.element.id = "timeline-overview-events";
+this._context = this._canvas.getContext("2d");
 
 this._fillStyles = {};
 var categories = WebInspector.TimelinePresentationModel.categories();
 for (var category in categories)
-this._fillStyles[category] = WebInspector.TimelinePresentationModel.createFillStyleForCategory(this._context, 0, WebInspector.TimelineCategoryStrips._innerStripHeight, categories[category]);
+this._fillStyles[category] = WebInspector.TimelinePresentationModel.createFillStyleForCategory(this._context, 0, WebInspector.TimelineEventOverview._innerStripHeight, categories[category]);
 
-this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.createFillStyle(this._context, 0, WebInspector.TimelineCategoryStrips._innerStripHeight,
+this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.createFillStyle(this._context, 0, WebInspector.TimelineEventOverview._innerStripHeight,
 "rgb(218, 218, 218)", "rgb(170, 170, 170)", "rgb(143, 143, 143)");
 
 this._disabledCategoryBorderStyle = "rgb(143, 143, 143)";
 }
 
 
-WebInspector.TimelineCategoryStrips._canvasHeight = 60;
+WebInspector.TimelineEventOverview._canvasHeight = 60;
 
-WebInspector.TimelineCategoryStrips._numberOfStrips = 3;
+WebInspector.TimelineEventOverview._numberOfStrips = 3;
 
-WebInspector.TimelineCategoryStrips._stripHeight = Math.round(WebInspector.TimelineCategoryStrips._canvasHeight  / WebInspector.TimelineCategoryStrips._numberOfStrips);
+WebInspector.TimelineEventOverview._stripHeight = Math.round(WebInspector.TimelineEventOverview._canvasHeight  / WebInspector.TimelineEventOverview._numberOfStrips);
 
-WebInspector.TimelineCategoryStrips._stripPadding = 4;
+WebInspector.TimelineEventOverview._stripPadding = 4;
 
-WebInspector.TimelineCategoryStrips._innerStripHeight = WebInspector.TimelineCategoryStrips._stripHeight - 2 * WebInspector.TimelineCategoryStrips._stripPadding;
+WebInspector.TimelineEventOverview._innerStripHeight = WebInspector.TimelineEventOverview._stripHeight - 2 * WebInspector.TimelineEventOverview._stripPadding;
 
-WebInspector.TimelineCategoryStrips.prototype = {
+WebInspector.TimelineEventOverview.prototype = {
 update: function()
 {
 
-this.element.width = this.element.parentElement.clientWidth;
-this.element.height = WebInspector.TimelineCategoryStrips._canvasHeight;
+this._canvas.width = this.element.parentElement.clientWidth;
+this._canvas.height = WebInspector.TimelineEventOverview._canvasHeight;
 
 var timeOffset = this._model.minimumRecordTime();
 var timeSpan = this._model.maximumRecordTime() - timeOffset;
-var scale = this.element.width / timeSpan;
+var scale = this._canvas.width / timeSpan;
 
 var lastBarByGroup = [];
 
 this._context.fillStyle = "rgba(0, 0, 0, 0.05)";
-for (var i = 1; i < WebInspector.TimelineCategoryStrips._numberOfStrips; i += 2)
-this._context.fillRect(0.5, i * WebInspector.TimelineCategoryStrips._stripHeight + 0.5, this.element.width, WebInspector.TimelineCategoryStrips._stripHeight);
+for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips; i += 2)
+this._context.fillRect(0.5, i * WebInspector.TimelineEventOverview._stripHeight + 0.5, this._canvas.width, WebInspector.TimelineEventOverview._stripHeight);
 
 function appendRecord(record)
 {
-if (!!this._minimumRecordDuration && (WebInspector.TimelineModel.durationInSeconds(record) < this._minimumRecordDuration))
-return;
 if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame)
 return;
 var recordStart = Math.floor((WebInspector.TimelineModel.startTimeInSeconds(record) - timeOffset) * scale);
@@ -1714,36 +1847,34 @@
 }
 },
 
-
-setMinimumRecordDuration: function(value)
+categoryVisibilityChanged: function()
 {
-this._minimumRecordDuration = value;
 this.update();
 },
 
 _renderBar: function(begin, end, category)
 {
 var x = begin + 0.5;
-var y = category.overviewStripGroupIndex * WebInspector.TimelineCategoryStrips._stripHeight + WebInspector.TimelineCategoryStrips._stripPadding + 0.5;
+var y = category.overviewStripGroupIndex * WebInspector.TimelineEventOverview._stripHeight + WebInspector.TimelineEventOverview._stripPadding + 0.5;
 var width = Math.max(end - begin, 1);
 
 this._context.save();
 this._context.translate(x, y);
 this._context.fillStyle = category.hidden ? this._disabledCategoryFillStyle : this._fillStyles[category.name];
-this._context.fillRect(0, 0, width, WebInspector.TimelineCategoryStrips._innerStripHeight);
+this._context.fillRect(0, 0, width, WebInspector.TimelineEventOverview._innerStripHeight);
 this._context.strokeStyle = category.hidden ? this._disabledCategoryBorderStyle : category.borderColor;
-this._context.strokeRect(0, 0, width, WebInspector.TimelineCategoryStrips._innerStripHeight);
+this._context.strokeRect(0, 0, width, WebInspector.TimelineEventOverview._innerStripHeight);
 this._context.restore();
-}
+},
+
+__proto__: WebInspector.TimelineOverviewBase.prototype
 }
 
 
 WebInspector.TimelineFrameOverview = function(model)
 {
-WebInspector.View.call(this);
-this.element = document.createElement("canvas");
-this.element.className = "timeline-frame-overview-bars fill";
-this._model = model;
+WebInspector.TimelineOverviewBase.call(this, model);
+this._canvas.classList.add("timeline-frame-overview-bars");
 this.reset();
 
 this._outerPadding = 4;
@@ -1753,7 +1884,7 @@
 this._actualPadding = 5;
 this._actualOuterBarWidth = this._maxInnerBarWidth + this._actualPadding;
 
-this._context = this.element.getContext("2d");
+this._context = this._canvas.getContext("2d");
 
 this._fillStyles = {};
 var categories = WebInspector.TimelinePresentationModel.categories();
@@ -1785,7 +1916,7 @@
 if (fullBarLength < this._medianFrameLength)
 fullBarLength = Math.min(this._medianFrameLength * 2, this._maxFrameLength);
 
-var scale = (this.element.clientHeight - paddingTop) / fullBarLength;
+var scale = (this._canvas.clientHeight - paddingTop) / fullBarLength;
 this._renderBars(visibleFrames, scale);
 },
 
@@ -1842,11 +1973,11 @@
 _renderBars: function(frames, scale)
 {
 
-this.element.width = this.element.clientWidth;
-this.element.height = this.element.clientHeight;
+this._canvas.width = this._canvas.clientWidth;
+this._canvas.height = this._canvas.clientHeight;
 
 const maxPadding = 5;
-this._actualOuterBarWidth = Math.min((this.element.width - 2 * this._outerPadding) / frames.length, this._maxInnerBarWidth + maxPadding);
+this._actualOuterBarWidth = Math.min((this._canvas.width - 2 * this._outerPadding) / frames.length, this._maxInnerBarWidth + maxPadding);
 this._actualPadding = Math.min(Math.floor(this._actualOuterBarWidth / 3), maxPadding);
 
 var barWidth = this._actualOuterBarWidth - this._actualPadding;
@@ -1880,21 +2011,21 @@
 for (var i = 0; i < fpsMarks.length; ++i) {
 var fps = fpsMarks[i];
 
-var y = this.element.height - Math.floor(1.0 / fps * scale) - 0.5;
+var y = this._canvas.height - Math.floor(1.0 / fps * scale) - 0.5;
 var label = fps + " FPS ";
 var labelWidth = this._context.measureText(label).width;
-var labelX = this.element.width;
+var labelX = this._canvas.width;
 var labelY;
 
 if (labelTopMargin < y - lineHeight)
 labelY = y - lineHeight;
-else if (y + lineHeight < this.element.height)
+else if (y + lineHeight < this._canvas.height)
 labelY = y;
 else
 break; 
 
 this._context.moveTo(0, y);
-this._context.lineTo(this.element.width, y);
+this._context.lineTo(this._canvas.width, y);
 
 this._context.fillStyle = "rgba(255, 255, 255, 0.75)";
 this._context.fillRect(labelX - labelWidth - labelPadding, labelY, labelWidth + 2 * labelPadding, lineHeight);
@@ -1915,7 +2046,7 @@
 var x = Math.floor(left) + 0.5;
 width = Math.floor(width);
 
-for (var i = 0, bottomOffset = this.element.height; i < categories.length; ++i) {
+for (var i = 0, bottomOffset = this._canvas.height; i < categories.length; ++i) {
 var category = categories[i];
 var duration = frame.timeByCategory[category];
 
@@ -1929,16 +2060,18 @@
 this._context.scale(width / this._maxInnerBarWidth, 1);
 this._context.fillStyle = this._fillStyles[category];
 this._context.fillRect(0, y, this._maxInnerBarWidth, Math.floor(height));
+this._context.strokeStyle = WebInspector.TimelinePresentationModel.categories()[category].borderColor;
+this._context.beginPath();
+this._context.moveTo(0, y);
+this._context.lineTo(this._maxInnerBarWidth, y);
+this._context.stroke();
 this._context.restore();
 
-this._context.strokeStyle = WebInspector.TimelinePresentationModel.categories()[category].borderColor;
-this._context.strokeRect(x, y, width, Math.floor(height));
 bottomOffset -= height - 1;
 }
 
-var nonCPUTime = frame.duration - frame.cpuTime;
-var y0 = Math.floor(bottomOffset - nonCPUTime * scale) + 0.5;
-var y1 = Math.floor(bottomOffset) + 0.5;
+var y0 = Math.floor(this._canvas.height - frame.duration * scale) + 0.5;
+var y1 = this._canvas.height + 0.5;
 
 this._context.strokeStyle = "rgb(90, 90, 90)";
 this._context.beginPath();
@@ -1949,7 +2082,7 @@
 this._context.stroke();
 },
 
-getWindowTimes: function(windowLeft, windowRight)
+windowTimes: function(windowLeft, windowRight)
 {
 var windowSpan = this.element.clientWidth;
 var leftOffset = windowLeft * windowSpan - this._outerPadding + this._actualPadding;
@@ -1964,7 +2097,7 @@
 }
 },
 
-__proto__: WebInspector.View.prototype
+__proto__: WebInspector.TimelineOverviewBase.prototype
 }
 
 
@@ -1997,11 +2130,11 @@
 if (WebInspector.TimelinePresentationModel._categories)
 return WebInspector.TimelinePresentationModel._categories;
 WebInspector.TimelinePresentationModel._categories = {
-program: new WebInspector.TimelineCategory("program", WebInspector.UIString("Program"), -1, "#BBBBBB", "#DDDDDD", "#FFFFFF"),
 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), 0, "#5A8BCC", "#8EB6E9", "#70A2E3"),
 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), 1, "#D8AA34", "#F3D07A", "#F1C453"),
 rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), 2, "#8266CC", "#AF9AEB", "#9A7EE6"),
-painting: new WebInspector.TimelineCategory("painting", WebInspector.UIString("Painting"), 2, "#5FA050", "#8DC286", "#71B363")
+painting: new WebInspector.TimelineCategory("painting", WebInspector.UIString("Painting"), 2, "#5FA050", "#8DC286", "#71B363"),
+other: new WebInspector.TimelineCategory("other", WebInspector.UIString("Other"), -1, "#BBBBBB", "#DDDDDD", "#EEEEEE")
 };
 return WebInspector.TimelinePresentationModel._categories;
 };
@@ -2017,7 +2150,7 @@
 
 var recordStyles = {};
 recordStyles[recordTypes.Root] = { title: "#root", category: categories["loading"] };
-recordStyles[recordTypes.Program] = { title: WebInspector.UIString("Program"), category: categories["program"] };
+recordStyles[recordTypes.Program] = { title: WebInspector.UIString("Other"), category: categories["other"] };
 recordStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: categories["scripting"] };
 recordStyles[recordTypes.BeginFrame] = { title: WebInspector.UIString("Frame Start"), category: categories["rendering"] };
 recordStyles[recordTypes.ScheduleStyleRecalculation] = { title: WebInspector.UIString("Schedule Style Recalculation"), category: categories["rendering"] };
@@ -2025,7 +2158,8 @@
 recordStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] };
 recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
 recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
-recordStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["painting"] };
+recordStyles[recordTypes.Rasterize] = { title: WebInspector.UIString("Rasterize"), category: categories["painting"] };
+recordStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["rendering"] };
 recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] };
 recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] };
 recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] };
@@ -2051,6 +2185,10 @@
 recordStyles[recordTypes.RequestAnimationFrame] = { title: WebInspector.UIString("Request Animation Frame"), category: categories["scripting"] };
 recordStyles[recordTypes.CancelAnimationFrame] = { title: WebInspector.UIString("Cancel Animation Frame"), category: categories["scripting"] };
 recordStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] };
+recordStyles[recordTypes.WebSocketCreate] = { title: WebInspector.UIString("Create WebSocket"), category: categories["scripting"] };
+recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspector.UIString("Send WebSocket Handshake"), category: categories["scripting"] };
+recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebInspector.UIString("Receive WebSocket Handshake"), category: categories["scripting"] };
+recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString("Destroy WebSocket"), category: categories["scripting"] };
 
 WebInspector.TimelinePresentationModel._recordStylesMap = recordStyles;
 return recordStyles;
@@ -2064,7 +2202,7 @@
 if (!result) {
 result = {
 title: WebInspector.UIString("Unknown: %s", record.type),
-category: WebInspector.TimelinePresentationModel.categories()["program"]
+category: WebInspector.TimelinePresentationModel.categories()["other"]
 };
 recordStyles[record.type] = result;
 }
@@ -2082,9 +2220,8 @@
 if (record.type === recordTypes.TimeStamp)
 return true;
 if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad) {
-var mainFrame = WebInspector.resourceTreeModel.mainFrame;
-if (mainFrame && mainFrame.id === record.frameId)
-return true;
+if (record.data && ((typeof record.data.isMainFrame) === "boolean"))
+return record.data.isMainFrame;
 }
 return false;
 }
@@ -2194,11 +2331,15 @@
 this._scheduledResourceRequests = {};
 this._timerRecords = {};
 this._requestAnimationFrameRecords = {};
+this._eventDividerRecords = [];
 this._timeRecords = {};
+this._timeRecordStack = [];
 this._frames = [];
 this._minimumRecordTime = -1;
-this._lastInvalidateLayout = {};
+this._layoutInvalidateStack = {};
 this._lastScheduleStyleRecalculation = {};
+this._webSocketCreateRecords = {};
+this._coalescingBuckets = {};
 },
 
 addFrame: function(frame)
@@ -2229,12 +2370,24 @@
 const recordTypes = WebInspector.TimelineModel.RecordType;
 var isHiddenRecord = record.type in WebInspector.TimelinePresentationModel._hiddenRecords;
 var origin;
+var coalescingBucket;
+
 if (!isHiddenRecord) {
 var newParentRecord = this._findParentRecord(record);
 if (newParentRecord) {
 origin = parentRecord;
 parentRecord = newParentRecord;
 }
+if (parentRecord === this._rootRecord) {
+
+coalescingBucket = record.thread ? record.type : "mainThread";
+var coalescedRecord = this._findCoalescedParent(record, coalescingBucket);
+if (coalescedRecord) {
+if (!origin)
+origin = parentRecord;
+parentRecord = coalescedRecord;
+}
+}
 }
 
 var children = record.children;
@@ -2259,33 +2412,95 @@
 
 var formattedRecord = new WebInspector.TimelinePresentationModel.Record(this, record, parentRecord, origin, scriptDetails, isHiddenRecord);
 
+if (WebInspector.TimelinePresentationModel.isEventDivider(formattedRecord))
+this._eventDividerRecords.push(formattedRecord);
+
 if (isHiddenRecord)
 return formattedRecord;
 
-formattedRecord.collapsed = (parentRecord === this._rootRecord);
+formattedRecord.collapsed = parentRecord === this._rootRecord;
+if (coalescingBucket)
+this._coalescingBuckets[coalescingBucket] = formattedRecord;
 
 var childrenCount = children ? children.length : 0;
 for (var i = 0; i < childrenCount; ++i)
 this._innerAddRecord(children[i], formattedRecord);
 
-formattedRecord.calculateAggregatedStats(WebInspector.TimelinePresentationModel.categories());
+formattedRecord.calculateAggregatedStats();
 
-if (origin) {
-var lastChildEndTime = formattedRecord.lastChildEndTime;
-var aggregatedStats = formattedRecord.aggregatedStats;
-for (var currentRecord = formattedRecord.parent; !currentRecord.isRoot(); currentRecord = currentRecord.parent) {
-currentRecord._cpuTime += formattedRecord._cpuTime;
+if (origin)
+this._updateAncestorStats(formattedRecord);
+
+if (parentRecord.coalesced && parentRecord.startTime > formattedRecord.startTime)
+parentRecord._record.startTime = record.startTime;
+
+origin = formattedRecord.origin();
+if (!origin.isRoot() && !origin.coalesced)
+origin.selfTime -= formattedRecord.endTime - formattedRecord.startTime;
+return formattedRecord;
+},
+
+
+_updateAncestorStats: function(record)
+{
+var lastChildEndTime = record.lastChildEndTime;
+var aggregatedStats = record.aggregatedStats;
+for (var currentRecord = record.parent; currentRecord && !currentRecord.isRoot(); currentRecord = currentRecord.parent) {
+currentRecord._cpuTime += record._cpuTime;
 if (currentRecord.lastChildEndTime < lastChildEndTime)
 currentRecord.lastChildEndTime = lastChildEndTime;
 for (var category in aggregatedStats)
 currentRecord.aggregatedStats[category] += aggregatedStats[category];
 }
-}
-origin = formattedRecord.origin();
-if (!origin.isRoot()) {
-origin.selfTime -= formattedRecord.endTime - formattedRecord.startTime;
-}
-return formattedRecord;
+},
+
+
+_findCoalescedParent: function(record, bucket)
+{
+const coalescingThresholdSeconds = 0.001;
+
+var lastRecord = this._coalescingBuckets[bucket];
+var startTime = WebInspector.TimelineModel.startTimeInSeconds(record);
+var endTime = WebInspector.TimelineModel.endTimeInSeconds(record);
+if (!lastRecord || lastRecord.type !== record.type)
+return null;
+if (lastRecord.endTime + coalescingThresholdSeconds < startTime)
+return null;
+if (endTime + coalescingThresholdSeconds < lastRecord.startTime)
+return null;
+if (lastRecord.parent.coalesced)
+return lastRecord.parent;
+
+if (lastRecord.parent !== this._rootRecord)
+return null;
+return this._replaceWithCoalescedRecord(lastRecord);
+},
+
+
+_replaceWithCoalescedRecord: function(record)
+{
+var rawRecord = {
+type: record._record.type,
+startTime: record._record.startTime,
+endTime: record._record.endTime,
+data: { }
+};
+if (record._record.thread)
+rawRecord.thread = "aggregated";
+var coalescedRecord = new WebInspector.TimelinePresentationModel.Record(this, rawRecord, null, null, null, false);
+var parent = record.parent;
+
+coalescedRecord.coalesced = true;
+coalescedRecord.collapsed = true;
+coalescedRecord._children.push(record);
+record.parent = coalescedRecord;
+coalescedRecord.calculateAggregatedStats();
+if (record.hasWarning || record.childHasWarning)
+coalescedRecord.childHasWarning = true;
+
+coalescedRecord.parent = parent;
+parent._children[parent._children.indexOf(record)] = coalescedRecord;
+return coalescedRecord;
 },
 
 _findParentRecord: function(record)
@@ -2386,6 +2601,11 @@
 return this._frames.slice(firstFrame, lastFrame);
 },
 
+eventDividerRecords: function()
+{
+return this._eventDividerRecords;
+},
+
 isVisible: function(record)
 {
 for (var i = 0; i < this._filters.length; ++i) {
@@ -2413,13 +2633,13 @@
 var duration = endTime - startTime;
 var offset = this._minimumRecordTime;
 
-var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("CPU"));
+var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("CPU"));
 var durationText = WebInspector.UIString("%s (at %s)", Number.secondsToString(duration, true),
 Number.secondsToString(startTime - offset, true));
-contentHelper._appendTextRow(WebInspector.UIString("Duration"), durationText);
-contentHelper._appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(cpuTime, true));
-contentHelper._appendTextRow(WebInspector.UIString("Message Count"), messageCount);
-return contentHelper._contentTable;
+contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText);
+contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(cpuTime, true));
+contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageCount);
+return contentHelper.contentTable();
 },
 
 __proto__: WebInspector.Object.prototype
@@ -2429,11 +2649,14 @@
 WebInspector.TimelinePresentationModel.Record = function(presentationModel, record, parentRecord, origin, scriptDetails, hidden)
 {
 this._linkifier = presentationModel._linkifier;
-this._aggregatedStats = [];
+this._aggregatedStats = {};
 this._record = record;
 this._children = [];
 if (!hidden && parentRecord) {
 this.parent = parentRecord;
+if (this.isBackground)
+WebInspector.TimelinePresentationModel.insertRetrospectiveRecord(parentRecord, this);
+else
 parentRecord.children.push(this);
 }
 if (origin)
@@ -2507,7 +2730,13 @@
 break;
 
 case recordTypes.Time:
-presentationModel._timeRecords[record.data["message"]] = this;
+var message = record.data["message"];
+var oldReference = presentationModel._timeRecords[message];
+if (oldReference)
+break;
+presentationModel._timeRecords[message] = this;
+if (origin)
+presentationModel._timeRecordStack.push(this);
 break;
 
 case recordTypes.TimeEnd:
@@ -2520,6 +2749,17 @@
 var intervalDuration = this.startTime - timeRecord.startTime;
 this.intervalDuration = intervalDuration;
 timeRecord.intervalDuration = intervalDuration;
+if (!origin)
+break;
+var recordStack = presentationModel._timeRecordStack;
+recordStack.splice(recordStack.indexOf(timeRecord), 1);
+for (var index = recordStack.length; index; --index) {
+var openRecord = recordStack[index - 1];
+if (openRecord.startTime > timeRecord.startTime)
+continue;
+WebInspector.TimelinePresentationModel.adoptRecord(openRecord, timeRecord);
+break;
+}
 }
 break;
 
@@ -2535,20 +2775,71 @@
 break;
 
 case recordTypes.InvalidateLayout:
-presentationModel._lastInvalidateLayout[this.frameId] = this;
+
+
+var styleRecalcStack;
+if (!presentationModel._layoutInvalidateStack[this.frameId]) {
+for (var outerRecord = parentRecord; outerRecord; outerRecord = record.parent) {
+if (outerRecord.type === recordTypes.RecalculateStyles) {
+styleRecalcStack = outerRecord.callSiteStackTrace;
+break;
+}
+}
+}
+presentationModel._layoutInvalidateStack[this.frameId] = styleRecalcStack || this.stackTrace;
 break;
 
 case recordTypes.Layout:
-var invalidateLayoutRecord = presentationModel._lastInvalidateLayout[this.frameId];
-if (invalidateLayoutRecord)
-this.callSiteStackTrace = invalidateLayoutRecord.stackTrace || invalidateLayoutRecord.callSiteStackTrace;
+var layoutInvalidateStack = presentationModel._layoutInvalidateStack[this.frameId];
+if (layoutInvalidateStack)
+this.callSiteStackTrace = layoutInvalidateStack;
 if (this.stackTrace)
 this.setHasWarning();
-presentationModel._lastInvalidateLayout[this.frameId] = null;
+presentationModel._layoutInvalidateStack[this.frameId] = null;
+this.highlightQuad = record.data.root || WebInspector.TimelinePresentationModel.quadFromRectData(record.data);
+break;
+
+case recordTypes.Paint:
+this.highlightQuad = record.data.clip || WebInspector.TimelinePresentationModel.quadFromRectData(record.data);
+break;
+
+case recordTypes.WebSocketCreate:
+this.webSocketURL = record.data["url"];
+if (typeof record.data["webSocketProtocol"] !== "undefined")
+this.webSocketProtocol = record.data["webSocketProtocol"];
+presentationModel._webSocketCreateRecords[record.data["identifier"]] = this;
+break;
+
+case recordTypes.WebSocketSendHandshakeRequest:
+case recordTypes.WebSocketReceiveHandshakeResponse:
+case recordTypes.WebSocketDestroy:
+var webSocketCreateRecord = presentationModel._webSocketCreateRecords[record.data["identifier"]];
+if (webSocketCreateRecord) { 
+this.webSocketURL = webSocketCreateRecord.webSocketURL;
+if (typeof webSocketCreateRecord.webSocketProtocol !== "undefined")
+this.webSocketProtocol = webSocketCreateRecord.webSocketProtocol;
+}
 break;
 }
 }
 
+WebInspector.TimelinePresentationModel.adoptRecord = function(newParent, record)
+{
+record.parent.children.splice(record.parent.children.indexOf(record));
+WebInspector.TimelinePresentationModel.insertRetrospectiveRecord(newParent, record);
+record.parent = newParent;
+}
+
+WebInspector.TimelinePresentationModel.insertRetrospectiveRecord = function(parent, record)
+{
+function compareStartTime(value, record)
+{
+return value < record.startTime ? -1 : 1;
+}
+
+parent.children.splice(insertionIndexForObjectInListSortedByFunction(record.startTime, parent.children, compareStartTime), 0, record);
+}
+
 WebInspector.TimelinePresentationModel.Record.prototype = {
 get lastChildEndTime()
 {
@@ -2562,7 +2853,7 @@
 
 get selfTime()
 {
-return this._selfTime;
+return this.coalesced ? this._lastChildEndTime - this.startTime : this._selfTime;
 },
 
 set selfTime(time)
@@ -2631,6 +2922,12 @@
 },
 
 
+get isBackground()
+{
+return !!this._record.thread;
+},
+
+
 get data()
 {
 return this._record.data;
@@ -2685,17 +2982,23 @@
 
 _generatePopupContentWithImagePreview: function(callback, previewElement)
 {
-var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(this.title);
+var contentHelper = new WebInspector.PopoverContentHelper(this.title);
 var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, true),
 Number.secondsToString(this._startTimeOffset));
-contentHelper._appendTextRow(WebInspector.UIString("Duration"), text);
+contentHelper.appendTextRow(WebInspector.UIString("Duration"), text);
 
 if (this._children.length) {
-contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true));
-contentHelper._appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true));
-contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"),
+if (!this.coalesced)
+contentHelper.appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true));
+contentHelper.appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true));
+contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),
 WebInspector.TimelinePresentationModel._generateAggregatedInfo(this._aggregatedStats));
 }
+
+if (this.coalesced) {
+callback(contentHelper.contentTable());
+return;
+}
 const recordTypes = WebInspector.TimelineModel.RecordType;
 
 
@@ -2704,90 +3007,125 @@
 
 switch (this.type) {
 case recordTypes.GCEvent:
-contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data["usedHeapSizeDelta"]));
+contentHelper.appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data["usedHeapSizeDelta"]));
 break;
-case recordTypes.TimerInstall:
 case recordTypes.TimerFire:
+callSiteStackTraceLabel = WebInspector.UIString("Timer installed");
+
+
+case recordTypes.TimerInstall:
 case recordTypes.TimerRemove:
-contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data["timerId"]);
+contentHelper.appendTextRow(WebInspector.UIString("Timer ID"), this.data["timerId"]);
 if (typeof this.timeout === "number") {
-contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000));
-contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
+contentHelper.appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000));
+contentHelper.appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
 }
 break;
 case recordTypes.FireAnimationFrame:
-contentHelper._appendTextRow(WebInspector.UIString("Callback ID"), this.data["id"]);
+callSiteStackTraceLabel = WebInspector.UIString("Animation frame requested");
+contentHelper.appendTextRow(WebInspector.UIString("Callback ID"), this.data["id"]);
 break;
 case recordTypes.FunctionCall:
-contentHelper._appendElementRow(WebInspector.UIString("Location"), this._linkifyScriptLocation());
+contentHelper.appendElementRow(WebInspector.UIString("Location"), this._linkifyScriptLocation());
 break;
 case recordTypes.ScheduleResourceRequest:
 case recordTypes.ResourceSendRequest:
 case recordTypes.ResourceReceiveResponse:
 case recordTypes.ResourceReceivedData:
 case recordTypes.ResourceFinish:
-contentHelper._appendElementRow(WebInspector.UIString("Resource"), WebInspector.linkifyResourceAsNode(this.url));
+contentHelper.appendElementRow(WebInspector.UIString("Resource"), WebInspector.linkifyResourceAsNode(this.url));
 if (previewElement)
-contentHelper._appendElementRow(WebInspector.UIString("Preview"), previewElement);
+contentHelper.appendElementRow(WebInspector.UIString("Preview"), previewElement);
 if (this.data["requestMethod"])
-contentHelper._appendTextRow(WebInspector.UIString("Request Method"), this.data["requestMethod"]);
+contentHelper.appendTextRow(WebInspector.UIString("Request Method"), this.data["requestMethod"]);
 if (typeof this.data["statusCode"] === "number")
-contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data["statusCode"]);
+contentHelper.appendTextRow(WebInspector.UIString("Status Code"), this.data["statusCode"]);
 if (this.data["mimeType"])
-contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data["mimeType"]);
+contentHelper.appendTextRow(WebInspector.UIString("MIME Type"), this.data["mimeType"]);
 if (this.data["encodedDataLength"])
-contentHelper._appendTextRow(WebInspector.UIString("Encoded Data Length"), WebInspector.UIString("%d Bytes", this.data["encodedDataLength"]));
+contentHelper.appendTextRow(WebInspector.UIString("Encoded Data Length"), WebInspector.UIString("%d Bytes", this.data["encodedDataLength"]));
 break;
 case recordTypes.EvaluateScript:
 if (this.data && this.url)
-contentHelper._appendElementRow(WebInspector.UIString("Script"), this._linkifyLocation(this.url, this.data["lineNumber"]));
+contentHelper.appendElementRow(WebInspector.UIString("Script"), this._linkifyLocation(this.url, this.data["lineNumber"]));
 break;
 case recordTypes.Paint:
-contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
-contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
+var clip = this.data["clip"];
+if (clip) {
+contentHelper.appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", clip[0], clip[1]));
+var clipWidth = WebInspector.TimelinePresentationModel.quadWidth(clip);
+var clipHeight = WebInspector.TimelinePresentationModel.quadHeight(clip);
+contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", clipWidth, clipHeight));
+} else {
+
+if (typeof this.data["x"] !== "undefined" && typeof this.data["y"] !== "undefined")
+contentHelper.appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
+if (typeof this.data["width"] !== "undefined" && typeof this.data["height"] !== "undefined")
+contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d\u2009\u00d7\u2009%d", this.data["width"], this.data["height"]));
+}
 break;
 case recordTypes.RecalculateStyles: 
-callSiteStackTraceLabel = WebInspector.UIString("Styles invalidated");
+if (this.data["elementCount"])
+contentHelper.appendTextRow(WebInspector.UIString("Elements affected"), this.data["elementCount"]);
 callStackLabel = WebInspector.UIString("Styles recalculation forced");
 break;
 case recordTypes.Layout:
+if (this.data["dirtyObjects"])
+contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layout"), this.data["dirtyObjects"]);
+if (this.data["totalObjects"])
+contentHelper.appendTextRow(WebInspector.UIString("Layout tree size"), this.data["totalObjects"]);
+if (typeof this.data["partialLayout"] === "boolean") {
+contentHelper.appendTextRow(WebInspector.UIString("Layout scope"),
+this.data["partialLayout"] ? WebInspector.UIString("Partial") : WebInspector.UIString("Whole document"));
+}
 callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated");
 if (this.stackTrace) {
 callStackLabel = WebInspector.UIString("Layout forced");
-contentHelper._appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
+contentHelper.appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
 }
 break;
 case recordTypes.Time:
 case recordTypes.TimeEnd:
-contentHelper._appendTextRow(WebInspector.UIString("Message"), this.data["message"]);
+contentHelper.appendTextRow(WebInspector.UIString("Message"), this.data["message"]);
 if (typeof this.intervalDuration === "number")
-contentHelper._appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true));
+contentHelper.appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true));
+break;
+case recordTypes.WebSocketCreate:
+case recordTypes.WebSocketSendHandshakeRequest:
+case recordTypes.WebSocketReceiveHandshakeResponse:
+case recordTypes.WebSocketDestroy:
+if (typeof this.webSocketURL !== "undefined")
+contentHelper.appendTextRow(WebInspector.UIString("URL"), this.webSocketURL);
+if (typeof this.webSocketProtocol !== "undefined")
+contentHelper.appendTextRow(WebInspector.UIString("WebSocket Protocol"), this.webSocketProtocol);
+if (typeof this.data["message"] !== "undefined")
+contentHelper.appendTextRow(WebInspector.UIString("Message"), this.data["message"])
 break;
 default:
 if (this.detailsNode())
-contentHelper._appendElementRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].cloneNode());
+contentHelper.appendElementRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].cloneNode());
 break;
 }
 
 if (this.scriptName && this.type !== recordTypes.FunctionCall)
-contentHelper._appendElementRow(WebInspector.UIString("Function Call"), this._linkifyScriptLocation());
+contentHelper.appendElementRow(WebInspector.UIString("Function Call"), this._linkifyScriptLocation());
 
 if (this.usedHeapSize) {
 if (this.usedHeapSizeDelta) {
 var sign = this.usedHeapSizeDelta > 0 ? "+" : "-";
-contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"),
+contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),
 WebInspector.UIString("%s (%s%s)", Number.bytesToString(this.usedHeapSize), sign, Number.bytesToString(this.usedHeapSizeDelta)));
 } else if (this.category === WebInspector.TimelinePresentationModel.categories().scripting)
-contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize));
+contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize));
 }
 
 if (this.callSiteStackTrace)
-contentHelper._appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
+contentHelper.appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
 
 if (this.stackTrace)
-contentHelper._appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
+contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
 
-callback(contentHelper._contentTable);
+callback(contentHelper.contentTable());
 },
 
 _refreshDetails: function()
@@ -2820,6 +3158,9 @@
 _getRecordDetails: function()
 {
 var details;
+if (this.coalesced)
+return this._createSpanWithText(WebInspector.UIString("× %d", this.children.length));
+
 switch (this.type) {
 case WebInspector.TimelineModel.RecordType.GCEvent:
 details = WebInspector.UIString("%s collected", Number.bytesToString(this.data["usedHeapSizeDelta"]));
@@ -2837,7 +3178,10 @@
 details = this.data ? this.data["type"] : null;
 break;
 case WebInspector.TimelineModel.RecordType.Paint:
-details = this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"];
+var width = this.data.clip ? WebInspector.TimelinePresentationModel.quadWidth(this.data.clip) : this.data.width;
+var height = this.data.clip ? WebInspector.TimelinePresentationModel.quadHeight(this.data.clip) : this.data.height;
+if (width && height)
+details = WebInspector.UIString("%d\u2009\u00d7\u2009%d", width, height);
 break;
 case WebInspector.TimelineModel.RecordType.DecodeImage:
 details = this.data["imageType"];
@@ -2879,10 +3223,14 @@
 break;
 }
 
-if (typeof details === "string")
-return this._createSpanWithText(details);
+if (details) {
+if (details instanceof Node)
+details.tabIndex = -1;
+else
+return this._createSpanWithText("" + details);
+}
 
-return details ? details : null;
+return details || null;
 },
 
 
@@ -2911,24 +3259,25 @@
 
 _linkifyScriptLocation: function(defaultValue)
 {
-return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : defaultValue;
+if (this.scriptName)
+return this._linkifyLocation(this.scriptName, this.scriptLine, 0);
+else
+return defaultValue ? "" + defaultValue : null;
 },
 
-calculateAggregatedStats: function(categories)
+calculateAggregatedStats: function()
 {
 this._aggregatedStats = {};
-for (var category in categories)
-this._aggregatedStats[category] = 0;
 this._cpuTime = this._selfTime;
 
 for (var index = this._children.length; index; --index) {
 var child = this._children[index - 1];
-for (var category in categories)
-this._aggregatedStats[category] += child._aggregatedStats[category];
+for (var category in child._aggregatedStats)
+this._aggregatedStats[category] = (this._aggregatedStats[category] || 0) + child._aggregatedStats[category];
 }
 for (var category in this._aggregatedStats)
 this._cpuTime += this._aggregatedStats[category];
-this._aggregatedStats[this.category.name] += this._selfTime;
+this._aggregatedStats[this.category.name] = (this._aggregatedStats[this.category.name] || 0) + this._selfTime;
 },
 
 get aggregatedStats()
@@ -2960,87 +3309,19 @@
 return cell;
 }
 
-
-WebInspector.TimelinePresentationModel.PopupContentHelper = function(title)
-{
-this._contentTable = document.createElement("table");
-var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "timeline-details-title");
-titleCell.colSpan = 2;
-var titleRow = document.createElement("tr");
-titleRow.appendChild(titleCell);
-this._contentTable.appendChild(titleRow);
-}
-
-WebInspector.TimelinePresentationModel.PopupContentHelper.prototype = {
-
-_createCell: function(content, styleName)
-{
-var text = document.createElement("label");
-text.appendChild(document.createTextNode(content));
-var cell = document.createElement("td");
-cell.className = "timeline-details";
-if (styleName)
-cell.className += " " + styleName;
-cell.textContent = content;
-return cell;
-},
-
-_appendTextRow: function(title, content)
-{
-var row = document.createElement("tr");
-row.appendChild(this._createCell(title, "timeline-details-row-title"));
-row.appendChild(this._createCell(content, "timeline-details-row-data"));
-this._contentTable.appendChild(row);
-},
-
-
-_appendElementRow: function(title, content, titleStyle)
-{
-var row = document.createElement("tr");
-var titleCell = this._createCell(title, "timeline-details-row-title");
-if (titleStyle)
-titleCell.addStyleClass(titleStyle);
-row.appendChild(titleCell);
-var cell = document.createElement("td");
-cell.className = "timeline-details";
-cell.appendChild(content);
-row.appendChild(cell);
-this._contentTable.appendChild(row);
-},
-
-_appendStackTrace: function(title, stackTrace, callFrameLinkifier)
-{
-this._appendTextRow("", "");
-var framesTable = document.createElement("table");
-for (var i = 0; i < stackTrace.length; ++i) {
-var stackFrame = stackTrace[i];
-var row = document.createElement("tr");
-row.className = "timeline-details";
-row.appendChild(this._createCell(stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)"), "timeline-function-name"));
-row.appendChild(this._createCell(" @ "));
-var linkCell = document.createElement("td");
-var urlElement = callFrameLinkifier(stackFrame);
-linkCell.appendChild(urlElement);
-row.appendChild(linkCell);
-framesTable.appendChild(row);
-}
-this._appendElementRow(title, framesTable, "timeline-stacktrace-title");
-}
-}
-
 WebInspector.TimelinePresentationModel.generatePopupContentForFrame = function(frame)
 {
-var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("Frame"));
+var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("Frame"));
 var durationInSeconds = frame.endTime - frame.startTime;
 var durationText = WebInspector.UIString("%s (at %s)", Number.secondsToString(frame.endTime - frame.startTime, true),
 Number.secondsToString(frame.startTimeOffset, true));
-contentHelper._appendTextRow(WebInspector.UIString("Duration"), durationText);
-contentHelper._appendTextRow(WebInspector.UIString("FPS"), Math.floor(1 / durationInSeconds));
-contentHelper._appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(frame.cpuTime, true));
-contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"),
+contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText);
+contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1 / durationInSeconds));
+contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.secondsToString(frame.cpuTime, true));
+contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),
 WebInspector.TimelinePresentationModel._generateAggregatedInfo(frame.timeByCategory));
 
-return contentHelper._contentTable;
+return contentHelper.contentTable();
 }
 
 
@@ -3052,18 +3333,18 @@
 return WebInspector.UIString("%s (%.0f FPS)", Number.secondsToString(time, true), 1 / time);
 }
 
-var contentHelper = new WebInspector.TimelinePresentationModel.PopupContentHelper(WebInspector.UIString("Selected Range"));
+var contentHelper = new WebInspector.PopoverContentHelper(WebInspector.UIString("Selected Range"));
 
-contentHelper._appendTextRow(WebInspector.UIString("Selected range"), WebInspector.UIString("%s\u2013%s (%d frames)",
+contentHelper.appendTextRow(WebInspector.UIString("Selected range"), WebInspector.UIString("%s\u2013%s (%d frames)",
 Number.secondsToString(statistics.startOffset, true), Number.secondsToString(statistics.endOffset, true), statistics.frameCount));
-contentHelper._appendTextRow(WebInspector.UIString("Minimum Time"), formatTimeAndFPS(statistics.minDuration));
-contentHelper._appendTextRow(WebInspector.UIString("Average Time"), formatTimeAndFPS(statistics.average));
-contentHelper._appendTextRow(WebInspector.UIString("Maximum Time"), formatTimeAndFPS(statistics.maxDuration));
-contentHelper._appendTextRow(WebInspector.UIString("Standard Deviation"), Number.secondsToString(statistics.stddev, true));
-contentHelper._appendElementRow(WebInspector.UIString("Time by category"),
+contentHelper.appendTextRow(WebInspector.UIString("Minimum Time"), formatTimeAndFPS(statistics.minDuration));
+contentHelper.appendTextRow(WebInspector.UIString("Average Time"), formatTimeAndFPS(statistics.average));
+contentHelper.appendTextRow(WebInspector.UIString("Maximum Time"), formatTimeAndFPS(statistics.maxDuration));
+contentHelper.appendTextRow(WebInspector.UIString("Standard Deviation"), Number.secondsToString(statistics.stddev, true));
+contentHelper.appendElementRow(WebInspector.UIString("Time by category"),
 WebInspector.TimelinePresentationModel._generateAggregatedInfo(statistics.timeByCategory));
 
-return contentHelper._contentTable;
+return contentHelper.contentTable();
 }
 
 
@@ -3098,6 +3379,30 @@
 }
 
 
+WebInspector.TimelinePresentationModel.quadWidth = function(quad)
+{
+return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
+}
+
+
+WebInspector.TimelinePresentationModel.quadHeight = function(quad)
+{
+return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1] - quad[7], 2)));
+}
+
+
+WebInspector.TimelinePresentationModel.quadFromRectData = function(data)
+{
+if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined")
+return null;
+var x0 = data["x"];
+var x1 = data["x"] + data["width"];
+var y0 = data["y"];
+var y1 = data["y"] + data["height"];
+return [x0, y0, x1, y0, x1, y1, x0, y1];
+}
+
+
 WebInspector.TimelinePresentationModel.Filter = function()
 {
 }
@@ -3169,40 +3474,59 @@
 
 _addRecord: function(record)
 {
+if (record.isBackground)
+return;
 var records;
-if (record.type === WebInspector.TimelineModel.RecordType.Program)
+var programRecord;
+if (record.type === WebInspector.TimelineModel.RecordType.Program) {
+programRecord = record;
+if (this._lastFrame)
+this._lastFrame.timeByCategory["other"] += WebInspector.TimelineModel.durationInSeconds(programRecord);
 records = record["children"] || [];
-else
+} else
 records = [record];
-records.forEach(this._innerAddRecord, this);
+records.forEach(this._innerAddRecord.bind(this, programRecord));
 },
 
-_innerAddRecord: function(record)
+
+_innerAddRecord: function(programRecord, record)
 {
-if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame && this._lastFrame)
-this._flushFrame(record);
+var isFrameRecord = record.type === WebInspector.TimelineModel.RecordType.BeginFrame;
+var programTimeCarryover = isFrameRecord && programRecord ? WebInspector.TimelineModel.endTimeInSeconds(programRecord) - WebInspector.TimelineModel.startTimeInSeconds(record) : 0;
+if (isFrameRecord && this._lastFrame)
+this._flushFrame(record, programTimeCarryover);
 else {
 if (!this._lastFrame)
-this._lastFrame = this._createFrame(record);
+this._lastFrame = this._createFrame(record, programTimeCarryover);
+if (!record.thread)
 WebInspector.TimelineModel.aggregateTimeForRecord(this._lastFrame.timeByCategory, record);
-this._lastFrame.cpuTime += WebInspector.TimelineModel.durationInSeconds(record);
+var duration = WebInspector.TimelineModel.durationInSeconds(record);
+this._lastFrame.cpuTime += duration;
+this._lastFrame.timeByCategory["other"] -= duration;
 }
 },
 
-_flushFrame: function(record)
+
+_flushFrame: function(record, programTimeCarryover)
 {
 this._lastFrame.endTime = WebInspector.TimelineModel.startTimeInSeconds(record);
 this._lastFrame.duration = this._lastFrame.endTime - this._lastFrame.startTime;
+this._lastFrame.timeByCategory["other"] -= programTimeCarryover;
+
+
+this._lastFrame.cpuTime += this._lastFrame.timeByCategory["other"];
 this._overviewPane.addFrame(this._lastFrame);
 this._presentationModel.addFrame(this._lastFrame);
-this._lastFrame = this._createFrame(record);
+this._lastFrame = this._createFrame(record, programTimeCarryover);
 },
 
-_createFrame: function(record)
+
+_createFrame: function(record, programTimeCarryover)
 {
 var frame = new WebInspector.TimelineFrame();
 frame.startTime = WebInspector.TimelineModel.startTimeInSeconds(record);
 frame.startTimeOffset = this._model.recordOffsetInSeconds(record);
+frame.timeByCategory["other"] = programTimeCarryover;
 return frame;
 },
 
@@ -3257,24 +3581,26 @@
 this._presentationModel = new WebInspector.TimelinePresentationModel();
 
 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOverviewMode", WebInspector.TimelineOverviewPane.Mode.Events);
-this._glueRecordsSetting = WebInspector.settings.createSetting("timelineGlueRecords", true);
+this._glueRecordsSetting = WebInspector.settings.createSetting("timelineGlueRecords", false);
 
 this._overviewPane = new WebInspector.TimelineOverviewPane(this._model);
-this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.WindowChanged, this._invalidateAndScheduleRefresh.bind(this, false));
+this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.WindowChanged, this._invalidateAndScheduleRefresh.bind(this, false, true));
 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.ModeChanged, this._overviewModeChanged, this);
 this._overviewPane.show(this.element);
 
 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false);
-this.element.tabIndex = 0;
+
+this.element.addStyleClass("split-view-vertical");
 
 this._sidebarBackgroundElement = document.createElement("div");
-this._sidebarBackgroundElement.className = "sidebar split-view-sidebar-left timeline-sidebar-background";
+this._sidebarBackgroundElement.className = "sidebar split-view-sidebar split-view-contents-first timeline-sidebar-background";
 this.element.appendChild(this._sidebarBackgroundElement);
 
 this.createSidebarViewWithTree();
 this.element.appendChild(this.splitView.resizerElement());
 
 this._containerElement = this.splitView.element;
+this._containerElement.tabIndex = 0;
 this._containerElement.id = "timeline-container";
 this._containerElement.addEventListener("scroll", this._onScroll.bind(this), false);
 
@@ -3282,11 +3608,20 @@
 this._timelineMemorySplitter.id = "timeline-memory-splitter";
 WebInspector.installDragHandle(this._timelineMemorySplitter, this._startSplitterDragging.bind(this), this._splitterDragging.bind(this), this._endSplitterDragging.bind(this), "ns-resize");
 this._timelineMemorySplitter.addStyleClass("hidden");
-this._memoryStatistics = new WebInspector.MemoryStatistics(this, this._model, this.splitView.sidebarWidth());
+this._includeDomCounters = false;
+this._includeNativeMemoryStatistics = false;
+if (WebInspector.experimentsSettings.nativeMemoryTimeline.isEnabled()) {
+this._memoryStatistics = new WebInspector.NativeMemoryGraph(this, this._model, this.splitView.sidebarWidth());
+this._includeNativeMemoryStatistics = true;
+} else {
+this._memoryStatistics = new WebInspector.DOMCountersGraph(this, this._model, this.splitView.sidebarWidth());
+this._includeDomCounters = true;
+}
 WebInspector.settings.memoryCounterGraphsHeight = WebInspector.settings.createSetting("memoryCounterGraphsHeight", 150);
 
 var itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true);
 this.sidebarTree.appendChild(itemsTreeElement);
+this.sidebarTree.setFocusable(false);
 
 this._sidebarListElement = document.createElement("div");
 this.sidebarElement.appendChild(this._sidebarListElement);
@@ -3331,7 +3666,6 @@
 
 this._durationFilter = new WebInspector.TimelineIsLongFilter();
 
-this._timeStampRecords = [];
 this._expandOffset = 15;
 
 this._headerLineCount = 1;
@@ -3339,7 +3673,7 @@
 
 this._mainThreadTasks =   ([]);
 this._cpuBarsElement = this._timelineGrid.gridHeaderElement.createChild("div", "timeline-cpu-bars");
-this._mainThreadMonitoringEnabled = Capabilities.timelineCanMonitorMainThread && WebInspector.settings.showCpuOnTimelineRuler.get();
+this._mainThreadMonitoringEnabled = WebInspector.settings.showCpuOnTimelineRuler.get();
 WebInspector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpuOnTimelineRulerChanged, this);
 
 this._createFileSelector();
@@ -3415,9 +3749,7 @@
 get statusBarItems()
 {
 return this._statusBarItems.select("element").concat([
-this._miscStatusBarItems,
-this.recordsCounter,
-this.frameStatistics
+this._miscStatusBarItems
 ]);
 },
 
@@ -3466,9 +3798,9 @@
 this._statusBarItems.push(this._durationFilterSelector);
 
 this._miscStatusBarItems = document.createElement("div");
-this._miscStatusBarItems.className = "status-bar-items";
+this._miscStatusBarItems.className = "status-bar-items timeline-misc-status-bar-items";
 
-this._statusBarFilters = this._miscStatusBarItems.createChild("div");
+this._statusBarFilters = this._miscStatusBarItems.createChild("div", "timeline-misc-status-bar-filters");
 var categories = WebInspector.TimelinePresentationModel.categories();
 for (var categoryName in categories) {
 var category = categories[categoryName];
@@ -3477,11 +3809,15 @@
 this._statusBarFilters.appendChild(this._createTimelineCategoryStatusBarCheckbox(category, this._onCategoryCheckboxClicked.bind(this, category)));
 }
 
-this.recordsCounter = document.createElement("span");
+var statsContainer = this._statusBarFilters.createChild("div");
+statsContainer.className = "timeline-records-stats-container";
+
+this.recordsCounter = statsContainer.createChild("div");
 this.recordsCounter.className = "timeline-records-stats";
 
-this.frameStatistics = document.createElement("span");
+this.frameStatistics = statsContainer.createChild("div");
 this.frameStatistics.className = "timeline-records-stats hidden";
+
 function getAnchor()
 {
 return this.frameStatistics;
@@ -3516,7 +3852,7 @@
 _onCategoryCheckboxClicked: function(category, event)
 {
 category.hidden = !event.target.checked;
-this._invalidateAndScheduleRefresh(true);
+this._invalidateAndScheduleRefresh(true, true);
 },
 
 
@@ -3533,9 +3869,8 @@
 _registerShortcuts: function()
 {
 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, this._toggleTimelineButtonClicked.bind(this));
-if (InspectorFrontendHost.canSave())
 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, this._saveToFile.bind(this));
-this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, this._fileSelectorElement.click.bind(this._fileSelectorElement));
+this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, this._selectFileToLoad.bind(this));
 },
 
 _createFileSelector: function()
@@ -3543,37 +3878,40 @@
 if (this._fileSelectorElement)
 this.element.removeChild(this._fileSelectorElement);
 
-var fileSelectorElement = document.createElement("input");
-fileSelectorElement.type = "file";
-fileSelectorElement.style.zIndex = -1;
-fileSelectorElement.style.position = "absolute";
-fileSelectorElement.onchange = this._loadFromFile.bind(this);
-this.element.appendChild(fileSelectorElement);
-this._fileSelectorElement = fileSelectorElement;
+this._fileSelectorElement = WebInspector.createFileSelectorElement(this._loadFromFile.bind(this));
+this.element.appendChild(this._fileSelectorElement);
 },
 
 _contextMenu: function(event)
 {
 var contextMenu = new WebInspector.ContextMenu(event);
-if (InspectorFrontendHost.canSave())
-contextMenu.appendItem(WebInspector.UIString("Save Timeline data\u2026"), this._saveToFile.bind(this), this._operationInProgress);
-contextMenu.appendItem(WebInspector.UIString("Load Timeline data\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement), this._operationInProgress);
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save Timeline data\u2026" : "Save Timeline Data\u2026"), this._saveToFile.bind(this), this._operationInProgress);
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Load Timeline data\u2026" : "Load Timeline Data\u2026"), this._selectFileToLoad.bind(this), this._operationInProgress);
 contextMenu.show();
 },
 
-_saveToFile: function()
+
+_saveToFile: function(event)
 {
 if (this._operationInProgress)
-return;
+return true;
 this._model.saveToFile();
+return true;
 },
 
-_loadFromFile: function()
+
+_selectFileToLoad: function(event) {
+this._fileSelectorElement.click();
+return true;
+},
+
+
+_loadFromFile: function(file)
 {
 var progressIndicator = this._prepareToLoadTimeline();
 if (!progressIndicator)
 return;
-this._model.loadFromFile(this._fileSelectorElement.files[0], progressIndicator);
+this._model.loadFromFile(file, progressIndicator);
 this._createFileSelector();
 },
 
@@ -3638,9 +3976,10 @@
 this._timelineGrid.removeEventDividers();
 var clientWidth = this._graphRowsElementWidth;
 var dividers = [];
+var eventDividerRecords = this._presentationModel.eventDividerRecords();
 
-for (var i = 0; i < this._timeStampRecords.length; ++i) {
-var record = this._timeStampRecords[i];
+for (var i = 0; i < eventDividerRecords.length; ++i) {
+var record = eventDividerRecords[i];
 var positions = this._calculator.computeBarGraphWindowPosition(record);
 var dividerPosition = Math.round(positions.left);
 if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers[dividerPosition])
@@ -3745,20 +4084,21 @@
 }
 },
 
+
 _toggleTimelineButtonClicked: function()
 {
 if (this._operationInProgress)
-return;
+return true;
 if (this.toggleTimelineButton.toggled) {
 this._model.stopRecord();
 this.toggleTimelineButton.title = WebInspector.UIString("Record");
-}
-else {
-this._model.startRecord();
+} else {
+this._model.startRecord(this._includeDomCounters, this._includeNativeMemoryStatistics);
 this.toggleTimelineButton.title = WebInspector.UIString("Stop");
 WebInspector.userMetrics.TimelineStarted.record();
 }
 this.toggleTimelineButton.toggled = !this.toggleTimelineButton.toggled;
+return true;
 },
 
 _durationFilterChanged: function()
@@ -3766,14 +4106,13 @@
 var option = this._durationFilterSelector.selectedOption();
 var minimumRecordDuration = +option._durationMs / 1000.0;
 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration);
-this._overviewPane.setMinimumRecordDuration(minimumRecordDuration);
 this._durationFilterSelector.element.title = option.title;
-this._invalidateAndScheduleRefresh(true);
+this._invalidateAndScheduleRefresh(true, true);
 },
 
 _garbageCollectButtonClicked: function()
 {
-ProfilerAgent.collectGarbage();
+HeapProfilerAgent.collectGarbage();
 },
 
 _glueParentButtonClicked: function()
@@ -3792,13 +4131,13 @@
 var records = this._model.records;
 for (var i = 0; i < records.length; ++i)
 this._innerAddRecordToTimeline(records[i]);
-this._invalidateAndScheduleRefresh(false);
+this._invalidateAndScheduleRefresh(false, true);
 },
 
 _onTimelineEventRecorded: function(event)
 {
 if (this._innerAddRecordToTimeline(event.data))
-this._invalidateAndScheduleRefresh(false);
+this._invalidateAndScheduleRefresh(false, false);
 },
 
 _innerAddRecordToTimeline: function(record)
@@ -3812,16 +4151,13 @@
 
 var records = this._presentationModel.addRecord(record);
 this._allRecordsCount += records.length;
-var timeStampRecords = this._timeStampRecords;
 var hasVisibleRecords = false;
 var presentationModel = this._presentationModel;
-function processRecord(record)
+function checkVisible(record)
 {
-if (WebInspector.TimelinePresentationModel.isEventDivider(record))
-timeStampRecords.push(record);
 hasVisibleRecords |= presentationModel.isVisible(record);
 }
-WebInspector.TimelinePresentationModel.forAllRecords(records, processRecord);
+WebInspector.TimelinePresentationModel.forAllRecords(records, checkVisible);
 
 function isAdoptedRecord(record)
 {
@@ -3850,7 +4186,7 @@
 _resize: function(sidebarWidth)
 {
 this._closeRecordDetails();
-this._scheduleRefresh(false);
+this._scheduleRefresh(false, true);
 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth;
 this._containerElementHeight = this._containerElement.clientHeight;
 var lastItemElement = this._statusBarItems[this._statusBarItems.length - 1].element;
@@ -3867,13 +4203,12 @@
 _onRecordsCleared: function()
 {
 this._resetPanel();
-this._invalidateAndScheduleRefresh(true);
+this._invalidateAndScheduleRefresh(true, true);
 },
 
 _resetPanel: function()
 {
 this._presentationModel.reset();
-this._timeStampRecords = [];
 this._boundariesAreValid = false;
 this._adjustScrollPosition(0);
 this._closeRecordDetails();
@@ -3910,18 +4245,19 @@
 this._scrollTop = this._containerElement.scrollTop;
 var dividersTop = Math.max(0, this._scrollTop);
 this._timelineGrid.setScrollAndDividerTop(this._scrollTop, dividersTop);
-this._scheduleRefresh(true);
+this._scheduleRefresh(true, true);
 },
 
-_invalidateAndScheduleRefresh: function(preserveBoundaries)
+
+_invalidateAndScheduleRefresh: function(preserveBoundaries, userGesture)
 {
 this._presentationModel.invalidateFilteredRecords();
 delete this._searchResults;
-this._scheduleRefresh(preserveBoundaries);
+this._scheduleRefresh(preserveBoundaries, userGesture);
 },
 
 
-_scheduleRefresh: function(preserveBoundaries)
+_scheduleRefresh: function(preserveBoundaries, userGesture)
 {
 this._closeRecordDetails();
 this._boundariesAreValid &= preserveBoundaries;
@@ -3929,7 +4265,7 @@
 if (!this.isShowing())
 return;
 
-if (preserveBoundaries)
+if (preserveBoundaries || userGesture)
 this._refresh();
 else {
 if (!this._refreshTimeout)
@@ -3944,7 +4280,7 @@
 delete this._refreshTimeout;
 }
 
-this._timelinePaddingLeft = !this._overviewPane.windowLeft() ? this._expandOffset : 0;
+this._timelinePaddingLeft = this._expandOffset;
 this._calculator.setWindow(this._overviewPane.windowStartTime(), this._overviewPane.windowEndTime());
 this._calculator.setDisplayWindow(this._timelinePaddingLeft, this._graphRowsElementWidth);
 
@@ -3999,13 +4335,14 @@
 _revealRecord: function(recordToReveal)
 {
 
+this._recordToHighlight = recordToReveal;
 var treeUpdated = false;
 for (var parent = recordToReveal.parent; parent !== this._rootRecord(); parent = parent.parent) {
 treeUpdated = treeUpdated || parent.collapsed;
 parent.collapsed = false;
 }
 if (treeUpdated)
-this._invalidateAndScheduleRefresh(true);
+this._invalidateAndScheduleRefresh(true, true);
 
 var recordsInWindow = this._presentationModel.filteredRecords();
 var index = recordsInWindow.indexOf(recordToReveal);
@@ -4036,9 +4373,8 @@
 }
 
 
-const top = (startIndex * rowHeight) + "px";
-this._topGapElement.style.height = top;
-this.sidebarElement.style.top = top;
+this._topGapElement.style.height = (startIndex * rowHeight) + "px";
+this.sidebarTreeElement.style.height = ((startIndex + this._headerLineCount) * rowHeight) + "px";
 this._bottomGapElement.style.height = (recordsInWindow.length - endIndex) * rowHeight + "px";
 
 
@@ -4046,10 +4382,14 @@
 var width = this._graphRowsElementWidth;
 this._itemsGraphsElement.removeChild(this._graphRowsElement);
 var graphRowElement = this._graphRowsElement.firstChild;
-var scheduleRefreshCallback = this._invalidateAndScheduleRefresh.bind(this, true);
+var scheduleRefreshCallback = this._invalidateAndScheduleRefresh.bind(this, true, true);
 this._itemsGraphsElement.removeChild(this._expandElements);
 this._expandElements.removeChildren();
 
+this._clearRecordHighlight();
+var highlightedRecord = this._recordToHighlight;
+delete this._recordToHighlight;
+
 for (var i = 0; i < endIndex; ++i) {
 var record = recordsInWindow[i];
 var isEven = !(i % 2);
@@ -4071,6 +4411,11 @@
 this._graphRowsElement.appendChild(graphRowElement);
 }
 
+if (highlightedRecord === record) {
+this._highlightedListRowElement = listRowElement;
+this._highlightedGraphRowElement = graphRowElement;
+}
+
 listRowElement.row.update(record, isEven, visibleTop);
 graphRowElement.row.update(record, isEven, this._calculator, this._expandOffset, i);
 
@@ -4096,9 +4441,24 @@
 this._adjustScrollPosition((recordsInWindow.length + this._headerLineCount) * rowHeight);
 this._updateSearchHighlight(false);
 
+if (this._highlightedListRowElement) {
+this._highlightedListRowElement.addStyleClass("highlighted-timeline-record");
+this._highlightedGraphRowElement.addStyleClass("highlighted-timeline-record");
+}
+
 return recordsInWindow.length;
 },
 
+_clearRecordHighlight: function()
+{
+if (!this._highlightedListRowElement)
+return;
+this._highlightedListRowElement.removeStyleClass("highlighted-timeline-record");
+delete this._highlightedListRowElement;
+this._highlightedGraphRowElement.removeStyleClass("highlighted-timeline-record");
+delete this._highlightedGraphRowElement;
+},
+
 _refreshMainThreadBars: function()
 {
 const barOffset = 3;
@@ -4128,11 +4488,10 @@
 var lastLeft;
 var lastRight;
 
-while (taskIndex < tasks.length) {
+for (; taskIndex < tasks.length; ++taskIndex) {
 var task = tasks[taskIndex];
 if (task.startTime > endTime)
 break;
-taskIndex++;
 
 var left = Math.max(0, this._calculator.computePosition(task.startTime) + barOffset - widthAdjustment);
 var right = Math.min(width, this._calculator.computePosition(task.endTime) + barOffset + widthAdjustment);
@@ -4197,32 +4556,39 @@
 
 _mouseOut: function(e)
 {
-this._hideRectHighlight();
+this._hideQuadHighlight();
 },
 
+
 _mouseMove: function(e)
 {
 var anchor = this._getPopoverAnchor(e.target);
 
-const recordType = WebInspector.TimelineModel.RecordType;
-if (anchor && anchor.row && (anchor.row._record.type === recordType.Paint || anchor.row._record.type === recordType.Layout))
-this._highlightRect(anchor.row._record);
+if (anchor && anchor.row && anchor.row._record.highlightQuad)
+this._highlightQuad(anchor.row._record.highlightQuad);
 else
-this._hideRectHighlight();
+this._hideQuadHighlight();
+
+if (anchor && anchor._tasksInfo) {
+var offset = anchor.offsetLeft;
+this._timelineGrid.showCurtains(offset >= 0 ? offset : 0, anchor.offsetWidth);
+} else
+this._timelineGrid.hideCurtains();
 },
 
-_highlightRect: function(record)
+
+_highlightQuad: function(quad)
 {
-if (this._highlightedRect === record.data)
+if (this._highlightedQuad === quad)
 return;
-this._highlightedRect = record.data;
-DOMAgent.highlightRect(this._highlightedRect.x, this._highlightedRect.y, this._highlightedRect.width, this._highlightedRect.height, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA());
+this._highlightedQuad = quad;
+DOMAgent.highlightQuad(quad, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA());
 },
 
-_hideRectHighlight: function()
+_hideQuadHighlight: function()
 {
-if (this._highlightedRect) {
-delete this._highlightedRect;
+if (this._highlightedQuad) {
+delete this._highlightedQuad;
 DOMAgent.hideHighlight();
 }
 },
@@ -4237,7 +4603,7 @@
 if (anchor.row && anchor.row._record)
 anchor.row._record.generatePopupContent(showCallback);
 else if (anchor._tasksInfo)
-popover.show(this._presentationModel.generateMainThreadBarPopupContent(anchor._tasksInfo), anchor);
+popover.show(this._presentationModel.generateMainThreadBarPopupContent(anchor._tasksInfo), anchor, null, null, WebInspector.Popover.Orientation.Bottom);
 }
 
 function showCallback(popupContent)
@@ -4328,7 +4694,8 @@
 this._highlightSelectedSearchResult(revealRecord);
 },
 
-_updateSearchResults: function() {
+_updateSearchResults: function()
+{
 var searchRegExp = this._searchRegExp;
 if (!searchRegExp)
 return;
@@ -4382,7 +4749,7 @@
 this._searchFilter = new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(searchQuery, "i"));
 this._presentationModel.addFilter(this._searchFilter);
 }
-this._invalidateAndScheduleRefresh(true);
+this._invalidateAndScheduleRefresh(true, true);
 },
 
 performSearch: function(searchQuery)
@@ -4415,7 +4782,7 @@
 var start = (record.startTime - this._minimumBoundary) / this.boundarySpan() * 100;
 var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100;
 var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100;
-var cpuWidth = record.cpuTime / this.boundarySpan() * 100;
+var cpuWidth = record.coalesced ? endWithChildren - start : record.cpuTime / this.boundarySpan() * 100;
 return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth};
 },
 
@@ -4466,6 +4833,11 @@
 return this._minimumBoundary;
 },
 
+zeroTime: function()
+{
+return this._model.minimumRecordTime();
+},
+
 boundarySpan: function()
 {
 return this._maximumBoundary - this._minimumBoundary;
@@ -4510,6 +4882,8 @@
 this.element.addStyleClass("warning");
 else if (record.childHasWarning)
 this.element.addStyleClass("child-warning");
+if (record.isBackground)
+this.element.addStyleClass("background");
 
 this._typeElement.textContent = record.title;
 
@@ -4577,7 +4951,12 @@
 update: function(record, isEven, calculator, expandOffset, index)
 {
 this._record = record;
-this.element.className = "timeline-graph-side timeline-category-" + record.category.name + (isEven ? " even" : "");
+this.element.className = "timeline-graph-side timeline-category-" + record.category.name;
+if (isEven)
+this.element.addStyleClass("even");
+if (record.isBackground)
+this.element.addStyleClass("background");
+
 var barPosition = calculator.computeBarGraphWindowPosition(record);
 this._barWithChildrenElement.style.left = barPosition.left + "px";
 this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px";
@@ -4591,7 +4970,7 @@
 _onClick: function(event)
 {
 this._record.collapsed = !this._record.collapsed;
-this._scheduleRefresh(false);
+this._scheduleRefresh(false, true);
 },
 
 dispose: function()
diff --git a/resources/inspector/auditsPanel.css b/resources/inspector/auditsPanel.css
index 430c4d3..83889a6 100644
--- a/resources/inspector/auditsPanel.css
+++ b/resources/inspector/auditsPanel.css
@@ -63,13 +63,14 @@
     bottom: 0;
     padding: 0 0 0 16px;
     white-space: nowrap;
-    display: -webkit-box;
+    display: -webkit-flex;
     text-align: left;
-    -webkit-box-orient: vertical;
+    -webkit-flex-direction: column;
 }
 
 .audit-launcher-view h1 {
     padding-top: 15px;
+    -webkit-flex: none;
 }
 
 .audit-launcher-view h1.no-audits {
@@ -80,10 +81,13 @@
 }
 
 .audit-launcher-view div.button-container {
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
     width: 100%;
     padding: 16px 0;
+    -webkit-flex: none;
+}
+
+.audit-launcher-view div.button-container > button {
+    -webkit-align-self: flex-start;
 }
 
 .audit-launcher-view fieldset.audit-categories-container {
@@ -93,6 +97,7 @@
     width: 100%;
     overflow-y: auto;
     border: 0 none;
+    -webkit-flex: none;
 }
 
 .audit-launcher-view button {
@@ -107,6 +112,7 @@
 .panel-enabler-view.audit-launcher-view label {
     padding: 0 0 5px 0;
     margin: 0;
+    -webkit-flex: none;
 }
 
 .panel-enabler-view.audit-launcher-view label.disabled {
@@ -144,17 +150,37 @@
 }
 
 .audit-result-tree li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
     float: left;
     width: 8px;
-    height: 8px;
-    margin-top: 1px;
-    padding-right: 2px;
+    height: 10px;
+    content: "a";
+    color: transparent;
+    margin-left: 3px;
+    margin-right: 4px;
+    position: relative;
+    top: 1px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.audit-result-tree li.parent::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.audit-result-tree li.parent::before {
+    background-position: -4px -96px;
+}
+
+.audit-result-tree li.parent.expanded::before {
+    background-position: -20px -96px;
 }
 
 .audit-result-tree {
-    font-size: 11px;
-    line-height: 14px;
+    line-height: 16px;
     -webkit-user-select: text;
 }
 
@@ -162,7 +188,6 @@
     position: relative;
     padding: 2px 6px !important;
     margin: 0;
-    color: rgb(84, 84, 84);
     cursor: default;
     min-width: 100%;
 }
@@ -197,19 +222,6 @@
     margin-left: -12px
 }
 
-.audit-result-tree li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 0;
-    padding-right: 2px;
-}
-
-.audit-result-tree li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
 .audit-result-tree ol.children {
     display: none;
 }
@@ -220,7 +232,6 @@
 
 .audit-result {
     font-weight: bold;
-    color: black;
 }
 
 .audit-result img {
diff --git a/resources/inspector/breadcrumbList.css b/resources/inspector/breadcrumbList.css
index 6b0818b..729c134 100644
--- a/resources/inspector/breadcrumbList.css
+++ b/resources/inspector/breadcrumbList.css
@@ -44,8 +44,8 @@
     height: 24px;
     border-width: 0 12px 0 2px;
     -webkit-border-image: url(Images/segment.png) 0 12 0 2;
-    margin-right: -12px;
-    padding-left: 18px;
+    margin-right: -3px;
+    padding-left: 6px;
     padding-right: 2px;
     white-space: nowrap;
     line-height: 23px;
@@ -77,8 +77,8 @@
 
 .crumbs .crumb.selected {
     -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
-    color: black;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    color: white;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0;
 }
 
 .crumbs .crumb.selected:hover {
@@ -91,7 +91,7 @@
 
 .crumbs .crumb:hover {
     -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
-    color: black;
+    color: #222;
 }
 
 .crumbs .crumb.end:hover {
diff --git a/resources/inspector/breakpointsList.css b/resources/inspector/breakpointsList.css
new file mode 100644
index 0000000..78edf83
--- /dev/null
+++ b/resources/inspector/breakpointsList.css
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.sidebar-pane > .body .breakpoint-condition {
+    display: block;
+    margin-top: 4px;
+    margin-bottom: 4px;
+    margin-left: 23px;
+    margin-right: 8px;
+}
+
+#breakpoint-condition-input {
+    display: block;
+    margin-left: 0;
+    margin-right: 0;
+    outline: none !important;
+    border: 1px solid rgb(66%, 66%, 66%);
+}
+
+ol.breakpoint-list {
+    -webkit-padding-start: 0;
+    list-style: none;
+    margin: 0;
+}
+
+.breakpoints-list-deactivated {
+    background-color: rgb(245, 245, 245);
+    opacity: 0.3;
+}
+
+.breakpoint-list li {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    padding: 2px 0;
+}
+
+.breakpoint-list li:hover {
+    background-color: rgba(56, 121, 217, 0.2);
+}
+
+.breakpoint-list .checkbox-elem {
+    font-size: 10px;
+    margin: 0 4px;
+    vertical-align: top;
+    position: relative;
+    z-index: 1;
+    top: 3px;
+}
+
+.breakpoint-list .source-text {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    margin: 2px 0 0px 20px;
+}
+
+.sidebar-pane .breakpoint-hit {
+    background-color: rgb(255, 255, 194);
+}
+
+li.breakpoint-hit .breakpoint-hit-marker {
+    background-color: rgb(255, 255, 194);
+    height: 18px;
+    left: 0px;
+    margin-top: -16px;
+    position: absolute;
+    right: 0px;
+    z-index: -1;
+}
+
+.event-listener-breakpoints.properties-tree .children li {
+    margin-left: 12px;
+    height: 16px;
+}
+
+.event-listener-breakpoints .checkbox-elem {
+    float: left;
+    top: -2px;
+    position: relative;
+    left: -1px;
+    font-size: 10px;
+}
diff --git a/resources/inspector/buildSystemOnly.js b/resources/inspector/buildSystemOnly.js
new file mode 100644
index 0000000..7be07f7
--- /dev/null
+++ b/resources/inspector/buildSystemOnly.js
@@ -0,0 +1,7 @@
+/**
+ * This flag notifies inspector that it was deployed with the help
+ * of a build system. Build system flattenes all css and js files,
+ * so in this case inspector has to correct paths for dynamic resource loading.
+ */
+window.flattenImports = true;
+window.DEBUG = false;
\ No newline at end of file
diff --git a/resources/inspector/canvasProfiler.css b/resources/inspector/canvasProfiler.css
index b903dfa..fca5e04 100644
--- a/resources/inspector/canvasProfiler.css
+++ b/resources/inspector/canvasProfiler.css
@@ -41,11 +41,11 @@
     text-align: center;
     background-color: black;
     overflow: hidden;
-    padding: 5px;
+    padding: 5px 5px 10px 5px;
     color: white;
 }
 
-#canvas-replay-image {
+.canvas-replay-image {
     zoom: 100;
     height: auto;
     width: auto;
@@ -55,11 +55,48 @@
     display: block;
 }
 
-#canvas-replay-image.wait {
-    content: url(Images/spinnerActiveSelected.gif);
-    zoom: inherit;
+.canvas-debug-info {
     position: absolute;
-    top: 50%;
-    left: 50%;
-    margin: -16px 0 0 -16px;
+    left: 0;
+    right: 0;
+    bottom: 6px;
+}
+
+.canvas-spinner-icon {
+    content: url(Images/spinnerActiveSelected.gif);
+    position: absolute;
+    width: 16px;
+    right: 4px;
+    bottom: 4px;
+}
+
+.canvas-replay-log {
+    position: absolute;
+    top: 24px;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.canvas-replay-first-step .glyph {
+    -webkit-mask-position: 0 -72px;
+    -webkit-transform: rotate(180deg);
+    top: 0;
+    bottom: 0;
+}
+.canvas-replay-next-step .glyph {
+    -webkit-mask-position: -64px -72px;
+}
+.canvas-replay-prev-step .glyph {
+    -webkit-mask-position: -96px -72px;
+}
+.canvas-replay-last-step .glyph {
+    -webkit-mask-position: 0 -72px;
+}
+.canvas-replay-prev-draw .glyph {
+    -webkit-mask-position: -128px -72px;
+    -webkit-transform: scaleX(-1);
+}
+.canvas-replay-next-draw .glyph {
+    -webkit-mask-position: -128px -72px;
 }
diff --git a/resources/inspector/cmdevtools.css b/resources/inspector/cmdevtools.css
index 62d7f58..7026b63 100644
--- a/resources/inspector/cmdevtools.css
+++ b/resources/inspector/cmdevtools.css
@@ -1,10 +1,32 @@
+.CodeMirror * {
+  -webkit-box-sizing: content-box;
+}
+
 .CodeMirror {
   line-height: 1.2em !important;
   height: 100% !important;
+  background-color: transparent !important;
 }
 
+.CodeMirror .source-frame-eval-expression {
+  outline: 0px;
+  border: 1px solid rgb(163, 41, 34);
+  border-left-width: 0px;
+  border-right-width: 0px;
+}
+
+.CodeMirror .source-frame-eval-expression-end {
+  border-right-width: 1px;
+  margin-right: -1px;
+}
+
+.CodeMirror .source-frame-eval-expression-start {
+  border-left-width: 1px;
+  margin-left: -1px;
+}
+
+
 .CodeMirror-linenumber {
-  padding-top: 1px !important;
   min-width: 22px !important;
 }
 
@@ -15,26 +37,72 @@
     from {background-color: rgb(255, 255, 120); }
     to { background-color: white; }
 }
-.cm-breakpoint {
+
+.cm-breakpoint .CodeMirror-linenumber {
   color: white;
-  position: absolute;
-  right: 3px;
-  margin: 0 -8px 0 -6px !important;
-  border-width: 0 8px 0px 2px !important;
-  -webkit-border-image: url(Images/breakpointBorder.png) 1 14 1 2;
-  padding: 0 0 1px 100px;
+  border-width: 1px 4px 1px 1px !important;
+  -webkit-border-image: url(Images/breakpoint2.png) 1 4 1 1;
+  margin: 0px 0px 0px 3px !important;
+  padding-right: 3px;
+  padding-left: 1px;
+  height: 10px;
+  line-height: 11px !important;
 }
-.cm-breakpoint-disabled {
+
+.cm-breakpoint.cm-breakpoint-conditional .CodeMirror-linenumber {
+  -webkit-border-image: url(Images/breakpointConditional2.png) 1 4 1 1;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+  .cm-breakpoint .CodeMirror-linenumber {
+    -webkit-border-image: url(Images/breakpoint2_2x.png) 2 8 2 2;
+  }
+  .cm-breakpoint.cm-breakpoint-conditional .CodeMirror-linenumber {
+    -webkit-border-image: url(Images/breakpointConditional2_2x.png) 2 8 2 2;
+  }
+}
+
+.cm-breakpoint-disabled .CodeMirror-linenumber {
   opacity: 0.5;
 }
-.cm-breakpoint-conditional {
-  -webkit-border-image: url(Images/breakpointConditionalBorder.png) 1 14 1 2;
+
+.CodeMirror-matchingbracket {
+  border-bottom: 1px solid black;
+  color: #222 !important;
 }
+
+.CodeMirror-nonmatchingbracket {
+  color: #222 !important;
+}
+
 .cm-execution-line {
     background-color: rgb(171, 191, 254) !important;
     outline: 1px solid rgb(64, 115, 244);
 }
 
+.cm-execution-line .CodeMirror-linenumber {
+    border-right: 1px solid rgb(64, 115, 244);
+}
+
+.cm-token-highlight {
+    position: relative;
+}
+
+.cm-token-highlight:before {
+    position: absolute;
+    border: 1px solid gray;
+    border-radius: 3px;
+    top: 0px;
+    bottom: 0px;
+    left: 0px;
+    right: 0px;
+    content: "";
+}
+
+.cm-line-with-selection .cm-column-with-selection:before {
+    border: 0px;
+}
+
 .cm-s-web-inspector-js span.cm-keyword {color: rgb(170, 13, 145);}
 .cm-s-web-inspector-js span.cm-number {color: rgb(28, 0, 207);}
 .cm-s-web-inspector-js span.cm-comment {color: rgb(0, 116, 0);}
@@ -50,6 +118,7 @@
 .cm-s-web-inspector-css span.cm-string-2 {color: rgb(7, 144, 154);}
 .cm-s-web-inspector-css span.cm-link {color: rgb(7, 144, 154);}
 .cm-s-web-inspector-css span.cm-variable {color: rgb(200, 0, 0);}
+.cm-s-web-inspector-css span.cm-property {color: rgb(200, 0, 0);}
 
 .cm-s-web-inspector-html span.cm-meta {color: rgb(192, 192, 192);}
 .cm-s-web-inspector-html span.cm-comment {color: rgb(35, 110, 37);}
diff --git a/resources/inspector/codemirror.css b/resources/inspector/codemirror.css
index f9ff050..0934a14 100644
--- a/resources/inspector/codemirror.css
+++ b/resources/inspector/codemirror.css
@@ -39,26 +39,22 @@
 
 /* CURSOR */
 
-.CodeMirror pre.CodeMirror-cursor {
+.CodeMirror div.CodeMirror-cursor {
   border-left: 1px solid black;
+  z-index: 3;
 }
 /* Shown when moving in bi-directional text */
-.CodeMirror pre.CodeMirror-secondarycursor {
+.CodeMirror div.CodeMirror-secondarycursor {
   border-left: 1px solid silver;
 }
-.cm-keymap-fat-cursor pre.CodeMirror-cursor {
+.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
   width: auto;
   border: 0;
-  background: transparent;
-  background: rgba(0, 200, 0, .4);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
-}
-/* Kludge to turn off filter in ie9+, which also accepts rgba */
-.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+  background: #7e7;
+  z-index: 1;
 }
 /* Can style cursor different in overwrite (non-insert) mode */
-.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
+.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
 
 /* DEFAULT THEME */
 
@@ -66,11 +62,11 @@
 .cm-s-default .cm-atom {color: #219;}
 .cm-s-default .cm-number {color: #164;}
 .cm-s-default .cm-def {color: #00f;}
-.cm-s-default .cm-variable {color: black;}
+.cm-s-default .cm-variable {color: #222;}
 .cm-s-default .cm-variable-2 {color: #05a;}
 .cm-s-default .cm-variable-3 {color: #085;}
-.cm-s-default .cm-property {color: black;}
-.cm-s-default .cm-operator {color: black;}
+.cm-s-default .cm-property {color: #222;}
+.cm-s-default .cm-operator {color: #222;}
 .cm-s-default .cm-comment {color: #a50;}
 .cm-s-default .cm-string {color: #a11;}
 .cm-s-default .cm-string-2 {color: #f50;}
@@ -90,7 +86,6 @@
 .cm-positive {color: #292;}
 .cm-header, .cm-strong {font-weight: bold;}
 .cm-em {font-style: italic;}
-.cm-emstrong {font-style: italic; font-weight: bold;}
 .cm-link {text-decoration: underline;}
 
 .cm-invalidchar {color: #f00;}
@@ -107,6 +102,8 @@
   line-height: 1;
   position: relative;
   overflow: hidden;
+  background: white;
+  color: #222;
 }
 
 .CodeMirror-scroll {
@@ -148,6 +145,7 @@
 .CodeMirror-gutters {
   position: absolute; left: 0; top: 0;
   height: 100%;
+  padding-bottom: 30px;
   z-index: 3;
 }
 .CodeMirror-gutter {
@@ -196,6 +194,11 @@
 .CodeMirror-linewidget {
   position: relative;
   z-index: 2;
+  overflow: auto;
+}
+
+.CodeMirror-widget {
+  display: inline-block;
 }
 
 .CodeMirror-wrap .CodeMirror-scroll {
@@ -210,13 +213,13 @@
 }
 .CodeMirror-measure pre { position: static; }
 
-.CodeMirror pre.CodeMirror-cursor {
+.CodeMirror div.CodeMirror-cursor {
   position: absolute;
   visibility: hidden;
   border-right: none;
   width: 0;
 }
-.CodeMirror-focused pre.CodeMirror-cursor {
+.CodeMirror-focused div.CodeMirror-cursor {
   visibility: visible;
 }
 
@@ -233,7 +236,7 @@
 
 @media print {
   /* Hide the cursor when printing */
-  .CodeMirror pre.CodeMirror-cursor {
+  .CodeMirror div.CodeMirror-cursor {
     visibility: hidden;
   }
 }
diff --git a/resources/inspector/cssNamedFlows.css b/resources/inspector/cssNamedFlows.css
index d090b2e..f3387d5 100644
--- a/resources/inspector/cssNamedFlows.css
+++ b/resources/inspector/cssNamedFlows.css
@@ -27,8 +27,7 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-.css-named-flow-collections-view .split-view-sidebar-left {
-    border-right: 1px solid rgb(163, 163, 163);
+.css-named-flow-collections-view .split-view-sidebar {
     overflow-x: hidden;
 }
 
@@ -46,7 +45,7 @@
     width: 100%;
 }
 
-.css-named-flow-collections-view .split-view-sidebar-left .sidebar-content {
+.css-named-flow-collections-view .split-view-sidebar .sidebar-content {
     bottom: 0px;
     left: 0px;
     padding: 0px;
@@ -55,7 +54,7 @@
     top: 23px;
 }
 
-.css-named-flow-collections-view .split-view-sidebar-left .selection {
+.css-named-flow-collections-view .split-view-sidebar .selection {
     margin-left: -12px;
     z-index: 0;
 }
@@ -64,7 +63,7 @@
     position: relative;
 }
 
-.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before, .css-named-flow-collections-view .region-empty:before, .css-named-flow-collections-view .region-fit::before, .css-named-flow-collections-view .region-overset::before {
+.css-named-flow-collections-view .split-view-sidebar .named-flow-overflow::before, .css-named-flow-collections-view .region-empty:before, .css-named-flow-collections-view .region-fit::before, .css-named-flow-collections-view .region-overset::before {
     cursor: default;
     float: left;
     height: 10px;
@@ -75,7 +74,7 @@
     z-index: 1;
 }
 
-.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before {
+.css-named-flow-collections-view .split-view-sidebar .named-flow-overflow::before {
     content: url(Images/namedFlowOverflow.png);
     margin: 2px 3px 0px -13px;
 }
diff --git a/resources/inspector/dataGrid.css b/resources/inspector/dataGrid.css
index f44539e..ec8eac1 100644
--- a/resources/inspector/dataGrid.css
+++ b/resources/inspector/dataGrid.css
@@ -1,6 +1,8 @@
 .data-grid {
     position: relative;
     border: 1px solid #aaa;
+    font-size: 11px;
+    line-height: 120%;
 }
 
 .data-grid .highlight {
@@ -16,8 +18,6 @@
     border-spacing: 0;
     border-collapse: collapse;
     width: 100%;
-    font-size: 10px;
-    font-family: Lucida Grande, sans-serif;
 }
 
 .data-grid .data-container {
@@ -26,15 +26,23 @@
     bottom: 0;
     left: 0;
     right: 0;
-    padding-right: 14px;
     overflow-x: hidden;
     overflow-y: overlay;
 }
 
+.data-grid.inline {
+    border-right: none;
+}
+
 .data-grid.inline .data-container {
     position: static;
 }
 
+.data-grid.inline th.corner,
+.data-grid.inline td.corner {
+    display: none;
+}
+
 .data-grid th {
     text-align: left;
     background-image: url(Images/glossyHeader.png);
@@ -48,11 +56,13 @@
     white-space: nowrap;
 }
 
-.data-grid th.corner {
+.data-grid th.corner,
+.data-grid td.corner,
+.data-grid col.corner {
     width: 14px;
     padding-right: 0px;
     padding-left: 0px;
-    border-right: 0 none transparent;
+    border-right: 0 none transparent !important;
 }
 
 .data-grid tr.filler {
@@ -69,7 +79,7 @@
     position: absolute;
     left: 0;
     top: 0;
-    right: 16px;
+    right: 0;
     bottom: 0;
     height: 100%;
     border-top: 0 none transparent;
@@ -92,9 +102,9 @@
 
 .data-grid td {
     vertical-align: top;
-    height: 12px;
-    line-height: 12px;
-    padding: 2px 4px;
+    height: 16px; /* Keep in sync with .data-grid table.data @ -webkit-background-size */
+    line-height: 13px;
+    padding: 1px 4px;
     white-space: nowrap;
     overflow: hidden;
     border-right: 1px solid #aaa;
@@ -111,7 +121,7 @@
     text-overflow: clip;
 }
 
-.data-grid .centered div {
+.data-grid .center div {
     text-align: center;
 }
 
@@ -137,32 +147,38 @@
     background-image: url(Images/glossyHeaderSelectedPressed.png);
 }
 
-.data-grid th.sort-ascending > div::after {
+.data-grid th.sort-ascending > div::after,
+.data-grid th.sort-descending > div::after {
     position: absolute;
-    top: 0;
-    bottom: 0;
+    top: 1px;
     right: 0;
-    height: 12px;
-    margin-bottom: auto;
-    margin-top: auto;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
     width: 8px;
-    content: url(Images/treeUpTriangleBlack.png);
+    height: 10px;
+    content: "a";
+    color: transparent;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.data-grid th.sort-ascending > div::after,
+.data-grid th.sort-descending > div::after {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.data-grid th.sort-ascending > div::after {
+    background-position: -4px -108px;
 }
 
 .data-grid th.sort-descending > div::after {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    right: 0;
-    height: 8px;
-    margin-bottom: auto;
-    margin-top: auto;
-    width: 8px;
-    content: url(Images/treeDownTriangleBlack.png);
+    background-position: -20px -96px;
 }
 
 .data-grid button {
     line-height: 18px;
+    color: inherit;
 }
 
 body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-descending {
@@ -172,19 +188,31 @@
 }
 
 .data-grid tr.parent td.disclosure::before {
-    float: left;
-    content: url(Images/treeRightTriangleBlack.png);
-    width: 8px;
-    height: 8px;
-    margin-right: 2px;
     -webkit-user-select: none;
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+    float: left;
+    width: 8px;
+    margin-right: 2px;
+    content: "a";
+    color: transparent;
+    position: relative;
+    top: 1px;
+}
+
+.data-grid tr.parent td.disclosure::before {
+    background-color: rgb(110, 110, 110);
+    -webkit-mask-position: -4px -96px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.data-grid tr.parent td.disclosure::before {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
 }
 
 .data-grid tr.expanded td.disclosure::before {
-    content: url(Images/treeDownTriangleBlack.png);
-    width: 8px;
-    height: 8px;
-    margin-top: 1px;
+    -webkit-mask-position: -20px -96px;
 }
 
 .data-grid tr.selected {
@@ -202,11 +230,13 @@
 }
 
 .data-grid:focus tr.parent.selected td.disclosure::before {
-    content: url(Images/treeRightTriangleWhite.png);
+    background-color: white;
+    -webkit-mask-position: -4px -96px;
 }
 
 .data-grid:focus tr.expanded.selected td.disclosure::before {
-    content: url(Images/treeDownTriangleWhite.png);
+    background-color: white;
+    -webkit-mask-position: -20px -96px;
 }
 
 .data-grid tr:not(.parent) td.disclosure {
diff --git a/resources/inspector/devTools.css b/resources/inspector/devTools.css
deleted file mode 100644
index 64309b5..0000000
--- a/resources/inspector/devTools.css
+++ /dev/null
@@ -1,3581 +0,0 @@
-/* dialog.css */
-
-.dialog-glass-pane {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    z-index: 1900;
-}
-
-.dialog {
-    position: absolute;
-    
-    padding: 10px;
-    border-radius: 10px;
-    border: 1px solid gray;
-
-    -webkit-box-shadow: rgb(40,40,40) 0px 0px 50px;
-    
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-    
-    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E9E9E9), to(#CFCFCF));
-    font-size: 11px;
-    font-family: 'Lucida Grande', sans-serif;
-}
-
-.dialog-contents {
-    width: 100%;
-    height: 100%;
-
-    font-size: 11px;
-    font-family: 'Lucida Grande', sans-serif;
-}
-
-.go-to-line-dialog input {
-    font-size: 11px;
-}
-
-.go-to-line-dialog button {
-    font-size: 11px;
-    color: rgb(6, 6, 6);
-    border: 1px solid rgb(165, 165, 165);
-    background-color: rgb(237, 237, 237);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 12px;
-    -webkit-appearance: none;
-
-    padding: 3px 20px;
-    margin: 0 0 0 10px;
-}
-
-.go-to-line-dialog button:active {
-    background-color: rgb(215, 215, 215);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-/* inspector.css */
-
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-input[type="search"]:focus, input[type="text"]:focus {
-    outline: auto 5px -webkit-focus-ring-color;
-}
-
-.fill {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.hidden {
-    display: none;
-}
-
-.nowrap {
-    white-space: nowrap !important;
-}
-
-#toolbar {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    height: 26px;
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
-    padding-top: 1px;
-    padding-left: 5px;
-    border-bottom: 1px solid rgb(80, 80, 80);
-    -webkit-box-orient: horizontal;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-body.show-toolbar-icons #toolbar {
-    height: 56px;
-}
-
-body.show-toolbar-icons.dock-to-bottom #toolbar {
-    height: 34px;
-}
-
-body.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207)));
-    border-bottom: 1px solid rgb(64%, 64%, 64%);
-}
-
-body.undocked.platform-mac-leopard #toolbar,
-body.undocked.platform-mac-snowleopard #toolbar {
-    background: transparent;
-}
-
-body.dock-to-bottom #toolbar {
-    padding-top: 0;
-    border-top: 1px solid rgb(100, 100, 100);
-    cursor: ns-resize;
-}
-
-body.dock-to-bottom.port-qt #toolbar {
-    cursor: auto;
-}
-
-body.dock-to-bottom.inactive #toolbar {
-    border-top: 1px solid rgb(64%, 64%, 64%);
-}
-
-.toolbar-item {
-    margin: 0;
-    padding-right: 6px;
-    background-color: transparent;
-    border-style: none;
-    border-color: transparent;
-}
-
-body:not(.show-toolbar-icons) .toolbar-item {
-    height: 24px;
-}
-
-body.dock-to-bottom:not(.show-toolbar-icons) .toolbar-item.toggleable {
-    padding: 0 11px;
-}
-
-body.dock-to-bottom:not(.show-toolbar-icons) .toolbar-item.toggleable.toggled-on {
-    padding: 0 9px;
-}
-
-body.show-toolbar-icons .toolbar-item.toggleable {
-    padding-top: 4px;
-    padding-bottom: 4px;
-}
-
-body.show-toolbar-icons.dock-to-bottom .toolbar-item.toggleable {
-    margin: 1px 0;
-    padding-bottom: 2px;
-}
-
-.toolbar-item.toggleable.toggled-on {
-    border-width: 0 2px 0 2px;
-    padding-left: 4px;
-    padding-right: 4px;
-    -webkit-border-image: url(Images/toolbarItemSelected.png) 0 2 0 2;
-}
-
-.toolbar-icon {
-    display: none;
-    width: 32px;
-    height: 32px;
-    background-image: url(Images/toolbarIcons.png);
-    vertical-align: top;
-}
-
-body.dock-to-bottom .toolbar-icon {
-    width: 24px;
-    height: 24px;
-    vertical-align: middle;
-    background-image: url(Images/toolbarIconsSmall.png);
-}
-
-body.show-toolbar-icons .toolbar-icon {
-    display: inline-block;
-}
-
-body.dock-to-bottom .toolbar-icon.custom-toolbar-icon {
-    background-position-x: -32px;
-}
-
-.toolbar-item:active .toolbar-icon {
-    background-position-y: 32px;
-}
-
-body.dock-to-bottom .toolbar-item:active .toolbar-icon {
-    background-position-y: 24px;
-}
-
-.toolbar-label {
-    line-height: 22px;
-    font-size: 11px;
-    font-family: Lucida Grande, sans-serif;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-}
-
-body.show-toolbar-icons .toolbar-label {
-    line-height: 15px;
-}
-.toolbar-item.toggleable:active .toolbar-label {
-    text-shadow: none;
-}
-
-body.show-toolbar-icons.dock-to-bottom .toolbar-label {
-    display: inline-block;
-    margin-left: 3px;
-    top: 0;
-}
-
-body.dock-to-bottom #search-toolbar-label {
-    display: none;
-}
-
-#toolbar-controls {
-    float: right;
-    display: -webkit-box;
-    -webkit-box-align: center;
-    height: 100%;
-}
-
-#toolbar-dropdown-arrow {
-    font-size: 14px;
-    font-weight: bold;
-    border: 0;
-    background-color: transparent;
-    -webkit-border-radius: 5px;
-    text-shadow: none;
-    cursor: default;
-    margin: 0;
-    /* A line height of 0 allows precise text positioning using padding. */
-    line-height: 0;
-    padding: 11px 6px 11px;
-}
-
-#toolbar-dropdown-arrow.dropdown-visible {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(251, 251, 251, 0.9)), to(rgba(231, 231, 231, 0.9)));
-}
-
-#toolbar-dropdown-arrow:hover {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(191, 191, 191, 0.7)), to(rgba(171, 171, 171, 0.5)));
-}
-
-#toolbar-dropdown-arrow:active {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(111, 111, 111, 0.8)), to(rgba(91, 91, 91, 0.8)));
-}
-
-#toolbar-dropdown {
-    position: absolute;
-    z-index: 1000;
-    -webkit-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
-    border: 1px solid rgb(128, 128, 128);
-    background-color: inherit;
-    background-image: inherit;
-}
-
-body.show-toolbar-icons #toolbar-dropdown {
-    padding: 4px;
-}
-
-body.undocked.platform-mac-leopard #toolbar-dropdown,
-body.undocked.platform-mac-snowleopard #toolbar-dropdown {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
-}
-
-#toolbar-dropdown .scrollable-content {
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-    -webkit-box-align: start;
-    padding-right: 0;
-}
-
-#toolbar-dropdown .toolbar-item {
-    display: -webkit-box;
-    -webkit-box-orient: horizontal;
-    width: 100%;
-    border: 1px solid rgba(0, 0, 0, 0);
-}
-
-body.show-toolbar-icons #toolbar-dropdown .toolbar-item {
-    position: relative;
-    left: -2px;
-    margin: 0px 2px;
-    padding: 4px;
-}
-
-#toolbar-dropdown .toolbar-item.toggleable.toggled-on {
-    border: 1px solid rgba(100, 100, 120, 0.4);
-    -webkit-border-image: none;
-    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.6)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.2)));
-}
-
-#toolbar-dropdown .toolbar-item.toggleable:hover {
-    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.3)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.1)));
-}
-
-#toolbar-dropdown .toolbar-icon {
-    margin-right: 0.5em;
-}
-
-#toolbar-dropdown .toolbar-label {
-    line-height: 22px;
-    top: 0;
-}
-
-body.show-toolbar-icons #toolbar-dropdown .toolbar-label {
-    line-height: 32px;
-}
-
-.scrollable-content {
-    position: static;
-    height: 100%;
-    overflow-y: auto;
-    width: 100%;
-    margin-right: 12px;
-    padding-right: 3px;
-}
-
-.scrollable-content::-webkit-scrollbar {
-    width: 11px;
-}
-
-.scrollable-content::-webkit-scrollbar-corner,
-.scrollable-content::-webkit-resizer {
-    display: none;
-}
-
-.scrollable-content::-webkit-scrollbar-thumb:vertical {
-    background: -webkit-gradient(linear, left top, right top, from(rgb(192, 192, 192)), to(rgb(192, 192, 192)), color-stop(40%, rgb(214, 214, 214)));
-    border-radius: 5px;
-    min-height: 20px;
-}
-
-.scrollable-content::-webkit-scrollbar-thumb:vertical:hover,
-.scrollable-content::-webkit-scrollbar-thumb:vertical:active {
-    background: -webkit-gradient(linear, left top, right top, from(rgb(230, 230, 230)), to(rgb(230, 230, 230)), color-stop(40%, rgb(252, 252, 252)));
-}
-
-.scrollable-content::-webkit-scrollbar-track:vertical {
-    background: -webkit-gradient(linear, left top, right top, from(rgb(128, 128, 128)), to(rgb(164, 164, 164)), color-stop(25%, rgb(164, 164, 164)));
-    border-radius: 5px;
-}
-
-.search-replace {
-    -webkit-appearance: none;
-    border: 0;
-    padding: 0 2px;
-    margin: 0;
-    width: 165px;
-}
-
-.filter {
-    -webkit-appearance: none;
-    border: 0;
-    padding: 0 2px;
-    margin: 0;
-    width: 251px;
-}
-
-.search-replace:focus {
-    outline: none;
-}
-
-.toolbar-search {
-    border-spacing: 1px;
-}
-
-.toolbar-search td {
-    padding: 0 5px 0 0;
-}
-
-.toolbar-search-navigation-controls {
-    position: absolute;
-    top: 0;
-    right: 0;
-    height: 18px;
-    background-image: -webkit-linear-gradient(rgb(228, 228, 228), rgb(206, 206, 206));
-}
-
-.toolbar-search-navigation {
-    display: inline-block;
-    width: 18px;
-    height: 18px;
-    background-repeat: no-repeat;
-    background-position: 4px 7px;
-    border-left: 1px solid rgb(170, 170, 170);
-    opacity: 0.3;
-}
-
-.toolbar-search-navigation.enabled {
-    opacity: 1.0;
-}
-
-.toolbar-search input[type="checkbox"] {
-    position: relative;
-    margin-top: -1px;
-    margin-left: 15px;
-    top: 2px;
-}
-
-.toolbar-search button {
-    border: 1px solid rgb(163, 163, 163);
-    border-radius: 8px;
-    margin: 0 0px;
-    font-size: 11px;
-    background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220));
-    width: 100%;
-}
-
-.toolbar-search button:active {
-    background-image: -webkit-linear-gradient(rgb(185, 185, 185), rgb(156, 156, 156));
-}
-
-.toolbar-search-control {
-    display: inline-block;
-    position: relative;
-    background-color: white;
-    border: 1px solid rgb(163, 163, 163);
-    height: 20px;
-    border-radius: 2px;
-    padding-top: 1px;
-}
-
-.toolbar-replace-control {
-    border: 1px solid rgb(163, 163, 163);
-    height: 20px;
-    border-radius: 2px;
-    width: 100%;
-}
-
-.toolbar-search-navigation.enabled:active {
-    background-position: 4px 7px, 0px 0px;
-}
-
-.toolbar-search-navigation.toolbar-search-navigation-prev {
-    background-image: url(Images/searchPrev.png);
-    border-left: 1px solid rgb(163, 163, 163);
-}
-
-.toolbar-search-navigation.toolbar-search-navigation-prev.enabled:active {
-    background-image: url(Images/searchPrev.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
-}
-
-.toolbar-search-navigation.toolbar-search-navigation-next {
-    background-image: url(Images/searchNext.png);
-    border-left: 1px solid rgb(230, 230, 230);
-}
-
-.toolbar-search-navigation.toolbar-search-navigation-next.enabled:active {
-    background-image: url(Images/searchNext.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
-}
-
-.search-results-matches {
-    display: inline-block;
-    min-width: 50px;
-    min-height: 10px;
-    margin-right: 36px;
-    text-align: right;
-    font-size: 11px;
-    padding: 0 4px;
-    color: rgb(165, 165, 165);
-}
-
-.toolbar-item.elements .toolbar-icon {
-    background-position-x: 0;
-}
-
-.toolbar-item.resources .toolbar-icon {
-    background-position-x: -32px;
-}
-
-body.dock-to-bottom .toolbar-item.resources .toolbar-icon {
-    background-position-x: -24px;
-}
-
-.toolbar-item.network .toolbar-icon {
-    background-position-x: -64px;
-}
-
-body.dock-to-bottom .toolbar-item.network .toolbar-icon {
-    background-position-x: -48px;
-}
-
-.toolbar-item.scripts .toolbar-icon {
-    background-position-x: -96px;
-}
-
-body.dock-to-bottom .toolbar-item.scripts .toolbar-icon {
-    background-position-x: -72px;
-}
-
-.toolbar-item.timeline .toolbar-icon {
-    background-position-x: -128px;
-}
-
-body.dock-to-bottom .toolbar-item.timeline .toolbar-icon {
-    background-position-x: -96px;
-}
-
-.toolbar-item.profiles .toolbar-icon {
-    background-position-x: -160px;
-}
-
-body.dock-to-bottom .toolbar-item.profiles .toolbar-icon {
-    background-position-x: -120px;
-}
-
-.toolbar-item.audits .toolbar-icon {
-    background-position-x: -192px;
-}
-
-body.dock-to-bottom .toolbar-item.audits .toolbar-icon {
-    background-position-x: -144px;
-}
-
-.toolbar-item.console .toolbar-icon {
-    background-position-x: -224px;
-}
-
-body.dock-to-bottom .toolbar-item.console .toolbar-icon {
-    background-position-x: -168px;
-}
-
-#close-button-left, #close-button-right {
-    width: 14px;
-    height: 14px;
-    background-image: url(Images/closeButtons.png);
-    background-position: 0 0;
-}
-
-#close-button-left:hover, #close-button-right:hover {
-    background-position: 14px 0;
-}
-
-#close-button-left:active, #close-button-right:active {
-    background-position: 28px 0;
-}
-
-.close-left {
-    float: left;
-}
-
-body.undocked .toolbar-item.close-left, body.undocked .toolbar-item.close-right {
-    display: none;
-}
-
-body.dock-to-bottom.port-qt .toolbar-item.close-left, body.dock-to-bottom.port-qt .toolbar-item.close-right {
-    display: none;
-}
-
-body.platform-mac .toolbar-item.close-right {
-    display: none;
-}
-
-body.remote .toolbar-item.close-left, body.remote .toolbar-item.close-right {
-    display: none;
-}
-
-body:not(.platform-mac) .toolbar-item.close-left {
-    display: none;
-}
-
-.toolbar-item.close-left, .toolbar-item.close-right {
-  display: -webkit-box;
-  -webkit-box-align: center;
-  height: 100%;
-  cursor: default;
-}
-
-#main {
-    position: absolute;
-    z-index: 1;
-    top: 26px;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    overflow: hidden;
-    background-color: white;
-}
-
-body.show-toolbar-icons #main {
-    top: 56px;
-}
-
-body.show-toolbar-icons.dock-to-bottom #main {
-    top: 34px;
-}
-
-#main-panels {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 23px;
-    overflow: hidden;
-}
-
-body.drawer-visible #main-panels {
-    bottom: 24px;
-}
-
-#main-status-bar {
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-
-.status-bar {
-    white-space: nowrap;
-    height: 23px;
-    overflow: hidden;
-    z-index: 12;
-    background-image: -webkit-linear-gradient(rgb(253,253,253), rgb(230,230,230) 75%, rgb(230,230,230));
-    border-top: 1px solid rgb(202, 202, 202);
-    display: -webkit-flex;
-}
-
-.status-bar > div {
-    display: inline-block;
-    vertical-align: top;
-    overflow: visible;
-}
-
-.status-bar-item {
-    display: inline-block;
-    pointer-events: auto;
-    cursor: default;
-    height: 24px;
-    padding: 0;
-    margin-left: -1px;
-    margin-right: 0;
-    vertical-align: top;
-    border: 0 transparent none;
-    background-color: transparent;
-}
-
-#floating-status-bar-container {
-    position: absolute;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    display: none;
-    border-bottom: 1px solid rgb(202, 202, 202);
-    cursor: ns-resize;
-    height: 24px;
-}
-
-body.drawer-visible #floating-status-bar-container {
-    display: -webkit-flex;
-}
-
-#floating-status-bar-resizer {
-    content: url(Images/statusbarResizerVertical.png);
-    margin-top: 7px;
-    pointer-events: none;
-    height: 8px;
-}
-
-#panel-status-bar {
-    -webkit-flex: 1 0;
-    display: -webkit-flex;
-    pointer-events: none;
-}
-
-#panel-status-bar > div {
-    width: 100%;
-}
-
-.status-bar-item:active {
-    position: relative;
-    z-index: 200;
-}
-
-.glyph {
-    position: absolute;
-    top: -1px;
-    bottom: 1px;
-    left: 0;
-    right: 0;
-    background-color: rgba(0, 0, 0, 0.75);
-    z-index: 1;
-}
-
-.glyph.shadow {
-    top: 0;
-    bottom: 0;
-    background-color: white !important;
-    z-index: 0;
-}
-
-.long-click-glyph {
-    background-color: rgba(0, 0, 0, 0.75);
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
-    -webkit-mask-position: -288px -48px;
-    -webkit-mask-size: 320px 72px;
-    z-index: 1;
-}
-
-@media (-webkit-min-device-pixel-ratio: 1.5) {
-.long-click-glyph {
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
-}
-}
-
-.long-click-glyph.shadow {
-    top: 1px;
-    background-color: white !important;
-    z-index: 0;
-}
-
-button.status-bar-item {
-    position: relative;
-    width: 32px;
-    border-left: 1px solid rgb(202, 202, 202);
-    border-right: 1px solid rgb(202, 202, 202);
-}
-
-.status-bar button.status-bar-item .glyph {
-    margin: 0 -1px;
-}
-
-.status-bar select.status-bar-item:active,
-.status-bar button.status-bar-item:active {
-    background-color: rgb(163,163,163);
-    border-left: 1px solid rgb(120, 120, 120);
-    border-right: 1px solid rgb(120, 120, 120);
-}
-
-button.status-bar-item .glyph.shadow {
-    background-color: rgba(255, 255, 255, 0.33) !important;
-}
-
-button.status-bar-item.toggled-on .glyph {
-    background-color: rgb(66, 129, 235);
-}
-
-button.status-bar-item:disabled {
-    opacity: 0.5;
-    background-position: 0 0 !important;
-}
-
-button.status-bar-item.extension {
-    background-image: none;
-    background-color: auto;
-}
-
-.status-bar-select-container {
-    display: inline-block;
-    background-image: url(Images/disclosureTriangleSmallDown.png);
-    background-repeat: no-repeat;
-    background-position-x: right;
-    background-position-y: 5px;
-    padding-right: 10px;
-    border-right: 5px solid transparent;
-}
-
-select.status-bar-item {
-    min-width: 48px;
-    font-weight: bold;
-    color: rgb(48, 48, 48);
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
-    -webkit-appearance: none;
-    border: 0;
-    border-radius: 0;
-    padding: 0 15px 0 5px;
-    margin-right: -15px;
-    position: relative;
-    top: -1px;
-    height: 23px;
-}
-
-select.status-bar-item, select.status-bar-item:hover {
-    border-left: 1px solid rgb(202, 202, 202);
-    border-right: 1px solid rgb(202, 202, 202);
-}
-
-.status-bar-item > .glyph {
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
-    -webkit-mask-size: 320px 72px;
-}
-
-@media (-webkit-min-device-pixel-ratio: 1.5) {
-.status-bar-item > .glyph {
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
-}
-}
-
-button.dock-status-bar-item.status-bar-item.toggled-undock .glyph {
-    -webkit-mask-position: 0 -48px;
-}
-
-button.dock-status-bar-item.status-bar-item.toggled-bottom .glyph {
-    -webkit-mask-position: -32px -24px;
-    background-color: rgba(0, 0, 0, 0.75);
-}
-
-button.dock-status-bar-item.status-bar-item.toggled-right .glyph {
-    -webkit-mask-position: -256px -48px;
-    background-color: rgba(0, 0, 0, 0.75);
-}
-
-body.undocked .alternate-status-bar-buttons-bar {
-    margin-left: 1px;
-}
-
-.alternate-status-bar-buttons-bar {
-    position: absolute;
-    width: 31px;
-    bottom: -3px;
-    background: white;
-}
-
-.alternate-status-bar-buttons-bar .status-bar-item {
-    height: 24px;
-    margin-top: -1px;
-    border: 1px solid rgb(202, 202, 202);
-    border-bottom: 1px solid transparent;
-}
-
-.alternate-status-bar-buttons-bar .status-bar-item.emulate-active {
-    background-color: rgb(163,163,163);
-    border: 1px solid rgb(120, 120, 120);
-    border-bottom: 1px solid transparent;
-}
-
-button.status-bar-item.settings-status-bar-item,
-button.status-bar-item.settings-status-bar-item:active {
-    border-right: 0 transparent none;
-}
-
-.settings-status-bar-item .glyph {
-    -webkit-mask-position: -160px -24px;
-}
-
-body.remote .dock-status-bar-item,
-body.port-qt .dock-status-bar-item {
-    display: none;
-}
-
-.console-status-bar-item .glyph {
-    -webkit-mask-position: -64px -24px;
-}
-
-.clear-status-bar-item .glyph {
-    -webkit-mask-position: -64px 0;
-}
-
-#error-warning-count {
-    padding: 5px 2px 6px 0px;
-    font-size: 10px;
-    height: 19px;
-    cursor: pointer;
-}
-
-#error-warning-count:hover {
-    border-bottom: 1px solid rgb(96, 96, 96);
-}
-
-#error-count-img {
-    content: url(Images/errorIcon.png);
-    width: 10px;
-    height: 10px;
-    vertical-align: -1px;
-    margin-right: 2px;
-}
-
-#error-count + #warning-count-img {
-    margin-left: 6px;
-}
-
-#warning-count-img {
-    content: url(Images/warningIcon.png);
-    width: 10px;
-    height: 10px;
-    vertical-align: -1px;
-    margin-right: 2px;
-}
-
-#drawer {
-    display: none;
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    height: 200px;
-    background-color: white;
-}
-
-#drawer-contents {
-    position: absolute;
-    top: 0;
-    bottom: 24px;
-    left: 0;
-    right: 0;
-}
-
-body.drawer-visible #drawer {
-    display: block;
-}
-
-body.platform-mac .monospace, body.platform-mac .source-code {
-    font-size: 11px !important;
-    font-family: Menlo, monospace;
-}
-
-body.platform-mac.platform-mac-tiger .monospace,
-body.platform-mac.platform-mac-tiger .source-code {
-    font-size: 10px !important;
-    font-family: Monaco, monospace;
-}
-
-body.platform-windows .monospace, body.platform-windows .source-code {
-    font-size: 12px !important;
-    font-family: Consolas, Lucida Console, monospace;
-}
-
-body.platform-linux .monospace, body.platform-linux .source-code {
-    font-size: 11px !important;
-    font-family: dejavu sans mono, monospace;
-}
-
-#console-view {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    overflow-y: auto;
-}
-
-#console-messages {
-    position: absolute;
-    z-index: 0;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    padding: 2px 0;
-    overflow-y: overlay;
-    word-wrap: break-word;
-    -webkit-user-select: text;
-    -webkit-text-size-adjust: auto;
-}
-
-#console-prompt {
-    clear: right;
-    position: relative;
-    border-top: 1px solid rgb(240, 240, 240);
-    padding: 1px 22px 1px 0px;
-    margin-left: 24px;
-    min-height: 16px;
-    white-space: pre-wrap;
-    -webkit-user-modify: read-write-plaintext-only;
-}
-
-#console-prompt::before {
-    background-image: url(Images/userInputIcon.png);
-}
-
-.console-user-command-result.console-log-level::before {
-    background-image: url(Images/userInputResultIcon.png);
-}
-
-.console-message, .console-user-command {
-    clear: right;
-    position: relative;
-    border-top: 1px solid rgb(240, 240, 240);
-    padding: 1px 22px 1px 0px;
-    margin-left: 24px;
-    min-height: 16px;
-}
-
-.console-mesage:first-child {
-    border-top: none;
-}
-
-.console-adjacent-user-command-result {
-    border-bottom: none;
-}
-
-.console-adjacent-user-command-result + .console-user-command-result.console-log-level::before {
-    background-image: none;
-}
-
-.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
-    position: absolute;
-    display: block;
-    content: "";
-    left: -17px;
-    top: 0.8em;
-    width: 10px;
-    height: 10px;
-    margin-top: -6px;
-    -webkit-user-select: none;
-}
-
-.console-message .bubble {
-    display: inline-block;
-    height: 14px;
-    background-color: rgb(128, 151, 189);
-    vertical-align: middle;
-    white-space: nowrap;
-    padding: 1px 4px;
-    margin-top: -1px;
-    margin-right: 4px;
-    margin-left: -18px;
-    text-align: left;
-    font-size: 11px;
-    line-height: normal;
-    font-family: Helvetica, Arial, sans-serif;
-    font-weight: bold;
-    text-shadow: none;
-    color: white;
-    -webkit-border-radius: 7px;
-}
-
-.console-message-text {
-    white-space: pre-wrap;
-}
-
-.repeated-message.console-error-level::before, .repeated-message.console-warning-level:before, .repeated-message.console-debug-level:before {
-    visibility: hidden;
-}
-
-.repeated-message .outline-disclosure, .repeated-message > .console-message-text {
-    -webkit-flex: 1;
-}
-
-.console-info {
-    color: rgb(128, 128, 128);
-    font-style: italic;
-}
-
-.console-group .console-group > .console-group-messages {
-    margin-left: 16px;
-}
-
-.console-group-title {
-    font-weight: bold;
-}
-
-.console-group-title::before {
-    background-image: url(Images/disclosureTriangleSmallDown.png);
-    top: 0.6em;
-    width: 11px;
-    height: 12px;
-    left: -16px;
-    position: absolute;
-}
-
-.console-group.collapsed .console-group-title::before {
-    background-image: url(Images/disclosureTriangleSmallRight.png);
-}
-
-.console-group.collapsed > .console-group-messages {
-    display: none;
-}
-
-.console-group {
-    position: relative;
-}
-
-.console-group-bracket {
-    position:absolute;
-    top: 15px;
-    left: 13px;
-    bottom: 5px;
-    width: 3px;
-    border-style: solid;
-    border-color: #A3A3A3;
-    border-width: 0px 0px 1px 1px;
-}
-
-.console-group.collapsed > .console-group-bracket {
-    display: none;
-}
-
-.console-error-level .console-message-text, .console-error-level .section .header .title {
-    color: red !important;
-}
-
-.console-debug-level .console-message-text {
-    color: blue;
-}
-
-.console-debug-level::before {
-    background-image: url(Images/searchSmallBrightBlue.png);
-}
-
-.console-error-level::before {
-    background-image: url(Images/errorIcon.png);
-}
-
-.console-warning-level::before {
-    background-image: url(Images/warningIcon.png);
-    margin-top: -7px;
-}
-
-.console-user-command .console-message {
-    margin-left: -24px;
-    padding-right: 0;
-    border-bottom: none;
-}
-
-.console-user-command::before {
-    background-image: url(Images/userInputPreviousIcon.png);
-}
-
-.console-user-command > .console-message-text {
-    color: rgb(0, 128, 255);
-}
-
-#console-messages a {
-    color: rgb(33%, 33%, 33%);
-    cursor: pointer;
-}
-
-#console-messages a:hover {
-    color: rgb(15%, 15%, 15%);
-}
-
-ol.watch-expressions > li.hovered {
-    background-color: #F0F0F0;
-}
-
-.console-message-url {
-    float: right;
-    text-align: right;
-    max-width: 100%;
-    margin-left: 4px;
-}
-
-.console-group-messages .section {
-    margin: 0 0 0 12px !important;
-}
-
-.console-group-messages .section .header {
-    padding: 0 8px 0 0;
-    background-image: none;
-    border: none;
-    min-height: 0;
-}
-
-.console-group-messages .section .header::before {
-    position: absolute;
-    top: 1px;
-    left: 1px;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-.console-group-messages .section.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.console-group-messages .section .header .title {
-    color: black;
-    font-weight: normal;
-    line-height: 13px;
-}
-
-.console-group-messages .section .properties li .info {
-    padding-top: 0;
-    padding-bottom: 0;
-    color: rgb(60%, 60%, 60%);
-}
-
-.console-group-messages .outline-disclosure {
-    padding-left: 0;
-}
-
-.console-group-messages .outline-disclosure > ol {
-    padding: 0 0 0 12px !important;
-}
-
-.console-group-messages .outline-disclosure, .console-group-messages .outline-disclosure ol {
-    font-size: inherit;
-    line-height: 12px;
-}
-
-.console-group-messages .outline-disclosure.single-node li {
-    padding-left: 2px;
-}
-
-.console-group-messages .outline-disclosure li .selection {
-    margin-left: -6px;
-    margin-right: -6px;
-}
-
-.console-group-messages .add-attribute {
-    display: none;
-}
-
-.console-formatted-object, .console-formatted-node, .console-formatted-array {
-    position: relative;
-    display: inline-block;
-    vertical-align: top;
-    color: black;
-}
-
-.console-formatted-node:hover {
-    background-color: rgba(56, 121, 217, 0.1);
-}
-
-.console-formatted-object .section, .console-formatted-node .section, .console-formatted-array .section {
-    position: static;
-}
-
-.console-formatted-object .properties, .console-formatted-node .properties {
-    padding-left: 0 !important;
-}
-
-.console-formatted-number {
-    color: rgb(28, 0, 207);
-}
-
-.console-formatted-string, .console-formatted-regexp {
-    color: rgb(196, 26, 22);
-    white-space: pre;
-}
-
-.console-formatted-null, .console-formatted-undefined {
-    color: rgb(128, 128, 128);
-}
-
-.console-formatted-preview-node,
-.section .console-formatted-node {
-    color: rgb(136, 18, 128);
-}
-
-.console-object-preview {
-    font-style: italic;
-}
-
-.error-message {
-    color: red;
-}
-
-.error-input {
-    background-color: rgb(220, 130, 130);
-}
-
-.auto-complete-text, .editing .auto-complete-text {
-    color: rgb(128, 128, 128) !important;
-    -webkit-user-select: none;
-    -webkit-user-modify: read-only;
-}
-
-.panel {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.panel.visible {
-    display: block;
-}
-
-iframe.extension {
-    width: 100%;
-    height: 100%;
-}
-
-iframe.panel.extension {
-    display: block;
-    height: 100%;
-}
-
-.webkit-line-gutter-backdrop {
-    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
-    width: 31px;
-    background-color: rgb(240, 240, 240);
-    border-right: 1px solid rgb(187, 187, 187);
-    position: absolute;
-    z-index: -1;
-    left: 0;
-    top: 0;
-    height: 100%
-}
-
-.outline-disclosure li.hovered:not(.selected) .selection {
-    display: block;
-    left: 3px;
-    right: 3px;
-    background-color: rgba(56, 121, 217, 0.1);
-    -webkit-border-radius: 5px;
-}
-
-.outline-disclosure li.highlighted .highlight {
-    background-color: rgb(255, 230, 179);
-    -webkit-border-radius: 4px;
-    padding-bottom: 2px;
-    margin-bottom: -2px;
-}
-
-.outline-disclosure li.selected.highlighted .highlight {
-    background-color: transparent;
-    padding-bottom: 0;
-    margin-bottom: 0;
-}
-
-.outline-disclosure li .selection {
-    display: none;
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 15px;
-    z-index: -1;
-}
-
-.outline-disclosure li.selected .selection {
-    display: block;
-    background-color: rgb(212, 212, 212);
-}
-
-.outline-disclosure li.elements-drag-over .selection {
-    display: block;
-    margin-top: -2px;
-    border-top: 2px solid rgb(56, 121, 217);
-}
-
-.outline-disclosure ol:focus li.selected .selection {
-    background-color: rgb(56, 121, 217);
-}
-
-.outline-disclosure ol.search-match-not-found li.selected .selection {
-    border: 1px solid rgb(56, 121, 217);
-    background-color: white;
-}
-
-.outline-disclosure {
-    font-size: 11px;
-}
-
-.outline-disclosure > ol {
-    position: relative;
-    padding: 2px 6px !important;
-    margin: 0;
-    color: black;
-    cursor: default;
-    min-width: 100%;
-}
-
-.outline-disclosure, .outline-disclosure ol {
-    list-style-type: none;
-    -webkit-padding-start: 12px;
-    margin: 0;
-}
-
-.source-code {
-    font-family: monospace;
-    font-size: 10px !important;
-    white-space: pre-wrap;
-}
-
-.outline-disclosure li {
-    padding: 0 0 0 14px;
-    margin-top: 1px;
-    margin-left: -2px;
-    word-wrap: break-word;
-}
-
-.outline-disclosure ol:focus li.selected {
-    color: white;
-}
-
-.outline-disclosure ol.search-match-found li.selected {
-    color: white;
-}
-
-.outline-disclosure ol:focus li.selected * {
-    color: inherit;
-}
-
-.outline-disclosure ol.search-match-found li.selected * {
-    color: inherit;
-}
-
-.outline-disclosure li.parent {
-    margin-left: -12px
-}
-
-.outline-disclosure li .webkit-html-tag.close {
-    margin-left: -12px;
-}
-
-.webkit-html-tag.shadow, .webkit-html-fragment.shadow {
-    opacity: 0.6;
-}
-
-.outline-disclosure li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    float: left;
-    width: 8px;
-    height: 8px;
-    padding-right: 2px;
-}
-
-.outline-disclosure li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-.outline-disclosure ol:focus li.parent.selected::before {
-    content: url(Images/treeRightTriangleWhite.png);
-}
-
-.outline-disclosure ol.search-match-found li.parent.selected::before {
-    content: url(Images/treeRightTriangleWhite.png);
-}
-
-.outline-disclosure li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.outline-disclosure ol:focus li.parent.expanded.selected::before {
-    content: url(Images/treeDownTriangleWhite.png);
-}
-
-.outline-disclosure ol.search-match-found li.parent.expanded.selected::before {
-    content: url(Images/treeDownTriangleWhite.png);
-}
-
-.outline-disclosure ol.children {
-    display: none;
-}
-
-.outline-disclosure ol.children.expanded {
-    display: block;
-}
-
-.placard {
-    position: relative;
-    margin-top: 1px;
-    padding: 3px 8px 4px 18px;
-    min-height: 18px;
-    white-space: nowrap;
-}
-
-.placard:nth-of-type(2n) {
-    background-color: rgb(234, 243, 255);
-}
-
-.placard.selected {
-    border-top: 1px solid rgb(172, 172, 172);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(182, 182, 182)), to(rgb(162, 162, 162)));
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-:focus .placard.selected {
-    border-top: 1px solid rgb(70, 103, 215);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(56, 121, 217)));
-}
-
-.placard .title {
-    color: black;
-    font-weight: normal;
-    word-wrap: break-word;
-    white-space: normal;
-}
-
-.placard.selected .title {
-    color: white;
-    font-weight: bold;
-}
-
-.placard .subtitle {
-    float: right;
-    font-size: 10px;
-    margin-left: 5px;
-    color: rgba(0, 0, 0, 0.7);
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.placard.selected .subtitle {
-    color: rgba(255, 255, 255, 0.7);
-}
-
-.placard .subtitle a {
-    color: inherit;
-}
-
-.section {
-    position: relative;
-    margin-top: 1px;
-}
-
-.events-pane .section:not(:nth-of-type(1)) {
-    border-top: 1px solid rgb(191, 191, 191);
-}
-
-.section .header {
-    color: black;
-    padding: 0 8px 0 18px;
-    min-height: 18px;
-    white-space: nowrap;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-.section .header::before {
-    position: absolute;
-    top: 2px;
-    left: 7px;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeRightTriangleBlack.png);
-    opacity: 0.8;
-}
-
-.section.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.section .header .title, .event-bar .header .title {
-    font-weight: normal;
-    word-wrap: break-word;
-    white-space: normal;
-    line-height: 18px;
-}
-
-.section .header .title.blank-title {
-    font-style: italic;
-}
-
-.section .header label, .event-bar .header label {
-    display: none;
-}
-
-.section.expanded .header label, .event-bar.expanded .header label {
-    display: inline;
-}
-
-.section .header .subtitle, .event-bar .header .subtitle {
-    float: right;
-    margin-left: 5px;
-    max-width: 55%;
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.section .header .subtitle a {
-    color: inherit;
-}
-
-.section .properties, .event-bar .event-properties {
-    display: none;
-}
-
-.section.expanded .properties, .event-bar.expanded .event-properties {
-    display: block;
-    padding-left: 16px;
-}
-
-.section.no-affect .properties li {
-    opacity: 0.5;
-}
-
-.section.no-affect .properties li.editing {
-    opacity: 1.0;
-}
-
-.properties-tree {
-    margin: 0;
-    padding: 0 6px 2px;
-    list-style: none;
-    min-height: 18px;
-}
-
-.properties-tree li {
-    margin-left: 12px;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    -webkit-user-select: text;
-    cursor: default;
-}
-
-.properties-tree li.parent {
-    margin-left: 1px;
-}
-
-.properties-tree li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    opacity: 0.75;
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 0;
-    padding-right: 3px;
-    -webkit-user-select: none;
-}
-
-.properties-tree li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-    margin-top: 1px;
-}
-
-.properties-tree li .info {
-    padding-top: 4px;
-    padding-bottom: 3px;
-}
-
-.properties-tree ol {
-    display: none;
-    margin: 0;
-    -webkit-padding-start: 12px;
-    list-style: none;
-}
-
-.properties-tree ol.expanded {
-    display: block;
-}
-
-.event-listener-breakpoints .event-category {
-    font-size: 11px;
-    font-weight: bold;
-    color: rgb(96, 96, 96);
-    padding-top: 2px;
-}
-
-.event-listener-breakpoints.properties-tree .children li {
-    margin-left: 12px;
-    height: 16px;
-}
-
-.event-listener-breakpoints .checkbox-elem {
-    font-size: 10px;
-    float: left;
-    top: -2px;
-    position: relative;
-    left: -1px;
-}
-
-.editing {
-    -webkit-user-select: text;
-    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
-    outline: 1px solid rgb(66%, 66%, 66%) !important;
-    background-color: white;
-    -webkit-user-modify: read-write-plaintext-only;
-    text-overflow: clip !important;
-    padding-left: 2px;
-    margin-left: -2px;
-    padding-right: 2px;
-    margin-right: -2px;
-    margin-bottom: -1px;
-    padding-bottom: 1px;
-    opacity: 1.0 !important;
-}
-
-.editing, .editing * {
-    color: black !important;
-    text-decoration: none !important;
-}
-
-.child-editing {
-    color: black !important;
-    text-decoration: none !important;
-    overflow: visible !important;
-}
-
-.editing br {
-    display: none;
-}
-
-.section .properties li.editing {
-    margin-left: 10px;
-    text-overflow: clip;
-}
-
-li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-button {
-    display: none !important;
-}
-
-.properties-tree.watch-expressions {
-    padding-bottom: 8px;
-    padding-left: 4px !important;
-}
-
-.properties-tree.watch-expressions > li {
-    padding-top: 2px;
-    padding-left: 4px;
-}
-
-.properties-tree.watch-expressions > li > .value {
-    display: inline;
-    position: static;
-}
-
-.properties-tree.watch-expressions > li:not(.parent) {
-    margin-left: 1px;
-    padding-left: 15px;
-}
-
-.properties-tree.watch-expressions > li.hovered {
-    padding-right: 14px;
-}
-
-.watch-expressions > li.editing-sub-part .text-prompt {
-    display: block;
-    width: 100%;
-}
-
-.watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator  {
-    display: none;
-}
-
-.section .properties li.editing-sub-part {
-    padding: 3px 6px 8px 18px;
-    margin: -3px -6px -8px -6px;
-    text-overflow: clip;
-}
-
-.section .properties .delete-button {
-    width: 10px;
-    height: 10px;
-    background-image: url(Images/deleteIcon.png);
-    background-position: 0 0;
-    background-color: transparent;
-    background-repeat: no-repeat;
-    border: 0 none transparent;
-    position: absolute;
-    right: 8px;
-    display: none;
-}
-
-.section .properties li.hovered .delete-button {
-    display: inline;
-}
-
-.section .properties .name, .event-properties .name, .console-formatted-object .name {
-    color: rgb(136, 19, 145);
-}
-
-.section .properties .dimmed {
-    opacity: 0.6;
-}
-
-.section .properties .value.error {
-    color: red;
-}
-
-.section .properties .number, .event-properties .number {
-    color: blue;
-}
-
-.section .properties .keyword, .event-properties .keyword {
-    color: rgb(136, 19, 79);
-}
-
-.section .properties .color, .event-properties .color {
-    color: rgb(118, 15, 21);
-}
-
-.swatch {
-    margin-left: 1px;
-    margin-right: 2px;
-    margin-bottom: -1px;
-    width: 1em;
-    height: 1em;
-    display: inline-block;
-    background-image: url(Images/checker.png);
-}
-
-.swatch-inner {
-    width: 100%;
-    height: 100%;
-    display: inline-block;
-    border: 1px solid rgba(128, 128, 128, 0.6);
-}
-
-.swatch-inner:hover {
-    border: 1px solid rgba(64, 64, 64, 0.8);
-}
-
-.pane:not(.expanded) + .pane, .pane:first-of-type {
-    margin-top: -1px;
-}
-
-.pane > .title {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
-    height: 20px;
-    padding: 0 5px;
-    border-top: 1px solid rgb(189, 189, 189);
-    border-bottom: 1px solid rgb(189, 189, 189);
-    font-weight: bold;
-    font-size: 12px;
-    line-height: 18px;
-    color: rgb(110, 110, 110);
-    text-shadow: white 0 1px 0;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-.pane > .title:active {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(231, 231, 231)), color-stop(0.05, rgb(231, 231, 231)), color-stop(0.05, rgb(207, 207, 207)), to(rgb(186, 186, 186)));
-    border-top: 1px solid rgb(178, 178, 178);
-    border-bottom: 1px solid rgb(178, 178, 178);
-}
-
-.pane > .title::before {
-    content: url(Images/disclosureTriangleSmallRightBlack.png);
-    float: left;
-    width: 11px;
-    height: 12px;
-    margin-right: 2px;
-    margin-top: 1px;
-}
-
-.pane.expanded > .title::before {
-    content: url(Images/disclosureTriangleSmallDownBlack.png);
-}
-
-.pane > .title > select {
-    float: right;
-    width: 23px;
-    height: 17px;
-    color: transparent;
-    background-color: transparent;
-    border: none;
-    background-repeat: no-repeat;
-    margin: 1px 0 0 0;
-    padding: 0;
-    -webkit-border-radius: 0;
-    -webkit-appearance: none;
-}
-
-.pane > .title > select:hover {
-    background-position: -23px 0px;
-}
-
-.pane > .title > select:active {
-    background-position: -46px 0px;
-}
-
-.pane > .title > select.select-settings {
-    background-image: url(Images/paneSettingsButtons.png);
-}
-
-.pane > .title > select.select-filter {
-    background-image: url(Images/paneFilterButtons.png);
-}
-
-.pane > .title > select > option, .pane > .title > select > hr {
-    color: black;
-}
-
-.pane > .title > .pane-title-button {
-    float: right;
-    width: 23px;
-    height: 17px;
-    color: transparent;
-    background-color: transparent;
-    border: none;
-    background-repeat: no-repeat;
-    margin: 1px 0 0 0;
-    padding: 0;
-    -webkit-border-radius: 0;
-    -webkit-appearance: none;
-}
-
-.pane > .title > .pane-title-button:hover {
-    background-position: -23px 0px;
-}
-
-.pane > .title > .pane-title-button:active, .pane > .title > .pane-title-button.toggled {
-    background-position: -46px 0px;
-}
-
-.pane > .title > .pane-title-button.add {
-    background-image: url(Images/paneAddButtons.png);
-}
-
-.pane > .title > .pane-title-button.element-state {
-    background-image: url(Images/paneElementStateButtons.png);
-}
-
-.pane > .title > .pane-title-button.refresh {
-    background-image: url(Images/paneRefreshButtons.png);
-}
-
-.pane > .body {
-    position: relative;
-    display: none;
-    overflow-y: auto;
-    overflow-x: hidden;
-}
-
-.pane > .body .info {
-    text-align: center;
-    font-style: italic;
-    font-size: 10px;
-    padding: 6px;
-    color: black;
-}
-
-.pane > .body .placard + .info {
-    border-top: 1px solid rgb(189, 189, 189);
-    background-color: rgb(255, 255, 194);
-}
-
-.pane.expanded > .body, .pane.expanded > .growbar {
-    display: block;
-}
-
-.pane > .body .breakpoint-condition {
-    display: block;
-    margin-top: 4px;
-    margin-bottom: 4px;
-    margin-left: 23px;
-    margin-right: 8px;
-}
-
-#breakpoint-condition-input {
-    display: block;
-    margin-left: 0;
-    margin-right: 0;
-    outline: none !important;
-    border: 1px solid rgb(66%, 66%, 66%);
-}
-
-.pane.expanded:nth-last-of-type(1) {
-    border-bottom: 1px solid rgb(189, 189, 189);
-}
-
-.pane > .growbar {
-    display: none;
-    background-image: url(Images/paneGrowHandleLine.png), url(Images/paneBottomGrow.png);
-    background-repeat: no-repeat, repeat-x;
-    background-position: center center, bottom;
-    height: 5px;
-}
-
-.sidebar-pane-subtitle {
-    position: absolute;
-    right: 0;
-    font-weight: normal;
-}
-
-body.platform-windows .sidebar-pane-subtitle {
-    padding-top: 1px;
-}
-
-.sidebar-pane-subtitle input, .section .header input[type=checkbox] {
-    font-size: inherit;
-    hight: 1em;
-    width: 1em;
-    margin-left: 0;
-    margin-top: 0;
-    margin-bottom: 0.25em;
-    vertical-align: bottom;
-}
-
-.sidebar {
-    overflow-x: hidden;
-    background-color: rgb(214, 221, 229);
-}
-
-body.inactive .sidebar {
-    background-color: rgb(232, 232, 232);
-}
-
-.panel-enabler-view button:not(.status-bar-item), .pane button, button.show-all-nodes {
-    color: rgb(6, 6, 6);
-    background-color: transparent;
-    border: 1px solid rgb(165, 165, 165);
-    background-color: rgb(237, 237, 237);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 12px;
-    -webkit-appearance: none;
-}
-
-button.show-all-nodes {
-    font-size: 13px;
-    margin: 0;
-    padding: 0 20px;
-    height: 20px;
-}
-
-.pane button {
-    margin: 6px 0 6px 3px;
-    padding: 2px 9px;
-}
-
-.panel-enabler-view button:active:not(.status-bar-item), .pane button:active, button.show-all-nodes:active {
-    background-color: rgb(215, 215, 215);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-body.inactive .panel-enabler-view button:not(.status-bar-item), .panel-enabler-view button:disabled:not(.status-bar-item), body.inactive .pane button, .pane button:disabled, body.inactive button.show-all-nodes {
-    color: rgb(130, 130, 130);
-    border-color: rgb(212, 212, 212);
-    background-color: rgb(239, 239, 239);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
-}
-
-button.enable-toggle-status-bar-item .glyph {
-    -webkit-mask-position: -192px 0;
-}
-
-button.enable-toggle-status-bar-item.toggled-on .glyph {
-    -webkit-mask-position: -96px -24px;
-}
-
-#console-messages.console-filter-top {
-    margin-top: 23px;
-}
-
-.scope-bar {
-    line-height: 19px;
-    padding-right: 10px;
-    overflow: hidden;
-}
-
-.scope-bar li {
-    display: inline-block;
-    margin: 0 2px;
-    padding: 2px 6px;
-    font-size: 11px;
-    line-height: 12px;
-    font-weight: bold;
-    color: rgb(46, 46, 46);
-    background: transparent;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-    -webkit-border-radius: 8px;
-    vertical-align: middle;
-}
-
-.scope-bar-divider {
-    background-color: rgba(0, 0, 0, 0.4);
-    height: 16px;
-    width: 1px;
-    vertical-align: middle;
-    display: inline-block;
-}
-
-.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active {
-    color: white;
-    text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
-}
-
-.scope-bar li.all {
-    margin: 0 8px;
-}
-
-.scope-bar li:hover {
-    background: rgba(0, 0, 0, 0.2);
-}
-
-.scope-bar li.selected {
-    background: rgba(0, 0, 0, 0.3);
-    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-.scope-bar li:active {
-    background: rgba(0, 0, 0, 0.5);
-    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-.console-warning-level, .console-error-level, .console-log-level, .console-debug-level {
-    display: none;
-}
-
-.filter-all .console-warning-level, .filter-warnings .console-warning-level,
-.filter-all .console-error-level, .filter-errors .console-error-level,
-.filter-all .console-log-level, .filter-logs .console-log-level,
-.filter-all .console-debug-level, .filter-debug .console-debug-level {
-    display: block;
-}
-
-.filter-all .console-warning-level.repeated-message, .filter-warnings .console-warning-level.repeated-message,
-.filter-all .console-error-level.repeated-message, .filter-errors .console-error-level.repeated-message,
-.filter-all .console-log-level.repeated-message, .filter-logs .console-log-level.repeated-message,
-.filter-all .console-debug-level.repeated-message, .filter-debug .console-debug-level.repeated-message {
-    display: -webkit-flex;
-}
-
-.console-user-command-result {
-    display: block;
-}
-
-.source-view-frame {
-    width: 100%;
-    height: 100%;
-}
-
-.sidebar-resizer-vertical {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    width: 5px;
-    z-index: 500;
-    cursor: ew-resize;
-}
-
-.sidebar-tree, .sidebar-tree .children {
-    position: relative;
-    padding: 0;
-    margin: 0;
-    list-style: none;
-    font-size: 11px;
-}
-
-.sidebar-tree-section {
-    position: relative;
-    height: 18px;
-    padding: 1px 10px 6px 10px;
-    white-space: nowrap;
-    margin-top: 1px;
-    color: rgb(92, 110, 129);
-    font-weight: bold;
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
-}
-
-.sidebar-tree-item {
-    position: relative;
-    height: 36px;
-    padding: 0 5px 0 5px;
-    white-space: nowrap;
-    overflow-x: hidden;
-    overflow-y: hidden;
-    margin-top: 1px;
-    line-height: 34px;
-    border-top: 1px solid transparent;
-}
-
-.sidebar-tree .children {
-    display: none;
-}
-
-.sidebar-tree .children.expanded {
-    display: block;
-}
-
-.sidebar-tree-section + .children > .sidebar-tree-item {
-    padding-left: 10px !important;
-}
-
-.sidebar-tree-section + .children.small > .sidebar-tree-item {
-    padding-left: 17px !important;
-}
-
-.sidebar-tree > .children > .sidebar-tree-item {
-    padding-left: 37px;
-}
-
-.sidebar-tree > .children > .children > .sidebar-tree-item {
-    padding-left: 37px;
-}
-
-.sidebar-tree.hide-disclosure-buttons > .children {
-    display: none;
-}
-
-.sidebar-tree > .children.hide-disclosure-buttons > .children {
-    display: none;
-}
-
-.sidebar-tree.some-expandable:not(.hide-disclosure-buttons) > .sidebar-tree-item:not(.parent) .icon {
-    margin-left: 16px;
-}
-
-.sidebar-tree-item .disclosure-button {
-    float: left;
-    width: 16px;
-    height: 100%;
-    border: 0;
-    background-color: transparent;
-    background-image: url(Images/disclosureTriangleSmallRight.png);
-    background-repeat: no-repeat;
-    background-position: center;
-    -webkit-apearance: none;
-}
-
-.sidebar-tree.hide-disclosure-buttons .sidebar-tree-item .disclosure-button {
-    display: none;
-}
-
-body.inactive .sidebar-tree-item .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
-}
-
-body.inactive .sidebar-tree-item.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
-}
-
-body.inactive .sidebar-tree-item .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDownBlack.png);
-}
-
-.sidebar-tree-item.selected .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallRightWhite.png) !important;
-}
-
-.sidebar-tree-item.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDown.png);
-}
-
-.sidebar-tree-item.selected.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDownWhite.png) !important;
-}
-
-.sidebar-tree-item.selected .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDownWhite.png) !important;
-}
-
-.sidebar-tree-item .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDown.png);
-}
-
-.sidebar-tree-item .icon {
-    float: left;
-    width: 32px;
-    height: 32px;
-    margin-top: 1px;
-    margin-right: 3px;
-}
-
-li .status {
-    float: right;
-    height: 16px;
-    margin-top: 9px;
-    margin-left: 4px;
-    line-height: 1em;
-}
-
-li .status:empty {
-    display: none;
-}
-
-li .status .bubble {
-    display: inline-block;
-    height: 14px;
-    min-width: 16px;
-    margin-top: 1px;
-    background-color: rgb(128, 151, 189);
-    vertical-align: middle;
-    white-space: nowrap;
-    padding: 1px 4px;
-    text-align: center;
-    font-size: 11px;
-    line-height: normal;
-    font-family: Helvetica, Arial, sans-serif;
-    font-weight: bold;
-    text-shadow: none;
-    color: white;
-    -webkit-border-radius: 7px;
-}
-
-li .status .bubble:empty {
-    display: none;
-}
-
-li.selected .status .bubble {
-    background-color: white !important;
-    color: rgb(132, 154, 190) !important;
-}
-
-:focus li.selected .status .bubble {
-    color: rgb(36, 98, 172) !important;
-}
-
-body.inactive li.selected .status .bubble {
-    color: rgb(159, 159, 159) !important;
-}
-
-.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side {
-    height: 20px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
-    width: 16px;
-    height: 16px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
-    margin-top: 1px;
-}
-
-.sidebar-tree-item.selected {
-    color: white;
-    border-top: 1px solid rgb(145, 160, 192);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
-    text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
-    font-weight: bold;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-:focus .sidebar-tree-item.selected {
-    border-top: 1px solid rgb(68, 128, 200);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
-}
-
-body.inactive .sidebar-tree-item.selected {
-    border-top: 1px solid rgb(151, 151, 151);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
-}
-
-.sidebar-tree-item .titles {
-    position: relative;
-    top: 5px;
-    line-height: 11px;
-    padding-bottom: 1px;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    white-space: nowrap;
-}
-
-.sidebar-tree-item .titles.no-subtitle {
-    top: 10px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .titles, .sidebar-tree .children.small .sidebar-tree-item .titles, .sidebar-tree-item.small .titles {
-    top: 2px;
-    line-height: normal;
-}
-
-.sidebar-tree:not(.small) .sidebar-tree-item:not(.small) .title::after, .sidebar-tree .children:not(.small) .sidebar-tree-item .title::after {
-    content: "\A";
-    white-space: pre;
-}
-
-.sidebar-tree-item .subtitle {
-    font-size: 9px;
-    color: rgba(0, 0, 0, 0.7);
-}
-
-.sidebar-tree.small .sidebar-tree-item .subtitle, .sidebar-tree .children.small .sidebar-tree-item .subtitle, .sidebar-tree-item.small .subtitle {
-    display: none;
-}
-
-.sidebar-tree-item.selected .subtitle {
-    color: rgba(255, 255, 255, 0.9);
-}
-
-.bubble.debug, .console-debug-level .bubble {
-    background-color: rgb(0, 0, 255) !important;
-}
-
-.bubble.warning, .console-warning-level .bubble {
-    background-color: rgb(232, 164, 0) !important;
-}
-
-.bubble.error, .console-error-level .bubble {
-    background-color: rgb(216, 35, 35) !important;
-}
-
-.bubble.search-matches {
-    background-image: url(Images/searchSmallWhite.png);
-    background-repeat: no-repeat;
-    background-position: 3px 2px;
-    padding-left: 13px !important;
-}
-
-li.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallBlue.png);
-}
-
-:focus li.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallBrightBlue.png);
-}
-
-body.inactive li.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallGray.png);
-}
-
-.storage-application-cache-status-icon, .storage-application-cache-connectivity-icon {
-    margin-bottom: -3px;
-    margin-left: 5px;
-    vertical-align: middle;
-}
-
-.status-bar-divider {
-    margin-left: 7px;
-    border-right: 1px solid #CCC;
-}
-
-.storage-application-cache-status, .storage-application-cache-connectivity {
-    position: relative;
-    top: 4px;
-}
-
-.status-bar-items {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 200px;
-    overflow: hidden;
-    border-left: 1px solid rgb(184, 184, 184);
-    margin-left: -1px;
-}
-
-.node-search-status-bar-item .glyph {
-    -webkit-mask-position: -224px -24px;
-}
-
-.delete-storage-status-bar-item .glyph {
-    -webkit-mask-position: -128px 0;
-}
-
-.refresh-storage-status-bar-item .glyph {
-    -webkit-mask-position: 0 0;
-}
-
-ol.breakpoint-list {
-    -webkit-padding-start: 0;
-    list-style: none;
-    margin: 0;
-}
-
-.breakpoints-list-deactivated {
-    background-color: rgb(245, 245, 245);
-    opacity: 0.3;
-}
-
-.breakpoint-list li {
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    padding: 2px 0;
-    color: black;
-}
-
-.breakpoint-list li:hover {
-    background-color: rgba(56, 121, 217, 0.2);
-}
-
-.breakpoint-list .checkbox-elem {
-    font-size: 10px;
-    margin: 0 4px;
-    vertical-align: top;
-    position: relative;
-    z-index: 1;
-}
-
-.breakpoint-list .source-text {
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    margin: 2px 0 0px 20px;
-}
-
-.pane .breakpoint-hit {
-    background-color: rgb(255, 255, 194);
-}
-
-li.breakpoint-hit .breakpoint-hit-marker {
-    background-color: rgb(255, 255, 194);
-    height: 18px;
-    left: 0px;
-    margin-top: -16px;
-    position: absolute;
-    right: 0px;
-    z-index: -1;
-}
-
-.webkit-html-js-node, .webkit-html-css-node {
-    white-space: pre;
-}
-
-.source-frame-breakpoint-condition {
-    z-index: 30;
-    padding: 4px;
-    background-color: rgb(203, 226, 255);
-    -webkit-border-radius: 7px;
-    border: 2px solid rgb(169, 172, 203);
-    width: 90%;
-    pointer-events: auto;
-}
-
-.source-frame-breakpoint-message {
-    background-color: transparent;
-    font-family: Lucida Grande, sans-serif;
-    font-weight: normal;
-    font-size: 11px;
-    text-align: left;
-    text-shadow: none;
-    color: rgb(85, 85, 85);
-    cursor: default;
-    margin: 0 0 2px 0;
-}
-
-#source-frame-breakpoint-condition {
-    margin: 0;
-    border: 1px inset rgb(190, 190, 190) !important;
-    width: 100%;
-    box-shadow: none !important;
-    outline: none !important;
-    -webkit-user-modify: read-write;
-}
-
-.source-frame-popover-title {
-    text-overflow: ellipsis;
-    overflow: hidden;
-    white-space: nowrap;
-    font-weight: bold;
-    padding-left: 18px;
-}
-
-.source-frame-popover-tree {
-    border-top: 1px solid rgb(194, 194, 147);
-    overflow: auto;
-    position: absolute;
-    top: 15px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-
-.source-frame-eval-expression {
-    border: 1px solid rgb(163, 41, 34);
-    margin: -1px;
-    background-color: rgb(255, 255, 194);
-}
-
-.workers-list {
-    list-style: none;
-    margin: 0;
-    padding: 0;
-}
-
-.workers-list > li {
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-    margin-left: 1em;
-    font-size: 12px;
-}
-
-a.worker-item {
-    color: rgb(33%, 33%, 33%);
-    cursor: pointer;
-    text-decoration: none;
-}
-
-a.worker-item:hover {
-    color: rgb(15%, 15%, 15%);
-}
-
-.resource-content-unavailable {
-    color: rgb(50%, 50%, 50%);
-    font-style: italic;
-    font-size: 14px;
-    text-align: center;
-    padding: 32px;
-}
-
-.node-link {
-    text-decoration: underline;
-    cursor: pointer;
-}
-
-.cursor-pointer {
-    cursor: pointer;
-}
-
-.cursor-auto {
-    cursor: auto;
-}
-
-.please-wait-msg {
-    position: absolute;
-    left: 0;
-    top: 0;
-    border: 4px black solid;
-    border-radius: 4px;
-    background-color: black;
-    opacity: 0.85;
-    color: white;
-    font-size: 12px;
-    font-weight: bold;
-    z-index: 10000;
-}
-
-.resource-view.json {
-    padding: 5px;
-}
-
-.resource-view.html iframe {
-    width: 100%;
-    height: 100%;
-    position: absolute;
-}
-
-.soft-context-menu-glass-pane {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    z-index: 20000;
-}
-
-.soft-context-menu {
-    position: absolute;
-    font-family: 'Lucida Grande', 'Helvetica', 'sans-serif';
-    border: 1px solid rgba(196, 196, 196, 0.9);
-    border-top: 1px solid rgba(196, 196, 196, 0.5);
-    border-bottom: 1px solid rgba(150, 150, 150, 0.9);
-    padding: 4px 0 4px 0;
-    border-radius: 4px;
-    background-color: white;
-    -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
-}
-
-.soft-context-menu-item {
-    width: 100%;
-    line-height: 13px;
-    font-size: 14px;
-    border-top: 1px solid transparent;
-    border-bottom: 1px solid transparent;
-    padding: 2px 7px 2px 6px;
-    margin: 0 13px 0 0;
-    white-space: nowrap;
-}
-
-.soft-context-menu-separator {
-    height: 10px;
-    margin: 0 1px;
-}
-
-.soft-context-menu-separator > .separator-line {
-    margin: 0;
-    height: 5px;
-    border-bottom: 1px solid rgb(227, 227, 227);
-    pointer-events: none;
-}
-
-.soft-context-menu-item-mouse-over {
-    border-top: 1px solid rgb(56, 121, 217);
-    border-bottom: 1px solid rgb(56, 121, 217);
-    background-color: rgb(56, 121, 217);
-    color: white;
-}
-
-body.platform-mac .soft-context-menu-item-mouse-over {
-    border-top: 1px solid rgb(90, 131, 236);
-    border-bottom: 1px solid rgb(18, 88, 233);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(100, 140, 243)), to(rgb(36, 101, 243)));
-}
-
-.soft-context-menu-item-checkmark {
-    color: rgb(108, 108, 108);
-    pointer-events: none;
-}
-
-.soft-context-menu-item-submenu-arrow {
-    color: black;
-    float: right;
-    pointer-events: none;
-}
-
-.soft-context-menu-item-mouse-over .soft-context-menu-item-checkmark {
-    color: white;
-}
-
-.search-view {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-
-.search-drawer-header input[type="search"].search-config-search {
-    font-size: 11px;
-    margin-left: 4px;
-    color: #303030;
-    position: relative;
-}
-
-body.platform-mac .search-drawer-header input[type="search"].search-config-search {
-    top: 1px;
-}
-
-.search-drawer-header label.search-config-label {
-    margin-left: 8px;
-    color: #303030;
-}
-
-.search-drawer-header input[type="checkbox"].search-config-checkbox {
-    vertical-align: bottom;
-}
-
-body:not(.platform-mac) .search-drawer-header input[type="checkbox"].search-config-checkbox {
-    margin-bottom: 5px;
-}
-
-body.platform-mac .search-drawer-header input[type="checkbox"].search-config-checkbox {
-    margin-bottom: 4px;
-}
-
-.drawer-header {
-    font-size: 11px;
-    border-right: 1px solid rgb(197, 197, 197);
-    line-height: 21px;
-    padding-left: 6px;
-    display: inline-block;
-}
-
-.drawer-header-close-button {
-    font-family: Arial, monospace;
-    padding: 3px 8px;
-    font-size: 14px;
-    color:rgb(80, 80, 80);
-    opacity: 0.5;
-    position: relative;
-    top: 1px;
-}
-
-.drawer-header-close-button:hover {
-    opacity: 1;
-}
-
-.drawer-header-close-button:active {
-    opacity: 0.7;
-}
-
-#bottom-status-bar-container {
-    -webkit-flex: 1 1 0;
-    width: 0;
-    overflow: hidden;
-}
-
-.search-status-bar-item {
-    display: inline-block;
-    cursor: pointer;
-    font-size: 11px;
-    height: 23px;
-}
-
-.search-status-bar-message {
-    margin-left:5px;
-    margin-right:5px;
-    margin-top:5px;
-    float:left;
-}
-
-.progress-bar-stop-button-item {
-    width: 19px;
-    height: 24px;
-    overflow: hidden;
-}
-
-.progress-bar-stop-button .glyph {
-    -webkit-mask-position: -96px -48px;
-    background-color: rgb(216, 0, 0) !important;
-}
-
-.search-results-status-bar-message {
-    margin-right: 10px;
-    cursor: default;
-    font-size: 11px;
-    float: right;
-    margin-top: 5px;
-}
-
-.search-view .search-results {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    overflow-y: auto;
-}
-
-#search-results-pane-file-based li {
-    list-style: none;
-}
-
-#search-results-pane-file-based ol {
-    -webkit-padding-start: 0;
-    margin-top: 0;
-}
-
-#search-results-pane-file-based ol.children {
-    display: none;
-}
-
-#search-results-pane-file-based ol.children.expanded {
-    display: block;
-}
-
-#search-results-pane-file-based li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    position: relative;
-    left: -4px;
-}
-
-#search-results-pane-file-based li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-#search-results-pane-file-based .search-result {
-    font-size: 11px;
-    padding: 2px 0 2px 10px;
-    word-wrap: normal;
-    white-space: pre;
-    cursor: pointer;
-}
-
-#search-results-pane-file-based .search-result:hover {
-    background-color: rgba(121, 121, 121, 0.1);
-}
-
-#search-results-pane-file-based .search-result .search-result-file-name {
-    font-weight: bold;
-    color: #222;
-}
-
-#search-results-pane-file-based .search-result .search-result-matches-count {
-    margin-left: 5px;
-    color: #333;
-}
-
-#search-results-pane-file-based .show-more-matches {
-    padding: 4px 0;
-    color: #333;
-    cursor: pointer;
-    font-size: 11px;
-    margin-left: 20px;
-}
-
-#search-results-pane-file-based .show-more-matches:hover {
-    text-decoration: underline;
-}
-
-#search-results-pane-file-based .search-match {
-    word-wrap: normal;
-    white-space: pre;
-}
-
-#search-results-pane-file-based .search-match .webkit-line-number.search-match-line-number {
-    margin-right: 5px;
-    border-right: 1px solid #BBB;
-}
-
-#search-results-pane-file-based .search-match:not(:hover) .webkit-line-number.search-match-line-number {
-    background-color: #F0F0F0;
-}
-
-#search-results-pane-file-based .search-match:hover {
-    background-color: rgba(56, 121, 217, 0.1);
-}
-
-#search-results-pane-file-based .search-match .highlighted-match {
-    background-color: #F1EA00;
-}
-
-#search-results-pane-file-based a {
-    text-decoration: none;
-    display: block;
-}
-
-#search-results-pane-file-based .search-match .search-match-content {
-    color: #000;
-}
-
-.record-cpu-profile-status-bar-item .glyph, .record-profile-status-bar-item .glyph {
-    -webkit-mask-position: -288px 0;
-}
-
-.record-cpu-profile-status-bar-item.toggled-on .glyph, .record-profile-status-bar-item.toggled-on .glyph {
-    -webkit-mask-position: -288px -24px;
-    background-color: rgb(216, 0, 0) !important;
-}
-
-.storage-empty-view, .storage-view .storage-table-error {
-    position: absolute;
-    top: 0;
-    bottom: 25%;
-    left: 0;
-    right: 0;
-    font-size: 24px;
-    color: rgb(75%, 75%, 75%);
-    margin-top: auto;
-    margin-bottom: auto;
-    height: 50px;
-    line-height: 26px;
-    text-align: center;
-    font-weight: bold;
-    padding: 10px;
-    white-space: pre-wrap;
-}
-
-/* Generic suggest box style */
-
-.suggest-box.generic-suggest {
-    margin-left: -1px;
-    border-color: rgb(66%, 66%, 66%);
-}
-
-.suggest-box.generic-suggest.above-anchor {
-   border-radius: 5px 5px 5px 0;
-}
-
-.suggest-box.generic-suggest.under-anchor {
-   border-radius: 0 5px 5px 5px;
-}
-
-/* Custom popup scrollers */
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar, .custom-popup-vertical-scroll ::-webkit-scrollbar {
-    width: 11px;
-    height: 11px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-corner, .custom-popup-vertical-scroll ::-webkit-scrollbar-corner {
-    display: none;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-resizer, .custom-popup-vertical-scroll ::-webkit-resizer {
-    display: none;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-button, .custom-popup-vertical-scroll ::-webkit-scrollbar-button {
-    display: none;
-}
-
-/* Custom Horizontal Scrollbar Styles */
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar:horizontal:corner-present {
-    border-right-width: 0;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal {
-    -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 11px;
-    min-width: 20px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:hover {
-    -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:active {
-    -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:start {
-    margin-left: 5px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end {
-    margin-right: 5px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end:corner-present {
-    margin-right: 4px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:decrement {
-    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 0 0 11px;
-}
-
-.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:increment {
-    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 11px 0 0;
-}
-
-/* Custom Vertical Scrollbar Styles */
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar:vertical:corner-present {
-    border-bottom-width: 0;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical {
-    -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 11px 0;
-    min-height: 20px;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:hover {
-    -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:active {
-    -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:start {
-    margin-top: 5px;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end {
-    margin-bottom: 5px;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end:corner-present {
-    margin-bottom: 4px;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:decrement {
-    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 11px 0 0 0;
-}
-
-.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:increment {
-    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 0 0 11px 0;
-}
-
-.console-context {
-    max-width: 200px;
-}
-
-.inspector-footer {
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    font-size: 11px;
-    height: auto;
-}
-
-.progress-bar-container {
-    display: -webkit-flex;
-    margin: 0 8px;
-    -webkit-flex: 1 0;
-}
-
-.progress-bar-container span {
-    padding: 6px;
-}
-
-.progress-bar-container progress {
-    margin-top: 7px;
-    -webkit-flex: 1 0;
-}
-
-body.platform-mac .progress-bar-container progress {
-    margin-top: 6px;
-}
-
-.progress-bar-container button.status-bar-item {
-    border-left: none;
-    margin-top: 1px;
-}
-
-/* inspectorCommon.css */
-
-html {
-    height: 100%;
-}
-
-body {
-    cursor: default;
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    overflow: hidden;
-    font-family: Lucida Grande, sans-serif;
-    font-size: 10px;
-    margin: 0;
-    tab-size: 4;
-    -webkit-user-select: none;
-}
-
-body.dock-to-right:not(.undocked) {
-    border-left: 1px solid rgb(80, 80, 80);
-}
-
-body.dock-to-right.inactive:not(.undocked) {
-    border-left: 1px solid rgb(64%, 64%, 64%);
-}
-
-* {
-    -webkit-box-sizing: border-box;
-}
-
-:focus {
-    outline: none;
-}
-
-img {
-    -webkit-user-drag: none;
-}
-
-iframe, a img {
-    border: none;
-}
-
-iframe.view {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    left: 0;
-    right: 0;
-    top: 0;
-    bottom: 0;
-}
-
-.hidden {
-    display: none !important;
-}
-
-.monospace {
-    font-size: 10px !important;
-    font-family: monospace;
-}
-
-.resources-dividers {
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 100%;
-    top: 0;
-    z-index: -100;
-}
-
-.resources-event-dividers {
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 100%;
-    top: 0;
-    z-index: 300;
-    pointer-events: none;
-}
-
-.resources-dividers-label-bar {
-    position: absolute;
-    top: 0;
-    left: 0px;
-    right: 0;
-    background-color: rgba(255, 255, 255, 0.8);
-    background-clip: padding;
-    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
-    height: 20px;
-    z-index: 200;
-    pointer-events: none;
-}
-
-.resources-divider {
-    position: absolute;
-    width: 1px;
-    top: 0;
-    bottom: 0;
-    background-color: rgba(0, 0, 0, 0.1);
-}
-
-.resources-event-divider-padding {
-    position: absolute;
-    width: 8px;
-    top: 0;
-    bottom: 0;
-    pointer-events: auto;
-}
-
-.resources-event-divider {
-    position: absolute;
-    width: 2px;
-    top: 0;
-    bottom: 0;
-    z-index: 300;
-}
-
-.resources-divider-label {
-    position: absolute;
-    top: 4px;
-    right: 3px;
-    font-size: 9px;
-    color: rgb(50%, 50%, 50%);
-    white-space: nowrap;
-}
-
-
-/* Network timing is shared between popover and network item view pane */
-
-.network-timing-row {
-    position: relative;
-    height: 16px;
-}
-
-.network-timing-bar {
-    position: absolute;
-    background-color: red;
-    border-left: 1px solid red;
-    opacity: 0.4;
-    top: 0;
-    bottom: 0;
-}
-
-.network-timing-bar-title {
-    position: absolute;
-    color: black;
-    top: 1px;
-}
-
-.webkit-search-result {
-    -webkit-border-radius: 4px;
-    padding: 2px 2px 2px 3px;
-    margin: -2px -2px -2px -3px;
-    opacity: 0.8;
-    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
-    background-color: rgb(241, 234, 0);
-    color: black;
-}
-
-.sidebar-separator {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
-    padding: 0 5px;
-    border-top: 1px solid rgb(189, 189, 189);
-    border-bottom: 1px solid rgb(189, 189, 189);
-    color: rgb(110, 110, 110);
-    text-shadow: white 0 1px 0;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    font-size: 11px;
-}
-
-.sidebar-label {
-    font-size: 11px;
-}
-
-
-/* inspectorSyntaxHighlight.css */
-
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-.webkit-css-comment {
-    color: rgb(0, 116, 0);
-}
-
-.webkit-css-url, .webkit-css-color, .webkit-css-string, .webkit-css-keyword {
-    color: rgb(7, 144, 154);
- }
-
-.webkit-css-number {
-    color: rgb(50, 0, 255);
-}
-
-.webkit-css-property, .webkit-css-at-rule {
-    color: rgb(200, 0, 0);
-}
-
-.webkit-css-selector {
-    color: black;
-}
-
-.webkit-css-bang-keyword {
-    color: rgb(200, 0, 180);
-}
-
-.webkit-javascript-comment {
-    color: rgb(0, 116, 0);
-}
-
-.webkit-javascript-keyword {
-    color: rgb(170, 13, 145);
-}
-
-.webkit-javascript-number {
-    color: rgb(28, 0, 207);
-}
-
-.webkit-javascript-string, .webkit-javascript-regexp {
-    color: rgb(196, 26, 22);
-}
-
-.webkit-javascript-ident {
-    color: black;
-}
-
-.webkit-html-comment {
-    /* Keep this in sync with view-source.css (.webkit-html-comment) */
-    color: rgb(35, 110, 37);
-}
-
-.webkit-html-tag {
-    /* Keep this in sync with view-source.css (.webkit-html-tag) */
-    color: rgb(136, 18, 128);
-}
-
-.webkit-html-doctype {
-    /* Keep this in sync with view-source.css (.webkit-html-doctype) */
-    color: rgb(192, 192, 192);
-}
-
-.webkit-html-attribute-name {
-    /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
-    color: rgb(153, 69, 0);
-}
-
-.webkit-html-attribute-value {
-    /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
-    color: rgb(26, 26, 166);
-}
-
-.webkit-html-external-link, .webkit-html-resource-link {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
-    color: #00e;
-}
-
-.webkit-html-external-link {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link) */
-    text-decoration: none;
-}
-
-.webkit-html-external-link:hover {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
-    text-decoration: underline;
-}
-
-/* popover.css */
-
-.popover {
-    position: absolute;
-    -webkit-border-image: url(Images/popoverBackground.png) 25 25 25 25;
-    border-width: 25px;
-    z-index: 100;
-    pointer-events: none;
-}
-
-.popover .content {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    pointer-events: auto;
-    overflow: auto;
-    -webkit-user-select: text;
-}
-
-.popover .content.fixed-height {
-    overflow: hidden;
-} 
-
-.popover .arrow {
-    position: absolute;
-    background-image: url(Images/popoverArrows.png);
-    width: 19px;
-    height: 19px;
-    margin-left: 15px;
-    margin-top: -25px;
-    top: 0;
-    left: 0;
-}
-
-.popover.top-left-arrow .arrow {
-    /* The default is top-left, no styles needed. */
-}
-
-.popover.top-right-arrow .arrow {
-    right: 25px;
-    left: auto;
-}
-
-.popover.bottom-left-arrow .arrow {
-    top: auto;
-    bottom: 0;
-    margin-top: 0;
-    margin-bottom: -25px;
-    background-position: 0 -19px;
-}
-
-.popover.bottom-right-arrow .arrow {
-    right: 15px;
-    left: auto;
-    top: auto;
-    bottom: 0;
-    margin-top: 0;
-    margin-bottom: -25px;
-    background-position: 0 -19px;
-}
-
-.popover.left-top-arrow .arrow {
-    top: 0;
-    margin-top: 15px;
-    margin-left: -25px;
-    background-position: 0 -38px;
-}
-
-.popover.left-bottom-arrow .arrow {
-    top: auto;
-    bottom: 0;
-    margin-bottom: 15px;
-    margin-left: -25px;
-    background-position: 0 -38px;
-}
-
-.popover.right-top-arrow .arrow {
-    right: 0;
-    left: auto;
-    top: 0;
-    margin-top: 15px;
-    margin-right: -25px;
-    background-position: 0 -57px;
-}
-
-.popover.right-bottom-arrow .arrow {
-    right: 0;
-    left: auto;
-    top: auto;
-    bottom: 0;
-    margin-bottom: 15px;
-    margin-right: -25px;
-    background-position: 0 -57px;
-}
-
-/* devTools.css */
-
-.data-grid table {
-    line-height: 120%;
-}
-
-body.dock-to-bottom #toolbar {
-    border-top-color: white;
-    cursor: default; /* overriden */
-}
-
-/* Chrome theme overrides */
-
-body.platform-windows #toolbar, body.platform-windows.inactive #toolbar {
-    background-image: none;
-}
-
-body.undocked.platform-mac-leopard #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
-}
-
-body.undocked.platform-mac-leopard.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
-}
-
-body.undocked.platform-mac-snowleopard #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(167, 167, 167))) !important;
-}
-
-body.undocked.platform-mac-snowleopard.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(228, 228, 228)), to(rgb(216, 216, 216))) !important;
-}
-
-body.undocked.platform-mac-mountain-lion #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(208, 208, 208)), to(rgb(200, 200, 200))) !important;
-}
-
-body.undocked.platform-mac-mountain-lion.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(238, 238, 238)), to(rgb(224, 224, 224))) !important;
-}
-
-body.platform-linux #scripts-files {
-    font-size: 11px;
-    font-weight: normal;
-    line-height: 12px;
-}
-
-.console-group-messages .section > .header {
-    padding: 0 8px 0 0;
-    background-image: none;
-    border: none;
-    min-height: 0;
-}
-
-#resources-filter {
-    background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233)));
-}
-
-.crumbs .crumb {
-    -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2;
-    margin-right: -3px;
-    padding-left: 6px;
-}
-
-.crumbs .crumb.selected {
-    -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
-    color: white;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0;
-}
-
-.crumbs .crumb.selected:hover {
-    -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
-}
-
-.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
-    -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2;
-}
-
-.crumbs .crumb:hover {
-    -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
-}
-
-.crumbs .crumb.end:hover {
-    -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2;
-}
-
-.status-bar {
-    background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235));
-}
-
-.scope-bar li.selected {
-    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
-}
-
-.scope-bar li:active {
-    -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
-}
-
-.timeline-category-statusbar-item input {
-    vertical-align: middle;
-}
-
diff --git a/resources/inspector/devtools.html b/resources/inspector/devtools.html
index 148f371..2963457 100644
--- a/resources/inspector/devtools.html
+++ b/resources/inspector/devtools.html
@@ -28,10 +28,11 @@
 <!DOCTYPE html>
 <html>
 <head>
+    <script type="text/javascript" src="buildSystemOnly.js"></script>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval'">
-    <link rel="stylesheet" type="text/css" href="devTools.css">
-    <script type="text/javascript" src="DevTools.js"></script>
+    <link rel="stylesheet" type="text/css" href="inspector.css">
+    <script type="text/javascript" src="inspector.js"></script>
 </head>
 <body class="undocked" id="-webkit-web-inspector">
     <div id="toolbar">
@@ -40,6 +41,7 @@
             <div class="toolbar-item"><div id="toolbar-dropdown-arrow">&raquo;</div></div>
             <div class="toolbar-item close-right"><div id="close-button-right"></div></div>
         </div>
+        <div class="toolbar-item"><div id="toolbar-panels-menu" class="hidden">&hellip;</div></div>
     </div>
     <div id="main">
         <div id="floating-status-bar-container" class="status-bar"><div id="floating-status-bar-resizer"></div></div>
@@ -47,7 +49,9 @@
     <div id="drawer"></div>
     <div id="main-status-bar" class="status-bar">
         <div id="bottom-status-bar-container">
-            <div id="panel-status-bar"></div>
+            <div id="panel-status-bar">
+                <div id="drawer-view-anchor"></div>
+            </div>
         </div>
         <div id="error-warning-count" class="hidden"></div>
     </div>
diff --git a/resources/inspector/devtools_extension_api.js b/resources/inspector/devtools_extension_api.js
index 6f60814..51155ed 100644
--- a/resources/inspector/devtools_extension_api.js
+++ b/resources/inspector/devtools_extension_api.js
@@ -42,7 +42,6 @@
     if (!apiPrivate.console)
         apiPrivate.console = {};
     apiPrivate.console.Severity = {
-        Tip: "tip",
         Debug: "debug",
         Log: "log",
         Warning: "warning",
@@ -64,7 +63,6 @@
         ConsoleMessageAdded: "console-message-added",
         ElementsPanelObjectSelected: "panel-objectSelected-elements",
         NetworkRequestFinished: "network-request-finished",
-        Reset: "reset",
         OpenResource: "open-resource",
         PanelSearch: "panel-search-",
         Reload: "Reload",
@@ -184,8 +182,6 @@
     defineDeprecatedProperty(this, "webInspector", "resources", "network");
     this.timeline = new Timeline();
     this.console = new ConsoleAPI();
-
-    this.onReset = new EventSink(events.Reset);
 }
 
 /**
@@ -453,7 +449,6 @@
 
     setExpression: function(expression, rootTitle, evaluateOptions)
     {
-        var callback = extractCallbackArgument(arguments);
         var request = {
             command: commands.SetSidebarContent,
             id: this._id,
@@ -463,7 +458,7 @@
         };
         if (typeof evaluateOptions === "object")
             request.evaluateOptions = evaluateOptions;
-        extensionServer.sendRequest(request, callback);
+        extensionServer.sendRequest(request, extractCallbackArgument(arguments));
     },
 
     setObject: function(jsonObject, rootTitle, callback)
@@ -661,7 +656,10 @@
         var callback = extractCallbackArgument(arguments);
         function callbackWrapper(result)
         {
-            callback(result.value, result.isException);
+            if (result.isError || result.isException)
+                callback(undefined, result);
+            else
+                callback(result.value);
         }
         var request = {
             command: commands.EvaluateOnInspectedPage,
@@ -867,25 +865,21 @@
 var Resource = declareInterfaceClass(ResourceImpl);
 var Timeline = declareInterfaceClass(TimelineImpl);
 
-var extensionServer = new ExtensionServerClient();
+// extensionServer is a closure variable defined by the glue below -- make sure we fail if it's not there.
+if (!extensionServer)
+    extensionServer = new ExtensionServerClient();
 
 return new InspectorExtensionAPI();
 }
 
-// Default implementation; platforms will override.
-function buildPlatformExtensionAPI(extensionInfo)
-{
-    function platformExtensionAPI(coreAPI)
-    {
-        window.webInspector = coreAPI;
-    }
-    return platformExtensionAPI.toString();
-}
-
-
+/**
+ * @param {ExtensionDescriptor} extensionInfo
+ * @return {string}
+ */
 function buildExtensionAPIInjectedScript(extensionInfo)
 {
-    return "(function(injectedScriptHost, inspectedWindow, injectedScriptId){ " +
+    return "(function(injectedScriptId){ " +
+        "var extensionServer;" +
         defineCommonExtensionSymbols.toString() + ";" +
         injectedExtensionAPI.toString() + ";" +
         buildPlatformExtensionAPI(extensionInfo) + ";" +
diff --git a/resources/inspector/elementsPanel.css b/resources/inspector/elementsPanel.css
index 9dd1d78..b847e20 100644
--- a/resources/inspector/elementsPanel.css
+++ b/resources/inspector/elementsPanel.css
@@ -55,6 +55,21 @@
     opacity: 0.5;
 }
 
+#elements-content .CodeMirror {
+    /* Consistent with the .editing class in inspector.css */
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    outline: 1px solid rgb(66%, 66%, 66%) !important;
+    background-color: white;
+}
+
+#elements-content .CodeMirror pre {
+    padding: 0;
+}
+
+#elements-content .CodeMirror-lines {
+    padding: 0;
+}
+
 .elements-tree-editor {
     -webkit-user-select: text;
     -webkit-user-modify: read-write-plaintext-only;
@@ -70,7 +85,6 @@
 .metrics .label {
     position: absolute;
     font-size: 10px;
-    color: black;
     margin-left: 3px;
     padding-left: 2px;
     padding-right: 2px;
@@ -233,11 +247,11 @@
 }
 
 .styles-section .selector {
-    color: #777;
+    color: #888;
 }
 
 .styles-section .selector-matches {
-    color: black;
+    color: #222;
 }
 
 .styles-section a[data-uncopyable] {
@@ -252,7 +266,7 @@
 .styles-section .properties {
     display: none;
     margin: 0;
-    padding: 2px 4px 0 6px;
+    padding: 2px 4px 0 0;
     list-style: none;
     clear: both;
 }
@@ -276,6 +290,7 @@
 .styles-section .properties li {
     margin-left: 12px;
     padding-left: 22px;
+    padding-top: 0;
     white-space: normal;
     text-overflow: ellipsis;
     overflow: hidden;
@@ -331,40 +346,30 @@
     display: block;
 }
 
-.styles-section .properties li.parent::before {
-    content: none;
+.styles-section.matched-styles .properties li.parent .expand-element {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    margin-right: 2px;
+    margin-left: -6px;
+    opacity: 0.55;
+    width: 8px;
+    height: 10px;
+    display: inline-block;
 }
 
-.styles-section .properties li.parent.expanded::before {
-    content: none;
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.styles-section.matched-styles .properties li.parent .expand-element {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
 }
 
 .styles-section.matched-styles .properties li.parent .expand-element {
-    content: url(Images/treeRightTriangleBlack.png);
-    margin-right: 1px;
-    margin-left: -5px;
-    opacity: 0.6;
+    background-position: -4px -96px;
 }
 
 .styles-section.matched-styles .properties li.parent.expanded .expand-element {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.styles-section.computed-style .properties li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    opacity: 0.75;
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 0;
-    padding-right: 3px;
-    -webkit-user-select: none;
-    cursor: default;
-}
-
-.styles-section.computed-style .properties li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-    margin-top: 1px;
+    background-position: -20px -96px;
 }
 
 .styles-section .properties li .info {
@@ -471,7 +476,7 @@
 }
 
 .event-bars .event-bar .header {
-    padding: 0 8px 0 18px;
+    padding: 0 8px 0 6px;
     min-height: 16px;
     opacity: 1.0;
     white-space: nowrap;
@@ -481,7 +486,6 @@
 
 .event-bars .event-bar .header .title {
     font-weight: normal;
-    color: black;
     text-shadow: white 0 1px 0;
 }
 
@@ -490,17 +494,31 @@
 }
 
 .event-bars .event-bar .header::before {
-    position: absolute;
-    top: 2px;
-    left: 7px;
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    float: left;
     width: 8px;
-    height: 8px;
-    opacity: 0.75;
-    content: url(Images/treeRightTriangleBlack.png) !important;
+    margin-right: 4px;
+    margin-top: 2px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.event-bars .event-bar .header::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.event-bars .event-bar .header::before {
+    background-position: -4px -96px;
 }
 
 .event-bars .event-bar.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png) !important;
+    background-position: -20px -96px;
 }
 
 .image-preview-container {
@@ -516,3 +534,69 @@
     -webkit-user-select: text;
     -webkit-user-drag: auto;
 }
+
+
+.sidebar-pane.composite {
+    overflow: hidden;
+    position: absolute;
+}
+
+.sidebar-pane.composite > .body {
+    height: 100%;
+}
+
+.sidebar-pane.composite .metrics {
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+    height: 206px;
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
+    -webkit-align-items: center;
+    -webkit-justify-content: center;
+}
+
+.sidebar-pane.composite .metrics-and-computed .sidebar-pane-toolbar {
+    margin-top: 4px;
+    margin-bottom: -4px;
+    position: relative;
+}
+
+.sidebar-pane.composite .sidebar-pane-toolbar > .sidebar-pane-subtitle {
+    left: 8px;
+}
+
+.sidebar-pane.composite .styles-section.read-only {
+    background-color: inherit;
+}
+
+.panel.elements .sidebar-pane-toolbar > select {
+    float: right;
+    width: 23px;
+    height: 17px;
+    color: transparent;
+    background-color: transparent;
+    border: none;
+    background-repeat: no-repeat;
+    margin: 1px 0 0 0;
+    padding: 0;
+    -webkit-border-radius: 0;
+    -webkit-appearance: none;
+}
+
+.panel.elements .sidebar-pane-toolbar > select:hover {
+    background-position: -23px 0px;
+}
+
+.panel.elements .sidebar-pane-toolbar > select:active {
+    background-position: -46px 0px;
+}
+
+.panel.elements .sidebar-pane-toolbar > select.select-settings {
+    background-image: url(Images/paneSettingsButtons.png);
+}
+
+.panel.elements .sidebar-pane-toolbar > select.select-filter {
+    background-image: url(Images/paneFilterButtons.png);
+}
+.panel.elements .sidebar-pane-toolbar > select > option, .panel.elements .sidebar-pane-toolbar > select > hr {
+    color: black;
+}
diff --git a/resources/inspector/filteredItemSelectionDialog.css b/resources/inspector/filteredItemSelectionDialog.css
index 3651071..8154050 100644
--- a/resources/inspector/filteredItemSelectionDialog.css
+++ b/resources/inspector/filteredItemSelectionDialog.css
@@ -1,10 +1,10 @@
-.js-outline-dialog > input {
+.filtered-item-list-dialog > input {
     font-size: 11px;
     width: 100%;
     height: 24px;
 }
 
-.js-outline-dialog > div.progress {
+.filtered-item-list-dialog > div.progress {
     position: absolute;
     top: 35px;
     left: 10px;
@@ -12,7 +12,7 @@
     height: 2px;
 }
 
-.js-outline-dialog > div.container {
+.filtered-item-list-dialog > div.container {
     position: absolute;
     top: 38px;
     bottom: 10px;
@@ -23,7 +23,7 @@
     background-color: white;
 }
 
-.js-outline-dialog > .container > div.item {
+.filtered-item-list-dialog-item {
     padding: 2px;
     white-space: nowrap;
     text-overflow: ellipsis;
@@ -31,17 +31,23 @@
     color: rgb(95, 95, 95);
 }
 
-.js-outline-dialog span.subtitle {
+.filtered-item-list-dialog-subtitle {
     color: rgb(155, 155, 155);
-    padding-right: 2px;
+}
+
+.filtered-item-list-dialog-item.one-row .filtered-item-list-dialog-subtitle {
     float: right;
 }
 
-.js-outline-dialog > .container > div.item.selected {
+.filtered-item-list-dialog-item.two-rows {
+    border-bottom: 1px solid rgb(235, 235, 235);
+}
+
+.filtered-item-list-dialog-item.selected {
     background-color: rgb(224, 224, 224);
 }
 
-.js-outline-dialog > .container > div.item span.highlight {
-    color: black;
+.filtered-item-list-dialog-item span.highlight {
+    color: #222;
     font-weight: bold;
 }
diff --git a/resources/inspector/flameChart.css b/resources/inspector/flameChart.css
new file mode 100644
index 0000000..205f293
--- /dev/null
+++ b/resources/inspector/flameChart.css
@@ -0,0 +1,23 @@
+.overview-container {
+    overflow: hidden;
+    position: absolute;
+    top: 0px;
+    width: 100%;
+    height: 80px;
+}
+
+.chart-container {
+    overflow: hidden;
+    position: absolute;
+    top: 80px;
+    width: 100%;
+    bottom: 0px;
+}
+
+#flame-chart-overview-grid .resources-dividers-label-bar {
+    pointer-events: auto;
+}
+
+#flame-chart-overview-container {
+    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+}
diff --git a/resources/inspector/heapProfiler.css b/resources/inspector/heapProfiler.css
index 73d5365..646ff27 100644
--- a/resources/inspector/heapProfiler.css
+++ b/resources/inspector/heapProfiler.css
@@ -124,6 +124,10 @@
     text-align: right;
 }
 
+.heap-snapshot-view .data-grid div.heap-snapshot-multiple-values {
+    float: right;
+}
+
 .heap-snapshot-view .data-grid span.percent-column {
     color: grey;
     width: 32px;
@@ -210,6 +214,7 @@
     width: 200px;
     height: 18px;
     font-size: 11px;
+    font-family: inherit;
     padding: 2px;
     margin: 2px 10px;
     background-color: white;
@@ -223,10 +228,6 @@
     background-position: right center, center;
     cursor: row-resize;
     height: 23px;
-    font: -webkit-small-control;
-    font-weight: bold;
-    color: rgb(48, 48, 48);
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
     display: block;
     position: absolute;
     left: 0;
diff --git a/resources/inspector/helpScreen.css b/resources/inspector/helpScreen.css
index 928181b..316e455 100644
--- a/resources/inspector/helpScreen.css
+++ b/resources/inspector/helpScreen.css
@@ -11,8 +11,8 @@
     max-height: 100%;
     color: white;
     background-color: rgba(17, 17, 17, 0.85);
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
     border-top-width: 0;
     border-radius: 10px;
 }
@@ -35,7 +35,7 @@
     overflow-y: auto;
     overflow-x: hidden;
     scrollbar-width: 11px;
-    -webkit-box-flex: 1;
+    -webkit-flex: 1;
     margin: 8px;
     padding: 0 4px;
     font-size: 13px;
@@ -159,11 +159,9 @@
 
 .help-section-title {
     font-weight: bold;
-    color: inherit;
 }
 
 .help-key {
-    color: black;
     font-weight: bold;
 }
 
@@ -172,7 +170,6 @@
 }
 
 .help-combine-keys, .help-key-delimiter {
-    color: black;
     font-size: 9px;
 }
 
@@ -256,7 +253,7 @@
 
 .help-content option {
     background-color: #EEEEEE;
-    color: black;
+    color: #222;
 }
 
 #settings-screen .help-window-main,
@@ -396,7 +393,7 @@
 }
 
 .settings-tab .help-section-title {
-    color: black;
+    color: #222;
 }
 
 .settings-tab .help-block label {
@@ -413,7 +410,7 @@
 }
 
 .settings-tab .help-block label:hover {
-    color: black;
+    color: #222;
 }
 
 .settings-tab p {
@@ -436,3 +433,57 @@
 .settings-tab select:disabled {
     background-color: rgb(221, 221, 221);
 }
+
+
+
+.settings-tab .file-systems-editor input.file-system-path {
+    width: 383px;
+}
+
+.settings-tab .file-mappings-editor .workspace-settings-row input {
+    width: 190px;
+}
+
+.settings-tab .file-mappings-editor .workspace-settings-row input.file-mapping-url {
+    margin-right: 3px;
+}
+
+#workspace-tab-content .button:hover {
+    opacity: 1.0 !important;
+}
+
+#workspace-tab-content .workspace-settings-row:hover .button {
+    visibility: visible;
+    opacity: 0.4;
+}
+
+#workspace-tab-content .workspace-settings-row .button {
+    width: 10px;
+    height: 10px;
+    border: none;
+    -webkit-appearance: none;
+    background-color: transparent;
+    visibility: hidden;
+    background-position: center;
+    margin: 0 0 0 4px;
+}
+
+#workspace-tab-content .workspace-settings-row .remove-button {
+    background-image: url(Images/deleteIcon.png);
+}
+
+#workspace-tab-content .workspace-settings-row .add-button {
+    background-image: url(Images/addIcon.png);
+}
+
+#workspace-tab-content .workspace-settings-row .file-system-add-button {
+    color: gray;
+    border: none;
+    border-bottom: 1px transparent solid;
+    -webkit-appearance: none;
+    background: transparent;
+}
+
+#workspace-tab-content .workspace-settings-row .file-system-add-button:hover {
+    border-bottom: 1px gray dashed;
+}
diff --git a/resources/inspector/inspector.css b/resources/inspector/inspector.css
new file mode 100644
index 0000000..36995d3
--- /dev/null
+++ b/resources/inspector/inspector.css
@@ -0,0 +1,6521 @@
+/* dialog.css */
+
+.dialog {
+    position: absolute;
+    
+    padding: 10px;
+    border-radius: 10px;
+    border: 1px solid gray;
+
+    -webkit-box-shadow: rgb(40,40,40) 0px 0px 50px;
+    
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
+    
+    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E9E9E9), to(#CFCFCF));
+    font-size: 11px;
+    font-family: 'Lucida Grande', sans-serif;
+}
+
+.dialog-contents {
+    width: 100%;
+    font-size: 11px;
+    font-family: 'Lucida Grande', sans-serif;
+}
+
+.go-to-line-dialog input {
+    font-size: 11px;
+}
+
+.go-to-line-dialog button {
+    font-size: 11px;
+    color: rgb(6, 6, 6);
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+
+    padding: 3px 20px;
+    margin: 0 0 0 10px;
+}
+
+.go-to-line-dialog button:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+/* inspector.css */
+
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+input[type="search"]:focus, input[type="text"]:focus {
+    outline: auto 5px -webkit-focus-ring-color;
+}
+
+.fill {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.inline-block {
+    display: inline-block;
+}
+
+.hidden {
+    display: none;
+}
+
+.nowrap {
+    white-space: nowrap !important;
+}
+
+#toolbar {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 26px;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
+    padding-top: 1px;
+    padding-left: 5px;
+    border-bottom: 1px solid rgb(80, 80, 80);
+    -webkit-flex-direction: row;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+body.show-toolbar-icons #toolbar {
+    height: 56px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #toolbar {
+    height: 34px;
+}
+
+body.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207)));
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.dock-to-bottom #toolbar {
+    padding-top: 0;
+    border-top: 1px solid rgb(100, 100, 100);
+    cursor: default;
+}
+
+body.dock-to-bottom.platform-mac #toolbar {
+    border-top-color: white;
+}
+
+body.dock-to-bottom.inactive #toolbar {
+    border-top: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.platform-windows #toolbar, body.platform-windows.inactive #toolbar {
+    background-image: none;
+}
+
+body.undocked.platform-mac-leopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
+}
+
+body.undocked.platform-mac-leopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
+}
+
+body.undocked.platform-mac-snowleopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(167, 167, 167))) !important;
+}
+
+body.undocked.platform-mac-snowleopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(228, 228, 228)), to(rgb(216, 216, 216))) !important;
+}
+
+body.undocked.platform-mac-mountain-lion #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(208, 208, 208)), to(rgb(200, 200, 200))) !important;
+}
+
+body.undocked.platform-mac-mountain-lion.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(238, 238, 238)), to(rgb(224, 224, 224))) !important;
+}
+
+.toolbar-item {
+    display: inline-block;
+    float: left;
+    margin: 0;
+    padding-right: 6px;
+    background-color: transparent;
+    border-style: none;
+    border-color: transparent;
+    color: inherit;
+    font-family: inherit;
+    font-size: inherit;
+}
+
+body:not(.show-toolbar-icons) .toolbar-item {
+    height: 24px;
+}
+
+body.show-toolbar-icons .toolbar-item.toggleable {
+    padding-top: 2px;
+    padding-bottom: 2px;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-item.toggleable {
+    margin: 2px 0;
+    padding-bottom: 2px;
+}
+
+.toolbar-item.toggleable.toggled-on {
+    border-width: 0 2px 0 2px;
+    padding-left: 4px;
+    padding-right: 4px;
+    -webkit-border-image: url(Images/toolbarItemSelected.png) 0 2 0 2;
+}
+
+.toolbar-icon {
+    display: none;
+    width: 32px;
+    height: 32px;
+    background-image: url(Images/toolbarIcons.png);
+    vertical-align: top;
+}
+
+body.show-toolbar-icons .toolbar-icon {
+    display: block;
+    margin: auto;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-icon {
+    width: 24px;
+    height: 24px;
+    display: inline-block;
+    vertical-align: middle;
+    background-image: url(Images/toolbarIconsSmall.png);
+}
+
+body.dock-to-bottom .toolbar-icon.custom-toolbar-icon {
+    background-position-x: -32px;
+}
+
+.toolbar-item:active .toolbar-icon {
+    background-position-y: 32px;
+}
+
+body.dock-to-bottom .toolbar-item:active .toolbar-icon {
+    background-position-y: 24px;
+}
+
+.toolbar-label {
+    line-height: 22px;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    display: inline;
+}
+
+.toolbar-item-close-button {
+    display: inline-block;
+    margin: auto 0 auto 4px;
+    color: #555;
+    line-height: 10px;
+    font-family: Arial, Helvetica, sans-serif !important;
+    font-size: 16px;
+    opacity: 0.4;
+}
+
+.toolbar-item .toolbar-item-close-button:hover {
+    opacity: 1;
+}
+
+#toolbar-dropdown .toolbar-items-separator {
+    border-bottom: 1px solid #aaa;
+    width: 100%;
+    margin: 5px 0;
+}
+
+body.show-toolbar-icons .toolbar-label {
+    line-height: 15px;
+}
+
+.toolbar-item.toggleable:active .toolbar-label {
+    text-shadow: none;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-label {
+    display: inline-block;
+    margin-left: 3px;
+    top: 0;
+    vertical-align: middle;
+}
+
+body.dock-to-bottom #search-toolbar-label {
+    display: none;
+}
+
+#toolbar-controls {
+    float: right;
+    display: -webkit-flex;
+    -webkit-align-items: center;
+    height: 100%;
+}
+
+#toolbar-dropdown-arrow {
+    font-size: 14px;
+    font-weight: bold;
+    border: 0;
+    background-color: transparent;
+    -webkit-border-radius: 5px;
+    text-shadow: none;
+    cursor: default;
+    margin: 0;
+    /* A line height of 0 allows precise text positioning using padding. */
+    line-height: 0;
+    padding: 11px 6px 11px;
+}
+
+#toolbar-dropdown-arrow.dropdown-visible {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(251, 251, 251, 0.9)), to(rgba(231, 231, 231, 0.9)));
+}
+
+#toolbar-dropdown-arrow:hover {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(191, 191, 191, 0.7)), to(rgba(171, 171, 171, 0.5)));
+}
+
+#toolbar-dropdown-arrow:active {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(111, 111, 111, 0.8)), to(rgba(91, 91, 91, 0.8)));
+}
+
+#toolbar-dropdown {
+    position: absolute;
+    z-index: 1000;
+    -webkit-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
+    border: 1px solid rgb(128, 128, 128);
+    background-color: inherit;
+    background-image: inherit;
+}
+
+body.show-toolbar-icons #toolbar-dropdown {
+    padding: 4px;
+}
+
+body.undocked.platform-mac-leopard #toolbar-dropdown,
+body.undocked.platform-mac-snowleopard #toolbar-dropdown {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
+}
+
+#toolbar-dropdown .scrollable-content {
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
+    -webkit-align-items: flex-start;
+    padding-right: 0;
+}
+
+#toolbar-dropdown .toolbar-item {
+    display: -webkit-flex;
+    -webkit-flex-direction: row;
+    width: 100%;
+    border: 1px solid rgba(0, 0, 0, 0);
+}
+
+body.show-toolbar-icons #toolbar-dropdown .toolbar-item {
+    position: relative;
+    left: -2px;
+    margin: 0px 2px;
+    padding: 4px;
+}
+
+#toolbar-dropdown .toolbar-item.toggleable.toggled-on {
+    border: 1px solid rgba(100, 100, 120, 0.4);
+    -webkit-border-image: none;
+    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.6)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.2)));
+}
+
+#toolbar-dropdown .toolbar-item.toggleable:hover {
+    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.3)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.1)));
+}
+
+#toolbar-dropdown .toolbar-icon {
+    margin-left: 0;
+    margin-right: 0.5em;
+}
+
+#toolbar-dropdown .toolbar-label {
+    line-height: 22px;
+    top: 0;
+}
+
+body.show-toolbar-icons #toolbar-dropdown .toolbar-label {
+    line-height: 32px;
+}
+
+#toolbar-panels-menu {
+    border: 0;
+    -webkit-border-radius: 5px;
+    cursor: default;
+    font-family: Arial, Helvetica, sans-serif !important;
+    font-weight: bold;
+    line-height: 16px;
+    height: 22px;
+    padding: 0 4px 0 4px;
+    margin: 1px 3px;
+}
+
+body.show-toolbar-icons #toolbar-panels-menu {
+    margin: 16px 3px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #toolbar-panels-menu {
+    margin: 6px 3px;
+}
+
+#toolbar-panels-menu:hover:not(.disabled) {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(191, 191, 191, 0.7)), to(rgba(171, 171, 171, 0.5)));
+}
+
+#toolbar-panels-menu.disabled {
+    opacity: 0.4;
+    text-shadow: white 1px 1px 0;
+}
+
+#toolbar-panels-menu:active:not(.disabled) {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(111, 111, 111, 0.8)), to(rgba(91, 91, 91, 0.8)));
+}
+
+.scrollable-content {
+    position: static;
+    height: 100%;
+    overflow-y: auto;
+    width: 100%;
+    margin-right: 12px;
+    padding-right: 3px;
+}
+
+.scrollable-content::-webkit-scrollbar {
+    width: 11px;
+}
+
+.scrollable-content::-webkit-scrollbar-corner,
+.scrollable-content::-webkit-resizer {
+    display: none;
+}
+
+.scrollable-content::-webkit-scrollbar-thumb:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(192, 192, 192)), to(rgb(192, 192, 192)), color-stop(40%, rgb(214, 214, 214)));
+    border-radius: 5px;
+    min-height: 20px;
+}
+
+.scrollable-content::-webkit-scrollbar-thumb:vertical:hover,
+.scrollable-content::-webkit-scrollbar-thumb:vertical:active {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(230, 230, 230)), to(rgb(230, 230, 230)), color-stop(40%, rgb(252, 252, 252)));
+}
+
+.scrollable-content::-webkit-scrollbar-track:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(128, 128, 128)), to(rgb(164, 164, 164)), color-stop(25%, rgb(164, 164, 164)));
+    border-radius: 5px;
+}
+
+.search-replace {
+    -webkit-appearance: none;
+    border: 0;
+    padding: 0 2px;
+    margin: 0;
+    width: 165px;
+}
+
+.filter {
+    -webkit-appearance: none;
+    border: 0;
+    padding: 0 2px;
+    margin: 0;
+    width: 251px;
+}
+
+.search-replace:focus {
+    outline: none;
+}
+
+.toolbar-search {
+    border-spacing: 1px;
+}
+
+.toolbar-search td {
+    padding: 0 5px 0 0;
+}
+
+.toolbar-search-navigation-controls {
+    position: absolute;
+    top: 0;
+    right: 0;
+    height: 18px;
+    background-image: -webkit-linear-gradient(rgb(228, 228, 228), rgb(206, 206, 206));
+}
+
+.toolbar-search-navigation {
+    display: inline-block;
+    width: 18px;
+    height: 18px;
+    background-repeat: no-repeat;
+    background-position: 4px 7px;
+    border-left: 1px solid rgb(170, 170, 170);
+    opacity: 0.3;
+}
+
+.toolbar-search-navigation.enabled {
+    opacity: 1.0;
+}
+
+.toolbar-search input[type="checkbox"] {
+    position: relative;
+    margin-top: -1px;
+    margin-left: 15px;
+    top: 2px;
+}
+
+.toolbar-search button {
+    border: 1px solid rgb(163, 163, 163);
+    border-radius: 8px;
+    margin: 0 0px;
+    font-size: 11px;
+    background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220));
+    width: 100%;
+}
+
+.toolbar-search button:active {
+    background-image: -webkit-linear-gradient(rgb(185, 185, 185), rgb(156, 156, 156));
+}
+
+.toolbar-search-control {
+    display: inline-block;
+    position: relative;
+    background-color: white;
+    border: 1px solid rgb(163, 163, 163);
+    height: 20px;
+    border-radius: 2px;
+    padding-top: 1px;
+}
+
+.toolbar-replace-control {
+    border: 1px solid rgb(163, 163, 163);
+    height: 20px;
+    border-radius: 2px;
+    width: 100%;
+}
+
+.toolbar-search-navigation.enabled:active {
+    background-position: 4px 7px, 0px 0px;
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-prev {
+    background-image: url(Images/searchPrev.png);
+    border-left: 1px solid rgb(163, 163, 163);
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-prev.enabled:active {
+    background-image: url(Images/searchPrev.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-next {
+    background-image: url(Images/searchNext.png);
+    border-left: 1px solid rgb(230, 230, 230);
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-next.enabled:active {
+    background-image: url(Images/searchNext.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
+}
+
+.search-results-matches {
+    display: inline-block;
+    min-width: 50px;
+    min-height: 10px;
+    margin-right: 36px;
+    text-align: right;
+    font-size: 11px;
+    padding: 0 4px;
+    color: rgb(165, 165, 165);
+}
+
+.toolbar-item.elements .toolbar-icon {
+    background-position-x: 0;
+}
+
+.toolbar-item.resources .toolbar-icon {
+    background-position-x: -32px;
+}
+
+body.dock-to-bottom .toolbar-item.resources .toolbar-icon {
+    background-position-x: -24px;
+}
+
+.toolbar-item.network .toolbar-icon {
+    background-position-x: -64px;
+}
+
+body.dock-to-bottom .toolbar-item.network .toolbar-icon {
+    background-position-x: -48px;
+}
+
+.toolbar-item.scripts .toolbar-icon {
+    background-position-x: -96px;
+}
+
+body.dock-to-bottom .toolbar-item.scripts .toolbar-icon {
+    background-position-x: -72px;
+}
+
+.toolbar-item.timeline .toolbar-icon {
+    background-position-x: -128px;
+}
+
+body.dock-to-bottom .toolbar-item.timeline .toolbar-icon {
+    background-position-x: -96px;
+}
+
+.toolbar-item.profiles .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.cpu-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.css-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.heap-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.canvas-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.memory-chart-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.memory-snapshot-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+body.dock-to-bottom .toolbar-item.profiles .toolbar-icon {
+    background-position-x: -120px;
+}
+
+.toolbar-item.audits .toolbar-icon {
+    background-position-x: -192px;
+}
+
+body.dock-to-bottom .toolbar-item.audits .toolbar-icon {
+    background-position-x: -144px;
+}
+
+.toolbar-item.console .toolbar-icon {
+    background-position-x: -224px;
+}
+
+body.dock-to-bottom .toolbar-item.console .toolbar-icon {
+    background-position-x: -168px;
+}
+
+#close-button-left, #close-button-right {
+    width: 14px;
+    height: 14px;
+    background-image: url(Images/closeButtons.png);
+    background-position: 0 0;
+}
+
+#close-button-left:hover, #close-button-right:hover {
+    background-position: 14px 0;
+}
+
+#close-button-left:active, #close-button-right:active {
+    background-position: 28px 0;
+}
+
+.close-left {
+    float: left;
+}
+
+body.undocked .toolbar-item.close-left, body.undocked .toolbar-item.close-right {
+    display: none;
+}
+
+body.platform-mac .toolbar-item.close-right {
+    display: none;
+}
+
+body.remote .toolbar-item.close-left, body.remote .toolbar-item.close-right {
+    display: none;
+}
+
+body:not(.platform-mac) .toolbar-item.close-left {
+    display: none;
+}
+
+.toolbar-item.close-left, .toolbar-item.close-right {
+  display: -webkit-flex;
+  -webkit-align-items: center;
+  height: 100%;
+  cursor: default;
+}
+
+#main {
+    position: absolute;
+    z-index: 1;
+    top: 26px;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    overflow: hidden;
+    background-color: white;
+}
+
+.animate-slow * {
+    -webkit-transition-duration: 2.5s !important;
+}
+
+.animate #main {
+    -webkit-transition: bottom 100ms linear;
+}
+
+body.show-toolbar-icons #main {
+    top: 56px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #main {
+    top: 34px;
+}
+
+#main-panels {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 23px;
+    overflow: hidden;
+}
+
+body.drawer-visible #main-panels {
+    bottom: 24px;
+}
+
+#main-status-bar {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.status-bar {
+    position: relative;
+    white-space: nowrap;
+    height: 23px;
+    overflow: hidden;
+    width: 100%;
+    z-index: 12;
+    background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235));
+    border-top: 1px solid rgb(202, 202, 202);
+    display: -webkit-flex;
+}
+
+.status-bar > div {
+    display: inline-block;
+    vertical-align: top;
+    overflow: visible;
+}
+
+.status-bar-item {
+    display: inline-block;
+    pointer-events: auto;
+    cursor: default;
+    height: 22px;
+    padding: 0;
+    margin-left: -1px;
+    margin-right: 0;
+    vertical-align: top;
+    border: 0 transparent none;
+    background-color: transparent;
+}
+
+#floating-status-bar-container {
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    display: none;
+    border-bottom: 1px solid rgb(202, 202, 202);
+    cursor: ns-resize;
+    height: 24px;
+}
+
+.animate #floating-status-bar-container {
+    -webkit-transition: padding 100ms linear;
+}
+
+body.drawer-visible #floating-status-bar-container {
+    display: -webkit-flex;
+}
+
+#floating-status-bar-resizer {
+    content: url(Images/statusbarResizerVertical.png);
+    margin-top: 7px;
+    pointer-events: none;
+    height: 8px;
+}
+
+#panel-status-bar {
+    -webkit-flex: 1 0;
+    display: -webkit-flex;
+    pointer-events: none;
+}
+
+#drawer-view-anchor {
+    display: inline-block;
+}
+
+.status-bar-item:active {
+    position: relative;
+    z-index: 200;
+}
+
+.glyph {
+    position: absolute;
+    top: -1px;
+    bottom: 1px;
+    left: 0;
+    right: 0;
+    background-color: rgba(0, 0, 0, 0.75);
+    z-index: 1;
+}
+
+.glyph.shadow {
+    top: 0;
+    bottom: 0;
+    background-color: white !important;
+    z-index: 0;
+}
+
+.long-click-glyph {
+    background-color: rgba(0, 0, 0, 0.75);
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-position: -288px -48px;
+    -webkit-mask-size: 320px 120px;
+    z-index: 1;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.long-click-glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.long-click-glyph.shadow {
+    top: 1px;
+    background-color: white !important;
+    z-index: 0;
+}
+
+button.status-bar-item {
+    position: relative;
+    width: 32px;
+    border-left: 1px solid rgb(202, 202, 202);
+    border-right: 1px solid rgb(202, 202, 202);
+}
+
+.status-bar button.status-bar-item .glyph {
+    margin: 0 -1px;
+}
+
+.status-bar select.status-bar-item:active,
+.status-bar button.status-bar-item:active {
+    border-left: 1px solid rgb(120, 120, 120);
+    border-right: 1px solid rgb(120, 120, 120);
+}
+
+button.status-bar-item .glyph.shadow {
+    background-color: rgba(255, 255, 255, 0.33) !important;
+}
+
+button.status-bar-item.toggled-on .glyph {
+    background-color: rgb(66, 129, 235);
+}
+
+button.status-bar-item:disabled {
+    opacity: 0.5;
+    background-position: 0 0 !important;
+}
+
+button.status-bar-item.extension {
+    background-image: none;
+    background-color: auto;
+}
+
+.status-bar-select-container {
+    display: inline-block;
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+    background-repeat: no-repeat;
+    background-position-x: right;
+    background-position-y: 5px;
+    padding-right: 10px;
+    border-right: 5px solid transparent;
+}
+
+select.status-bar-item {
+    min-width: 48px;
+    font-weight: bold;
+    color: rgb(48, 48, 48);
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+    -webkit-appearance: none;
+    border: 0;
+    border-radius: 0;
+    padding: 0 15px 0 5px;
+    margin-right: -15px;
+    position: relative;
+    top: -1px;
+}
+
+select.status-bar-item, select.status-bar-item:hover {
+    border-left: 1px solid rgb(202, 202, 202);
+    border-right: 1px solid rgb(202, 202, 202);
+}
+
+.status-bar-item > .glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.status-bar-item > .glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-undock .glyph {
+    -webkit-mask-position: 0 -48px;
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-bottom .glyph {
+    -webkit-mask-position: -32px -24px;
+    background-color: rgba(0, 0, 0, 0.75);
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-right .glyph {
+    -webkit-mask-position: -256px -48px;
+    background-color: rgba(0, 0, 0, 0.75);
+}
+
+body.undocked .alternate-status-bar-buttons-bar {
+    margin-left: 1px;
+}
+
+.alternate-status-bar-buttons-bar {
+    position: absolute;
+    width: 31px;
+    bottom: -3px;
+    background: white;
+}
+
+.alternate-status-bar-buttons-bar .status-bar-item {
+    height: 24px;
+    margin-top: -1px;
+    border: 1px solid rgb(202, 202, 202);
+    border-bottom: 1px solid transparent;
+}
+
+.alternate-status-bar-buttons-bar .status-bar-item.emulate-active {
+    background-color: rgb(163,163,163);
+    border: 1px solid rgb(120, 120, 120);
+    border-bottom: 1px solid transparent;
+}
+
+button.status-bar-item.settings-status-bar-item,
+button.status-bar-item.settings-status-bar-item:active {
+    border-right: 0 transparent none;
+}
+
+.settings-status-bar-item .glyph {
+    -webkit-mask-position: -160px -24px;
+}
+
+body.remote .dock-status-bar-item {
+    display: none;
+}
+
+.console-status-bar-item .glyph {
+    -webkit-mask-position: -64px -24px;
+}
+
+.clear-status-bar-item .glyph {
+    -webkit-mask-position: -64px 0;
+}
+
+#error-warning-count {
+    padding: 4px 6px 6px 0px;
+    font-size: 11px;
+    height: 19px;
+    cursor: pointer;
+    line-height: 14px;
+}
+
+#error-warning-count:hover {
+    border-bottom: 1px solid rgb(96, 96, 96);
+}
+
+#error-count-img {
+    content: url(Images/errorIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#error-count + #warning-count-img {
+    margin-left: 6px;
+}
+
+#warning-count-img {
+    content: url(Images/warningIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#drawer {
+    display: none;
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    height: 200px;
+    background-color: white;
+}
+
+.animate #drawer {
+    -webkit-transition: height 100ms linear;
+}
+
+#drawer-contents {
+    position: absolute;
+    top: 0;
+    bottom: 24px;
+    left: 0;
+    right: 0;
+}
+
+body.drawer-visible #drawer {
+    display: block;
+}
+
+body.platform-mac .monospace, body.platform-mac .source-code {
+    font-size: 11px !important;
+    font-family: Menlo, monospace;
+}
+
+body.platform-mac.platform-mac-tiger .monospace,
+body.platform-mac.platform-mac-tiger .source-code {
+    font-size: 10px !important;
+    font-family: Monaco, monospace;
+}
+
+body.platform-windows .monospace, body.platform-windows .source-code {
+    font-size: 12px !important;
+    font-family: Consolas, Lucida Console, monospace;
+}
+
+body.platform-linux .monospace, body.platform-linux .source-code {
+    font-size: 11px !important;
+    font-family: dejavu sans mono, monospace;
+}
+
+#console-view {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow-y: auto;
+}
+
+#console-messages {
+    position: absolute;
+    z-index: 0;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    padding: 2px 0;
+    overflow-y: overlay;
+    word-wrap: break-word;
+    -webkit-user-select: text;
+}
+
+#console-prompt {
+    clear: right;
+    position: relative;
+    border-top: 1px solid rgb(240, 240, 240);
+    padding: 1px 22px 1px 0px;
+    margin-left: 24px;
+    min-height: 16px;
+    white-space: pre-wrap;
+    -webkit-user-modify: read-write-plaintext-only;
+}
+
+#console-prompt::before {
+    background-image: url(Images/userInputIcon.png);
+}
+
+.console-user-command-result.console-log-level::before {
+    background-image: url(Images/userInputResultIcon.png);
+}
+
+.console-message, .console-user-command {
+    clear: right;
+    position: relative;
+    border-top: 1px solid rgb(240, 240, 240);
+    padding: 1px 22px 1px 0px;
+    margin-left: 24px;
+    min-height: 16px;
+}
+
+.console-mesage:first-child {
+    border-top: none;
+}
+
+.console-adjacent-user-command-result {
+    border-bottom: none;
+}
+
+.console-adjacent-user-command-result + .console-user-command-result.console-log-level::before {
+    background-image: none;
+}
+
+.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
+    position: absolute;
+    display: block;
+    content: "";
+    left: -17px;
+    top: 0.8em;
+    width: 10px;
+    height: 10px;
+    margin-top: -6px;
+    -webkit-user-select: none;
+}
+
+.console-message > .outline-disclosure li.parent::before {
+    top: 0;
+}
+
+.console-message .bubble {
+    display: inline-block;
+    height: 14px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    margin-top: -1px;
+    margin-right: 4px;
+    margin-left: -18px;
+    text-align: left;
+    font-size: 11px;
+    line-height: normal;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+.console-message-text {
+    white-space: pre-wrap;
+}
+
+.repeated-message.console-error-level::before, .repeated-message.console-warning-level:before, .repeated-message.console-debug-level:before {
+    visibility: hidden;
+}
+
+.repeated-message .outline-disclosure, .repeated-message > .console-message-text {
+    -webkit-flex: 1;
+}
+
+.console-info {
+    color: rgb(128, 128, 128);
+    font-style: italic;
+}
+
+.console-group .console-group > .console-group-messages {
+    margin-left: 16px;
+}
+
+.console-group-title {
+    font-weight: bold;
+}
+
+.console-group-title::before {
+    -webkit-user-select: none;
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+    float: left;
+    width: 8px;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    margin-left: 3px;
+    margin-top: -7px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.console-group-title::before {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.console-group .console-group-title::before {
+    -webkit-mask-position: -20px -96px;
+    background-color: rgb(110, 110, 110);
+}
+
+.console-group.collapsed .console-group-title::before {
+    -webkit-mask-position: -4px -96px;
+}
+
+.console-group.collapsed > .console-group-messages {
+    display: none;
+}
+
+.console-group {
+    position: relative;
+}
+
+.console-group-bracket {
+    position:absolute;
+    top: 15px;
+    left: 13px;
+    bottom: 5px;
+    width: 3px;
+    border-style: solid;
+    border-color: #A3A3A3;
+    border-width: 0px 0px 1px 1px;
+}
+
+.console-group.collapsed > .console-group-bracket {
+    display: none;
+}
+
+.console-error-level .console-message-text, .console-error-level .section > .header .title {
+    color: red !important;
+}
+
+.console-debug-level .console-message-text {
+    color: blue;
+}
+
+.console-debug-level::before {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+.console-error-level::before {
+    background-image: url(Images/errorIcon.png);
+}
+
+.console-warning-level::before {
+    background-image: url(Images/warningIcon.png);
+    margin-top: -7px;
+}
+
+.console-user-command .console-message {
+    margin-left: -24px;
+    padding-right: 0;
+    border-bottom: none;
+}
+
+.console-user-command::before {
+    background-image: url(Images/userInputPreviousIcon.png);
+}
+
+.console-user-command > .console-message-text {
+    color: rgb(0, 128, 255);
+}
+
+#console-messages a {
+    color: rgb(33%, 33%, 33%);
+    cursor: pointer;
+}
+
+#console-messages a:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+ol.watch-expressions > li.hovered {
+    background-color: #F0F0F0;
+}
+
+.console-message-url {
+    float: right;
+    text-align: right;
+    max-width: 100%;
+    margin-left: 4px;
+}
+
+.console-group-messages .section {
+    margin: 0 0 0 12px !important;
+}
+
+.console-group-messages .section > .header {
+    padding: 0 8px 0 0;
+    background-image: none;
+    border: none;
+    min-height: 0;
+}
+
+.console-group-messages .section > .header::before {
+    margin-left: -12px;
+}
+
+.console-group-messages .section > .header .title {
+    color: #222;
+    font-weight: normal;
+    line-height: 13px;
+}
+
+.console-group-messages .section .properties li .info {
+    padding-top: 0;
+    padding-bottom: 0;
+    color: rgb(60%, 60%, 60%);
+}
+
+.console-group-messages .outline-disclosure {
+    padding-left: 0;
+}
+
+.console-group-messages .outline-disclosure > ol {
+    padding: 0 0 0 12px !important;
+}
+
+.console-group-messages .outline-disclosure, .console-group-messages .outline-disclosure ol {
+    font-size: inherit;
+    line-height: 12px;
+}
+
+.console-group-messages .outline-disclosure.single-node li {
+    padding-left: 2px;
+}
+
+.console-group-messages .outline-disclosure li .selection {
+    margin-left: -6px;
+    margin-right: -6px;
+}
+
+.console-group-messages .add-attribute {
+    display: none;
+}
+
+.console-formatted-object, .console-formatted-node, .console-formatted-array {
+    position: relative;
+    display: inline-block;
+    vertical-align: top;
+    color: #222;
+}
+
+.console-formatted-node:hover {
+    background-color: rgba(56, 121, 217, 0.1);
+}
+
+.console-formatted-object .section, .console-formatted-node .section, .console-formatted-array .section {
+    position: static;
+}
+
+.console-formatted-object .section > .header::before {
+    margin-top: 0;
+}
+
+.console-formatted-object .properties, .console-formatted-node .properties {
+    padding-left: 0 !important;
+}
+
+.console-formatted-number {
+    color: rgb(28, 0, 207);
+}
+
+.console-formatted-string, .console-formatted-regexp {
+    color: rgb(196, 26, 22);
+    white-space: pre;
+}
+
+.console-formatted-null, .console-formatted-undefined {
+    color: rgb(128, 128, 128);
+}
+
+.console-formatted-preview-node,
+.section .console-formatted-node {
+    color: rgb(136, 18, 128);
+}
+
+.console-object-preview {
+    font-style: italic;
+}
+
+.object-info-state-note {
+    display: none;
+    width: 11px;
+    height: 11px;
+    background-color: rgb(179, 203, 247);
+    color: white;
+    text-align: center;
+    border-radius: 3px;
+    line-height: 13px;
+    margin: 0 6px;
+    font-size: 9px;
+}
+
+.object-info-state-note::before {
+    content: "i";
+}
+
+.section.expanded .object-info-state-note {
+    display: inline-block;
+}
+
+.error-message {
+    color: red;
+}
+
+.error-input {
+    background-color: rgb(220, 130, 130);
+}
+
+.auto-complete-text, .editing .auto-complete-text {
+    color: rgb(128, 128, 128) !important;
+    -webkit-user-select: none;
+    -webkit-user-modify: read-only;
+}
+
+.panel {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.panel.visible {
+    display: block;
+}
+
+iframe.extension {
+    width: 100%;
+    height: 100%;
+}
+
+iframe.panel.extension {
+    display: block;
+    height: 100%;
+}
+
+.webkit-line-gutter-backdrop {
+    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
+    width: 31px;
+    background-color: rgb(240, 240, 240);
+    border-right: 1px solid rgb(187, 187, 187);
+    position: absolute;
+    z-index: -1;
+    left: 0;
+    top: 0;
+    height: 100%
+}
+
+.outline-disclosure li.hovered:not(.selected) .selection {
+    display: block;
+    left: 3px;
+    right: 3px;
+    background-color: rgba(56, 121, 217, 0.1);
+    -webkit-border-radius: 5px;
+}
+
+.outline-disclosure li.highlighted .highlight {
+    background-color: rgb(255, 230, 179);
+    -webkit-border-radius: 4px;
+    padding-bottom: 2px;
+    margin-bottom: -2px;
+}
+
+.outline-disclosure li.selected.highlighted .highlight {
+    background-color: transparent;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+
+.outline-disclosure li .selection {
+    display: none;
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 15px;
+    z-index: -1;
+}
+
+.outline-disclosure li.selected .selection {
+    display: block;
+    background-color: rgb(212, 212, 212);
+}
+
+.outline-disclosure li.elements-drag-over .selection {
+    display: block;
+    margin-top: -2px;
+    border-top: 2px solid rgb(56, 121, 217);
+}
+
+.outline-disclosure ol:focus li.selected .selection {
+    background-color: rgb(56, 121, 217);
+}
+
+.outline-disclosure ol.search-match-not-found li.selected .selection {
+    border: 1px solid rgb(56, 121, 217);
+    background-color: white;
+}
+
+.outline-disclosure > ol {
+    position: relative;
+    padding: 2px 6px !important;
+    margin: 0;
+    cursor: default;
+    min-width: 100%;
+}
+
+.outline-disclosure, .outline-disclosure ol {
+    list-style-type: none;
+    -webkit-padding-start: 12px;
+    margin: 0;
+}
+
+.source-code {
+    font-family: monospace;
+    font-size: 11px !important;
+    white-space: pre-wrap;
+}
+
+.outline-disclosure li {
+    padding: 0 0 0 14px;
+    margin-top: 1px;
+    margin-left: -2px;
+    word-wrap: break-word;
+}
+
+.outline-disclosure ol:focus li.selected {
+    color: white;
+}
+
+.outline-disclosure ol.search-match-found li.selected {
+    color: white;
+}
+
+.outline-disclosure ol:focus li.selected * {
+    color: inherit;
+}
+
+.outline-disclosure ol.search-match-found li.selected * {
+    color: inherit;
+}
+
+.outline-disclosure li.parent {
+    margin-left: -12px
+}
+
+.outline-disclosure li .webkit-html-tag.close {
+    margin-left: -12px;
+}
+
+.webkit-html-tag.shadow, .webkit-html-fragment.shadow {
+    opacity: 0.6;
+}
+
+.outline-disclosure li.parent::before {
+    float: left;
+    width: 8px;
+    padding-right: 2px;
+}
+
+.outline-disclosure li.parent::before {
+    -webkit-user-select: none;
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    position: relative;
+    top: 2px;
+    margin-right: 1px;
+    height: 12px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.outline-disclosure li.parent::before {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.outline-disclosure li.parent::before {
+    -webkit-mask-position: -4px -96px;
+    background-color: rgb(110, 110, 110);
+}
+
+.outline-disclosure ol:focus li.parent.selected::before,
+.outline-disclosure ol.search-match-found li.parent.selected::before {
+    -webkit-mask-position: -4px -96px;
+    background-color: white;
+}
+
+.outline-disclosure li.parent.expanded::before {
+    -webkit-mask-position: -20px -96px;
+}
+
+.outline-disclosure ol:focus li.parent.expanded.selected::before,
+.outline-disclosure ol.search-match-found li.parent.expanded.selected::before {
+    -webkit-mask-position: -20px -96px;
+    background-color: white;
+}
+
+.outline-disclosure ol.children {
+    display: none;
+}
+
+.outline-disclosure ol.children.expanded {
+    display: block;
+}
+
+.placard {
+    position: relative;
+    margin-top: 1px;
+    padding: 3px 8px 4px 18px;
+    min-height: 18px;
+    white-space: nowrap;
+}
+
+.placard:nth-of-type(2n) {
+    background-color: rgb(234, 243, 255);
+}
+
+.placard.selected {
+    border-top: 1px solid rgb(172, 172, 172);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(182, 182, 182)), to(rgb(162, 162, 162)));
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .placard.selected {
+    border-top: 1px solid rgb(70, 103, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(56, 121, 217)));
+}
+
+.placard .title {
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+}
+
+.placard.selected .title {
+    color: white;
+    font-weight: bold;
+}
+
+.placard .subtitle {
+    float: right;
+    font-size: 10px;
+    margin-left: 5px;
+    color: rgba(0, 0, 0, 0.7);
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.placard.selected .subtitle {
+    color: rgba(255, 255, 255, 0.7);
+}
+
+.placard .subtitle a {
+    color: inherit;
+}
+
+.section {
+    position: relative;
+    margin-top: 1px;
+}
+
+.events-pane .section {
+    margin: 0;
+}
+.events-pane .section:not(:nth-of-type(1)) {
+    border-top: 1px solid rgb(231, 231, 231);
+}
+
+.section > .header {
+    padding: 0 8px 0 5px;
+    min-height: 18px;
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.section > .header::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    float: left;
+    width: 8px;
+    margin-right: 4px;
+    margin-top: 2px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.section > .header::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.section > .header::before {
+    background-position: -4px -96px;
+}
+
+.section.expanded > .header::before {
+    background-position: -20px -96px;
+}
+
+.section > .header .title, .event-bar .header .title {
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+    line-height: 18px;
+}
+
+.section > .header .title.blank-title {
+    font-style: italic;
+}
+
+.section > .header label, .event-bar .header label {
+    display: none;
+}
+
+.section.expanded .header label, .event-bar.expanded .header label {
+    display: inline;
+}
+
+.section > .header .subtitle, .event-bar .header .subtitle {
+    float: right;
+    margin-left: 5px;
+    max-width: 55%;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.section > .header .subtitle a {
+    color: inherit;
+}
+
+.section .properties, .event-bar .event-properties {
+    display: none;
+}
+
+.section.expanded .properties, .event-bar.expanded .event-properties {
+    display: block;
+}
+
+.event-bar .event-properties {
+    padding-left: 16px;
+}
+
+.section.no-affect .properties li {
+    opacity: 0.5;
+}
+
+.section.no-affect .properties li.editing {
+    opacity: 1.0;
+}
+
+.properties-tree {
+    margin: 0;
+    padding: 0 6px 2px;
+    list-style: none;
+    min-height: 18px;
+}
+
+.properties-tree li {
+    margin-left: 12px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    -webkit-user-select: text;
+    cursor: default;
+    padding-top: 2px;
+}
+
+.properties-tree li.parent {
+    margin-left: 1px;
+}
+
+
+.properties-tree li.parent::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    content: "a";
+    width: 8px;
+    float: left;
+    margin-right: 4px;
+    color: transparent;
+    text-shadow: none;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.properties-tree li.parent::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.properties-tree li.parent::before {
+    background-position: -4px -96px;
+}
+
+.properties-tree li.parent.expanded::before {
+    background-position: -20px -96px;
+}
+
+.properties-tree li .info {
+    padding-top: 4px;
+    padding-bottom: 3px;
+}
+
+.properties-tree ol {
+    display: none;
+    margin: 0;
+    -webkit-padding-start: 12px;
+    list-style: none;
+}
+
+.properties-tree ol.expanded {
+    display: block;
+}
+
+.editing {
+    -webkit-user-select: text;
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    outline: 1px solid rgb(66%, 66%, 66%) !important;
+    background-color: white;
+    -webkit-user-modify: read-write-plaintext-only;
+    text-overflow: clip !important;
+    padding-left: 2px;
+    margin-left: -2px;
+    padding-right: 2px;
+    margin-right: -2px;
+    margin-bottom: -1px;
+    padding-bottom: 1px;
+    opacity: 1.0 !important;
+}
+
+.editing, .editing * {
+    color: #222 !important;
+    text-decoration: none !important;
+}
+
+.child-editing {
+    color: #222 !important;
+    text-decoration: none !important;
+    overflow: visible !important;
+}
+
+.editing br {
+    display: none;
+}
+
+.section .properties li.editing {
+    margin-left: 10px;
+    text-overflow: clip;
+}
+
+li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-button {
+    display: none !important;
+}
+
+.properties-tree.watch-expressions {
+    padding-left: 0 !important;
+}
+
+.properties-tree.watch-expressions > li {
+    padding-left: 4px;
+}
+
+.properties-tree.watch-expressions > li > .value {
+    display: inline;
+    position: static;
+}
+
+.properties-tree.watch-expressions > li:not(.parent) {
+    margin-left: 1px;
+    padding-left: 15px;
+}
+
+.properties-tree.watch-expressions > li.hovered {
+    padding-right: 14px;
+}
+
+.watch-expressions > li.editing-sub-part .text-prompt {
+    display: block;
+    width: 100%;
+}
+
+.watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator  {
+    display: none;
+}
+
+.section .properties li.editing-sub-part {
+    padding: 3px 6px 8px 18px;
+    margin: -3px -6px -8px -6px;
+    text-overflow: clip;
+}
+
+.section .properties .delete-button {
+    width: 10px;
+    height: 10px;
+    background-image: url(Images/deleteIcon.png);
+    background-position: 0 0;
+    background-color: transparent;
+    background-repeat: no-repeat;
+    border: 0 none transparent;
+    position: absolute;
+    right: 8px;
+    display: none;
+}
+
+.section .properties li.hovered .delete-button {
+    display: inline;
+}
+
+.section .properties .name, .event-properties .name, .console-formatted-object .name {
+    color: rgb(136, 19, 145);
+}
+
+.section .properties .dimmed {
+    opacity: 0.6;
+}
+
+.section .properties .value.error {
+    color: red;
+}
+
+.section .properties .number, .event-properties .number {
+    color: blue;
+}
+
+.section .properties .keyword, .event-properties .keyword {
+    color: rgb(136, 19, 79);
+}
+
+.section .properties .color, .event-properties .color {
+    color: rgb(118, 15, 21);
+}
+
+.swatch {
+    margin-left: 1px;
+    margin-right: 2px;
+    width: 1em;
+    height: 1em;
+    position: relative;
+    top: 1px;
+    display: inline-block;
+    background-image: url(Images/checker.png);
+    -webkit-user-select: none;
+}
+
+.swatch-inner {
+    width: 100%;
+    height: 100%;
+    display: inline-block;
+    border: 1px solid rgba(128, 128, 128, 0.6);
+}
+
+.swatch-inner:hover {
+    border: 1px solid rgba(64, 64, 64, 0.8);
+}
+
+.sidebar {
+    overflow-x: hidden;
+    background-color: rgb(214, 221, 229);
+}
+
+body.inactive .sidebar {
+    background-color: rgb(232, 232, 232);
+}
+
+.pane-title-button {
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+.pane-title-button:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+button.show-all-nodes {
+    font-size: 13px;
+    margin: 0;
+    padding: 0 20px;
+    height: 20px;
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+body.inactive button.show-all-nodes {
+    color: rgb(130, 130, 130);
+    border-color: rgb(212, 212, 212);
+    background-color: rgb(239, 239, 239);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
+}
+
+button.show-all-nodes:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+button.enable-toggle-status-bar-item .glyph {
+    -webkit-mask-position: -192px 0;
+}
+
+button.enable-toggle-status-bar-item.toggled-on .glyph {
+    -webkit-mask-position: -96px -24px;
+}
+
+#console-messages.console-filter-top {
+    margin-top: 23px;
+}
+
+.scope-bar {
+    line-height: 19px;
+    padding-right: 10px;
+    overflow: hidden;
+}
+
+.scope-bar li {
+    display: inline-block;
+    margin: 0 2px;
+    padding: 2px 6px;
+    line-height: 12px;
+    font-weight: bold;
+    background: transparent;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    -webkit-border-radius: 8px;
+    vertical-align: middle;
+}
+
+.scope-bar-divider {
+    background-color: rgba(0, 0, 0, 0.4);
+    height: 16px;
+    width: 1px;
+    vertical-align: middle;
+    display: inline-block;
+}
+
+.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active {
+    color: white;
+    text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+}
+
+.scope-bar li.all {
+    margin: 0 8px;
+}
+
+.scope-bar li:hover {
+    background: rgba(0, 0, 0, 0.2);
+}
+
+.scope-bar li.selected {
+    background: rgba(0, 0, 0, 0.3);
+}
+
+.scope-bar li:active {
+    background: rgba(0, 0, 0, 0.5);
+}
+
+
+.console-warning-level.repeated-message,
+.console-error-level.repeated-message,
+.console-log-level.repeated-message,
+.console-debug-level.repeated-message{
+    display: -webkit-flex;
+}
+
+.console-user-command-result {
+    display: block;
+}
+
+.source-view-frame {
+    width: 100%;
+    height: 100%;
+}
+
+.sidebar-resizer-vertical {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    width: 5px;
+    z-index: 500;
+    cursor: ew-resize;
+}
+
+.sidebar-tree, .sidebar-tree .children {
+    position: relative;
+    padding: 0;
+    margin: 0;
+    list-style: none;
+}
+
+.sidebar-tree-section {
+    position: relative;
+    height: 18px;
+    padding: 1px 10px 6px 10px;
+    white-space: nowrap;
+    margin-top: 1px;
+    color: rgb(92, 110, 129);
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+}
+
+.sidebar-tree-item {
+    position: relative;
+    height: 36px;
+    padding: 0 5px 0 5px;
+    white-space: nowrap;
+    overflow-x: hidden;
+    overflow-y: hidden;
+    margin-top: 1px;
+    line-height: 34px;
+    border-top: 1px solid transparent;
+}
+
+.sidebar-tree .children {
+    display: none;
+}
+
+.sidebar-tree .children.expanded {
+    display: block;
+}
+
+.sidebar-tree-section + .children > .sidebar-tree-item {
+    padding-left: 10px !important;
+}
+
+.sidebar-tree-section + .children.small > .sidebar-tree-item {
+    padding-left: 17px !important;
+}
+
+.sidebar-tree > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree > .children > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree > .children.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree.some-expandable:not(.hide-disclosure-buttons) > .sidebar-tree-item:not(.parent) .icon {
+    margin-left: 16px;
+}
+
+.sidebar-tree-item .disclosure-button {
+    float: left;
+    width: 16px;
+    height: 100%;
+    border: 0;
+    background-color: transparent;
+    background-image: url(Images/disclosureTriangleSmallRight.png);
+    background-repeat: no-repeat;
+    background-position: center;
+    -webkit-apearance: none;
+}
+
+.sidebar-tree.hide-disclosure-buttons .sidebar-tree-item .disclosure-button {
+    display: none;
+}
+
+body.inactive .sidebar-tree-item .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
+}
+
+body.inactive .sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
+}
+
+body.inactive .sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownBlack.png);
+}
+
+.sidebar-tree-item.selected .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightWhite.png) !important;
+}
+
+.sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+}
+
+.sidebar-tree-item.selected.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownWhite.png) !important;
+}
+
+.sidebar-tree-item.selected .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownWhite.png) !important;
+}
+
+.sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDown.png);
+}
+
+.sidebar-tree-item .icon {
+    float: left;
+    width: 32px;
+    height: 32px;
+    margin-top: 1px;
+    margin-right: 3px;
+}
+
+li .status {
+    float: right;
+    height: 16px;
+    margin-top: 9px;
+    margin-left: 4px;
+    line-height: 1em;
+}
+
+li .status:empty {
+    display: none;
+}
+
+li .status .bubble {
+    display: inline-block;
+    height: 14px;
+    min-width: 16px;
+    margin-top: 1px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    text-align: center;
+    font-size: 11px;
+    line-height: normal;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+li .status .bubble:empty {
+    display: none;
+}
+
+li.selected .status .bubble {
+    background-color: white !important;
+    color: rgb(132, 154, 190) !important;
+}
+
+:focus li.selected .status .bubble {
+    color: rgb(36, 98, 172) !important;
+}
+
+body.inactive li.selected .status .bubble {
+    color: rgb(159, 159, 159) !important;
+}
+
+.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side {
+    height: 20px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
+    width: 16px;
+    height: 16px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
+    margin-top: 1px;
+}
+
+.sidebar-tree-item.selected {
+    color: white;
+    border-top: 1px solid rgb(145, 160, 192);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
+    text-shadow: rgba(0, 0, 0, 0.33) 1px 1px 0;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(68, 128, 200);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
+}
+
+body.inactive .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(151, 151, 151);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
+}
+
+.sidebar-tree-item .titles {
+    position: relative;
+    top: 5px;
+    line-height: 12px;
+    padding-bottom: 1px;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+}
+
+.sidebar-tree-item .titles.no-subtitle {
+    top: 10px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .titles, .sidebar-tree .children.small .sidebar-tree-item .titles, .sidebar-tree-item.small .titles {
+    top: 2px;
+    line-height: normal;
+}
+
+.sidebar-tree:not(.small) .sidebar-tree-item:not(.small) .title::after, .sidebar-tree .children:not(.small) .sidebar-tree-item .title::after {
+    content: "\A";
+    white-space: pre;
+}
+
+.sidebar-tree-item .subtitle {
+    font-size: 80%;
+}
+
+.sidebar-tree.small .sidebar-tree-item .subtitle, .sidebar-tree .children.small .sidebar-tree-item .subtitle, .sidebar-tree-item.small .subtitle {
+    display: none;
+}
+
+.sidebar-tree-item.selected .subtitle {
+    color: white;
+}
+
+.bubble.debug, .console-debug-level .bubble {
+    background-color: rgb(0, 0, 255) !important;
+}
+
+.bubble.warning, .console-warning-level .bubble {
+    background-color: rgb(232, 164, 0) !important;
+}
+
+.bubble.error, .console-error-level .bubble {
+    background-color: rgb(216, 35, 35) !important;
+}
+
+.bubble.search-matches {
+    background-image: url(Images/searchSmallWhite.png);
+    background-repeat: no-repeat;
+    background-position: 3px 2px;
+    padding-left: 13px !important;
+}
+
+li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBlue.png);
+}
+
+:focus li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+body.inactive li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallGray.png);
+}
+
+.storage-application-cache-status-icon, .storage-application-cache-connectivity-icon {
+    margin-bottom: -3px;
+    margin-left: 5px;
+    vertical-align: middle;
+}
+
+.status-bar-divider {
+    margin-left: 7px;
+    border-right: 1px solid #CCC;
+}
+
+.storage-application-cache-status, .storage-application-cache-connectivity {
+    position: relative;
+    top: 4px;
+}
+
+.status-bar-items {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 200px;
+    overflow: hidden;
+    border-left: 1px solid rgb(184, 184, 184);
+    margin-left: -1px;
+}
+
+.node-search-status-bar-item .glyph {
+    -webkit-mask-position: -224px -24px;
+}
+
+.delete-storage-status-bar-item .glyph {
+    -webkit-mask-position: -128px 0;
+}
+
+.clear-storage-status-bar-item .glyph {
+    -webkit-mask-position: -64px 0;
+}
+
+.refresh-storage-status-bar-item .glyph {
+    -webkit-mask-position: 0 0;
+}
+
+.webkit-html-js-node, .webkit-html-css-node {
+    white-space: pre;
+}
+
+.source-frame-breakpoint-condition {
+    z-index: 30;
+    padding: 4px;
+    background-color: rgb(203, 226, 255);
+    -webkit-border-radius: 7px;
+    border: 2px solid rgb(169, 172, 203);
+    width: 90%;
+    pointer-events: auto;
+}
+
+.source-frame-breakpoint-message {
+    background-color: transparent;
+    font-weight: normal;
+    font-size: 11px;
+    text-align: left;
+    text-shadow: none;
+    color: rgb(85, 85, 85);
+    cursor: default;
+    margin: 0 0 2px 0;
+}
+
+#source-frame-breakpoint-condition {
+    margin: 0;
+    border: 1px inset rgb(190, 190, 190) !important;
+    width: 100%;
+    box-shadow: none !important;
+    outline: none !important;
+    -webkit-user-modify: read-write;
+}
+
+.source-frame-popover-title {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+    font-weight: bold;
+    padding-left: 18px;
+}
+
+.source-frame-popover-tree {
+    border-top: 1px solid rgb(194, 194, 147);
+    overflow: auto;
+    position: absolute;
+    top: 15px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.source-frame-eval-expression {
+    outline: 1px solid rgb(163, 41, 34);
+    background-color: rgb(255, 255, 194);
+}
+
+.workers-list {
+    list-style: none;
+    margin: 0;
+    padding: 0;
+}
+
+.resource-content-unavailable {
+    color: rgb(50%, 50%, 50%);
+    font-style: italic;
+    font-size: 14px;
+    text-align: center;
+    padding: 32px;
+}
+
+.node-link {
+    text-decoration: underline;
+    cursor: pointer;
+}
+
+.cursor-pointer {
+    cursor: pointer;
+}
+
+.cursor-auto {
+    cursor: auto;
+}
+
+.please-wait-msg {
+    position: absolute;
+    left: 0;
+    top: 0;
+    border: 4px black solid;
+    border-radius: 4px;
+    background-color: black;
+    opacity: 0.85;
+    color: white;
+    font-size: 12px;
+    font-weight: bold;
+    z-index: 10000;
+}
+
+.resource-view.json {
+    padding: 5px;
+}
+
+.resource-view.html iframe {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+}
+
+.soft-context-menu-glass-pane {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    z-index: 20000;
+}
+
+.soft-context-menu {
+    position: absolute;
+    border: 1px solid rgba(196, 196, 196, 0.9);
+    border-top: 1px solid rgba(196, 196, 196, 0.5);
+    border-bottom: 1px solid rgba(150, 150, 150, 0.9);
+    padding: 4px 0 4px 0;
+    border-radius: 4px;
+    background-color: white;
+    -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
+}
+
+.soft-context-menu-item {
+    width: 100%;
+    line-height: 13px;
+    font-size: 14px;
+    border-top: 1px solid transparent;
+    border-bottom: 1px solid transparent;
+    padding: 2px 7px 2px 6px;
+    margin: 0 13px 0 0;
+    white-space: nowrap;
+}
+
+.soft-context-menu-separator {
+    height: 10px;
+    margin: 0 1px;
+}
+
+.soft-context-menu-separator > .separator-line {
+    margin: 0;
+    height: 5px;
+    border-bottom: 1px solid rgb(227, 227, 227);
+    pointer-events: none;
+}
+
+.soft-context-menu-item-mouse-over {
+    border-top: 1px solid rgb(56, 121, 217);
+    border-bottom: 1px solid rgb(56, 121, 217);
+    background-color: rgb(56, 121, 217);
+    color: white;
+}
+
+body.platform-mac .soft-context-menu-item-mouse-over {
+    border-top: 1px solid rgb(90, 131, 236);
+    border-bottom: 1px solid rgb(18, 88, 233);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(100, 140, 243)), to(rgb(36, 101, 243)));
+}
+
+.soft-context-menu-item-checkmark {
+    color: rgb(108, 108, 108);
+    pointer-events: none;
+}
+
+.soft-context-menu-item-submenu-arrow {
+    color: #222;
+    float: right;
+    pointer-events: none;
+}
+
+.soft-context-menu-item-mouse-over .soft-context-menu-item-checkmark {
+    color: white;
+}
+
+.search-view {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.search-drawer-header input[type="search"].search-config-search {
+    font-size: 11px;
+    margin-left: 4px;
+    color: #303030;
+    position: relative;
+}
+
+body.platform-mac .search-drawer-header input[type="search"].search-config-search {
+    top: 1px;
+}
+
+.search-drawer-header label.search-config-label {
+    margin-left: 8px;
+    color: #303030;
+}
+
+.search-drawer-header input[type="checkbox"].search-config-checkbox {
+    vertical-align: bottom;
+}
+
+body:not(.platform-mac) .search-drawer-header input[type="checkbox"].search-config-checkbox {
+    margin-bottom: 5px;
+}
+
+body.platform-mac .search-drawer-header input[type="checkbox"].search-config-checkbox {
+    margin-bottom: 4px;
+}
+
+.drawer-header {
+    font-size: 11px;
+    border-right: 1px solid rgb(197, 197, 197);
+    line-height: 21px;
+    padding-left: 6px;
+    display: inline-block;
+}
+
+.drawer-header-close-button {
+    padding: 3px 8px;
+    font-size: 14px;
+    color:rgb(80, 80, 80);
+    opacity: 0.5;
+    position: relative;
+    top: 1px;
+}
+
+.drawer-header-close-button:hover {
+    opacity: 1;
+}
+
+.drawer-header-close-button:active {
+    opacity: 0.7;
+}
+
+#bottom-status-bar-container {
+    -webkit-flex: 1 1 0;
+    width: 0;
+    overflow: hidden;
+}
+
+.animate #bottom-status-bar-container > * {
+    -webkit-transition: opacity 100ms linear;
+}
+
+.search-status-bar-item {
+    display: inline-block;
+    cursor: pointer;
+    font-size: 11px;
+    height: 23px;
+}
+
+.search-status-bar-message {
+    margin-left:5px;
+    margin-right:5px;
+    margin-top:5px;
+    float:left;
+}
+
+.progress-bar-stop-button-item {
+    width: 19px;
+    height: 24px;
+    overflow: hidden;
+}
+
+.progress-bar-stop-button .glyph {
+    -webkit-mask-position: -96px -48px;
+    background-color: rgb(216, 0, 0) !important;
+}
+
+.search-results-status-bar-message {
+    margin-right: 10px;
+    cursor: default;
+    font-size: 11px;
+    float: right;
+    margin-top: 5px;
+}
+
+.search-view .search-results {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow-y: auto;
+}
+
+#search-results-pane-file-based li {
+    list-style: none;
+}
+
+#search-results-pane-file-based ol {
+    -webkit-padding-start: 0;
+    margin-top: 0;
+}
+
+#search-results-pane-file-based ol.children {
+    display: none;
+}
+
+#search-results-pane-file-based ol.children.expanded {
+    display: block;
+}
+
+#search-results-pane-file-based li.parent::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    width: 8px;
+    content: "a";
+    color: transparent;
+    margin-left: -5px;
+    padding-right: 4px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+#search-results-pane-file-based li.parent::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+#search-results-pane-file-based li.parent::before {
+    background-position: -4px -96px;
+}
+
+#search-results-pane-file-based li.parent.expanded::before {
+    background-position: -20px -96px;
+}
+
+#search-results-pane-file-based .search-result {
+    font-size: 11px;
+    padding: 2px 0 2px 10px;
+    word-wrap: normal;
+    white-space: pre;
+    cursor: pointer;
+}
+
+#search-results-pane-file-based .search-result:hover {
+    background-color: rgba(121, 121, 121, 0.1);
+}
+
+#search-results-pane-file-based .search-result .search-result-file-name {
+    font-weight: bold;
+    color: #222;
+}
+
+#search-results-pane-file-based .search-result .search-result-matches-count {
+    margin-left: 5px;
+    color: #222;
+}
+
+#search-results-pane-file-based .show-more-matches {
+    padding: 4px 0;
+    color: #222;
+    cursor: pointer;
+    font-size: 11px;
+    margin-left: 20px;
+}
+
+#search-results-pane-file-based .show-more-matches:hover {
+    text-decoration: underline;
+}
+
+#search-results-pane-file-based .search-match {
+    word-wrap: normal;
+    white-space: pre;
+}
+
+#search-results-pane-file-based .search-match .webkit-line-number.search-match-line-number {
+    margin-right: 5px;
+    border-right: 1px solid #BBB;
+}
+
+#search-results-pane-file-based .search-match:not(:hover) .webkit-line-number.search-match-line-number {
+    background-color: #F0F0F0;
+}
+
+#search-results-pane-file-based .search-match:hover {
+    background-color: rgba(56, 121, 217, 0.1);
+}
+
+#search-results-pane-file-based .search-match .highlighted-match {
+    background-color: #F1EA00;
+}
+
+#search-results-pane-file-based a {
+    text-decoration: none;
+    display: block;
+}
+
+#search-results-pane-file-based .search-match .search-match-content {
+    color: #000;
+}
+
+.record-cpu-profile-status-bar-item .glyph, .record-profile-status-bar-item .glyph {
+    -webkit-mask-position: -288px 0;
+}
+
+.record-cpu-profile-status-bar-item.toggled-on .glyph, .record-profile-status-bar-item.toggled-on .glyph {
+    -webkit-mask-position: -288px -24px;
+    background-color: rgb(216, 0, 0) !important;
+}
+
+.storage-empty-view, .storage-view .storage-table-error {
+    position: absolute;
+    top: 0;
+    bottom: 25%;
+    left: 0;
+    right: 0;
+    font-size: 24px;
+    color: rgb(75%, 75%, 75%);
+    margin-top: auto;
+    margin-bottom: auto;
+    height: 50px;
+    line-height: 26px;
+    text-align: center;
+    font-weight: bold;
+    padding: 10px;
+    white-space: pre-wrap;
+}
+
+/* Generic suggest box style */
+
+.suggest-box.generic-suggest {
+    margin-left: -1px;
+    border-color: rgb(66%, 66%, 66%);
+}
+
+.suggest-box.generic-suggest.above-anchor {
+   border-radius: 5px 5px 5px 0;
+}
+
+.suggest-box.generic-suggest.under-anchor {
+   border-radius: 0 5px 5px 5px;
+}
+
+/* Custom popup scrollers */
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar, .custom-popup-vertical-scroll ::-webkit-scrollbar {
+    width: 11px;
+    height: 11px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-corner, .custom-popup-vertical-scroll ::-webkit-scrollbar-corner {
+    display: none;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-resizer, .custom-popup-vertical-scroll ::-webkit-resizer {
+    display: none;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-button, .custom-popup-vertical-scroll ::-webkit-scrollbar-button {
+    display: none;
+}
+
+/* Custom Horizontal Scrollbar Styles */
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar:horizontal:corner-present {
+    border-right-width: 0;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal {
+    -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px;
+    min-width: 20px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:hover {
+    -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:active {
+    -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:start {
+    margin-left: 5px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end {
+    margin-right: 5px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end:corner-present {
+    margin-right: 4px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:decrement {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 0 0 11px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:increment {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px 0 0;
+}
+
+/* Custom Vertical Scrollbar Styles */
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar:vertical:corner-present {
+    border-bottom-width: 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical {
+    -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0;
+    min-height: 20px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:hover {
+    -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:active {
+    -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:start {
+    margin-top: 5px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end {
+    margin-bottom: 5px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end:corner-present {
+    margin-bottom: 4px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:decrement {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0 0 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:increment {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 0 0 11px 0;
+}
+
+.console-context {
+    max-width: 200px;
+}
+
+.inspector-footer {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    font-size: 11px;
+    height: auto;
+}
+
+.progress-bar-container {
+    display: -webkit-flex;
+    margin: 0 8px;
+    -webkit-flex: 1 0;
+}
+
+.progress-bar-container span {
+    padding: 6px;
+}
+
+.progress-bar-container progress {
+    margin-top: 7px;
+    -webkit-flex: 1 0;
+}
+
+body.platform-mac .progress-bar-container progress {
+    margin-top: 6px;
+}
+
+.progress-bar-container button.status-bar-item {
+    border-left: none;
+    margin-top: 1px;
+}
+
+.source-frame-cursor-position {
+    padding-left: 6px;
+    padding-top: 4px;
+    display: inline-block;
+    pointer-events: auto;
+    -webkit-user-select: text;
+    font-size: 11px;
+    cursor: text;
+    line-height: 14px;
+}
+
+.elements-tree-outline li.parent::before {
+    top: 0 !important;
+}
+
+/* inspectorCommon.css */
+
+html {
+    height: 100%;
+}
+
+body {
+    cursor: default;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow: hidden;
+    font-family: Lucida Grande, sans-serif;
+    font-size: 11px;
+    margin: 0;
+    tab-size: 4;
+    -webkit-user-select: none;
+    color: #222;
+}
+
+body.platform-linux {
+  color: rgb(48, 57, 66);
+  font-family: Ubuntu, Arial, sans-serif;
+  font-size: 12px;
+}
+
+body.platform-mac {
+  color: rgb(48, 57, 66);
+  font-family: 'Lucida Grande', sans-serif;
+  font-size: 12px;
+}
+
+body.platform-windows {
+  font-family: 'Segoe UI', Tahoma, sans-serif;
+  font-size: 12px;
+}
+
+body.dock-to-right:not(.undocked) {
+    border-left: 1px solid rgb(80, 80, 80);
+}
+
+body.dock-to-right.inactive:not(.undocked) {
+    border-left: 1px solid rgb(64%, 64%, 64%);
+}
+
+* {
+    -webkit-box-sizing: border-box;
+}
+
+:focus {
+    outline: none;
+}
+
+img {
+    -webkit-user-drag: none;
+}
+
+iframe, a img {
+    border: none;
+}
+
+iframe.view {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+}
+
+.hidden {
+    display: none !important;
+}
+
+.monospace {
+    font-size: 10px !important;
+    font-family: monospace;
+}
+
+.resources-dividers {
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 100%;
+    top: 0;
+    z-index: -100;
+}
+
+.resources-event-dividers {
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 100%;
+    top: 0;
+    z-index: 300;
+    pointer-events: none;
+}
+
+.resources-dividers-label-bar {
+    position: absolute;
+    top: 0;
+    left: 0px;
+    right: 0;
+    background-color: rgba(255, 255, 255, 0.8);
+    background-clip: padding;
+    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+    height: 20px;
+    z-index: 200;
+    pointer-events: none;
+    cursor: move;
+    overflow: hidden;
+}
+
+.resources-divider {
+    position: absolute;
+    width: 1px;
+    top: 0;
+    bottom: 0;
+    background-color: rgba(0, 0, 0, 0.1);
+}
+
+.resources-event-divider-padding {
+    position: absolute;
+    width: 8px;
+    top: 0;
+    bottom: 0;
+    pointer-events: auto;
+}
+
+.resources-event-divider {
+    position: absolute;
+    width: 2px;
+    top: 0;
+    bottom: 0;
+    z-index: 300;
+}
+
+.resources-divider-label {
+    position: absolute;
+    top: 4px;
+    right: 3px;
+    font-size: 80%;
+    white-space: nowrap;
+    pointer-events: none;
+}
+
+.overview-grid-window-selector {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    background-color: rgba(125, 173, 217, 0.5);
+    z-index: 250;
+}
+
+.overview-grid-window {
+    background-color: white;
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 60px;
+    z-index: 150;
+}
+
+.overview-grid-dividers-background {
+    left: 0%;
+    right: 0%;
+    top: 0px;
+    bottom: 60px;
+    background-color: black;
+    position: absolute;
+}
+
+.overview-grid-window-rulers {
+    top: 0;
+    bottom: 0;
+    position: absolute;
+    opacity: 0.2;
+    border-right: 1px solid black;
+    border-left: 1px solid black;
+    z-index: 150;
+    pointer-events: none;
+}
+
+.overview-grid-window-resizer {
+    position: absolute;
+    top: 0px;
+    bottom: 60px;
+    width: 5px;
+    margin-left: -3px;
+    margin-right: -2px;
+    background-color: rgb(153, 153, 153);
+    z-index: 500;
+    cursor: ew-resize;
+    -webkit-border-radius: 2px;
+    -webkit-box-shadow: white 1px 0 0, white -1px 0 0, white 0 1px 0, white 0 -1px 0;
+}
+
+/* Network timing is shared between popover and network item view pane */
+
+.network-timing-row {
+    position: relative;
+    height: 16px;
+}
+
+.network-timing-bar {
+    position: absolute;
+    background-color: red;
+    border-left: 1px solid red;
+    opacity: 0.4;
+    top: 0;
+    bottom: 0;
+}
+
+.network-timing-bar-title {
+    position: absolute;
+    color: #222;
+    top: 1px;
+}
+
+.webkit-search-result {
+    -webkit-border-radius: 4px;
+    padding: 2px 2px 2px 3px;
+    margin: -2px -2px -2px -3px;
+    opacity: 0.8;
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    background-color: rgb(241, 234, 0);
+    color: #222;
+}
+
+.sidebar-separator {
+    background-color: rgb(230, 230, 230);
+    padding: 0 5px;
+    border-top: 1px solid rgb(189, 189, 189);
+    border-bottom: 1px solid rgb(189, 189, 189);
+    color: rgb(50, 50, 50);
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    line-height: 16px;
+}
+
+.sidebar-label {
+    font-size: 11px;
+}
+
+
+/* inspectorSyntaxHighlight.css */
+
+/*
+ * Copyright (C) 2009 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.webkit-css-comment {
+    color: rgb(0, 116, 0);
+}
+
+.webkit-css-url, .webkit-css-color, .webkit-css-string, .webkit-css-keyword {
+    color: rgb(7, 144, 154);
+ }
+
+.webkit-css-number {
+    color: rgb(50, 0, 255);
+}
+
+.webkit-css-property, .webkit-css-at-rule {
+    color: rgb(200, 0, 0);
+}
+
+.webkit-css-selector {
+    color: #222;
+}
+
+.webkit-css-bang-keyword {
+    color: rgb(200, 0, 180);
+}
+
+.webkit-javascript-undef {
+    color: rgb(123, 123, 123);
+}
+
+.webkit-javascript-comment {
+    color: rgb(0, 116, 0);
+}
+
+.webkit-javascript-keyword {
+    color: rgb(170, 13, 145);
+}
+
+.webkit-javascript-number {
+    color: rgb(28, 0, 207);
+}
+
+.webkit-javascript-string, .webkit-javascript-regexp {
+    color: rgb(196, 26, 22);
+}
+
+.webkit-javascript-ident {
+    color: #222;
+}
+
+.webkit-whitespace-1::before {
+    content: "·";
+}
+
+.webkit-whitespace-2::before {
+    content: "··";
+}
+
+.webkit-whitespace-4::before {
+    content: "····";
+}
+
+.webkit-whitespace-8::before {
+    content: "········";
+}
+
+.webkit-whitespace-16::before {
+    content: "················";
+}
+
+.webkit-whitespace::before {
+    position: absolute;
+    pointer-events: none;
+    color: rgb(175, 175, 175);
+}
+
+.webkit-html-comment {
+    /* Keep this in sync with view-source.css (.webkit-html-comment) */
+    color: rgb(35, 110, 37);
+}
+
+.webkit-html-tag {
+    /* Keep this in sync with view-source.css (.webkit-html-tag) */
+    color: rgb(136, 18, 128);
+}
+
+.webkit-html-doctype {
+    /* Keep this in sync with view-source.css (.webkit-html-doctype) */
+    color: rgb(192, 192, 192);
+}
+
+.webkit-html-attribute-name {
+    /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
+    color: rgb(153, 69, 0);
+}
+
+.webkit-html-attribute-value {
+    /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
+    color: rgb(26, 26, 166);
+}
+
+.webkit-html-external-link, .webkit-html-resource-link {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
+    color: #00e;
+}
+
+.webkit-html-external-link {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link) */
+    text-decoration: none;
+}
+
+.webkit-html-external-link:hover {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
+    text-decoration: underline;
+}
+
+/* popover.css */
+
+.popover {
+    position: absolute;
+    -webkit-border-image: url(Images/popoverBackground.png) 25 25 25 25;
+    border-width: 25px;
+    z-index: 100;
+    pointer-events: none;
+}
+
+.popover .content {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    pointer-events: auto;
+    overflow: auto;
+    -webkit-user-select: text;
+    line-height: 11px;
+}
+
+.popover .content.fixed-height {
+    overflow: hidden;
+} 
+
+.popover .arrow {
+    position: absolute;
+    background-image: url(Images/popoverArrows.png);
+    width: 19px;
+    height: 19px;
+    margin-left: 15px;
+    margin-top: -25px;
+    top: 0;
+    left: 0;
+}
+
+.popover.top-left-arrow .arrow {
+    /* The default is top-left, no styles needed. */
+}
+
+.popover.top-right-arrow .arrow {
+    right: 25px;
+    left: auto;
+}
+
+.popover.bottom-left-arrow .arrow {
+    top: auto;
+    bottom: 0;
+    margin-top: 0;
+    margin-bottom: -25px;
+    background-position: 0 -19px;
+}
+
+.popover.bottom-right-arrow .arrow {
+    right: 15px;
+    left: auto;
+    top: auto;
+    bottom: 0;
+    margin-top: 0;
+    margin-bottom: -25px;
+    background-position: 0 -19px;
+}
+
+.popover.left-top-arrow .arrow {
+    top: 0;
+    margin-top: 15px;
+    margin-left: -25px;
+    background-position: 0 -38px;
+}
+
+.popover.left-bottom-arrow .arrow {
+    top: auto;
+    bottom: 0;
+    margin-bottom: 15px;
+    margin-left: -25px;
+    background-position: 0 -38px;
+}
+
+.popover.right-top-arrow .arrow {
+    right: 0;
+    left: auto;
+    top: 0;
+    margin-top: 15px;
+    margin-right: -25px;
+    background-position: 0 -57px;
+}
+
+.popover.right-bottom-arrow .arrow {
+    right: 0;
+    left: auto;
+    top: auto;
+    bottom: 0;
+    margin-bottom: 15px;
+    margin-right: -25px;
+    background-position: 0 -57px;
+}
+
+.popover-details {
+    -webkit-user-select: text;
+    vertical-align: top;
+}
+
+.popover-function-name {
+    text-align: right;
+}
+
+.popover-stacktrace-title {
+    padding-top: 4px;
+}
+
+.popover-details-row-title {
+    font-weight: bold;
+    text-align: right;
+    white-space: nowrap;
+}
+
+.popover-details-row-data {
+    white-space: nowrap;
+}
+
+.popover-details-title {
+    border-bottom: 1px solid #B8B8B8;
+    font-size: 11px;
+    font-weight: bold;
+    padding-bottom: 5px;
+    padding-top: 0px;
+    white-space: nowrap;
+}
+
+/* inspector.css */
+
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+input[type="search"]:focus, input[type="text"]:focus {
+    outline: auto 5px -webkit-focus-ring-color;
+}
+
+.fill {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.inline-block {
+    display: inline-block;
+}
+
+.hidden {
+    display: none;
+}
+
+.nowrap {
+    white-space: nowrap !important;
+}
+
+#toolbar {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 26px;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
+    padding-top: 1px;
+    padding-left: 5px;
+    border-bottom: 1px solid rgb(80, 80, 80);
+    -webkit-flex-direction: row;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+body.show-toolbar-icons #toolbar {
+    height: 56px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #toolbar {
+    height: 34px;
+}
+
+body.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207)));
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.dock-to-bottom #toolbar {
+    padding-top: 0;
+    border-top: 1px solid rgb(100, 100, 100);
+    cursor: default;
+}
+
+body.dock-to-bottom.platform-mac #toolbar {
+    border-top-color: white;
+}
+
+body.dock-to-bottom.inactive #toolbar {
+    border-top: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.platform-windows #toolbar, body.platform-windows.inactive #toolbar {
+    background-image: none;
+}
+
+body.undocked.platform-mac-leopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
+}
+
+body.undocked.platform-mac-leopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
+}
+
+body.undocked.platform-mac-snowleopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(167, 167, 167))) !important;
+}
+
+body.undocked.platform-mac-snowleopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(228, 228, 228)), to(rgb(216, 216, 216))) !important;
+}
+
+body.undocked.platform-mac-mountain-lion #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(208, 208, 208)), to(rgb(200, 200, 200))) !important;
+}
+
+body.undocked.platform-mac-mountain-lion.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(238, 238, 238)), to(rgb(224, 224, 224))) !important;
+}
+
+.toolbar-item {
+    display: inline-block;
+    float: left;
+    margin: 0;
+    padding-right: 6px;
+    background-color: transparent;
+    border-style: none;
+    border-color: transparent;
+    color: inherit;
+    font-family: inherit;
+    font-size: inherit;
+}
+
+body:not(.show-toolbar-icons) .toolbar-item {
+    height: 24px;
+}
+
+body.show-toolbar-icons .toolbar-item.toggleable {
+    padding-top: 2px;
+    padding-bottom: 2px;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-item.toggleable {
+    margin: 2px 0;
+    padding-bottom: 2px;
+}
+
+.toolbar-item.toggleable.toggled-on {
+    border-width: 0 2px 0 2px;
+    padding-left: 4px;
+    padding-right: 4px;
+    -webkit-border-image: url(Images/toolbarItemSelected.png) 0 2 0 2;
+}
+
+.toolbar-icon {
+    display: none;
+    width: 32px;
+    height: 32px;
+    background-image: url(Images/toolbarIcons.png);
+    vertical-align: top;
+}
+
+body.show-toolbar-icons .toolbar-icon {
+    display: block;
+    margin: auto;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-icon {
+    width: 24px;
+    height: 24px;
+    display: inline-block;
+    vertical-align: middle;
+    background-image: url(Images/toolbarIconsSmall.png);
+}
+
+body.dock-to-bottom .toolbar-icon.custom-toolbar-icon {
+    background-position-x: -32px;
+}
+
+.toolbar-item:active .toolbar-icon {
+    background-position-y: 32px;
+}
+
+body.dock-to-bottom .toolbar-item:active .toolbar-icon {
+    background-position-y: 24px;
+}
+
+.toolbar-label {
+    line-height: 22px;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    display: inline;
+}
+
+.toolbar-item-close-button {
+    display: inline-block;
+    margin: auto 0 auto 4px;
+    color: #555;
+    line-height: 10px;
+    font-family: Arial, Helvetica, sans-serif !important;
+    font-size: 16px;
+    opacity: 0.4;
+}
+
+.toolbar-item .toolbar-item-close-button:hover {
+    opacity: 1;
+}
+
+#toolbar-dropdown .toolbar-items-separator {
+    border-bottom: 1px solid #aaa;
+    width: 100%;
+    margin: 5px 0;
+}
+
+body.show-toolbar-icons .toolbar-label {
+    line-height: 15px;
+}
+
+.toolbar-item.toggleable:active .toolbar-label {
+    text-shadow: none;
+}
+
+body.show-toolbar-icons.dock-to-bottom .toolbar-label {
+    display: inline-block;
+    margin-left: 3px;
+    top: 0;
+    vertical-align: middle;
+}
+
+body.dock-to-bottom #search-toolbar-label {
+    display: none;
+}
+
+#toolbar-controls {
+    float: right;
+    display: -webkit-flex;
+    -webkit-align-items: center;
+    height: 100%;
+}
+
+#toolbar-dropdown-arrow {
+    font-size: 14px;
+    font-weight: bold;
+    border: 0;
+    background-color: transparent;
+    -webkit-border-radius: 5px;
+    text-shadow: none;
+    cursor: default;
+    margin: 0;
+    /* A line height of 0 allows precise text positioning using padding. */
+    line-height: 0;
+    padding: 11px 6px 11px;
+}
+
+#toolbar-dropdown-arrow.dropdown-visible {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(251, 251, 251, 0.9)), to(rgba(231, 231, 231, 0.9)));
+}
+
+#toolbar-dropdown-arrow:hover {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(191, 191, 191, 0.7)), to(rgba(171, 171, 171, 0.5)));
+}
+
+#toolbar-dropdown-arrow:active {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(111, 111, 111, 0.8)), to(rgba(91, 91, 91, 0.8)));
+}
+
+#toolbar-dropdown {
+    position: absolute;
+    z-index: 1000;
+    -webkit-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
+    border: 1px solid rgb(128, 128, 128);
+    background-color: inherit;
+    background-image: inherit;
+}
+
+body.show-toolbar-icons #toolbar-dropdown {
+    padding: 4px;
+}
+
+body.undocked.platform-mac-leopard #toolbar-dropdown,
+body.undocked.platform-mac-snowleopard #toolbar-dropdown {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
+}
+
+#toolbar-dropdown .scrollable-content {
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
+    -webkit-align-items: flex-start;
+    padding-right: 0;
+}
+
+#toolbar-dropdown .toolbar-item {
+    display: -webkit-flex;
+    -webkit-flex-direction: row;
+    width: 100%;
+    border: 1px solid rgba(0, 0, 0, 0);
+}
+
+body.show-toolbar-icons #toolbar-dropdown .toolbar-item {
+    position: relative;
+    left: -2px;
+    margin: 0px 2px;
+    padding: 4px;
+}
+
+#toolbar-dropdown .toolbar-item.toggleable.toggled-on {
+    border: 1px solid rgba(100, 100, 120, 0.4);
+    -webkit-border-image: none;
+    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.6)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.2)));
+}
+
+#toolbar-dropdown .toolbar-item.toggleable:hover {
+    background: -webkit-gradient(linear, left top, left bottom, from(rgba(128, 128, 128, 0.6)), to(rgba(128, 128, 128, 0.3)), color-stop(20%, rgba(158, 158, 158, 0.2)), color-stop(80%, rgba(158, 158, 158, 0.1)));
+}
+
+#toolbar-dropdown .toolbar-icon {
+    margin-left: 0;
+    margin-right: 0.5em;
+}
+
+#toolbar-dropdown .toolbar-label {
+    line-height: 22px;
+    top: 0;
+}
+
+body.show-toolbar-icons #toolbar-dropdown .toolbar-label {
+    line-height: 32px;
+}
+
+#toolbar-panels-menu {
+    border: 0;
+    -webkit-border-radius: 5px;
+    cursor: default;
+    font-family: Arial, Helvetica, sans-serif !important;
+    font-weight: bold;
+    line-height: 16px;
+    height: 22px;
+    padding: 0 4px 0 4px;
+    margin: 1px 3px;
+}
+
+body.show-toolbar-icons #toolbar-panels-menu {
+    margin: 16px 3px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #toolbar-panels-menu {
+    margin: 6px 3px;
+}
+
+#toolbar-panels-menu:hover:not(.disabled) {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(191, 191, 191, 0.7)), to(rgba(171, 171, 171, 0.5)));
+}
+
+#toolbar-panels-menu.disabled {
+    opacity: 0.4;
+    text-shadow: white 1px 1px 0;
+}
+
+#toolbar-panels-menu:active:not(.disabled) {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(111, 111, 111, 0.8)), to(rgba(91, 91, 91, 0.8)));
+}
+
+.scrollable-content {
+    position: static;
+    height: 100%;
+    overflow-y: auto;
+    width: 100%;
+    margin-right: 12px;
+    padding-right: 3px;
+}
+
+.scrollable-content::-webkit-scrollbar {
+    width: 11px;
+}
+
+.scrollable-content::-webkit-scrollbar-corner,
+.scrollable-content::-webkit-resizer {
+    display: none;
+}
+
+.scrollable-content::-webkit-scrollbar-thumb:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(192, 192, 192)), to(rgb(192, 192, 192)), color-stop(40%, rgb(214, 214, 214)));
+    border-radius: 5px;
+    min-height: 20px;
+}
+
+.scrollable-content::-webkit-scrollbar-thumb:vertical:hover,
+.scrollable-content::-webkit-scrollbar-thumb:vertical:active {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(230, 230, 230)), to(rgb(230, 230, 230)), color-stop(40%, rgb(252, 252, 252)));
+}
+
+.scrollable-content::-webkit-scrollbar-track:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(128, 128, 128)), to(rgb(164, 164, 164)), color-stop(25%, rgb(164, 164, 164)));
+    border-radius: 5px;
+}
+
+.search-replace {
+    -webkit-appearance: none;
+    border: 0;
+    padding: 0 2px;
+    margin: 0;
+    width: 165px;
+}
+
+.filter {
+    -webkit-appearance: none;
+    border: 0;
+    padding: 0 2px;
+    margin: 0;
+    width: 251px;
+}
+
+.search-replace:focus {
+    outline: none;
+}
+
+.toolbar-search {
+    border-spacing: 1px;
+}
+
+.toolbar-search td {
+    padding: 0 5px 0 0;
+}
+
+.toolbar-search-navigation-controls {
+    position: absolute;
+    top: 0;
+    right: 0;
+    height: 18px;
+    background-image: -webkit-linear-gradient(rgb(228, 228, 228), rgb(206, 206, 206));
+}
+
+.toolbar-search-navigation {
+    display: inline-block;
+    width: 18px;
+    height: 18px;
+    background-repeat: no-repeat;
+    background-position: 4px 7px;
+    border-left: 1px solid rgb(170, 170, 170);
+    opacity: 0.3;
+}
+
+.toolbar-search-navigation.enabled {
+    opacity: 1.0;
+}
+
+.toolbar-search input[type="checkbox"] {
+    position: relative;
+    margin-top: -1px;
+    margin-left: 15px;
+    top: 2px;
+}
+
+.toolbar-search button {
+    border: 1px solid rgb(163, 163, 163);
+    border-radius: 8px;
+    margin: 0 0px;
+    font-size: 11px;
+    background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220));
+    width: 100%;
+}
+
+.toolbar-search button:active {
+    background-image: -webkit-linear-gradient(rgb(185, 185, 185), rgb(156, 156, 156));
+}
+
+.toolbar-search-control {
+    display: inline-block;
+    position: relative;
+    background-color: white;
+    border: 1px solid rgb(163, 163, 163);
+    height: 20px;
+    border-radius: 2px;
+    padding-top: 1px;
+}
+
+.toolbar-replace-control {
+    border: 1px solid rgb(163, 163, 163);
+    height: 20px;
+    border-radius: 2px;
+    width: 100%;
+}
+
+.toolbar-search-navigation.enabled:active {
+    background-position: 4px 7px, 0px 0px;
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-prev {
+    background-image: url(Images/searchPrev.png);
+    border-left: 1px solid rgb(163, 163, 163);
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-prev.enabled:active {
+    background-image: url(Images/searchPrev.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-next {
+    background-image: url(Images/searchNext.png);
+    border-left: 1px solid rgb(230, 230, 230);
+}
+
+.toolbar-search-navigation.toolbar-search-navigation-next.enabled:active {
+    background-image: url(Images/searchNext.png), -webkit-linear-gradient(rgb(168, 168, 168), rgb(116, 116, 116));
+}
+
+.search-results-matches {
+    display: inline-block;
+    min-width: 50px;
+    min-height: 10px;
+    margin-right: 36px;
+    text-align: right;
+    font-size: 11px;
+    padding: 0 4px;
+    color: rgb(165, 165, 165);
+}
+
+.toolbar-item.elements .toolbar-icon {
+    background-position-x: 0;
+}
+
+.toolbar-item.resources .toolbar-icon {
+    background-position-x: -32px;
+}
+
+body.dock-to-bottom .toolbar-item.resources .toolbar-icon {
+    background-position-x: -24px;
+}
+
+.toolbar-item.network .toolbar-icon {
+    background-position-x: -64px;
+}
+
+body.dock-to-bottom .toolbar-item.network .toolbar-icon {
+    background-position-x: -48px;
+}
+
+.toolbar-item.scripts .toolbar-icon {
+    background-position-x: -96px;
+}
+
+body.dock-to-bottom .toolbar-item.scripts .toolbar-icon {
+    background-position-x: -72px;
+}
+
+.toolbar-item.timeline .toolbar-icon {
+    background-position-x: -128px;
+}
+
+body.dock-to-bottom .toolbar-item.timeline .toolbar-icon {
+    background-position-x: -96px;
+}
+
+.toolbar-item.profiles .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.cpu-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.css-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.heap-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.canvas-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.memory-chart-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+.toolbar-item.memory-snapshot-profiler .toolbar-icon {
+    background-position-x: -160px;
+}
+
+body.dock-to-bottom .toolbar-item.profiles .toolbar-icon {
+    background-position-x: -120px;
+}
+
+.toolbar-item.audits .toolbar-icon {
+    background-position-x: -192px;
+}
+
+body.dock-to-bottom .toolbar-item.audits .toolbar-icon {
+    background-position-x: -144px;
+}
+
+.toolbar-item.console .toolbar-icon {
+    background-position-x: -224px;
+}
+
+body.dock-to-bottom .toolbar-item.console .toolbar-icon {
+    background-position-x: -168px;
+}
+
+#close-button-left, #close-button-right {
+    width: 14px;
+    height: 14px;
+    background-image: url(Images/closeButtons.png);
+    background-position: 0 0;
+}
+
+#close-button-left:hover, #close-button-right:hover {
+    background-position: 14px 0;
+}
+
+#close-button-left:active, #close-button-right:active {
+    background-position: 28px 0;
+}
+
+.close-left {
+    float: left;
+}
+
+body.undocked .toolbar-item.close-left, body.undocked .toolbar-item.close-right {
+    display: none;
+}
+
+body.platform-mac .toolbar-item.close-right {
+    display: none;
+}
+
+body.remote .toolbar-item.close-left, body.remote .toolbar-item.close-right {
+    display: none;
+}
+
+body:not(.platform-mac) .toolbar-item.close-left {
+    display: none;
+}
+
+.toolbar-item.close-left, .toolbar-item.close-right {
+  display: -webkit-flex;
+  -webkit-align-items: center;
+  height: 100%;
+  cursor: default;
+}
+
+#main {
+    position: absolute;
+    z-index: 1;
+    top: 26px;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    overflow: hidden;
+    background-color: white;
+}
+
+.animate-slow * {
+    -webkit-transition-duration: 2.5s !important;
+}
+
+.animate #main {
+    -webkit-transition: bottom 100ms linear;
+}
+
+body.show-toolbar-icons #main {
+    top: 56px;
+}
+
+body.show-toolbar-icons.dock-to-bottom #main {
+    top: 34px;
+}
+
+#main-panels {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 23px;
+    overflow: hidden;
+}
+
+body.drawer-visible #main-panels {
+    bottom: 24px;
+}
+
+#main-status-bar {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.status-bar {
+    position: relative;
+    white-space: nowrap;
+    height: 23px;
+    overflow: hidden;
+    width: 100%;
+    z-index: 12;
+    background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235));
+    border-top: 1px solid rgb(202, 202, 202);
+    display: -webkit-flex;
+}
+
+.status-bar > div {
+    display: inline-block;
+    vertical-align: top;
+    overflow: visible;
+}
+
+.status-bar-item {
+    display: inline-block;
+    pointer-events: auto;
+    cursor: default;
+    height: 22px;
+    padding: 0;
+    margin-left: -1px;
+    margin-right: 0;
+    vertical-align: top;
+    border: 0 transparent none;
+    background-color: transparent;
+}
+
+#floating-status-bar-container {
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    display: none;
+    border-bottom: 1px solid rgb(202, 202, 202);
+    cursor: ns-resize;
+    height: 24px;
+}
+
+.animate #floating-status-bar-container {
+    -webkit-transition: padding 100ms linear;
+}
+
+body.drawer-visible #floating-status-bar-container {
+    display: -webkit-flex;
+}
+
+#floating-status-bar-resizer {
+    content: url(Images/statusbarResizerVertical.png);
+    margin-top: 7px;
+    pointer-events: none;
+    height: 8px;
+}
+
+#panel-status-bar {
+    -webkit-flex: 1 0;
+    display: -webkit-flex;
+    pointer-events: none;
+}
+
+#drawer-view-anchor {
+    display: inline-block;
+}
+
+.status-bar-item:active {
+    position: relative;
+    z-index: 200;
+}
+
+.glyph {
+    position: absolute;
+    top: -1px;
+    bottom: 1px;
+    left: 0;
+    right: 0;
+    background-color: rgba(0, 0, 0, 0.75);
+    z-index: 1;
+}
+
+.glyph.shadow {
+    top: 0;
+    bottom: 0;
+    background-color: white !important;
+    z-index: 0;
+}
+
+.long-click-glyph {
+    background-color: rgba(0, 0, 0, 0.75);
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-position: -288px -48px;
+    -webkit-mask-size: 320px 120px;
+    z-index: 1;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.long-click-glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.long-click-glyph.shadow {
+    top: 1px;
+    background-color: white !important;
+    z-index: 0;
+}
+
+button.status-bar-item {
+    position: relative;
+    width: 32px;
+    border-left: 1px solid rgb(202, 202, 202);
+    border-right: 1px solid rgb(202, 202, 202);
+}
+
+.status-bar button.status-bar-item .glyph {
+    margin: 0 -1px;
+}
+
+.status-bar select.status-bar-item:active,
+.status-bar button.status-bar-item:active {
+    border-left: 1px solid rgb(120, 120, 120);
+    border-right: 1px solid rgb(120, 120, 120);
+}
+
+button.status-bar-item .glyph.shadow {
+    background-color: rgba(255, 255, 255, 0.33) !important;
+}
+
+button.status-bar-item.toggled-on .glyph {
+    background-color: rgb(66, 129, 235);
+}
+
+button.status-bar-item:disabled {
+    opacity: 0.5;
+    background-position: 0 0 !important;
+}
+
+button.status-bar-item.extension {
+    background-image: none;
+    background-color: auto;
+}
+
+.status-bar-select-container {
+    display: inline-block;
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+    background-repeat: no-repeat;
+    background-position-x: right;
+    background-position-y: 5px;
+    padding-right: 10px;
+    border-right: 5px solid transparent;
+}
+
+select.status-bar-item {
+    min-width: 48px;
+    font-weight: bold;
+    color: rgb(48, 48, 48);
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+    -webkit-appearance: none;
+    border: 0;
+    border-radius: 0;
+    padding: 0 15px 0 5px;
+    margin-right: -15px;
+    position: relative;
+    top: -1px;
+}
+
+select.status-bar-item, select.status-bar-item:hover {
+    border-left: 1px solid rgb(202, 202, 202);
+    border-right: 1px solid rgb(202, 202, 202);
+}
+
+.status-bar-item > .glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.status-bar-item > .glyph {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-undock .glyph {
+    -webkit-mask-position: 0 -48px;
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-bottom .glyph {
+    -webkit-mask-position: -32px -24px;
+    background-color: rgba(0, 0, 0, 0.75);
+}
+
+button.dock-status-bar-item.status-bar-item.toggled-right .glyph {
+    -webkit-mask-position: -256px -48px;
+    background-color: rgba(0, 0, 0, 0.75);
+}
+
+body.undocked .alternate-status-bar-buttons-bar {
+    margin-left: 1px;
+}
+
+.alternate-status-bar-buttons-bar {
+    position: absolute;
+    width: 31px;
+    bottom: -3px;
+    background: white;
+}
+
+.alternate-status-bar-buttons-bar .status-bar-item {
+    height: 24px;
+    margin-top: -1px;
+    border: 1px solid rgb(202, 202, 202);
+    border-bottom: 1px solid transparent;
+}
+
+.alternate-status-bar-buttons-bar .status-bar-item.emulate-active {
+    background-color: rgb(163,163,163);
+    border: 1px solid rgb(120, 120, 120);
+    border-bottom: 1px solid transparent;
+}
+
+button.status-bar-item.settings-status-bar-item,
+button.status-bar-item.settings-status-bar-item:active {
+    border-right: 0 transparent none;
+}
+
+.settings-status-bar-item .glyph {
+    -webkit-mask-position: -160px -24px;
+}
+
+body.remote .dock-status-bar-item {
+    display: none;
+}
+
+.console-status-bar-item .glyph {
+    -webkit-mask-position: -64px -24px;
+}
+
+.clear-status-bar-item .glyph {
+    -webkit-mask-position: -64px 0;
+}
+
+#error-warning-count {
+    padding: 4px 6px 6px 0px;
+    font-size: 11px;
+    height: 19px;
+    cursor: pointer;
+    line-height: 14px;
+}
+
+#error-warning-count:hover {
+    border-bottom: 1px solid rgb(96, 96, 96);
+}
+
+#error-count-img {
+    content: url(Images/errorIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#error-count + #warning-count-img {
+    margin-left: 6px;
+}
+
+#warning-count-img {
+    content: url(Images/warningIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#drawer {
+    display: none;
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    height: 200px;
+    background-color: white;
+}
+
+.animate #drawer {
+    -webkit-transition: height 100ms linear;
+}
+
+#drawer-contents {
+    position: absolute;
+    top: 0;
+    bottom: 24px;
+    left: 0;
+    right: 0;
+}
+
+body.drawer-visible #drawer {
+    display: block;
+}
+
+body.platform-mac .monospace, body.platform-mac .source-code {
+    font-size: 11px !important;
+    font-family: Menlo, monospace;
+}
+
+body.platform-mac.platform-mac-tiger .monospace,
+body.platform-mac.platform-mac-tiger .source-code {
+    font-size: 10px !important;
+    font-family: Monaco, monospace;
+}
+
+body.platform-windows .monospace, body.platform-windows .source-code {
+    font-size: 12px !important;
+    font-family: Consolas, Lucida Console, monospace;
+}
+
+body.platform-linux .monospace, body.platform-linux .source-code {
+    font-size: 11px !important;
+    font-family: dejavu sans mono, monospace;
+}
+
+#console-view {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow-y: auto;
+}
+
+#console-messages {
+    position: absolute;
+    z-index: 0;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    padding: 2px 0;
+    overflow-y: overlay;
+    word-wrap: break-word;
+    -webkit-user-select: text;
+}
+
+#console-prompt {
+    clear: right;
+    position: relative;
+    border-top: 1px solid rgb(240, 240, 240);
+    padding: 1px 22px 1px 0px;
+    margin-left: 24px;
+    min-height: 16px;
+    white-space: pre-wrap;
+    -webkit-user-modify: read-write-plaintext-only;
+}
+
+#console-prompt::before {
+    background-image: url(Images/userInputIcon.png);
+}
+
+.console-user-command-result.console-log-level::before {
+    background-image: url(Images/userInputResultIcon.png);
+}
+
+.console-message, .console-user-command {
+    clear: right;
+    position: relative;
+    border-top: 1px solid rgb(240, 240, 240);
+    padding: 1px 22px 1px 0px;
+    margin-left: 24px;
+    min-height: 16px;
+}
+
+.console-mesage:first-child {
+    border-top: none;
+}
+
+.console-adjacent-user-command-result {
+    border-bottom: none;
+}
+
+.console-adjacent-user-command-result + .console-user-command-result.console-log-level::before {
+    background-image: none;
+}
+
+.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
+    position: absolute;
+    display: block;
+    content: "";
+    left: -17px;
+    top: 0.8em;
+    width: 10px;
+    height: 10px;
+    margin-top: -6px;
+    -webkit-user-select: none;
+}
+
+.console-message > .outline-disclosure li.parent::before {
+    top: 0;
+}
+
+.console-message .bubble {
+    display: inline-block;
+    height: 14px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    margin-top: -1px;
+    margin-right: 4px;
+    margin-left: -18px;
+    text-align: left;
+    font-size: 11px;
+    line-height: normal;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+.console-message-text {
+    white-space: pre-wrap;
+}
+
+.repeated-message.console-error-level::before, .repeated-message.console-warning-level:before, .repeated-message.console-debug-level:before {
+    visibility: hidden;
+}
+
+.repeated-message .outline-disclosure, .repeated-message > .console-message-text {
+    -webkit-flex: 1;
+}
+
+.console-info {
+    color: rgb(128, 128, 128);
+    font-style: italic;
+}
+
+.console-group .console-group > .console-group-messages {
+    margin-left: 16px;
+}
+
+.console-group-title {
+    font-weight: bold;
+}
+
+.console-group-title::before {
+    -webkit-user-select: none;
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+    float: left;
+    width: 8px;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    margin-left: 3px;
+    margin-top: -7px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.console-group-title::before {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.console-group .console-group-title::before {
+    -webkit-mask-position: -20px -96px;
+    background-color: rgb(110, 110, 110);
+}
+
+.console-group.collapsed .console-group-title::before {
+    -webkit-mask-position: -4px -96px;
+}
+
+.console-group.collapsed > .console-group-messages {
+    display: none;
+}
+
+.console-group {
+    position: relative;
+}
+
+.console-group-bracket {
+    position:absolute;
+    top: 15px;
+    left: 13px;
+    bottom: 5px;
+    width: 3px;
+    border-style: solid;
+    border-color: #A3A3A3;
+    border-width: 0px 0px 1px 1px;
+}
+
+.console-group.collapsed > .console-group-bracket {
+    display: none;
+}
+
+.console-error-level .console-message-text, .console-error-level .section > .header .title {
+    color: red !important;
+}
+
+.console-debug-level .console-message-text {
+    color: blue;
+}
+
+.console-debug-level::before {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+.console-error-level::before {
+    background-image: url(Images/errorIcon.png);
+}
+
+.console-warning-level::before {
+    background-image: url(Images/warningIcon.png);
+    margin-top: -7px;
+}
+
+.console-user-command .console-message {
+    margin-left: -24px;
+    padding-right: 0;
+    border-bottom: none;
+}
+
+.console-user-command::before {
+    background-image: url(Images/userInputPreviousIcon.png);
+}
+
+.console-user-command > .console-message-text {
+    color: rgb(0, 128, 255);
+}
+
+#console-messages a {
+    color: rgb(33%, 33%, 33%);
+    cursor: pointer;
+}
+
+#console-messages a:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+ol.watch-expressions > li.hovered {
+    background-color: #F0F0F0;
+}
+
+.console-message-url {
+    float: right;
+    text-align: right;
+    max-width: 100%;
+    margin-left: 4px;
+}
+
+.console-group-messages .section {
+    margin: 0 0 0 12px !important;
+}
+
+.console-group-messages .section > .header {
+    padding: 0 8px 0 0;
+    background-image: none;
+    border: none;
+    min-height: 0;
+}
+
+.console-group-messages .section > .header::before {
+    margin-left: -12px;
+}
+
+.console-group-messages .section > .header .title {
+    color: #222;
+    font-weight: normal;
+    line-height: 13px;
+}
+
+.console-group-messages .section .properties li .info {
+    padding-top: 0;
+    padding-bottom: 0;
+    color: rgb(60%, 60%, 60%);
+}
+
+.console-group-messages .outline-disclosure {
+    padding-left: 0;
+}
+
+.console-group-messages .outline-disclosure > ol {
+    padding: 0 0 0 12px !important;
+}
+
+.console-group-messages .outline-disclosure, .console-group-messages .outline-disclosure ol {
+    font-size: inherit;
+    line-height: 12px;
+}
+
+.console-group-messages .outline-disclosure.single-node li {
+    padding-left: 2px;
+}
+
+.console-group-messages .outline-disclosure li .selection {
+    margin-left: -6px;
+    margin-right: -6px;
+}
+
+.console-group-messages .add-attribute {
+    display: none;
+}
+
+.console-formatted-object, .console-formatted-node, .console-formatted-array {
+    position: relative;
+    display: inline-block;
+    vertical-align: top;
+    color: #222;
+}
+
+.console-formatted-node:hover {
+    background-color: rgba(56, 121, 217, 0.1);
+}
+
+.console-formatted-object .section, .console-formatted-node .section, .console-formatted-array .section {
+    position: static;
+}
+
+.console-formatted-object .section > .header::before {
+    margin-top: 0;
+}
+
+.console-formatted-object .properties, .console-formatted-node .properties {
+    padding-left: 0 !important;
+}
+
+.console-formatted-number {
+    color: rgb(28, 0, 207);
+}
+
+.console-formatted-string, .console-formatted-regexp {
+    color: rgb(196, 26, 22);
+    white-space: pre;
+}
+
+.console-formatted-null, .console-formatted-undefined {
+    color: rgb(128, 128, 128);
+}
+
+.console-formatted-preview-node,
+.section .console-formatted-node {
+    color: rgb(136, 18, 128);
+}
+
+.console-object-preview {
+    font-style: italic;
+}
+
+.object-info-state-note {
+    display: none;
+    width: 11px;
+    height: 11px;
+    background-color: rgb(179, 203, 247);
+    color: white;
+    text-align: center;
+    border-radius: 3px;
+    line-height: 13px;
+    margin: 0 6px;
+    font-size: 9px;
+}
+
+.object-info-state-note::before {
+    content: "i";
+}
+
+.section.expanded .object-info-state-note {
+    display: inline-block;
+}
+
+.error-message {
+    color: red;
+}
+
+.error-input {
+    background-color: rgb(220, 130, 130);
+}
+
+.auto-complete-text, .editing .auto-complete-text {
+    color: rgb(128, 128, 128) !important;
+    -webkit-user-select: none;
+    -webkit-user-modify: read-only;
+}
+
+.panel {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.panel.visible {
+    display: block;
+}
+
+iframe.extension {
+    width: 100%;
+    height: 100%;
+}
+
+iframe.panel.extension {
+    display: block;
+    height: 100%;
+}
+
+.webkit-line-gutter-backdrop {
+    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
+    width: 31px;
+    background-color: rgb(240, 240, 240);
+    border-right: 1px solid rgb(187, 187, 187);
+    position: absolute;
+    z-index: -1;
+    left: 0;
+    top: 0;
+    height: 100%
+}
+
+.outline-disclosure li.hovered:not(.selected) .selection {
+    display: block;
+    left: 3px;
+    right: 3px;
+    background-color: rgba(56, 121, 217, 0.1);
+    -webkit-border-radius: 5px;
+}
+
+.outline-disclosure li.highlighted .highlight {
+    background-color: rgb(255, 230, 179);
+    -webkit-border-radius: 4px;
+    padding-bottom: 2px;
+    margin-bottom: -2px;
+}
+
+.outline-disclosure li.selected.highlighted .highlight {
+    background-color: transparent;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+
+.outline-disclosure li .selection {
+    display: none;
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 15px;
+    z-index: -1;
+}
+
+.outline-disclosure li.selected .selection {
+    display: block;
+    background-color: rgb(212, 212, 212);
+}
+
+.outline-disclosure li.elements-drag-over .selection {
+    display: block;
+    margin-top: -2px;
+    border-top: 2px solid rgb(56, 121, 217);
+}
+
+.outline-disclosure ol:focus li.selected .selection {
+    background-color: rgb(56, 121, 217);
+}
+
+.outline-disclosure ol.search-match-not-found li.selected .selection {
+    border: 1px solid rgb(56, 121, 217);
+    background-color: white;
+}
+
+.outline-disclosure > ol {
+    position: relative;
+    padding: 2px 6px !important;
+    margin: 0;
+    cursor: default;
+    min-width: 100%;
+}
+
+.outline-disclosure, .outline-disclosure ol {
+    list-style-type: none;
+    -webkit-padding-start: 12px;
+    margin: 0;
+}
+
+.source-code {
+    font-family: monospace;
+    font-size: 11px !important;
+    white-space: pre-wrap;
+}
+
+.outline-disclosure li {
+    padding: 0 0 0 14px;
+    margin-top: 1px;
+    margin-left: -2px;
+    word-wrap: break-word;
+}
+
+.outline-disclosure ol:focus li.selected {
+    color: white;
+}
+
+.outline-disclosure ol.search-match-found li.selected {
+    color: white;
+}
+
+.outline-disclosure ol:focus li.selected * {
+    color: inherit;
+}
+
+.outline-disclosure ol.search-match-found li.selected * {
+    color: inherit;
+}
+
+.outline-disclosure li.parent {
+    margin-left: -12px
+}
+
+.outline-disclosure li .webkit-html-tag.close {
+    margin-left: -12px;
+}
+
+.webkit-html-tag.shadow, .webkit-html-fragment.shadow {
+    opacity: 0.6;
+}
+
+.outline-disclosure li.parent::before {
+    float: left;
+    width: 8px;
+    padding-right: 2px;
+}
+
+.outline-disclosure li.parent::before {
+    -webkit-user-select: none;
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+    -webkit-mask-size: 320px 120px;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    position: relative;
+    top: 2px;
+    margin-right: 1px;
+    height: 12px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.outline-disclosure li.parent::before {
+    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.outline-disclosure li.parent::before {
+    -webkit-mask-position: -4px -96px;
+    background-color: rgb(110, 110, 110);
+}
+
+.outline-disclosure ol:focus li.parent.selected::before,
+.outline-disclosure ol.search-match-found li.parent.selected::before {
+    -webkit-mask-position: -4px -96px;
+    background-color: white;
+}
+
+.outline-disclosure li.parent.expanded::before {
+    -webkit-mask-position: -20px -96px;
+}
+
+.outline-disclosure ol:focus li.parent.expanded.selected::before,
+.outline-disclosure ol.search-match-found li.parent.expanded.selected::before {
+    -webkit-mask-position: -20px -96px;
+    background-color: white;
+}
+
+.outline-disclosure ol.children {
+    display: none;
+}
+
+.outline-disclosure ol.children.expanded {
+    display: block;
+}
+
+.placard {
+    position: relative;
+    margin-top: 1px;
+    padding: 3px 8px 4px 18px;
+    min-height: 18px;
+    white-space: nowrap;
+}
+
+.placard:nth-of-type(2n) {
+    background-color: rgb(234, 243, 255);
+}
+
+.placard.selected {
+    border-top: 1px solid rgb(172, 172, 172);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(182, 182, 182)), to(rgb(162, 162, 162)));
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .placard.selected {
+    border-top: 1px solid rgb(70, 103, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(56, 121, 217)));
+}
+
+.placard .title {
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+}
+
+.placard.selected .title {
+    color: white;
+    font-weight: bold;
+}
+
+.placard .subtitle {
+    float: right;
+    font-size: 10px;
+    margin-left: 5px;
+    color: rgba(0, 0, 0, 0.7);
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.placard.selected .subtitle {
+    color: rgba(255, 255, 255, 0.7);
+}
+
+.placard .subtitle a {
+    color: inherit;
+}
+
+.section {
+    position: relative;
+    margin-top: 1px;
+}
+
+.events-pane .section {
+    margin: 0;
+}
+.events-pane .section:not(:nth-of-type(1)) {
+    border-top: 1px solid rgb(231, 231, 231);
+}
+
+.section > .header {
+    padding: 0 8px 0 5px;
+    min-height: 18px;
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.section > .header::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    content: "a";
+    color: transparent;
+    text-shadow: none;
+    float: left;
+    width: 8px;
+    margin-right: 4px;
+    margin-top: 2px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.section > .header::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.section > .header::before {
+    background-position: -4px -96px;
+}
+
+.section.expanded > .header::before {
+    background-position: -20px -96px;
+}
+
+.section > .header .title, .event-bar .header .title {
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+    line-height: 18px;
+}
+
+.section > .header .title.blank-title {
+    font-style: italic;
+}
+
+.section > .header label, .event-bar .header label {
+    display: none;
+}
+
+.section.expanded .header label, .event-bar.expanded .header label {
+    display: inline;
+}
+
+.section > .header .subtitle, .event-bar .header .subtitle {
+    float: right;
+    margin-left: 5px;
+    max-width: 55%;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.section > .header .subtitle a {
+    color: inherit;
+}
+
+.section .properties, .event-bar .event-properties {
+    display: none;
+}
+
+.section.expanded .properties, .event-bar.expanded .event-properties {
+    display: block;
+}
+
+.event-bar .event-properties {
+    padding-left: 16px;
+}
+
+.section.no-affect .properties li {
+    opacity: 0.5;
+}
+
+.section.no-affect .properties li.editing {
+    opacity: 1.0;
+}
+
+.properties-tree {
+    margin: 0;
+    padding: 0 6px 2px;
+    list-style: none;
+    min-height: 18px;
+}
+
+.properties-tree li {
+    margin-left: 12px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    -webkit-user-select: text;
+    cursor: default;
+    padding-top: 2px;
+}
+
+.properties-tree li.parent {
+    margin-left: 1px;
+}
+
+
+.properties-tree li.parent::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    content: "a";
+    width: 8px;
+    float: left;
+    margin-right: 4px;
+    color: transparent;
+    text-shadow: none;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.properties-tree li.parent::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.properties-tree li.parent::before {
+    background-position: -4px -96px;
+}
+
+.properties-tree li.parent.expanded::before {
+    background-position: -20px -96px;
+}
+
+.properties-tree li .info {
+    padding-top: 4px;
+    padding-bottom: 3px;
+}
+
+.properties-tree ol {
+    display: none;
+    margin: 0;
+    -webkit-padding-start: 12px;
+    list-style: none;
+}
+
+.properties-tree ol.expanded {
+    display: block;
+}
+
+.editing {
+    -webkit-user-select: text;
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    outline: 1px solid rgb(66%, 66%, 66%) !important;
+    background-color: white;
+    -webkit-user-modify: read-write-plaintext-only;
+    text-overflow: clip !important;
+    padding-left: 2px;
+    margin-left: -2px;
+    padding-right: 2px;
+    margin-right: -2px;
+    margin-bottom: -1px;
+    padding-bottom: 1px;
+    opacity: 1.0 !important;
+}
+
+.editing, .editing * {
+    color: #222 !important;
+    text-decoration: none !important;
+}
+
+.child-editing {
+    color: #222 !important;
+    text-decoration: none !important;
+    overflow: visible !important;
+}
+
+.editing br {
+    display: none;
+}
+
+.section .properties li.editing {
+    margin-left: 10px;
+    text-overflow: clip;
+}
+
+li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-button {
+    display: none !important;
+}
+
+.properties-tree.watch-expressions {
+    padding-left: 0 !important;
+}
+
+.properties-tree.watch-expressions > li {
+    padding-left: 4px;
+}
+
+.properties-tree.watch-expressions > li > .value {
+    display: inline;
+    position: static;
+}
+
+.properties-tree.watch-expressions > li:not(.parent) {
+    margin-left: 1px;
+    padding-left: 15px;
+}
+
+.properties-tree.watch-expressions > li.hovered {
+    padding-right: 14px;
+}
+
+.watch-expressions > li.editing-sub-part .text-prompt {
+    display: block;
+    width: 100%;
+}
+
+.watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator  {
+    display: none;
+}
+
+.section .properties li.editing-sub-part {
+    padding: 3px 6px 8px 18px;
+    margin: -3px -6px -8px -6px;
+    text-overflow: clip;
+}
+
+.section .properties .delete-button {
+    width: 10px;
+    height: 10px;
+    background-image: url(Images/deleteIcon.png);
+    background-position: 0 0;
+    background-color: transparent;
+    background-repeat: no-repeat;
+    border: 0 none transparent;
+    position: absolute;
+    right: 8px;
+    display: none;
+}
+
+.section .properties li.hovered .delete-button {
+    display: inline;
+}
+
+.section .properties .name, .event-properties .name, .console-formatted-object .name {
+    color: rgb(136, 19, 145);
+}
+
+.section .properties .dimmed {
+    opacity: 0.6;
+}
+
+.section .properties .value.error {
+    color: red;
+}
+
+.section .properties .number, .event-properties .number {
+    color: blue;
+}
+
+.section .properties .keyword, .event-properties .keyword {
+    color: rgb(136, 19, 79);
+}
+
+.section .properties .color, .event-properties .color {
+    color: rgb(118, 15, 21);
+}
+
+.swatch {
+    margin-left: 1px;
+    margin-right: 2px;
+    width: 1em;
+    height: 1em;
+    position: relative;
+    top: 1px;
+    display: inline-block;
+    background-image: url(Images/checker.png);
+    -webkit-user-select: none;
+}
+
+.swatch-inner {
+    width: 100%;
+    height: 100%;
+    display: inline-block;
+    border: 1px solid rgba(128, 128, 128, 0.6);
+}
+
+.swatch-inner:hover {
+    border: 1px solid rgba(64, 64, 64, 0.8);
+}
+
+.sidebar {
+    overflow-x: hidden;
+    background-color: rgb(214, 221, 229);
+}
+
+body.inactive .sidebar {
+    background-color: rgb(232, 232, 232);
+}
+
+.pane-title-button {
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+.pane-title-button:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+button.show-all-nodes {
+    font-size: 13px;
+    margin: 0;
+    padding: 0 20px;
+    height: 20px;
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+body.inactive button.show-all-nodes {
+    color: rgb(130, 130, 130);
+    border-color: rgb(212, 212, 212);
+    background-color: rgb(239, 239, 239);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
+}
+
+button.show-all-nodes:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+button.enable-toggle-status-bar-item .glyph {
+    -webkit-mask-position: -192px 0;
+}
+
+button.enable-toggle-status-bar-item.toggled-on .glyph {
+    -webkit-mask-position: -96px -24px;
+}
+
+#console-messages.console-filter-top {
+    margin-top: 23px;
+}
+
+.scope-bar {
+    line-height: 19px;
+    padding-right: 10px;
+    overflow: hidden;
+}
+
+.scope-bar li {
+    display: inline-block;
+    margin: 0 2px;
+    padding: 2px 6px;
+    line-height: 12px;
+    font-weight: bold;
+    background: transparent;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    -webkit-border-radius: 8px;
+    vertical-align: middle;
+}
+
+.scope-bar-divider {
+    background-color: rgba(0, 0, 0, 0.4);
+    height: 16px;
+    width: 1px;
+    vertical-align: middle;
+    display: inline-block;
+}
+
+.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active {
+    color: white;
+    text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+}
+
+.scope-bar li.all {
+    margin: 0 8px;
+}
+
+.scope-bar li:hover {
+    background: rgba(0, 0, 0, 0.2);
+}
+
+.scope-bar li.selected {
+    background: rgba(0, 0, 0, 0.3);
+}
+
+.scope-bar li:active {
+    background: rgba(0, 0, 0, 0.5);
+}
+
+
+.console-warning-level.repeated-message,
+.console-error-level.repeated-message,
+.console-log-level.repeated-message,
+.console-debug-level.repeated-message{
+    display: -webkit-flex;
+}
+
+.console-user-command-result {
+    display: block;
+}
+
+.source-view-frame {
+    width: 100%;
+    height: 100%;
+}
+
+.sidebar-resizer-vertical {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    width: 5px;
+    z-index: 500;
+    cursor: ew-resize;
+}
+
+.sidebar-tree, .sidebar-tree .children {
+    position: relative;
+    padding: 0;
+    margin: 0;
+    list-style: none;
+}
+
+.sidebar-tree-section {
+    position: relative;
+    height: 18px;
+    padding: 1px 10px 6px 10px;
+    white-space: nowrap;
+    margin-top: 1px;
+    color: rgb(92, 110, 129);
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+}
+
+.sidebar-tree-item {
+    position: relative;
+    height: 36px;
+    padding: 0 5px 0 5px;
+    white-space: nowrap;
+    overflow-x: hidden;
+    overflow-y: hidden;
+    margin-top: 1px;
+    line-height: 34px;
+    border-top: 1px solid transparent;
+}
+
+.sidebar-tree .children {
+    display: none;
+}
+
+.sidebar-tree .children.expanded {
+    display: block;
+}
+
+.sidebar-tree-section + .children > .sidebar-tree-item {
+    padding-left: 10px !important;
+}
+
+.sidebar-tree-section + .children.small > .sidebar-tree-item {
+    padding-left: 17px !important;
+}
+
+.sidebar-tree > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree > .children > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree > .children.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree.some-expandable:not(.hide-disclosure-buttons) > .sidebar-tree-item:not(.parent) .icon {
+    margin-left: 16px;
+}
+
+.sidebar-tree-item .disclosure-button {
+    float: left;
+    width: 16px;
+    height: 100%;
+    border: 0;
+    background-color: transparent;
+    background-image: url(Images/disclosureTriangleSmallRight.png);
+    background-repeat: no-repeat;
+    background-position: center;
+    -webkit-apearance: none;
+}
+
+.sidebar-tree.hide-disclosure-buttons .sidebar-tree-item .disclosure-button {
+    display: none;
+}
+
+body.inactive .sidebar-tree-item .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
+}
+
+body.inactive .sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
+}
+
+body.inactive .sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownBlack.png);
+}
+
+.sidebar-tree-item.selected .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightWhite.png) !important;
+}
+
+.sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+}
+
+.sidebar-tree-item.selected.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownWhite.png) !important;
+}
+
+.sidebar-tree-item.selected .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownWhite.png) !important;
+}
+
+.sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDown.png);
+}
+
+.sidebar-tree-item .icon {
+    float: left;
+    width: 32px;
+    height: 32px;
+    margin-top: 1px;
+    margin-right: 3px;
+}
+
+li .status {
+    float: right;
+    height: 16px;
+    margin-top: 9px;
+    margin-left: 4px;
+    line-height: 1em;
+}
+
+li .status:empty {
+    display: none;
+}
+
+li .status .bubble {
+    display: inline-block;
+    height: 14px;
+    min-width: 16px;
+    margin-top: 1px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    text-align: center;
+    font-size: 11px;
+    line-height: normal;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+li .status .bubble:empty {
+    display: none;
+}
+
+li.selected .status .bubble {
+    background-color: white !important;
+    color: rgb(132, 154, 190) !important;
+}
+
+:focus li.selected .status .bubble {
+    color: rgb(36, 98, 172) !important;
+}
+
+body.inactive li.selected .status .bubble {
+    color: rgb(159, 159, 159) !important;
+}
+
+.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side {
+    height: 20px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
+    width: 16px;
+    height: 16px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
+    margin-top: 1px;
+}
+
+.sidebar-tree-item.selected {
+    color: white;
+    border-top: 1px solid rgb(145, 160, 192);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
+    text-shadow: rgba(0, 0, 0, 0.33) 1px 1px 0;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(68, 128, 200);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
+}
+
+body.inactive .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(151, 151, 151);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
+}
+
+.sidebar-tree-item .titles {
+    position: relative;
+    top: 5px;
+    line-height: 12px;
+    padding-bottom: 1px;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+}
+
+.sidebar-tree-item .titles.no-subtitle {
+    top: 10px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .titles, .sidebar-tree .children.small .sidebar-tree-item .titles, .sidebar-tree-item.small .titles {
+    top: 2px;
+    line-height: normal;
+}
+
+.sidebar-tree:not(.small) .sidebar-tree-item:not(.small) .title::after, .sidebar-tree .children:not(.small) .sidebar-tree-item .title::after {
+    content: "\A";
+    white-space: pre;
+}
+
+.sidebar-tree-item .subtitle {
+    font-size: 80%;
+}
+
+.sidebar-tree.small .sidebar-tree-item .subtitle, .sidebar-tree .children.small .sidebar-tree-item .subtitle, .sidebar-tree-item.small .subtitle {
+    display: none;
+}
+
+.sidebar-tree-item.selected .subtitle {
+    color: white;
+}
+
+.bubble.debug, .console-debug-level .bubble {
+    background-color: rgb(0, 0, 255) !important;
+}
+
+.bubble.warning, .console-warning-level .bubble {
+    background-color: rgb(232, 164, 0) !important;
+}
+
+.bubble.error, .console-error-level .bubble {
+    background-color: rgb(216, 35, 35) !important;
+}
+
+.bubble.search-matches {
+    background-image: url(Images/searchSmallWhite.png);
+    background-repeat: no-repeat;
+    background-position: 3px 2px;
+    padding-left: 13px !important;
+}
+
+li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBlue.png);
+}
+
+:focus li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+body.inactive li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallGray.png);
+}
+
+.storage-application-cache-status-icon, .storage-application-cache-connectivity-icon {
+    margin-bottom: -3px;
+    margin-left: 5px;
+    vertical-align: middle;
+}
+
+.status-bar-divider {
+    margin-left: 7px;
+    border-right: 1px solid #CCC;
+}
+
+.storage-application-cache-status, .storage-application-cache-connectivity {
+    position: relative;
+    top: 4px;
+}
+
+.status-bar-items {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 200px;
+    overflow: hidden;
+    border-left: 1px solid rgb(184, 184, 184);
+    margin-left: -1px;
+}
+
+.node-search-status-bar-item .glyph {
+    -webkit-mask-position: -224px -24px;
+}
+
+.delete-storage-status-bar-item .glyph {
+    -webkit-mask-position: -128px 0;
+}
+
+.clear-storage-status-bar-item .glyph {
+    -webkit-mask-position: -64px 0;
+}
+
+.refresh-storage-status-bar-item .glyph {
+    -webkit-mask-position: 0 0;
+}
+
+.webkit-html-js-node, .webkit-html-css-node {
+    white-space: pre;
+}
+
+.source-frame-breakpoint-condition {
+    z-index: 30;
+    padding: 4px;
+    background-color: rgb(203, 226, 255);
+    -webkit-border-radius: 7px;
+    border: 2px solid rgb(169, 172, 203);
+    width: 90%;
+    pointer-events: auto;
+}
+
+.source-frame-breakpoint-message {
+    background-color: transparent;
+    font-weight: normal;
+    font-size: 11px;
+    text-align: left;
+    text-shadow: none;
+    color: rgb(85, 85, 85);
+    cursor: default;
+    margin: 0 0 2px 0;
+}
+
+#source-frame-breakpoint-condition {
+    margin: 0;
+    border: 1px inset rgb(190, 190, 190) !important;
+    width: 100%;
+    box-shadow: none !important;
+    outline: none !important;
+    -webkit-user-modify: read-write;
+}
+
+.source-frame-popover-title {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+    font-weight: bold;
+    padding-left: 18px;
+}
+
+.source-frame-popover-tree {
+    border-top: 1px solid rgb(194, 194, 147);
+    overflow: auto;
+    position: absolute;
+    top: 15px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.source-frame-eval-expression {
+    outline: 1px solid rgb(163, 41, 34);
+    background-color: rgb(255, 255, 194);
+}
+
+.workers-list {
+    list-style: none;
+    margin: 0;
+    padding: 0;
+}
+
+.resource-content-unavailable {
+    color: rgb(50%, 50%, 50%);
+    font-style: italic;
+    font-size: 14px;
+    text-align: center;
+    padding: 32px;
+}
+
+.node-link {
+    text-decoration: underline;
+    cursor: pointer;
+}
+
+.cursor-pointer {
+    cursor: pointer;
+}
+
+.cursor-auto {
+    cursor: auto;
+}
+
+.please-wait-msg {
+    position: absolute;
+    left: 0;
+    top: 0;
+    border: 4px black solid;
+    border-radius: 4px;
+    background-color: black;
+    opacity: 0.85;
+    color: white;
+    font-size: 12px;
+    font-weight: bold;
+    z-index: 10000;
+}
+
+.resource-view.json {
+    padding: 5px;
+}
+
+.resource-view.html iframe {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+}
+
+.soft-context-menu-glass-pane {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    z-index: 20000;
+}
+
+.soft-context-menu {
+    position: absolute;
+    border: 1px solid rgba(196, 196, 196, 0.9);
+    border-top: 1px solid rgba(196, 196, 196, 0.5);
+    border-bottom: 1px solid rgba(150, 150, 150, 0.9);
+    padding: 4px 0 4px 0;
+    border-radius: 4px;
+    background-color: white;
+    -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
+}
+
+.soft-context-menu-item {
+    width: 100%;
+    line-height: 13px;
+    font-size: 14px;
+    border-top: 1px solid transparent;
+    border-bottom: 1px solid transparent;
+    padding: 2px 7px 2px 6px;
+    margin: 0 13px 0 0;
+    white-space: nowrap;
+}
+
+.soft-context-menu-separator {
+    height: 10px;
+    margin: 0 1px;
+}
+
+.soft-context-menu-separator > .separator-line {
+    margin: 0;
+    height: 5px;
+    border-bottom: 1px solid rgb(227, 227, 227);
+    pointer-events: none;
+}
+
+.soft-context-menu-item-mouse-over {
+    border-top: 1px solid rgb(56, 121, 217);
+    border-bottom: 1px solid rgb(56, 121, 217);
+    background-color: rgb(56, 121, 217);
+    color: white;
+}
+
+body.platform-mac .soft-context-menu-item-mouse-over {
+    border-top: 1px solid rgb(90, 131, 236);
+    border-bottom: 1px solid rgb(18, 88, 233);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(100, 140, 243)), to(rgb(36, 101, 243)));
+}
+
+.soft-context-menu-item-checkmark {
+    color: rgb(108, 108, 108);
+    pointer-events: none;
+}
+
+.soft-context-menu-item-submenu-arrow {
+    color: #222;
+    float: right;
+    pointer-events: none;
+}
+
+.soft-context-menu-item-mouse-over .soft-context-menu-item-checkmark {
+    color: white;
+}
+
+.search-view {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.search-drawer-header input[type="search"].search-config-search {
+    font-size: 11px;
+    margin-left: 4px;
+    color: #303030;
+    position: relative;
+}
+
+body.platform-mac .search-drawer-header input[type="search"].search-config-search {
+    top: 1px;
+}
+
+.search-drawer-header label.search-config-label {
+    margin-left: 8px;
+    color: #303030;
+}
+
+.search-drawer-header input[type="checkbox"].search-config-checkbox {
+    vertical-align: bottom;
+}
+
+body:not(.platform-mac) .search-drawer-header input[type="checkbox"].search-config-checkbox {
+    margin-bottom: 5px;
+}
+
+body.platform-mac .search-drawer-header input[type="checkbox"].search-config-checkbox {
+    margin-bottom: 4px;
+}
+
+.drawer-header {
+    font-size: 11px;
+    border-right: 1px solid rgb(197, 197, 197);
+    line-height: 21px;
+    padding-left: 6px;
+    display: inline-block;
+}
+
+.drawer-header-close-button {
+    padding: 3px 8px;
+    font-size: 14px;
+    color:rgb(80, 80, 80);
+    opacity: 0.5;
+    position: relative;
+    top: 1px;
+}
+
+.drawer-header-close-button:hover {
+    opacity: 1;
+}
+
+.drawer-header-close-button:active {
+    opacity: 0.7;
+}
+
+#bottom-status-bar-container {
+    -webkit-flex: 1 1 0;
+    width: 0;
+    overflow: hidden;
+}
+
+.animate #bottom-status-bar-container > * {
+    -webkit-transition: opacity 100ms linear;
+}
+
+.search-status-bar-item {
+    display: inline-block;
+    cursor: pointer;
+    font-size: 11px;
+    height: 23px;
+}
+
+.search-status-bar-message {
+    margin-left:5px;
+    margin-right:5px;
+    margin-top:5px;
+    float:left;
+}
+
+.progress-bar-stop-button-item {
+    width: 19px;
+    height: 24px;
+    overflow: hidden;
+}
+
+.progress-bar-stop-button .glyph {
+    -webkit-mask-position: -96px -48px;
+    background-color: rgb(216, 0, 0) !important;
+}
+
+.search-results-status-bar-message {
+    margin-right: 10px;
+    cursor: default;
+    font-size: 11px;
+    float: right;
+    margin-top: 5px;
+}
+
+.search-view .search-results {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow-y: auto;
+}
+
+#search-results-pane-file-based li {
+    list-style: none;
+}
+
+#search-results-pane-file-based ol {
+    -webkit-padding-start: 0;
+    margin-top: 0;
+}
+
+#search-results-pane-file-based ol.children {
+    display: none;
+}
+
+#search-results-pane-file-based ol.children.expanded {
+    display: block;
+}
+
+#search-results-pane-file-based li.parent::before {
+    -webkit-user-select: none;
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    width: 8px;
+    content: "a";
+    color: transparent;
+    margin-left: -5px;
+    padding-right: 4px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+#search-results-pane-file-based li.parent::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+#search-results-pane-file-based li.parent::before {
+    background-position: -4px -96px;
+}
+
+#search-results-pane-file-based li.parent.expanded::before {
+    background-position: -20px -96px;
+}
+
+#search-results-pane-file-based .search-result {
+    font-size: 11px;
+    padding: 2px 0 2px 10px;
+    word-wrap: normal;
+    white-space: pre;
+    cursor: pointer;
+}
+
+#search-results-pane-file-based .search-result:hover {
+    background-color: rgba(121, 121, 121, 0.1);
+}
+
+#search-results-pane-file-based .search-result .search-result-file-name {
+    font-weight: bold;
+    color: #222;
+}
+
+#search-results-pane-file-based .search-result .search-result-matches-count {
+    margin-left: 5px;
+    color: #222;
+}
+
+#search-results-pane-file-based .show-more-matches {
+    padding: 4px 0;
+    color: #222;
+    cursor: pointer;
+    font-size: 11px;
+    margin-left: 20px;
+}
+
+#search-results-pane-file-based .show-more-matches:hover {
+    text-decoration: underline;
+}
+
+#search-results-pane-file-based .search-match {
+    word-wrap: normal;
+    white-space: pre;
+}
+
+#search-results-pane-file-based .search-match .webkit-line-number.search-match-line-number {
+    margin-right: 5px;
+    border-right: 1px solid #BBB;
+}
+
+#search-results-pane-file-based .search-match:not(:hover) .webkit-line-number.search-match-line-number {
+    background-color: #F0F0F0;
+}
+
+#search-results-pane-file-based .search-match:hover {
+    background-color: rgba(56, 121, 217, 0.1);
+}
+
+#search-results-pane-file-based .search-match .highlighted-match {
+    background-color: #F1EA00;
+}
+
+#search-results-pane-file-based a {
+    text-decoration: none;
+    display: block;
+}
+
+#search-results-pane-file-based .search-match .search-match-content {
+    color: #000;
+}
+
+.record-cpu-profile-status-bar-item .glyph, .record-profile-status-bar-item .glyph {
+    -webkit-mask-position: -288px 0;
+}
+
+.record-cpu-profile-status-bar-item.toggled-on .glyph, .record-profile-status-bar-item.toggled-on .glyph {
+    -webkit-mask-position: -288px -24px;
+    background-color: rgb(216, 0, 0) !important;
+}
+
+.storage-empty-view, .storage-view .storage-table-error {
+    position: absolute;
+    top: 0;
+    bottom: 25%;
+    left: 0;
+    right: 0;
+    font-size: 24px;
+    color: rgb(75%, 75%, 75%);
+    margin-top: auto;
+    margin-bottom: auto;
+    height: 50px;
+    line-height: 26px;
+    text-align: center;
+    font-weight: bold;
+    padding: 10px;
+    white-space: pre-wrap;
+}
+
+/* Generic suggest box style */
+
+.suggest-box.generic-suggest {
+    margin-left: -1px;
+    border-color: rgb(66%, 66%, 66%);
+}
+
+.suggest-box.generic-suggest.above-anchor {
+   border-radius: 5px 5px 5px 0;
+}
+
+.suggest-box.generic-suggest.under-anchor {
+   border-radius: 0 5px 5px 5px;
+}
+
+/* Custom popup scrollers */
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar, .custom-popup-vertical-scroll ::-webkit-scrollbar {
+    width: 11px;
+    height: 11px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-corner, .custom-popup-vertical-scroll ::-webkit-scrollbar-corner {
+    display: none;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-resizer, .custom-popup-vertical-scroll ::-webkit-resizer {
+    display: none;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-button, .custom-popup-vertical-scroll ::-webkit-scrollbar-button {
+    display: none;
+}
+
+/* Custom Horizontal Scrollbar Styles */
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar:horizontal:corner-present {
+    border-right-width: 0;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal {
+    -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px;
+    min-width: 20px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:hover {
+    -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-thumb:horizontal:active {
+    -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:start {
+    margin-left: 5px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end {
+    margin-right: 5px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:end:corner-present {
+    margin-right: 4px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:decrement {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 0 0 11px;
+}
+
+.custom-popup-horizontal-scroll ::-webkit-scrollbar-track-piece:horizontal:increment {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px 0 0;
+}
+
+/* Custom Vertical Scrollbar Styles */
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar:vertical:corner-present {
+    border-bottom-width: 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical {
+    -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0;
+    min-height: 20px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:hover {
+    -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-thumb:vertical:active {
+    -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:start {
+    margin-top: 5px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end {
+    margin-bottom: 5px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:end:corner-present {
+    margin-bottom: 4px;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:decrement {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0 0 0;
+}
+
+.custom-popup-vertical-scroll ::-webkit-scrollbar-track-piece:vertical:increment {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 0 0 11px 0;
+}
+
+.console-context {
+    max-width: 200px;
+}
+
+.inspector-footer {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    font-size: 11px;
+    height: auto;
+}
+
+.progress-bar-container {
+    display: -webkit-flex;
+    margin: 0 8px;
+    -webkit-flex: 1 0;
+}
+
+.progress-bar-container span {
+    padding: 6px;
+}
+
+.progress-bar-container progress {
+    margin-top: 7px;
+    -webkit-flex: 1 0;
+}
+
+body.platform-mac .progress-bar-container progress {
+    margin-top: 6px;
+}
+
+.progress-bar-container button.status-bar-item {
+    border-left: none;
+    margin-top: 1px;
+}
+
+.source-frame-cursor-position {
+    padding-left: 6px;
+    padding-top: 4px;
+    display: inline-block;
+    pointer-events: auto;
+    -webkit-user-select: text;
+    font-size: 11px;
+    cursor: text;
+    line-height: 14px;
+}
+
+.elements-tree-outline li.parent::before {
+    top: 0 !important;
+}
+
diff --git a/resources/inspector/DevTools.js b/resources/inspector/inspector.js
similarity index 80%
rename from resources/inspector/DevTools.js
rename to resources/inspector/inspector.js
index 0f0f152..12c7a1e 100644
--- a/resources/inspector/DevTools.js
+++ b/resources/inspector/inspector.js
@@ -58,7 +58,7 @@
 }
 
 if (!foundChar)
-return this;
+return String(this);
 
 var result = "";
 for (var i = 0; i < this.length; ++i) {
@@ -70,9 +70,14 @@
 return result;
 }
 
+String.regexSpecialCharacters = function()
+{
+return "^[]{}()\\.$*+?|-,";
+}
+
 String.prototype.escapeForRegExp = function()
 {
-return this.escapeCharacters("^[]{}()\\.$*+?|");
+return this.escapeCharacters(String.regexSpecialCharacters);
 }
 
 String.prototype.escapeHTML = function()
@@ -88,7 +93,7 @@
 String.prototype.trimMiddle = function(maxLength)
 {
 if (this.length <= maxLength)
-return this;
+return String(this);
 var leftHalf = maxLength >> 1;
 var rightHalf = maxLength - leftHalf - 1;
 return this.substr(0, leftHalf) + "\u2026" + this.substr(this.length - rightHalf, rightHalf);
@@ -97,7 +102,7 @@
 String.prototype.trimEnd = function(maxLength)
 {
 if (this.length <= maxLength)
-return this;
+return String(this);
 return this.substr(0, maxLength - 1) + "\u2026";
 }
 
@@ -109,6 +114,21 @@
 return result;
 }
 
+String.prototype.toTitleCase = function()
+{
+return this.substring(0, 1).toUpperCase() + this.substring(1);
+}
+
+
+String.prototype.compareTo = function(other)
+{
+if (this > other)
+return 1;
+if (this < other)
+return -1;
+return 0;
+}
+
 
 function sanitizeHref(href)
 {
@@ -264,10 +284,10 @@
 var pivotNewIndex = array.partition(comparator, left, right, pivotIndex);
 quickSortFirstK(array, comparator, left, pivotNewIndex - 1, k);
 if (pivotNewIndex < left + k - 1)
-quickSortFirstK(array, comparator, pivotNewIndex + 1, right, k);
+quickSortFirstK(array, comparator, pivotNewIndex + 1, right, left + k - 1 - pivotNewIndex);
 }
 
-if (leftBound === 0 && rightBound === (this.length - 1) && k === this.length)
+if (leftBound === 0 && rightBound === (this.length - 1) && k >= this.length)
 this.sort(comparator);
 else
 quickSortFirstK(this, comparator, leftBound, rightBound, k);
@@ -345,6 +365,15 @@
 }
 });
 
+Object.defineProperty(Array.prototype, "peekLast",
+{
+
+value: function()
+{
+return this[this.length - 1];
+}
+});
+
 
 function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
 {
@@ -550,7 +579,7 @@
 function createPlainTextSearchRegex(query, flags)
 {
 
-var regexSpecialCharacters = "[](){}+-*.,?\\^$|";
+var regexSpecialCharacters = String.regexSpecialCharacters();
 var regex = "";
 for (var i = 0; i < query.length; ++i) {
 var c = query.charAt(i);
@@ -585,21 +614,88 @@
 }
 
 
+var createObjectIdentifier = function()
+{
+
+return '_' + ++createObjectIdentifier._last;
+}
+
+createObjectIdentifier._last = 0;
+
+
+var Set = function()
+{
+
+this._set = {};
+this._size = 0;
+}
+
+Set.prototype = {
+
+add: function(item)
+{
+var objectIdentifier = item.__identifier;
+if (!objectIdentifier) {
+objectIdentifier = createObjectIdentifier();
+item.__identifier = objectIdentifier;
+}
+if (!this._set[objectIdentifier])
+++this._size;
+this._set[objectIdentifier] = item;
+},
+
+
+remove: function(item)
+{
+if (this._set[item.__identifier]) {
+--this._size;
+delete this._set[item.__identifier];
+}
+},
+
+
+items: function()
+{
+var result = new Array(this._size);
+var i = 0;
+for (var objectIdentifier in this._set)
+result[i++] = this._set[objectIdentifier];
+return result;
+},
+
+
+hasItem: function(item)
+{
+return this._set[item.__identifier];
+},
+
+
+size: function()
+{
+return this._size;
+},
+
+clear: function()
+{
+this._set = {};
+this._size = 0;
+}
+}
+
+
 var Map = function()
 {
 this._map = {};
 this._size = 0;
 }
 
-Map._lastObjectIdentifier = 0;
-
 Map.prototype = {
 
 put: function(key, value)
 {
 var objectIdentifier = key.__identifier;
 if (!objectIdentifier) {
-objectIdentifier = ++Map._lastObjectIdentifier;
+objectIdentifier = createObjectIdentifier();
 key.__identifier = objectIdentifier;
 }
 if (!this._map[objectIdentifier])
@@ -611,9 +707,11 @@
 remove: function(key)
 {
 var result = this._map[key.__identifier];
-delete this._map[key.__identifier];
+if (!result)
+return undefined;
 --this._size;
-return result ? result[1] : undefined;
+delete this._map[key.__identifier];
+return result[1];
 },
 
 
@@ -644,6 +742,13 @@
 return entry ? entry[1] : undefined;
 },
 
+
+contains: function(key)
+{
+var entry = this._map[key.__identifier];
+return !!entry;
+},
+
 size: function()
 {
 return this._size;
@@ -739,14 +844,20 @@
 {
 if (_importedScripts[scriptName])
 return;
-_importedScripts[scriptName] = true;
 var xhr = new XMLHttpRequest();
+_importedScripts[scriptName] = true;
+if (window.flattenImports)
+scriptName = scriptName.split("/").reverse()[0];
 xhr.open("GET", scriptName, false);
 xhr.send(null);
+if (!xhr.responseText)
+throw "empty response arrived for script '" + scriptName + "'";
 var sourceURL = WebInspector.ParsedURL.completeURL(window.location.href, scriptName); 
 window.eval(xhr.responseText + "\n//@ sourceURL=" + sourceURL);
 }
 
+var loadScript = importScript;
+
 
 
 
@@ -1247,6 +1358,7 @@
 return { container: node, offset: offset };
 }
 
+
 Element.prototype.removeStyleClass = function(className)
 {
 this.classList.remove(className);
@@ -1259,17 +1371,28 @@
 this.className = this.className.replace(regex, " ");
 }
 
+
 Element.prototype.addStyleClass = function(className)
 {
 this.classList.add(className);
 }
 
+
 Element.prototype.hasStyleClass = function(className)
 {
 return this.classList.contains(className);
 }
 
 
+Element.prototype.enableStyleClass = function(className, enable)
+{
+if (enable)
+this.addStyleClass(className);
+else
+this.removeStyleClass(className);
+}
+
+
 Element.prototype.positionAt = function(x, y)
 {
 if (typeof x === "number")
@@ -1289,19 +1412,22 @@
 return this.scrollTop + this.clientHeight === this.scrollHeight;
 }
 
-Element.prototype.remove = function()
+Element.prototype.removeSelf = function()
 {
 if (this.parentElement)
 this.parentElement.removeChild(this);
 }
 
+CharacterData.prototype.removeSelf = Element.prototype.removeSelf;
+DocumentType.prototype.removeSelf = Element.prototype.removeSelf;
+
 
 function removeSubsequentNodes(fromNode, toNode)
 {
 for (var node = fromNode; node && node !== toNode; ) {
 var nodeToRemove = node;
 node = node.nextSibling;
-nodeToRemove.remove();
+nodeToRemove.removeSelf();
 }
 }
 
@@ -1313,13 +1439,14 @@
 }
 
 
-Element.prototype.measurePreferredSize = function()
+Element.prototype.measurePreferredSize = function(containerElement)
 {
-document.body.appendChild(this);
+containerElement = containerElement || document.body;
+containerElement.appendChild(this);
 this.positionAt(0, 0);
 var result = new Size(this.offsetWidth, this.offsetHeight);
 this.positionAt(undefined, undefined);
-document.body.removeChild(this);
+this.removeSelf();
 return result;
 }
 
@@ -1337,9 +1464,10 @@
 return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);
 }
 
-Node.prototype.enclosingNodeOrSelfWithClass = function(className)
+
+Node.prototype.enclosingNodeOrSelfWithClass = function(className, stayWithin)
 {
-for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
+for (var node = this; node && node !== stayWithin && node !== this.ownerDocument; node = node.parentNode)
 if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className))
 return node;
 return null;
@@ -1615,8 +1743,6 @@
 e.consume();
 }
 
-window.isUnderTest = false;
-
 
 function NonLeakingMutationObserver(handler)
 {
@@ -2674,24 +2800,36 @@
 var network = new WebInspector.NetworkPanelDescriptor();
 var scripts = new WebInspector.ScriptsPanelDescriptor();
 var timeline = new WebInspector.TimelinePanelDescriptor();
-var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
+var profiles = new WebInspector.ProfilesPanelDescriptor();
 var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");
 var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel");
 var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
+var allProfilers = [profiles];
+if (WebInspector.experimentsSettings.customizableToolbar.isEnabled()) {
+allProfilers = [];
+allProfilers.push(new WebInspector.PanelDescriptor("cpu-profiler", WebInspector.UIString("CPU Profiler"), "CPUProfilerPanel", "ProfilesPanel.js"));
+if (!WebInspector.WorkerManager.isWorkerFrontend())
+allProfilers.push(new WebInspector.PanelDescriptor("css-profiler", WebInspector.UIString("CSS Profiler"), "CSSSelectorProfilerPanel", "ProfilesPanel.js"));
+allProfilers.push(new WebInspector.PanelDescriptor("heap-profiler", WebInspector.UIString("Heap Profiler"), "HeapProfilerPanel", "ProfilesPanel.js"));
+if (!WebInspector.WorkerManager.isWorkerFrontend() && WebInspector.experimentsSettings.canvasInspection.isEnabled())
+allProfilers.push(new WebInspector.PanelDescriptor("canvas-profiler", WebInspector.UIString("Canvas Profiler"), "CanvasProfilerPanel", "ProfilesPanel.js"));
+if (!WebInspector.WorkerManager.isWorkerFrontend() && WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled()) {
+allProfilers.push(new WebInspector.PanelDescriptor("memory-chart-profiler", WebInspector.UIString("Memory Distribution"), "MemoryChartProfilerPanel", "ProfilesPanel.js"));
+allProfilers.push(new WebInspector.PanelDescriptor("memory-snapshot-profiler", WebInspector.UIString("Memory Snapshots"), "NativeMemoryProfilerPanel", "ProfilesPanel.js"));
+}
+Array.prototype.splice.bind(allDescriptors, allDescriptors.indexOf(profiles), 1).apply(null, allProfilers);
+}
 
 var panelDescriptors = [];
 if (WebInspector.WorkerManager.isWorkerFrontend()) {
 panelDescriptors.push(scripts);
 panelDescriptors.push(timeline);
-panelDescriptors.push(profiles);
+panelDescriptors = panelDescriptors.concat(allProfilers);
 panelDescriptors.push(console);
 return panelDescriptors;
 }
-var hiddenPanels = InspectorFrontendHost.hiddenPanels();
-for (var i = 0; i < allDescriptors.length; ++i) {
-if (hiddenPanels.indexOf(allDescriptors[i].name()) === -1)
+for (var i = 0; i < allDescriptors.length; ++i)
 panelDescriptors.push(allDescriptors[i]);
-}
 return panelDescriptors;
 },
 
@@ -2712,11 +2850,8 @@
 this._toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false);
 mainStatusBar.insertBefore(this._toggleConsoleButton.element, bottomStatusBarContainer);
 
-if (!WebInspector.WorkerManager.isWorkerFrontend()) {
-this._nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
-this._nodeSearchButton.addEventListener("click", this.toggleSearchingForNode, this);
-mainStatusBar.insertBefore(this._nodeSearchButton.element, bottomStatusBarContainer);
-}
+if (this.inspectElementModeController)
+mainStatusBar.insertBefore(this.inspectElementModeController.toggleSearchButton.element, bottomStatusBarContainer);
 
 mainStatusBar.appendChild(this.settingsController.statusBarItem);
 },
@@ -2757,7 +2892,9 @@
 closeButton.addStyleClass("drawer-header-close-button");
 closeButton.addEventListener("click", this.closeViewInDrawer.bind(this), false);
 
-document.getElementById("panel-status-bar").firstElementChild.appendChild(drawerStatusBarHeader);
+var panelStatusBar = document.getElementById("panel-status-bar");
+var drawerViewAnchor = document.getElementById("drawer-view-anchor");
+panelStatusBar.insertBefore(drawerStatusBarHeader, drawerViewAnchor);
 this._drawerStatusBarHeader = drawerStatusBarHeader;
 this.drawer.show(view, WebInspector.Drawer.AnimationType.Immediately);
 },
@@ -2886,28 +3023,6 @@
 InspectorFrontendHost.setZoomFactor(WebInspector.Zoom.Table[index]);
 },
 
-toggleSearchingForNode: function()
-{
-var enabled = !this._nodeSearchButton.toggled;
-
-function callback(error)
-{
-if (!error)
-this._nodeSearchButton.toggled = enabled;
-}
-WebInspector.domAgent.setInspectModeEnabled(enabled, callback.bind(this));
-},
-
-_profilesLinkifier: function(title)
-{
-var profileStringMatches = WebInspector.ProfileURLRegExp.exec(title);
-if (profileStringMatches) {
-var profilesPanel =   WebInspector.panel("profiles");
-title = WebInspector.ProfilesPanel._instance.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);
-}
-return title;
-},
-
 _debuggerPaused: function()
 {
 
@@ -2933,9 +3048,33 @@
 }
 })();}
 
+WebInspector.suggestReload = function()
+{
+if (window.confirm(WebInspector.UIString("It is recommended to restart inspector after making these changes. Would you like to restart it?")))
+this.reload();
+}
+
+WebInspector.reload = function()
+{
+var queryParams = window.location.search;
+var url = window.location.href;
+url = url.substring(0, url.length - queryParams.length);
+var queryParamsObject = {};
+for (var name in WebInspector.queryParamsObject)
+queryParamsObject[name] = WebInspector.queryParamsObject[name];
+if (this.dockController)
+queryParamsObject["dockSide"] = this.dockController.dockSide();
+var names = Object.keys(queryParamsObject);
+for (var i = 0; i < names.length; ++i)
+url += (i ? "&" : "?") + names[i] + "=" + queryParamsObject[names[i]];
+
+InspectorBackend.disconnect();
+document.location = url;
+}
+
 WebInspector.loaded = function()
 {
-InspectorBackend.loadFromJSONIfNeeded("../Inspector.json");
+InspectorBackend.loadFromJSONIfNeeded("../protocol.json");
 WebInspector.dockController = new WebInspector.DockController();
 
 if (WebInspector.WorkerManager.isDedicatedWorkerFrontend()) {
@@ -2987,24 +3126,17 @@
 if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsObject.textColor)
 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColor, WebInspector.queryParamsObject.textColor);
 
-InspectorFrontendHost.loaded();
 WebInspector.WorkerManager.loaded();
 
-DebuggerAgent.causesRecompilation(WebInspector._initializeCapability.bind(WebInspector, "debuggerCausesRecompilation", null));
-DebuggerAgent.supportsSeparateScriptCompilationAndExecution(WebInspector._initializeCapability.bind(WebInspector, "separateScriptCompilationAndExecutionEnabled", null));
-ProfilerAgent.causesRecompilation(WebInspector._initializeCapability.bind(WebInspector, "profilerCausesRecompilation", null));
-ProfilerAgent.isSampling(WebInspector._initializeCapability.bind(WebInspector, "samplingCPUProfiler", null));
-ProfilerAgent.hasHeapProfiler(WebInspector._initializeCapability.bind(WebInspector, "heapProfilerPresent", null));
-TimelineAgent.supportsFrameInstrumentation(WebInspector._initializeCapability.bind(WebInspector, "timelineSupportsFrameInstrumentation", null));
-TimelineAgent.canMonitorMainThread(WebInspector._initializeCapability.bind(WebInspector, "timelineCanMonitorMainThread", null));
 PageAgent.canShowFPSCounter(WebInspector._initializeCapability.bind(WebInspector, "canShowFPSCounter", null));
-PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null));
-PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", null));
-PageAgent.canOverrideDeviceOrientation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceOrientation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
+PageAgent.canContinuouslyPaint(WebInspector._initializeCapability.bind(WebInspector, "canContinuouslyPaint", null));
+WorkerAgent.canInspectWorkers(WebInspector._initializeCapability.bind(WebInspector, "canInspectWorkers", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
 }
 
 WebInspector._doLoadedDoneWithCapabilities = function()
 {
+new WebInspector.VersionController().updateVersion();
+
 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
 this._registerShortcuts();
 
@@ -3037,12 +3169,20 @@
 
 InspectorBackend.registerInspectorDispatcher(this);
 
-this.cssModel = new WebInspector.CSSStyleModel();
+this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager();
+this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispatcher(this.isolatedFileSystemManager);
+this.fileMapping = new WebInspector.FileMapping();
+this.workspace = new WebInspector.Workspace(this.fileMapping, this.isolatedFileSystemManager.mapping());
+
+this.cssModel = new WebInspector.CSSStyleModel(this.workspace);
 this.timelineManager = new WebInspector.TimelineManager();
 this.userAgentSupport = new WebInspector.UserAgentSupport();
 
 this.searchController = new WebInspector.SearchController();
 this.advancedSearchController = new WebInspector.AdvancedSearchController();
+if (!WebInspector.WorkerManager.isWorkerFrontend())
+this.inspectElementModeController = new WebInspector.InspectElementModeController();
+
 this.settingsController = new WebInspector.SettingsController();
 
 this.domBreakpointsSidebarPane = new WebInspector.DOMBreakpointsSidebarPane();
@@ -3056,22 +3196,23 @@
 this.openAnchorLocationRegistry = new WebInspector.HandlerRegistry(openAnchorLocationSetting);
 this.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
 
-this.networkWorkspaceProvider = new WebInspector.NetworkWorkspaceProvider();
-this.workspace = new WebInspector.Workspace();
-this.debuggerWorkspaceProvider = new WebInspector.DebuggerWorkspaceProvider(this.workspace);
-this.workspace.addProject("network", this.networkWorkspaceProvider);
 this.workspaceController = new WebInspector.WorkspaceController(this.workspace);
 
+this.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(this.isolatedFileSystemManager, this.workspace);
+
+this.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(this.workspace, WebInspector.projectTypes.Network);
+new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider, this.workspace);
+
 this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel, this.workspace);
 
-this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(this.workspace, this.networkWorkspaceProvider);
-new WebInspector.DebuggerScriptMapping(this.workspace, this.debuggerWorkspaceProvider, this.networkWorkspaceProvider);
+this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(this.workspace);
+
+new WebInspector.DebuggerScriptMapping(this.workspace, this.networkWorkspaceProvider);
 this.liveEditSupport = new WebInspector.LiveEditSupport(this.workspace);
-this.styleContentBinding = new WebInspector.StyleContentBinding(this.cssModel);
-new WebInspector.NetworkUISourceCodeProvider(this.workspace, this.networkWorkspaceProvider);
-new WebInspector.StylesSourceMapping(this.workspace);
+this.styleContentBinding = new WebInspector.StyleContentBinding(this.cssModel, this.workspace);
+new WebInspector.StylesSourceMapping(this.cssModel, this.workspace);
 if (WebInspector.experimentsSettings.sass.isEnabled())
-new WebInspector.SASSSourceMapping(this.workspace, this.networkWorkspaceProvider);
+new WebInspector.SASSSourceMapping(this.cssModel, this.workspace, this.networkWorkspaceProvider);
 
 new WebInspector.PresentationConsoleMessageHelper(this.workspace);
 
@@ -3084,7 +3225,6 @@
 WebInspector.endBatchUpdate();
 
 this.addMainEventListeners(document);
-WebInspector.registerLinkifierPlugin(this._profilesLinkifier.bind(this));
 
 window.addEventListener("resize", this.windowResize.bind(this), true);
 
@@ -3106,12 +3246,17 @@
 this.databaseModel = new WebInspector.DatabaseModel();
 this.domStorageModel = new WebInspector.DOMStorageModel();
 
-if (!Capabilities.profilerCausesRecompilation || WebInspector.settings.profilerEnabled.get())
 ProfilerAgent.enable();
 
 if (WebInspector.settings.showPaintRects.get())
 PageAgent.setShowPaintRects(true);
 
+if (WebInspector.settings.showDebugBorders.get())
+PageAgent.setShowDebugBorders(true);
+
+if (WebInspector.settings.continuousPainting.get())
+PageAgent.setContinuousPaintingEnabled(true);
+
 if (WebInspector.settings.javaScriptDisabled.get())
 PageAgent.setScriptExecutionDisabled(true);
 
@@ -3128,16 +3273,7 @@
 
 var windowLoaded = function()
 {
-var localizedStringsURL = InspectorFrontendHost.localizedStringsURL();
-if (localizedStringsURL) {
-var localizedStringsScriptElement = document.createElement("script");
-localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false);
-localizedStringsScriptElement.type = "text/javascript";
-localizedStringsScriptElement.src = localizedStringsURL;
-document.head.appendChild(localizedStringsScriptElement);
-} else
 WebInspector.loaded();
-
 window.removeEventListener("DOMContentLoaded", windowLoaded, false);
 delete windowLoaded;
 };
@@ -3193,7 +3329,7 @@
 WebInspector.documentClick = function(event)
 {
 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
-if (!anchor || anchor.target === "_blank")
+if (!anchor || (anchor.target === "_blank"))
 return;
 
 
@@ -3204,9 +3340,9 @@
 if (WebInspector.isBeingEdited(event.target) || WebInspector._showAnchorLocation(anchor))
 return;
 
-const profileMatch = WebInspector.ProfileURLRegExp.exec(anchor.href);
+const profileMatch = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href);
 if (profileMatch) {
-WebInspector.showProfileForURL(anchor.href);
+WebInspector.showPanel("profiles").showProfile(profileMatch[1], profileMatch[2]);
 return;
 }
 
@@ -3256,7 +3392,7 @@
 ];
 section.addRelatedKeys(keys, WebInspector.UIString("Go to the panel to the left/right"));
 
-var keys = [
+keys = [
 shortcut.makeDescriptor("[", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt),
 shortcut.makeDescriptor("]", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt)
 ];
@@ -3268,6 +3404,9 @@
 var advancedSearchShortcut = WebInspector.AdvancedSearchController.createShortcut();
 section.addKey(advancedSearchShortcut, WebInspector.UIString("Search across all sources"));
 
+var inspectElementModeShortcut = WebInspector.InspectElementModeController.createShortcut();
+section.addKey(inspectElementModeShortcut, WebInspector.UIString("Select node to inspect"));
+
 var openResourceShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);
 section.addKey(openResourceShortcut, WebInspector.UIString("Go to source"));
 
@@ -3281,6 +3420,12 @@
 
 var goToShortcut = WebInspector.GoToLineDialog.createShortcut();
 section.addKey(goToShortcut, WebInspector.UIString("Go to line"));
+
+keys = [
+shortcut.Keys.F1,
+shortcut.makeDescriptor("?")
+];
+section.addAlternateKeys(keys, WebInspector.UIString("Show keyboard shortcuts"));
 }
 
 
@@ -3315,6 +3460,8 @@
 return;
 if (WebInspector.advancedSearchController.handleShortcut(event))
 return;
+if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.handleShortcut(event))
+return;
 
 switch (event.keyIdentifier) {
 case "U+004F": 
@@ -3328,6 +3475,10 @@
 PageAgent.reload(event.shiftKey);
 event.consume(true);
 }
+if (window.DEBUG && event.altKey) {
+WebInspector.reload();
+return;
+}
 break;
 case "F5":
 if (!WebInspector.isMac()) {
@@ -3363,22 +3514,6 @@
 }
 break;
 }
-
-
-
-if (event.keyIdentifier === "U+0043") { 
-if (WebInspector.isMac())
-var isNodeSearchKey = event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey;
-else
-var isNodeSearchKey = event.ctrlKey && !event.metaKey && !event.altKey && event.shiftKey;
-
-if (isNodeSearchKey) {
-this.toggleSearchingForNode();
-event.consume(true);
-return;
-}
-return;
-}
 }
 
 WebInspector.postDocumentKeyDown = function(event)
@@ -3548,11 +3683,18 @@
 (new WebInspector.RemoteDebuggingTerminatedScreen(reason)).showModal();
 }
 
+WebInspector.targetCrashed = function()
+{
+(new WebInspector.HelpScreenUntilReload(
+WebInspector.UIString("Inspected target crashed"),
+WebInspector.UIString("Inspected target has crashed. Once it reloads we will attach to it automatically."))).showModal();
+}
+
 WebInspector._updateFocusedNode = function(nodeId)
 {
-if (WebInspector._nodeSearchButton.toggled) {
+if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.enabled()) {
 InspectorFrontendHost.bringToFront();
-WebInspector._nodeSearchButton.toggled = false;
+WebInspector.inspectElementModeController.disable();
 }
 WebInspector.showPanel("elements").revealAndSelectNode(nodeId);
 }
@@ -3589,11 +3731,6 @@
 return true;
 }
 
-WebInspector.showProfileForURL = function(url)
-{
-WebInspector.showPanel("profiles").showProfileForURL(url);
-}
-
 WebInspector.evaluateInConsole = function(expression, showResultOnly)
 {
 this.showConsole();
@@ -3605,13 +3742,11 @@
 doc.addEventListener("keydown", this.documentKeyDown.bind(this), true);
 doc.addEventListener("keydown", this.postDocumentKeyDown.bind(this), false);
 doc.addEventListener("beforecopy", this.documentCanCopy.bind(this), true);
-doc.addEventListener("copy", this.documentCopy.bind(this), true);
+doc.addEventListener("copy", this.documentCopy.bind(this), false);
 doc.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true);
 doc.addEventListener("click", this.documentClick.bind(this), true);
 }
 
-WebInspector.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
-
 WebInspector.Zoom = {
 Table: [0.25, 0.33, 0.5, 0.66, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5],
 DefaultOffset: 6
@@ -3621,1031 +3756,42 @@
 
 
 
+function buildPlatformExtensionAPI(extensionInfo)
+{
+return "var extensionInfo = " + JSON.stringify(extensionInfo) + ";" +
+"var tabId = " + WebInspector._inspectedTabId + ";" +
+platformExtensionAPI.toString();
+}
+
+WebInspector.setInspectedTabId = function(tabId)
+{
+WebInspector._inspectedTabId = tabId;
+}
+
+
+WebInspector.getSelectionBackgroundColor = function()
+{
+return InspectorFrontendHost.getSelectionBackgroundColor();
+}
+
+
+WebInspector.getSelectionForegroundColor = function()
+{
+return InspectorFrontendHost.getSelectionForegroundColor();
+}
+
+window.DEBUG = true;
+
+
+
+
+
+
 WebInspector.UIString = function(string, vararg)
 {
-if (Preferences.localizeUI) {
-if (window.localizedStrings && string in window.localizedStrings)
-string = window.localizedStrings[string];
-else {
-if (!(string in WebInspector._missingLocalizedStrings)) {
-console.warn("Localized string \"" + string + "\" not found.");
-WebInspector._missingLocalizedStrings[string] = true;
-}
-
-if (Preferences.showMissingLocalizedStrings)
-string += " (not localized)";
-}
-}
 return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
 }
 
-WebInspector._missingLocalizedStrings = {};
-
-
-
-
-
-
-WebInspector.installDragHandle = function(element, elementDragStart, elementDrag, elementDragEnd, cursor)
-{
-element.addEventListener("mousedown", WebInspector._elementDragStart.bind(WebInspector, elementDragStart, elementDrag, elementDragEnd, cursor), false);
-}
-
-
-WebInspector._elementDragStart = function(elementDragStart, elementDrag, elementDragEnd, cursor, event)
-{
-
-if (event.button || (WebInspector.isMac() && event.ctrlKey))
-return;
-
-if (WebInspector._elementDraggingEventListener)
-return;
-
-if (elementDragStart && !elementDragStart(event))
-return;
-
-if (WebInspector._elementDraggingGlassPane) {
-WebInspector._elementDraggingGlassPane.dispose();
-delete WebInspector._elementDraggingGlassPane;
-}
-
-var targetDocument = event.target.ownerDocument;
-
-WebInspector._elementDraggingEventListener = elementDrag;
-WebInspector._elementEndDraggingEventListener = elementDragEnd;
-WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument;
-
-targetDocument.addEventListener("mousemove", WebInspector._elementDraggingEventListener, true);
-targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, true);
-targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragging, true);
-
-targetDocument.body.style.cursor = cursor;
-
-event.preventDefault();
-}
-
-WebInspector._mouseOutWhileDragging = function()
-{
-WebInspector._unregisterMouseOutWhileDragging();
-WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane();
-}
-
-WebInspector._unregisterMouseOutWhileDragging = function()
-{
-if (!WebInspector._mouseOutWhileDraggingTargetDocument)
-return;
-WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout", WebInspector._mouseOutWhileDragging, true);
-delete WebInspector._mouseOutWhileDraggingTargetDocument;
-}
-
-WebInspector._elementDragEnd = function(event)
-{
-var targetDocument = event.target.ownerDocument;
-targetDocument.removeEventListener("mousemove", WebInspector._elementDraggingEventListener, true);
-targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true);
-WebInspector._unregisterMouseOutWhileDragging();
-
-targetDocument.body.style.removeProperty("cursor");
-
-if (WebInspector._elementDraggingGlassPane)
-WebInspector._elementDraggingGlassPane.dispose();
-
-var elementDragEnd = WebInspector._elementEndDraggingEventListener;
-
-delete WebInspector._elementDraggingGlassPane;
-delete WebInspector._elementDraggingEventListener;
-delete WebInspector._elementEndDraggingEventListener;
-
-event.preventDefault();
-if (elementDragEnd)
-elementDragEnd(event);
-}
-
-
-WebInspector.GlassPane = function()
-{
-this.element = document.createElement("div");
-this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;";
-this.element.id = "glass-pane-for-drag";
-document.body.appendChild(this.element);
-}
-
-WebInspector.GlassPane.prototype = {
-dispose: function()
-{
-if (this.element.parentElement)
-this.element.parentElement.removeChild(this.element);
-}
-}
-
-WebInspector.animateStyle = function(animations, duration, callback)
-{
-var interval;
-var complete = 0;
-var hasCompleted = false;
-
-const intervalDuration = (1000 / 30); 
-const animationsLength = animations.length;
-const propertyUnit = {opacity: ""};
-const defaultUnit = "px";
-
-function cubicInOut(t, b, c, d)
-{
-if ((t/=d/2) < 1) return c/2*t*t*t + b;
-return c/2*((t-=2)*t*t + 2) + b;
-}
-
-
-for (var i = 0; i < animationsLength; ++i) {
-var animation = animations[i];
-var element = null, start = null, end = null, key = null;
-for (key in animation) {
-if (key === "element")
-element = animation[key];
-else if (key === "start")
-start = animation[key];
-else if (key === "end")
-end = animation[key];
-}
-
-if (!element || !end)
-continue;
-
-if (!start) {
-var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
-start = {};
-for (key in end)
-start[key] = parseInt(computedStyle.getPropertyValue(key), 10);
-animation.start = start;
-} else
-for (key in start)
-element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-}
-
-function animateLoop()
-{
-if (hasCompleted)
-return;
-
-
-complete += intervalDuration;
-var next = complete + intervalDuration;
-
-
-for (var i = 0; i < animationsLength; ++i) {
-var animation = animations[i];
-var element = animation.element;
-var start = animation.start;
-var end = animation.end;
-if (!element || !end)
-continue;
-
-var style = element.style;
-for (key in end) {
-var endValue = end[key];
-if (next < duration) {
-var startValue = start[key];
-var newValue = cubicInOut(complete, startValue, endValue - startValue, duration);
-style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-} else
-style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-}
-}
-
-
-if (complete >= duration) {
-hasCompleted = true;
-clearInterval(interval);
-if (callback)
-callback();
-}
-}
-
-function forceComplete()
-{
-if (hasCompleted)
-return;
-
-complete = duration;
-animateLoop();
-}
-
-function cancel()
-{
-hasCompleted = true;
-clearInterval(interval);
-}
-
-interval = setInterval(animateLoop, intervalDuration);
-return {
-cancel: cancel,
-forceComplete: forceComplete
-};
-}
-
-WebInspector.isBeingEdited = function(element)
-{
-if (element.hasStyleClass("text-prompt") || element.nodeName === "INPUT")
-return true;
-
-if (!WebInspector.__editingCount)
-return false;
-
-while (element) {
-if (element.__editing)
-return true;
-element = element.parentElement;
-}
-return false;
-}
-
-WebInspector.markBeingEdited = function(element, value)
-{
-if (value) {
-if (element.__editing)
-return false;
-element.__editing = true;
-WebInspector.__editingCount = (WebInspector.__editingCount || 0) + 1;
-} else {
-if (!element.__editing)
-return false;
-delete element.__editing;
---WebInspector.__editingCount;
-}
-return true;
-}
-
-
-WebInspector.EditingConfig = function(commitHandler, cancelHandler, context)
-{
-this.commitHandler = commitHandler;
-this.cancelHandler = cancelHandler
-this.context = context;
-
-
-this.pasteHandler;
-
-
-this.multiline;
-
-
-this.customFinishHandler;
-}
-
-WebInspector.EditingConfig.prototype = {
-setPasteHandler: function(pasteHandler)
-{
-this.pasteHandler = pasteHandler;
-},
-
-setMultiline: function(multiline)
-{
-this.multiline = multiline;
-},
-
-setCustomFinishHandler: function(customFinishHandler)
-{
-this.customFinishHandler = customFinishHandler;
-}
-}
-
-WebInspector.CSSNumberRegex = /^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;
-
-WebInspector.StyleValueDelimiters = " \xA0\t\n\"':;,/()";
-
-
-
-WebInspector._valueModificationDirection = function(event)
-{
-var direction = null;
-if (event.type === "mousewheel") {
-if (event.wheelDeltaY > 0)
-direction = "Up";
-else if (event.wheelDeltaY < 0)
-direction = "Down";
-} else {
-if (event.keyIdentifier === "Up" || event.keyIdentifier === "PageUp")
-direction = "Up";
-else if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
-direction = "Down";        
-}
-return direction;
-}
-
-
-WebInspector._modifiedHexValue = function(hexString, event)
-{
-var direction = WebInspector._valueModificationDirection(event);
-if (!direction)
-return hexString;
-
-var number = parseInt(hexString, 16);
-if (isNaN(number) || !isFinite(number))
-return hexString;
-
-var maxValue = Math.pow(16, hexString.length) - 1;
-var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
-var delta;
-
-if (arrowKeyOrMouseWheelEvent)
-delta = (direction === "Up") ? 1 : -1;
-else
-delta = (event.keyIdentifier === "PageUp") ? 16 : -16;
-
-if (event.shiftKey)
-delta *= 16;
-
-var result = number + delta;
-if (result < 0)
-result = 0; 
-else if (result > maxValue)
-return hexString;
-
-
-var resultString = result.toString(16).toUpperCase();
-for (var i = 0, lengthDelta = hexString.length - resultString.length; i < lengthDelta; ++i)
-resultString = "0" + resultString;
-return resultString;
-}
-
-
-WebInspector._modifiedFloatNumber = function(number, event)
-{
-var direction = WebInspector._valueModificationDirection(event);
-if (!direction)
-return number;
-
-var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
-
-
-
-var changeAmount = 1;
-if (event.shiftKey && !arrowKeyOrMouseWheelEvent)
-changeAmount = 100;
-else if (event.shiftKey || !arrowKeyOrMouseWheelEvent)
-changeAmount = 10;
-else if (event.altKey)
-changeAmount = 0.1;
-
-if (direction === "Down")
-changeAmount *= -1;
-
-
-
-var result = Number((number + changeAmount).toFixed(6));
-if (!String(result).match(WebInspector.CSSNumberRegex))
-return null;
-
-return result;
-}
-
-
-WebInspector.handleElementValueModifications = function(event, element, finishHandler, suggestionHandler, customNumberHandler)
-{
-var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
-var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
-if (!arrowKeyOrMouseWheelEvent && !pageKeyPressed)
-return false;
-
-var selection = window.getSelection();
-if (!selection.rangeCount)
-return false;
-
-var selectionRange = selection.getRangeAt(0);
-if (!selectionRange.commonAncestorContainer.isSelfOrDescendant(element))
-return false;
-
-var originalValue = element.textContent;
-var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.StyleValueDelimiters, element);
-var wordString = wordRange.toString();
-
-if (suggestionHandler && suggestionHandler(wordString))
-return false;
-
-var replacementString;
-var prefix, suffix, number;
-
-var matches;
-matches = /(.*#)([\da-fA-F]+)(.*)/.exec(wordString);
-if (matches && matches.length) {
-prefix = matches[1];
-suffix = matches[3];
-number = WebInspector._modifiedHexValue(matches[2], event);
-
-if (customNumberHandler)
-number = customNumberHandler(number);
-
-replacementString = prefix + number + suffix;
-} else {
-matches = /(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);
-if (matches && matches.length) {
-prefix = matches[1];
-suffix = matches[3];
-number = WebInspector._modifiedFloatNumber(parseFloat(matches[2]), event);
-
-
-if (number === null)                
-return false;
-
-if (customNumberHandler)
-number = customNumberHandler(number);
-
-replacementString = prefix + number + suffix;
-}
-}
-
-if (replacementString) {
-var replacementTextNode = document.createTextNode(replacementString);
-
-wordRange.deleteContents();
-wordRange.insertNode(replacementTextNode);
-
-var finalSelectionRange = document.createRange();
-finalSelectionRange.setStart(replacementTextNode, 0);
-finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
-
-selection.removeAllRanges();
-selection.addRange(finalSelectionRange);
-
-event.handled = true;
-event.preventDefault();
-
-if (finishHandler)
-finishHandler(originalValue, replacementString);
-
-return true;
-}
-return false;
-}
-
-
-WebInspector.startEditing = function(element, config)
-{
-if (!WebInspector.markBeingEdited(element, true))
-return null;
-
-config = config || new WebInspector.EditingConfig(function() {}, function() {});
-var committedCallback = config.commitHandler;
-var cancelledCallback = config.cancelHandler;
-var pasteCallback = config.pasteHandler;
-var context = config.context;
-var oldText = getContent(element);
-var moveDirection = "";
-
-element.addStyleClass("editing");
-
-var oldTabIndex = element.getAttribute("tabIndex");
-if (typeof oldTabIndex !== "number" || oldTabIndex < 0)
-element.tabIndex = 0;
-
-function blurEventListener() {
-editingCommitted.call(element);
-}
-
-function getContent(element) {
-if (element.tagName === "INPUT" && element.type === "text")
-return element.value;
-else
-return element.textContent;
-}
-
-
-function cleanUpAfterEditing()
-{
-WebInspector.markBeingEdited(element, false);
-
-this.removeStyleClass("editing");
-
-if (typeof oldTabIndex !== "number")
-element.removeAttribute("tabIndex");
-else
-this.tabIndex = oldTabIndex;
-this.scrollTop = 0;
-this.scrollLeft = 0;
-
-element.removeEventListener("blur", blurEventListener, false);
-element.removeEventListener("keydown", keyDownEventListener, true);
-if (pasteCallback)
-element.removeEventListener("paste", pasteEventListener, true);
-
-WebInspector.restoreFocusFromElement(element);
-}
-
-
-function editingCancelled()
-{
-if (this.tagName === "INPUT" && this.type === "text")
-this.value = oldText;
-else
-this.textContent = oldText;
-
-cleanUpAfterEditing.call(this);
-
-cancelledCallback(this, context);
-}
-
-
-function editingCommitted()
-{
-cleanUpAfterEditing.call(this);
-
-committedCallback(this, getContent(this), oldText, context, moveDirection);
-}
-
-function defaultFinishHandler(event)
-{
-var isMetaOrCtrl = WebInspector.isMac() ?
-event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
-event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
-if (isEnterKey(event) && (event.isMetaOrCtrlForTest || !config.multiline || isMetaOrCtrl))
-return "commit";
-else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code || event.keyIdentifier === "U+001B")
-return "cancel";
-else if (event.keyIdentifier === "U+0009") 
-return "move-" + (event.shiftKey ? "backward" : "forward");
-}
-
-function handleEditingResult(result, event)
-{
-if (result === "commit") {
-editingCommitted.call(element);
-event.consume(true);
-} else if (result === "cancel") {
-editingCancelled.call(element);
-event.consume(true);
-} else if (result && result.startsWith("move-")) {
-moveDirection = result.substring(5);
-if (event.keyIdentifier !== "U+0009")
-blurEventListener();
-}
-}
-
-function pasteEventListener(event)
-{
-var result = pasteCallback(event);
-handleEditingResult(result, event);
-}
-
-function keyDownEventListener(event)
-{
-var handler = config.customFinishHandler || defaultFinishHandler;
-var result = handler(event);
-handleEditingResult(result, event);
-}
-
-element.addEventListener("blur", blurEventListener, false);
-element.addEventListener("keydown", keyDownEventListener, true);
-if (pasteCallback)
-element.addEventListener("paste", pasteEventListener, true);
-
-WebInspector.setCurrentFocusElement(element);
-return {
-cancel: editingCancelled.bind(element),
-commit: editingCommitted.bind(element)
-};
-}
-
-
-Number.secondsToString = function(seconds, higherResolution)
-{
-if (!isFinite(seconds))
-return "-";
-
-if (seconds === 0)
-return "0";
-
-var ms = seconds * 1000;
-if (higherResolution && ms < 1000)
-return WebInspector.UIString("%.3f\u2009ms", ms);
-else if (ms < 1000)
-return WebInspector.UIString("%.0f\u2009ms", ms);
-
-if (seconds < 60)
-return WebInspector.UIString("%.2f\u2009s", seconds);
-
-var minutes = seconds / 60;
-if (minutes < 60)
-return WebInspector.UIString("%.1f\u2009min", minutes);
-
-var hours = minutes / 60;
-if (hours < 24)
-return WebInspector.UIString("%.1f\u2009hrs", hours);
-
-var days = hours / 24;
-return WebInspector.UIString("%.1f\u2009days", days);
-}
-
-
-Number.bytesToString = function(bytes)
-{
-if (bytes < 1024)
-return WebInspector.UIString("%.0f\u2009B", bytes);
-
-var kilobytes = bytes / 1024;
-if (kilobytes < 100)
-return WebInspector.UIString("%.1f\u2009KB", kilobytes);
-if (kilobytes < 1024)
-return WebInspector.UIString("%.0f\u2009KB", kilobytes);
-
-var megabytes = kilobytes / 1024;
-if (megabytes < 100)
-return WebInspector.UIString("%.1f\u2009MB", megabytes);
-else
-return WebInspector.UIString("%.0f\u2009MB", megabytes);
-}
-
-Number.withThousandsSeparator = function(num)
-{
-var str = num + "";
-var re = /(\d+)(\d{3})/;
-while (str.match(re))
-str = str.replace(re, "$1\u2009$2"); 
-return str;
-}
-
-WebInspector.useLowerCaseMenuTitles = function()
-{
-return WebInspector.platform() === "windows" && Preferences.useLowerCaseMenuTitlesOnWindows;
-}
-
-WebInspector.formatLocalized = function(format, substitutions, formatters, initialValue, append)
-{
-return String.format(WebInspector.UIString(format), substitutions, formatters, initialValue, append);
-}
-
-WebInspector.openLinkExternallyLabel = function()
-{
-return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in new tab" : "Open Link in New Tab");
-}
-
-WebInspector.copyLinkAddressLabel = function()
-{
-return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy link address" : "Copy Link Address");
-}
-
-WebInspector.platform = function()
-{
-if (!WebInspector._platform)
-WebInspector._platform = InspectorFrontendHost.platform();
-return WebInspector._platform;
-}
-
-WebInspector.isMac = function()
-{
-if (typeof WebInspector._isMac === "undefined")
-WebInspector._isMac = WebInspector.platform() === "mac";
-
-return WebInspector._isMac;
-}
-
-WebInspector.isWin = function()
-{
-if (typeof WebInspector._isWin === "undefined")
-WebInspector._isWin = WebInspector.platform() === "windows";
-
-return WebInspector._isWin;
-}
-
-WebInspector.PlatformFlavor = {
-WindowsVista: "windows-vista",
-MacTiger: "mac-tiger",
-MacLeopard: "mac-leopard",
-MacSnowLeopard: "mac-snowleopard",
-MacLion: "mac-lion",
-MacMountainLion: "mac-mountain-lion"
-}
-
-WebInspector.platformFlavor = function()
-{
-function detectFlavor()
-{
-const userAgent = navigator.userAgent;
-
-if (WebInspector.platform() === "windows") {
-var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
-if (match && match[1] >= 6)
-return WebInspector.PlatformFlavor.WindowsVista;
-return null;
-} else if (WebInspector.platform() === "mac") {
-var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
-if (!match || match[1] != 10)
-return WebInspector.PlatformFlavor.MacSnowLeopard;
-switch (Number(match[2])) {
-case 4:
-return WebInspector.PlatformFlavor.MacTiger;
-case 5:
-return WebInspector.PlatformFlavor.MacLeopard;
-case 6:
-return WebInspector.PlatformFlavor.MacSnowLeopard;
-case 7:
-return WebInspector.PlatformFlavor.MacLion;
-case 8:
-return WebInspector.PlatformFlavor.MacMountainLion;
-default:
-return "";
-}
-}
-}
-
-if (!WebInspector._platformFlavor)
-WebInspector._platformFlavor = detectFlavor();
-
-return WebInspector._platformFlavor;
-}
-
-WebInspector.port = function()
-{
-if (!WebInspector._port)
-WebInspector._port = InspectorFrontendHost.port();
-
-return WebInspector._port;
-}
-
-WebInspector.installPortStyles = function()
-{
-var platform = WebInspector.platform();
-document.body.addStyleClass("platform-" + platform);
-var flavor = WebInspector.platformFlavor();
-if (flavor)
-document.body.addStyleClass("platform-" + flavor);
-var port = WebInspector.port();
-document.body.addStyleClass("port-" + port);
-}
-
-WebInspector._windowFocused = function(event)
-{
-if (event.target.document.nodeType === Node.DOCUMENT_NODE)
-document.body.removeStyleClass("inactive");
-}
-
-WebInspector._windowBlurred = function(event)
-{
-if (event.target.document.nodeType === Node.DOCUMENT_NODE)
-document.body.addStyleClass("inactive");
-}
-
-WebInspector.previousFocusElement = function()
-{
-return WebInspector._previousFocusElement;
-}
-
-WebInspector.currentFocusElement = function()
-{
-return WebInspector._currentFocusElement;
-}
-
-WebInspector._focusChanged = function(event)
-{
-WebInspector.setCurrentFocusElement(event.target);
-}
-
-WebInspector._textInputTypes = ["text", "search", "tel", "url", "email", "password"].keySet(); 
-WebInspector._isTextEditingElement = function(element)
-{
-if (element instanceof HTMLInputElement)
-return element.type in WebInspector._textInputTypes;
-
-if (element instanceof HTMLTextAreaElement)
-return true;
-
-return false;
-}
-
-WebInspector.setCurrentFocusElement = function(x)
-{
-if (WebInspector._currentFocusElement !== x)
-WebInspector._previousFocusElement = WebInspector._currentFocusElement;
-WebInspector._currentFocusElement = x;
-
-if (WebInspector._currentFocusElement) {
-WebInspector._currentFocusElement.focus();
-
-
-
-
-var selection = window.getSelection();
-if (!WebInspector._isTextEditingElement(WebInspector._currentFocusElement) && selection.isCollapsed && !WebInspector._currentFocusElement.isInsertionCaretInside()) {
-var selectionRange = WebInspector._currentFocusElement.ownerDocument.createRange();
-selectionRange.setStart(WebInspector._currentFocusElement, 0);
-selectionRange.setEnd(WebInspector._currentFocusElement, 0);
-
-selection.removeAllRanges();
-selection.addRange(selectionRange);
-}
-} else if (WebInspector._previousFocusElement)
-WebInspector._previousFocusElement.blur();
-}
-
-WebInspector.restoreFocusFromElement = function(element)
-{
-if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement()))
-WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());
-}
-
-WebInspector.setToolbarColors = function(backgroundColor, color)
-{
-if (!WebInspector._themeStyleElement) {
-WebInspector._themeStyleElement = document.createElement("style");
-document.head.appendChild(WebInspector._themeStyleElement);
-}
-WebInspector._themeStyleElement.textContent =
-"#toolbar {\
-             background-image: none !important;\
-             background-color: " + backgroundColor + " !important;\
-         }\
-         \
-         .toolbar-label {\
-             color: " + color + " !important;\
-             text-shadow: none;\
-         }";
-}
-
-WebInspector.resetToolbarColors = function()
-{
-if (WebInspector._themeStyleElement)
-WebInspector._themeStyleElement.textContent = "";
-}
-
-
-WebInspector.highlightSearchResult = function(element, offset, length, domChanges)
-{
-var result = WebInspector.highlightSearchResults(element, [{offset: offset, length: length }], domChanges);
-return result.length ? result[0] : null;
-}
-
-
-WebInspector.highlightSearchResults = function(element, resultRanges, changes)
-{
-return WebInspector.highlightRangesWithStyleClass(element, resultRanges, "webkit-search-result", changes);
-}
-
-
-WebInspector.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, changes)
-{
-changes = changes || [];
-var highlightNodes = [];
-var lineText = element.textContent;
-var ownerDocument = element.ownerDocument;
-var textNodeSnapshot = ownerDocument.evaluate(".//text()", element, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
-
-var snapshotLength = textNodeSnapshot.snapshotLength;
-if (snapshotLength === 0)
-return highlightNodes;
-
-var nodeRanges = [];
-var rangeEndOffset = 0;
-for (var i = 0; i < snapshotLength; ++i) {
-var range = {};
-range.offset = rangeEndOffset;
-range.length = textNodeSnapshot.snapshotItem(i).textContent.length;
-rangeEndOffset = range.offset + range.length;
-nodeRanges.push(range);
-}
-
-var startIndex = 0;
-for (var i = 0; i < resultRanges.length; ++i) {
-var startOffset = resultRanges[i].offset;
-var endOffset = startOffset + resultRanges[i].length;
-
-while (startIndex < snapshotLength && nodeRanges[startIndex].offset + nodeRanges[startIndex].length <= startOffset)
-startIndex++;
-var endIndex = startIndex;
-while (endIndex < snapshotLength && nodeRanges[endIndex].offset + nodeRanges[endIndex].length < endOffset)
-endIndex++;
-if (endIndex === snapshotLength)
-break;
-
-var highlightNode = ownerDocument.createElement("span");
-highlightNode.className = styleClass;
-highlightNode.textContent = lineText.substring(startOffset, endOffset);
-
-var lastTextNode = textNodeSnapshot.snapshotItem(endIndex);
-var lastText = lastTextNode.textContent;
-lastTextNode.textContent = lastText.substring(endOffset - nodeRanges[endIndex].offset);
-changes.push({ node: lastTextNode, type: "changed", oldText: lastText, newText: lastTextNode.textContent });
-
-if (startIndex === endIndex) {
-lastTextNode.parentElement.insertBefore(highlightNode, lastTextNode);
-changes.push({ node: highlightNode, type: "added", nextSibling: lastTextNode, parent: lastTextNode.parentElement });
-highlightNodes.push(highlightNode);
-
-var prefixNode = ownerDocument.createTextNode(lastText.substring(0, startOffset - nodeRanges[startIndex].offset));
-lastTextNode.parentElement.insertBefore(prefixNode, highlightNode);
-changes.push({ node: prefixNode, type: "added", nextSibling: highlightNode, parent: lastTextNode.parentElement });
-} else {
-var firstTextNode = textNodeSnapshot.snapshotItem(startIndex);
-var firstText = firstTextNode.textContent;
-var anchorElement = firstTextNode.nextSibling;
-
-firstTextNode.parentElement.insertBefore(highlightNode, anchorElement);
-changes.push({ node: highlightNode, type: "added", nextSibling: anchorElement, parent: firstTextNode.parentElement });
-highlightNodes.push(highlightNode);
-
-firstTextNode.textContent = firstText.substring(0, startOffset - nodeRanges[startIndex].offset);
-changes.push({ node: firstTextNode, type: "changed", oldText: firstText, newText: firstTextNode.textContent });
-
-for (var j = startIndex + 1; j < endIndex; j++) {
-var textNode = textNodeSnapshot.snapshotItem(j);
-var text = textNode.textContent;
-textNode.textContent = "";
-changes.push({ node: textNode, type: "changed", oldText: text, newText: textNode.textContent });
-}
-}
-startIndex = endIndex;
-nodeRanges[startIndex].offset = endOffset;
-nodeRanges[startIndex].length = lastTextNode.textContent.length;
-
-}
-return highlightNodes;
-}
-
-WebInspector.applyDomChanges = function(domChanges)
-{
-for (var i = 0, size = domChanges.length; i < size; ++i) {
-var entry = domChanges[i];
-switch (entry.type) {
-case "added":
-entry.parent.insertBefore(entry.node, entry.nextSibling);
-break;
-case "changed":
-entry.node.textContent = entry.newText;
-break;
-}
-}
-}
-
-WebInspector.revertDomChanges = function(domChanges)
-{
-for (var i = domChanges.length - 1; i >= 0; --i) {
-var entry = domChanges[i];
-switch (entry.type) {
-case "added":
-if (entry.node.parentElement)
-entry.node.parentElement.removeChild(entry.node);
-break;
-case "changed":
-entry.node.textContent = entry.oldText;
-break;
-}
-}
-}
-
-WebInspector._coalescingLevel = 0;
-
-WebInspector.startBatchUpdate = function()
-{
-if (!WebInspector._coalescingLevel)
-WebInspector._postUpdateHandlers = new Map();
-WebInspector._coalescingLevel++;
-}
-
-WebInspector.endBatchUpdate = function()
-{
-if (--WebInspector._coalescingLevel)
-return;
-
-var handlers = WebInspector._postUpdateHandlers;
-delete WebInspector._postUpdateHandlers;
-
-var keys = handlers.keys();
-for (var i = 0; i < keys.length; ++i) {
-var object = keys[i];
-var methods = handlers.get(object).keys();
-for (var j = 0; j < methods.length; ++j)
-methods[j].call(object);
-}
-}
-
-
-WebInspector.invokeOnceAfterBatchUpdate = function(object, method)
-{
-if (!WebInspector._coalescingLevel) {
-method.call(object);
-return;
-}
-
-var methods = WebInspector._postUpdateHandlers.get(object);
-if (!methods) {
-methods = new Map();
-WebInspector._postUpdateHandlers.put(object, methods);
-}
-methods.put(method);
-}
-
-;(function() {
-
-function windowLoaded()
-{
-window.addEventListener("focus", WebInspector._windowFocused, false);
-window.addEventListener("blur", WebInspector._windowBlurred, false);
-document.addEventListener("focus", WebInspector._focusChanged.bind(this), true);
-window.removeEventListener("DOMContentLoaded", windowLoaded, false);
-}
-
-window.addEventListener("DOMContentLoaded", windowLoaded, false);
-
-})();
-
 
 
 
@@ -4680,20 +3826,36 @@
 return callbackId;
 },
 
+_getAgent: function(domain)
+{
+var agentName = domain + "Agent";
+if (!window[agentName])
+window[agentName] = {};
+return window[agentName];
+},
+
 registerCommand: function(method, signature, replyArgs)
 {
 var domainAndMethod = method.split(".");
-var agentName = domainAndMethod[0] + "Agent";
-if (!window[agentName])
-window[agentName] = {};
+var agent = this._getAgent(domainAndMethod[0]);
 
-window[agentName][domainAndMethod[1]] = this._sendMessageToBackend.bind(this, method, signature);
-window[agentName][domainAndMethod[1]]["invoke"] = this._invoke.bind(this, method, signature);
+agent[domainAndMethod[1]] = this._sendMessageToBackend.bind(this, method, signature);
+agent[domainAndMethod[1]]["invoke"] = this._invoke.bind(this, method, signature);
 this._replyArgs[method] = replyArgs;
 
 this._initialized = true;
 },
 
+registerEnum: function(type, values)
+{
+var domainAndMethod = type.split(".");
+var agent = this._getAgent(domainAndMethod[0]);
+
+agent[domainAndMethod[1]] = values;
+
+this._initialized = true;
+},
+
 registerEvent: function(eventName, params)
 {
 this._eventArgs[eventName] = params;
@@ -4765,10 +3927,17 @@
 
 sendMessageObjectToBackend: function(messageObject)
 {
+if (this._disconnected)
+return;
 var message = JSON.stringify(messageObject);
 InspectorFrontendHost.sendMessageToBackend(message);
 },
 
+disconnect: function()
+{
+this._disconnected = true;
+},
+
 registerDomainDispatcher: function(domain, dispatcher)
 {
 this._domainDispatchers[domain] = dispatcher;
@@ -4884,10 +4053,18 @@
 xhr.send(null);
 
 var schema = JSON.parse(xhr.responseText);
+var code = InspectorBackendClass._generateCommands(schema);
+eval(code);
+}
+}
+
+
+InspectorBackendClass._generateCommands = function(schema) {
 var jsTypes = { integer: "number", array: "object" };
 var rawTypes = {};
+var result = [];
 
-var domains = schema["domains"];
+var domains = schema["domains"] || [];
 for (var i = 0; i < domains.length; ++i) {
 var domain = domains[i];
 for (var j = 0; domain.types && j < domain.types.length; ++j) {
@@ -4896,11 +4073,41 @@
 }
 }
 
-var result = [];
+function toUpperCase(groupIndex, group0, group1)
+{
+return [group0, group1][groupIndex].toUpperCase();
+}
+function generateEnum(enumName, items)
+{
+var members = []
+for (var m = 0; m < items.length; ++m) {
+var value = items[m];
+var name = value.replace(/-(\w)/g, toUpperCase.bind(null, 1)).toTitleCase();
+name = name.replace(/HTML|XML|WML|API/ig, toUpperCase.bind(null, 0));
+members.push(name + ": \"" + value +"\"");
+}
+return "InspectorBackend.registerEnum(\"" + enumName + "\", {" + members.join(", ") + "});";
+}
+
 for (var i = 0; i < domains.length; ++i) {
 var domain = domains[i];
 
-var commands = domain["commands"] || [];    
+var types = domain["types"] || [];
+for (var j = 0; j < types.length; ++j) {
+var type = types[j];
+if ((type["type"] === "string") && type["enum"])
+result.push(generateEnum(domain.domain + "." + type.id, type["enum"]));
+else if (type["type"] === "object") {
+var properties = type["properties"] || [];
+for (var k = 0; k < properties.length; ++k) {
+var property = properties[k];
+if ((property["type"] === "string") && property["enum"])
+result.push(generateEnum(domain.domain + "." + type.id + property["name"].toTitleCase(), property["enum"]));
+}
+}
+}
+
+var commands = domain["commands"] || [];
 for (var j = 0; j < commands.length; ++j) {
 var command = commands[j];
 var parameters = command["parameters"];
@@ -4944,8 +4151,7 @@
 
 result.push("InspectorBackend.register" + domain.domain + "Dispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, \"" + domain.domain + "\");");
 }
-eval(result.join("\n"));
-}
+return result.join("\n");
 }
 
 InspectorBackend = new InspectorBackendClass();
@@ -4964,20 +4170,30 @@
 InspectorBackend.registerEvent("Inspector.evaluateForTestInFrontend", ["testCallId", "script"]);
 InspectorBackend.registerEvent("Inspector.inspect", ["object", "hints"]);
 InspectorBackend.registerEvent("Inspector.detached", ["reason"]);
+InspectorBackend.registerEvent("Inspector.targetCrashed", []);
 InspectorBackend.registerCommand("Inspector.enable", [], []);
 InspectorBackend.registerCommand("Inspector.disable", [], []);
 
 
 InspectorBackend.registerMemoryDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Memory");
-InspectorBackend.registerCommand("Memory.getDOMNodeCount", [], ["domGroups", "strings"]);
-InspectorBackend.registerCommand("Memory.getProcessMemoryDistribution", [{"name": "reportGraph", "type": "boolean", "optional": true}], ["distribution", "graph"]);
+InspectorBackend.registerEvent("Memory.addNativeSnapshotChunk", ["chunk"]);
+InspectorBackend.registerCommand("Memory.getDOMCounters", [], ["documents", "nodes", "jsEventListeners"]);
+InspectorBackend.registerCommand("Memory.getProcessMemoryDistribution", [{"name": "reportGraph", "type": "boolean", "optional": true}], ["distribution", "graphMetaInformation"]);
 
 
 InspectorBackend.registerPageDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Page");
+InspectorBackend.registerEnum("Page.ResourceType", {Document: "Document", Stylesheet: "Stylesheet", Image: "Image", Font: "Font", Script: "Script", XHR: "XHR", WebSocket: "WebSocket", Other: "Other"});
 InspectorBackend.registerEvent("Page.domContentEventFired", ["timestamp"]);
 InspectorBackend.registerEvent("Page.loadEventFired", ["timestamp"]);
 InspectorBackend.registerEvent("Page.frameNavigated", ["frame"]);
 InspectorBackend.registerEvent("Page.frameDetached", ["frameId"]);
+InspectorBackend.registerEvent("Page.frameStartedLoading", ["frameId"]);
+InspectorBackend.registerEvent("Page.frameStoppedLoading", ["frameId"]);
+InspectorBackend.registerEvent("Page.frameScheduledNavigation", ["frameId", "delay"]);
+InspectorBackend.registerEvent("Page.frameClearedScheduledNavigation", ["frameId"]);
+InspectorBackend.registerEvent("Page.javascriptDialogOpening", ["message"]);
+InspectorBackend.registerEvent("Page.javascriptDialogClosed", []);
+InspectorBackend.registerEvent("Page.scriptsEnabled", ["isEnabled"]);
 InspectorBackend.registerCommand("Page.enable", [], []);
 InspectorBackend.registerCommand("Page.disable", [], []);
 InspectorBackend.registerCommand("Page.addScriptToEvaluateOnLoad", [{"name": "scriptSource", "type": "string", "optional": false}], ["identifier"]);
@@ -4985,33 +4201,38 @@
 InspectorBackend.registerCommand("Page.reload", [{"name": "ignoreCache", "type": "boolean", "optional": true}, {"name": "scriptToEvaluateOnLoad", "type": "string", "optional": true}, {"name": "scriptPreprocessor", "type": "string", "optional": true}], []);
 InspectorBackend.registerCommand("Page.navigate", [{"name": "url", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("Page.getCookies", [], ["cookies", "cookiesString"]);
-InspectorBackend.registerCommand("Page.deleteCookie", [{"name": "cookieName", "type": "string", "optional": false}, {"name": "domain", "type": "string", "optional": false}], []);
+InspectorBackend.registerCommand("Page.deleteCookie", [{"name": "cookieName", "type": "string", "optional": false}, {"name": "url", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("Page.getResourceTree", [], ["frameTree"]);
 InspectorBackend.registerCommand("Page.getResourceContent", [{"name": "frameId", "type": "string", "optional": false}, {"name": "url", "type": "string", "optional": false}], ["content", "base64Encoded"]);
 InspectorBackend.registerCommand("Page.searchInResource", [{"name": "frameId", "type": "string", "optional": false}, {"name": "url", "type": "string", "optional": false}, {"name": "query", "type": "string", "optional": false}, {"name": "caseSensitive", "type": "boolean", "optional": true}, {"name": "isRegex", "type": "boolean", "optional": true}], ["result"]);
 InspectorBackend.registerCommand("Page.searchInResources", [{"name": "text", "type": "string", "optional": false}, {"name": "caseSensitive", "type": "boolean", "optional": true}, {"name": "isRegex", "type": "boolean", "optional": true}], ["result"]);
 InspectorBackend.registerCommand("Page.setDocumentContent", [{"name": "frameId", "type": "string", "optional": false}, {"name": "html", "type": "string", "optional": false}], []);
-InspectorBackend.registerCommand("Page.canOverrideDeviceMetrics", [], ["result"]);
 InspectorBackend.registerCommand("Page.setDeviceMetricsOverride", [{"name": "width", "type": "number", "optional": false}, {"name": "height", "type": "number", "optional": false}, {"name": "fontScaleFactor", "type": "number", "optional": false}, {"name": "fitWindow", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.setShowPaintRects", [{"name": "result", "type": "boolean", "optional": false}], []);
+InspectorBackend.registerCommand("Page.setShowDebugBorders", [{"name": "show", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.canShowFPSCounter", [], ["show"]);
 InspectorBackend.registerCommand("Page.setShowFPSCounter", [{"name": "show", "type": "boolean", "optional": false}], []);
+InspectorBackend.registerCommand("Page.canContinuouslyPaint", [], ["value"]);
+InspectorBackend.registerCommand("Page.setContinuousPaintingEnabled", [{"name": "enabled", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.getScriptExecutionStatus", [], ["result"]);
 InspectorBackend.registerCommand("Page.setScriptExecutionDisabled", [{"name": "value", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.setGeolocationOverride", [{"name": "latitude", "type": "number", "optional": true}, {"name": "longitude", "type": "number", "optional": true}, {"name": "accuracy", "type": "number", "optional": true}], []);
 InspectorBackend.registerCommand("Page.clearGeolocationOverride", [], []);
-InspectorBackend.registerCommand("Page.canOverrideGeolocation", [], ["result"]);
 InspectorBackend.registerCommand("Page.setDeviceOrientationOverride", [{"name": "alpha", "type": "number", "optional": false}, {"name": "beta", "type": "number", "optional": false}, {"name": "gamma", "type": "number", "optional": false}], []);
 InspectorBackend.registerCommand("Page.clearDeviceOrientationOverride", [], []);
-InspectorBackend.registerCommand("Page.canOverrideDeviceOrientation", [], ["result"]);
 InspectorBackend.registerCommand("Page.setTouchEmulationEnabled", [{"name": "enabled", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.setEmulatedMedia", [{"name": "media", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("Page.getCompositingBordersVisible", [], ["result"]);
 InspectorBackend.registerCommand("Page.setCompositingBordersVisible", [{"name": "visible", "type": "boolean", "optional": false}], []);
 InspectorBackend.registerCommand("Page.captureScreenshot", [], ["data"]);
+InspectorBackend.registerCommand("Page.handleJavaScriptDialog", [{"name": "accept", "type": "boolean", "optional": false}, {"name": "promptText", "type": "string", "optional": true}], []);
 
 
 InspectorBackend.registerRuntimeDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Runtime");
+InspectorBackend.registerEnum("Runtime.RemoteObjectType", {Object: "object", Function: "function", Undefined: "undefined", String: "string", Number: "number", Boolean: "boolean"});
+InspectorBackend.registerEnum("Runtime.RemoteObjectSubtype", {Array: "array", Null: "null", Node: "node", Regexp: "regexp", Date: "date"});
+InspectorBackend.registerEnum("Runtime.PropertyPreviewType", {Object: "object", Function: "function", Undefined: "undefined", String: "string", Number: "number", Boolean: "boolean"});
+InspectorBackend.registerEnum("Runtime.PropertyPreviewSubtype", {Array: "array", Null: "null", Node: "node", Regexp: "regexp", Date: "date"});
 InspectorBackend.registerEvent("Runtime.executionContextCreated", ["context"]);
 InspectorBackend.registerCommand("Runtime.evaluate", [{"name": "expression", "type": "string", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}, {"name": "includeCommandLineAPI", "type": "boolean", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}, {"name": "contextId", "type": "number", "optional": true}, {"name": "returnByValue", "type": "boolean", "optional": true}, {"name": "generatePreview", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
 InspectorBackend.registerCommand("Runtime.callFunctionOn", [{"name": "objectId", "type": "string", "optional": false}, {"name": "functionDeclaration", "type": "string", "optional": false}, {"name": "arguments", "type": "object", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}, {"name": "returnByValue", "type": "boolean", "optional": true}, {"name": "generatePreview", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
@@ -5024,6 +4245,9 @@
 
 
 InspectorBackend.registerConsoleDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Console");
+InspectorBackend.registerEnum("Console.ConsoleMessageSource", {XML: "xml", Javascript: "javascript", Network: "network", ConsoleAPI: "console-api", Storage: "storage", Appcache: "appcache", Rendering: "rendering", Css: "css", Security: "security", Other: "other"});
+InspectorBackend.registerEnum("Console.ConsoleMessageLevel", {Log: "log", Warning: "warning", Error: "error", Debug: "debug"});
+InspectorBackend.registerEnum("Console.ConsoleMessageType", {Log: "log", Dir: "dir", DirXML: "dirxml", Table: "table", Trace: "trace", Clear: "clear", StartGroup: "startGroup", StartGroupCollapsed: "startGroupCollapsed", EndGroup: "endGroup", Assert: "assert", Timing: "timing", Profile: "profile", ProfileEnd: "profileEnd"});
 InspectorBackend.registerEvent("Console.messageAdded", ["message"]);
 InspectorBackend.registerEvent("Console.messageRepeatCountUpdated", ["count"]);
 InspectorBackend.registerEvent("Console.messagesCleared", []);
@@ -5036,6 +4260,7 @@
 
 
 InspectorBackend.registerNetworkDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Network");
+InspectorBackend.registerEnum("Network.InitiatorType", {Parser: "parser", Script: "script", Other: "other"});
 InspectorBackend.registerEvent("Network.requestWillBeSent", ["requestId", "frameId", "loaderId", "documentURL", "request", "timestamp", "initiator", "redirectResponse"]);
 InspectorBackend.registerEvent("Network.requestServedFromCache", ["requestId"]);
 InspectorBackend.registerEvent("Network.responseReceived", ["requestId", "frameId", "loaderId", "timestamp", "type", "response"]);
@@ -5072,21 +4297,26 @@
 
 
 InspectorBackend.registerIndexedDBDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "IndexedDB");
+InspectorBackend.registerEnum("IndexedDB.KeyType", {Number: "number", String: "string", Date: "date", Array: "array"});
+InspectorBackend.registerEnum("IndexedDB.KeyPathType", {Null: "null", String: "string", Array: "array"});
 InspectorBackend.registerCommand("IndexedDB.enable", [], []);
 InspectorBackend.registerCommand("IndexedDB.disable", [], []);
-InspectorBackend.registerCommand("IndexedDB.requestDatabaseNamesForFrame", [{"name": "frameId", "type": "string", "optional": false}], ["securityOriginWithDatabaseNames"]);
-InspectorBackend.registerCommand("IndexedDB.requestDatabase", [{"name": "frameId", "type": "string", "optional": false}, {"name": "databaseName", "type": "string", "optional": false}], ["databaseWithObjectStores"]);
-InspectorBackend.registerCommand("IndexedDB.requestData", [{"name": "frameId", "type": "string", "optional": false}, {"name": "databaseName", "type": "string", "optional": false}, {"name": "objectStoreName", "type": "string", "optional": false}, {"name": "indexName", "type": "string", "optional": false}, {"name": "skipCount", "type": "number", "optional": false}, {"name": "pageSize", "type": "number", "optional": false}, {"name": "keyRange", "type": "object", "optional": true}], ["objectStoreDataEntries", "hasMore"]);
+InspectorBackend.registerCommand("IndexedDB.requestDatabaseNames", [{"name": "securityOrigin", "type": "string", "optional": false}], ["databaseNames"]);
+InspectorBackend.registerCommand("IndexedDB.requestDatabase", [{"name": "securityOrigin", "type": "string", "optional": false}, {"name": "databaseName", "type": "string", "optional": false}], ["databaseWithObjectStores"]);
+InspectorBackend.registerCommand("IndexedDB.requestData", [{"name": "securityOrigin", "type": "string", "optional": false}, {"name": "databaseName", "type": "string", "optional": false}, {"name": "objectStoreName", "type": "string", "optional": false}, {"name": "indexName", "type": "string", "optional": false}, {"name": "skipCount", "type": "number", "optional": false}, {"name": "pageSize", "type": "number", "optional": false}, {"name": "keyRange", "type": "object", "optional": true}], ["objectStoreDataEntries", "hasMore"]);
+InspectorBackend.registerCommand("IndexedDB.clearObjectStore", [{"name": "securityOrigin", "type": "string", "optional": false}, {"name": "databaseName", "type": "string", "optional": false}, {"name": "objectStoreName", "type": "string", "optional": false}], []);
 
 
 InspectorBackend.registerDOMStorageDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "DOMStorage");
-InspectorBackend.registerEvent("DOMStorage.addDOMStorage", ["storage"]);
-InspectorBackend.registerEvent("DOMStorage.domStorageUpdated", ["storageId"]);
+InspectorBackend.registerEvent("DOMStorage.domStorageItemsCleared", ["storageId"]);
+InspectorBackend.registerEvent("DOMStorage.domStorageItemRemoved", ["storageId", "key"]);
+InspectorBackend.registerEvent("DOMStorage.domStorageItemAdded", ["storageId", "key", "newValue"]);
+InspectorBackend.registerEvent("DOMStorage.domStorageItemUpdated", ["storageId", "key", "oldValue", "newValue"]);
 InspectorBackend.registerCommand("DOMStorage.enable", [], []);
 InspectorBackend.registerCommand("DOMStorage.disable", [], []);
-InspectorBackend.registerCommand("DOMStorage.getDOMStorageEntries", [{"name": "storageId", "type": "string", "optional": false}], ["entries"]);
-InspectorBackend.registerCommand("DOMStorage.setDOMStorageItem", [{"name": "storageId", "type": "string", "optional": false}, {"name": "key", "type": "string", "optional": false}, {"name": "value", "type": "string", "optional": false}], ["success"]);
-InspectorBackend.registerCommand("DOMStorage.removeDOMStorageItem", [{"name": "storageId", "type": "string", "optional": false}, {"name": "key", "type": "string", "optional": false}], ["success"]);
+InspectorBackend.registerCommand("DOMStorage.getDOMStorageItems", [{"name": "storageId", "type": "object", "optional": false}], ["entries"]);
+InspectorBackend.registerCommand("DOMStorage.setDOMStorageItem", [{"name": "storageId", "type": "object", "optional": false}, {"name": "key", "type": "string", "optional": false}, {"name": "value", "type": "string", "optional": false}], []);
+InspectorBackend.registerCommand("DOMStorage.removeDOMStorageItem", [{"name": "storageId", "type": "object", "optional": false}, {"name": "key", "type": "string", "optional": false}], []);
 
 
 InspectorBackend.registerApplicationCacheDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "ApplicationCache");
@@ -5121,7 +4351,7 @@
 InspectorBackend.registerEvent("DOM.shadowRootPushed", ["hostId", "root"]);
 InspectorBackend.registerEvent("DOM.shadowRootPopped", ["hostId", "rootId"]);
 InspectorBackend.registerCommand("DOM.getDocument", [], ["root"]);
-InspectorBackend.registerCommand("DOM.requestChildNodes", [{"name": "nodeId", "type": "number", "optional": false}], []);
+InspectorBackend.registerCommand("DOM.requestChildNodes", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "depth", "type": "number", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.querySelector", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "selector", "type": "string", "optional": false}], ["nodeId"]);
 InspectorBackend.registerCommand("DOM.querySelectorAll", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "selector", "type": "string", "optional": false}], ["nodeIds"]);
 InspectorBackend.registerCommand("DOM.setNodeName", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "name", "type": "string", "optional": false}], ["nodeId"]);
@@ -5130,7 +4360,7 @@
 InspectorBackend.registerCommand("DOM.setAttributeValue", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "name", "type": "string", "optional": false}, {"name": "value", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOM.setAttributesAsText", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "text", "type": "string", "optional": false}, {"name": "name", "type": "string", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.removeAttribute", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "name", "type": "string", "optional": false}], []);
-InspectorBackend.registerCommand("DOM.getEventListenersForNode", [{"name": "nodeId", "type": "number", "optional": false}], ["listeners"]);
+InspectorBackend.registerCommand("DOM.getEventListenersForNode", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["listeners"]);
 InspectorBackend.registerCommand("DOM.getOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}], ["outerHTML"]);
 InspectorBackend.registerCommand("DOM.setOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "outerHTML", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOM.performSearch", [{"name": "query", "type": "string", "optional": false}], ["searchId", "resultCount"]);
@@ -5139,10 +4369,13 @@
 InspectorBackend.registerCommand("DOM.requestNode", [{"name": "objectId", "type": "string", "optional": false}], ["nodeId"]);
 InspectorBackend.registerCommand("DOM.setInspectModeEnabled", [{"name": "enabled", "type": "boolean", "optional": false}, {"name": "highlightConfig", "type": "object", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.highlightRect", [{"name": "x", "type": "number", "optional": false}, {"name": "y", "type": "number", "optional": false}, {"name": "width", "type": "number", "optional": false}, {"name": "height", "type": "number", "optional": false}, {"name": "color", "type": "object", "optional": true}, {"name": "outlineColor", "type": "object", "optional": true}], []);
+InspectorBackend.registerCommand("DOM.highlightQuad", [{"name": "quad", "type": "object", "optional": false}, {"name": "color", "type": "object", "optional": true}, {"name": "outlineColor", "type": "object", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.highlightNode", [{"name": "highlightConfig", "type": "object", "optional": false}, {"name": "nodeId", "type": "number", "optional": true}, {"name": "objectId", "type": "string", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.hideHighlight", [], []);
 InspectorBackend.registerCommand("DOM.highlightFrame", [{"name": "frameId", "type": "string", "optional": false}, {"name": "contentColor", "type": "object", "optional": true}, {"name": "contentOutlineColor", "type": "object", "optional": true}], []);
 InspectorBackend.registerCommand("DOM.pushNodeByPathToFrontend", [{"name": "path", "type": "string", "optional": false}], ["nodeId"]);
+InspectorBackend.registerCommand("DOM.pushNodeByBackendIdToFrontend", [{"name": "backendNodeId", "type": "number", "optional": false}], ["nodeId"]);
+InspectorBackend.registerCommand("DOM.releaseBackendNodeIds", [{"name": "nodeGroup", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOM.resolveNode", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["object"]);
 InspectorBackend.registerCommand("DOM.getAttributes", [{"name": "nodeId", "type": "number", "optional": false}], ["attributes"]);
 InspectorBackend.registerCommand("DOM.moveTo", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "targetNodeId", "type": "number", "optional": false}, {"name": "insertBeforeNodeId", "type": "number", "optional": true}], ["nodeId"]);
@@ -5150,9 +4383,14 @@
 InspectorBackend.registerCommand("DOM.redo", [], []);
 InspectorBackend.registerCommand("DOM.markUndoableState", [], []);
 InspectorBackend.registerCommand("DOM.focus", [{"name": "nodeId", "type": "number", "optional": false}], []);
+InspectorBackend.registerCommand("DOM.setFileInputFiles", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "files", "type": "object", "optional": false}], []);
 
 
 InspectorBackend.registerCSSDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "CSS");
+InspectorBackend.registerEnum("CSS.StyleSheetOrigin", {User: "user", UserAgent: "user-agent", Inspector: "inspector", Regular: "regular"});
+InspectorBackend.registerEnum("CSS.CSSPropertyStatus", {Active: "active", Inactive: "inactive", Disabled: "disabled", Style: "style"});
+InspectorBackend.registerEnum("CSS.CSSMediaSource", {MediaRule: "mediaRule", ImportRule: "importRule", LinkedSheet: "linkedSheet", InlineSheet: "inlineSheet"});
+InspectorBackend.registerEnum("CSS.RegionRegionOverset", {Overset: "overset", Fit: "fit", Empty: "empty"});
 InspectorBackend.registerEvent("CSS.mediaQueryResultChanged", []);
 InspectorBackend.registerEvent("CSS.styleSheetChanged", ["styleSheetId"]);
 InspectorBackend.registerEvent("CSS.namedFlowCreated", ["namedFlow"]);
@@ -5167,6 +4405,7 @@
 InspectorBackend.registerCommand("CSS.getStyleSheet", [{"name": "styleSheetId", "type": "string", "optional": false}], ["styleSheet"]);
 InspectorBackend.registerCommand("CSS.getStyleSheetText", [{"name": "styleSheetId", "type": "string", "optional": false}], ["text"]);
 InspectorBackend.registerCommand("CSS.setStyleSheetText", [{"name": "styleSheetId", "type": "string", "optional": false}, {"name": "text", "type": "string", "optional": false}], []);
+InspectorBackend.registerCommand("CSS.setStyleText", [{"name": "styleId", "type": "object", "optional": false}, {"name": "text", "type": "string", "optional": false}], ["style"]);
 InspectorBackend.registerCommand("CSS.setPropertyText", [{"name": "styleId", "type": "object", "optional": false}, {"name": "propertyIndex", "type": "number", "optional": false}, {"name": "text", "type": "string", "optional": false}, {"name": "overwrite", "type": "boolean", "optional": false}], ["style"]);
 InspectorBackend.registerCommand("CSS.toggleProperty", [{"name": "styleId", "type": "object", "optional": false}, {"name": "propertyIndex", "type": "number", "optional": false}, {"name": "disable", "type": "boolean", "optional": false}], ["style"]);
 InspectorBackend.registerCommand("CSS.setRuleSelector", [{"name": "ruleId", "type": "object", "optional": false}, {"name": "selector", "type": "string", "optional": false}], ["rule"]);
@@ -5180,22 +4419,18 @@
 
 InspectorBackend.registerTimelineDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Timeline");
 InspectorBackend.registerEvent("Timeline.eventRecorded", ["record"]);
-InspectorBackend.registerCommand("Timeline.start", [{"name": "maxCallStackDepth", "type": "number", "optional": true}], []);
+InspectorBackend.registerCommand("Timeline.start", [{"name": "maxCallStackDepth", "type": "number", "optional": true}, {"name": "includeDomCounters", "type": "boolean", "optional": true}, {"name": "includeNativeMemoryStatistics", "type": "boolean", "optional": true}], []);
 InspectorBackend.registerCommand("Timeline.stop", [], []);
-InspectorBackend.registerCommand("Timeline.setIncludeMemoryDetails", [{"name": "enabled", "type": "boolean", "optional": false}], []);
-InspectorBackend.registerCommand("Timeline.supportsFrameInstrumentation", [], ["result"]);
-InspectorBackend.registerCommand("Timeline.canMonitorMainThread", [], ["result"]);
 
 
 InspectorBackend.registerDebuggerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Debugger");
+InspectorBackend.registerEnum("Debugger.ScopeType", {Global: "global", Local: "local", With: "with", Closure: "closure", Catch: "catch"});
 InspectorBackend.registerEvent("Debugger.globalObjectCleared", []);
 InspectorBackend.registerEvent("Debugger.scriptParsed", ["scriptId", "url", "startLine", "startColumn", "endLine", "endColumn", "isContentScript", "sourceMapURL", "hasSourceURL"]);
 InspectorBackend.registerEvent("Debugger.scriptFailedToParse", ["url", "scriptSource", "startLine", "errorLine", "errorMessage"]);
 InspectorBackend.registerEvent("Debugger.breakpointResolved", ["breakpointId", "location"]);
 InspectorBackend.registerEvent("Debugger.paused", ["callFrames", "reason", "data"]);
 InspectorBackend.registerEvent("Debugger.resumed", []);
-InspectorBackend.registerCommand("Debugger.causesRecompilation", [], ["result"]);
-InspectorBackend.registerCommand("Debugger.supportsSeparateScriptCompilationAndExecution", [], ["result"]);
 InspectorBackend.registerCommand("Debugger.enable", [], []);
 InspectorBackend.registerCommand("Debugger.disable", [], []);
 InspectorBackend.registerCommand("Debugger.setBreakpointsActive", [{"name": "active", "type": "boolean", "optional": false}], []);
@@ -5219,8 +4454,11 @@
 InspectorBackend.registerCommand("Debugger.compileScript", [{"name": "expression", "type": "string", "optional": false}, {"name": "sourceURL", "type": "string", "optional": false}], ["scriptId", "syntaxErrorMessage"]);
 InspectorBackend.registerCommand("Debugger.runScript", [{"name": "scriptId", "type": "string", "optional": false}, {"name": "contextId", "type": "number", "optional": true}, {"name": "objectGroup", "type": "string", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
 InspectorBackend.registerCommand("Debugger.setOverlayMessage", [{"name": "message", "type": "string", "optional": true}], []);
+InspectorBackend.registerCommand("Debugger.setVariableValue", [{"name": "scopeNumber", "type": "number", "optional": false}, {"name": "variableName", "type": "string", "optional": false}, {"name": "newValue", "type": "object", "optional": false}, {"name": "callFrameId", "type": "string", "optional": true}, {"name": "functionObjectId", "type": "string", "optional": true}], []);
 
 
+InspectorBackend.registerDOMDebuggerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "DOMDebugger");
+InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType", {SubtreeModified: "subtree-modified", AttributeModified: "attribute-modified", NodeRemoved: "node-removed"});
 InspectorBackend.registerCommand("DOMDebugger.setDOMBreakpoint", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "type", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOMDebugger.removeDOMBreakpoint", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "type", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOMDebugger.setEventListenerBreakpoint", [{"name": "eventName", "type": "string", "optional": false}], []);
@@ -5232,27 +4470,34 @@
 
 
 InspectorBackend.registerProfilerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Profiler");
+InspectorBackend.registerEnum("Profiler.ProfileHeaderTypeId", {CPU: "CPU", CSS: "CSS", HEAP: "HEAP"});
 InspectorBackend.registerEvent("Profiler.addProfileHeader", ["header"]);
-InspectorBackend.registerEvent("Profiler.addHeapSnapshotChunk", ["uid", "chunk"]);
-InspectorBackend.registerEvent("Profiler.finishHeapSnapshot", ["uid"]);
 InspectorBackend.registerEvent("Profiler.setRecordingProfile", ["isProfiling"]);
 InspectorBackend.registerEvent("Profiler.resetProfiles", []);
-InspectorBackend.registerEvent("Profiler.reportHeapSnapshotProgress", ["done", "total"]);
-InspectorBackend.registerCommand("Profiler.causesRecompilation", [], ["result"]);
-InspectorBackend.registerCommand("Profiler.isSampling", [], ["result"]);
-InspectorBackend.registerCommand("Profiler.hasHeapProfiler", [], ["result"]);
 InspectorBackend.registerCommand("Profiler.enable", [], []);
 InspectorBackend.registerCommand("Profiler.disable", [], []);
 InspectorBackend.registerCommand("Profiler.start", [], []);
-InspectorBackend.registerCommand("Profiler.stop", [], []);
+InspectorBackend.registerCommand("Profiler.stop", [], ["header"]);
 InspectorBackend.registerCommand("Profiler.getProfileHeaders", [], ["headers"]);
-InspectorBackend.registerCommand("Profiler.getProfile", [{"name": "type", "type": "string", "optional": false}, {"name": "uid", "type": "number", "optional": false}], ["profile"]);
+InspectorBackend.registerCommand("Profiler.getCPUProfile", [{"name": "uid", "type": "number", "optional": false}], ["profile"]);
 InspectorBackend.registerCommand("Profiler.removeProfile", [{"name": "type", "type": "string", "optional": false}, {"name": "uid", "type": "number", "optional": false}], []);
 InspectorBackend.registerCommand("Profiler.clearProfiles", [], []);
-InspectorBackend.registerCommand("Profiler.takeHeapSnapshot", [], []);
-InspectorBackend.registerCommand("Profiler.collectGarbage", [], []);
-InspectorBackend.registerCommand("Profiler.getObjectByHeapObjectId", [{"name": "objectId", "type": "string", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["result"]);
-InspectorBackend.registerCommand("Profiler.getHeapObjectId", [{"name": "objectId", "type": "string", "optional": false}], ["heapSnapshotObjectId"]);
+
+
+InspectorBackend.registerHeapProfilerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "HeapProfiler");
+InspectorBackend.registerEvent("HeapProfiler.addProfileHeader", ["header"]);
+InspectorBackend.registerEvent("HeapProfiler.addHeapSnapshotChunk", ["uid", "chunk"]);
+InspectorBackend.registerEvent("HeapProfiler.finishHeapSnapshot", ["uid"]);
+InspectorBackend.registerEvent("HeapProfiler.resetProfiles", []);
+InspectorBackend.registerEvent("HeapProfiler.reportHeapSnapshotProgress", ["done", "total"]);
+InspectorBackend.registerCommand("HeapProfiler.getProfileHeaders", [], ["headers"]);
+InspectorBackend.registerCommand("HeapProfiler.getHeapSnapshot", [{"name": "uid", "type": "number", "optional": false}], []);
+InspectorBackend.registerCommand("HeapProfiler.removeProfile", [{"name": "uid", "type": "number", "optional": false}], []);
+InspectorBackend.registerCommand("HeapProfiler.clearProfiles", [], []);
+InspectorBackend.registerCommand("HeapProfiler.takeHeapSnapshot", [{"name": "reportProgress", "type": "boolean", "optional": true}], []);
+InspectorBackend.registerCommand("HeapProfiler.collectGarbage", [], []);
+InspectorBackend.registerCommand("HeapProfiler.getObjectByHeapObjectId", [{"name": "objectId", "type": "string", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["result"]);
+InspectorBackend.registerCommand("HeapProfiler.getHeapObjectId", [{"name": "objectId", "type": "string", "optional": false}], ["heapSnapshotObjectId"]);
 
 
 InspectorBackend.registerWorkerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Worker");
@@ -5263,21 +4508,26 @@
 InspectorBackend.registerCommand("Worker.enable", [], []);
 InspectorBackend.registerCommand("Worker.disable", [], []);
 InspectorBackend.registerCommand("Worker.sendMessageToWorker", [{"name": "workerId", "type": "number", "optional": false}, {"name": "message", "type": "object", "optional": false}], []);
+InspectorBackend.registerCommand("Worker.canInspectWorkers", [], ["result"]);
 InspectorBackend.registerCommand("Worker.connectToWorker", [{"name": "workerId", "type": "number", "optional": false}], []);
 InspectorBackend.registerCommand("Worker.disconnectFromWorker", [{"name": "workerId", "type": "number", "optional": false}], []);
 InspectorBackend.registerCommand("Worker.setAutoconnectToWorkers", [{"name": "value", "type": "boolean", "optional": false}], []);
 
 
 InspectorBackend.registerCanvasDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Canvas");
+InspectorBackend.registerEvent("Canvas.contextCreated", ["frameId"]);
+InspectorBackend.registerEvent("Canvas.traceLogsRemoved", ["frameId", "traceLogId"]);
 InspectorBackend.registerCommand("Canvas.enable", [], []);
 InspectorBackend.registerCommand("Canvas.disable", [], []);
 InspectorBackend.registerCommand("Canvas.dropTraceLog", [{"name": "traceLogId", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("Canvas.hasUninstrumentedCanvases", [], ["result"]);
-InspectorBackend.registerCommand("Canvas.captureFrame", [], ["traceLogId"]);
-InspectorBackend.registerCommand("Canvas.startCapturing", [], ["traceLogId"]);
+InspectorBackend.registerCommand("Canvas.captureFrame", [{"name": "frameId", "type": "string", "optional": true}], ["traceLogId"]);
+InspectorBackend.registerCommand("Canvas.startCapturing", [{"name": "frameId", "type": "string", "optional": true}], ["traceLogId"]);
 InspectorBackend.registerCommand("Canvas.stopCapturing", [{"name": "traceLogId", "type": "string", "optional": false}], []);
-InspectorBackend.registerCommand("Canvas.getTraceLog", [{"name": "traceLogId", "type": "string", "optional": false}, {"name": "startOffset", "type": "number", "optional": true}], ["traceLog"]);
-InspectorBackend.registerCommand("Canvas.replayTraceLog", [{"name": "traceLogId", "type": "string", "optional": false}, {"name": "stepNo", "type": "number", "optional": false}], ["screenshotDataUrl"]);
+InspectorBackend.registerCommand("Canvas.getTraceLog", [{"name": "traceLogId", "type": "string", "optional": false}, {"name": "startOffset", "type": "number", "optional": true}, {"name": "maxLength", "type": "number", "optional": true}], ["traceLog"]);
+InspectorBackend.registerCommand("Canvas.replayTraceLog", [{"name": "traceLogId", "type": "string", "optional": false}, {"name": "stepNo", "type": "number", "optional": false}], ["resourceState"]);
+InspectorBackend.registerCommand("Canvas.getResourceInfo", [{"name": "resourceId", "type": "string", "optional": false}], ["resourceInfo"]);
+InspectorBackend.registerCommand("Canvas.getResourceState", [{"name": "traceLogId", "type": "string", "optional": false}, {"name": "resourceId", "type": "string", "optional": false}], ["resourceState"]);
 
 
 InspectorBackend.registerInputDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Input");
@@ -5289,8 +4539,8 @@
 InspectorBackend.registerEvent("LayerTree.layerTreeDidChange", []);
 InspectorBackend.registerCommand("LayerTree.enable", [], []);
 InspectorBackend.registerCommand("LayerTree.disable", [], []);
-InspectorBackend.registerCommand("LayerTree.getLayerTree", [], ["layerTree"]);
-InspectorBackend.registerCommand("LayerTree.nodeIdForLayerId", [{"name": "layerId", "type": "string", "optional": false}], ["nodeId"]);
+InspectorBackend.registerCommand("LayerTree.layersForNode", [{"name": "nodeId", "type": "number", "optional": false}], ["layers"]);
+InspectorBackend.registerCommand("LayerTree.reasonsForCompositingLayer", [{"name": "layerId", "type": "string", "optional": false}], ["compositingReasons"]);
 
 
 
@@ -5322,52 +4572,8 @@
 var InspectorFrontendAPI = {
 _pendingCommands: [],
 
-isDebuggingEnabled: function()
-{
-return WebInspector.debuggerModel.debuggerEnabled();
-},
-
-setDebuggingEnabled: function(enabled)
-{
-if (enabled) {
-WebInspector.debuggerModel.enableDebugger();
-WebInspector.showPanel("scripts");
-} else
-WebInspector.debuggerModel.disableDebugger();
-},
-
-isTimelineProfilingEnabled: function()
-{
-return WebInspector.panels.timeline && WebInspector.panels.timeline.timelineProfilingEnabled;
-},
-
-setTimelineProfilingEnabled: function(enabled)
-{
-WebInspector.showPanel("timeline").setTimelineProfilingEnabled(enabled);
-},
-
-isProfilingJavaScript: function()
-{
-return WebInspector.panels.profiles && WebInspector.CPUProfileType.instance && WebInspector.CPUProfileType.instance.isRecordingProfile();
-},
-
-startProfilingJavaScript: function()
-{
-WebInspector.showPanel("profiles").enableProfiler();
-if (WebInspector.CPUProfileType.instance)
-WebInspector.CPUProfileType.instance.startRecordingProfile();
-},
-
-stopProfilingJavaScript: function()
-{
-WebInspector.showPanel("profiles");
-if (WebInspector.CPUProfileType.instance)
-WebInspector.CPUProfileType.instance.stopRecordingProfile();
-},
-
 setAttachedWindow: function(side)
 {
-
 },
 
 setDockSide: function(side)
@@ -5398,7 +4604,25 @@
 
 enterInspectElementMode: function()
 {
-WebInspector.toggleSearchingForNode();
+WebInspector.showPanel("elements");
+
+if (WebInspector.inspectElementModeController)
+WebInspector.inspectElementModeController.toggleSearch();
+},
+
+fileSystemsLoaded: function(fileSystems)
+{
+WebInspector.isolatedFileSystemDispatcher.fileSystemsLoaded(fileSystems);
+},
+
+fileSystemRemoved: function(fileSystemPath)
+{
+WebInspector.isolatedFileSystemDispatcher.fileSystemRemoved(fileSystemPath);
+},
+
+fileSystemAdded: function(errorMessage, fileSystem)
+{
+WebInspector.isolatedFileSystemDispatcher.fileSystemAdded(errorMessage, fileSystem);
 },
 
 savedURL: function(url)
@@ -5439,7 +4663,7 @@
 
 loadTimelineFromURL: function(url) 
 {
-WebInspector.showPanel("timeline").loadFromURL(url);
+(WebInspector.showPanel("timeline")).loadFromURL(url);
 },
 
 loadCompleted: function()
@@ -5583,6 +4807,27 @@
 }
 }
 
+
+WebInspector.EventTarget = function()
+{
+}
+
+WebInspector.EventTarget.prototype = {
+
+addEventListener: function(eventType, listener, thisObject) { },
+
+
+removeEventListener: function(eventType, listener, thisObject) { },
+
+removeAllListeners: function() { },
+
+
+hasEventListeners: function(eventType) { },
+
+
+dispatchEventToListeners: function(eventType, eventData) { },
+}
+
 WebInspector.notifications = new WebInspector.Object();
 
 
@@ -5594,44 +4839,29 @@
 maxInlineTextChildLength: 80,
 minConsoleHeight: 75,
 minSidebarWidth: 100,
+minSidebarHeight: 75,
 minElementsSidebarWidth: 200,
+minElementsSidebarHeight: 200,
 minScriptsSidebarWidth: 200,
-styleRulesExpandedState: {},
-showMissingLocalizedStrings: false,
-useLowerCaseMenuTitlesOnWindows: false,
-sharedWorkersDebugNote: undefined,
-localizeUI: true,
-exposeDisableCache: false,
-applicationTitle: "Web Inspector - %s",
-showDockToRight: false,
-exposeFileSystemInspection: false,
-experimentsEnabled: true
+applicationTitle: "Developer Tools - %s",
+experimentsEnabled: false
 }
 
 var Capabilities = {
-samplingCPUProfiler: false,
-debuggerCausesRecompilation: true,
-separateScriptCompilationAndExecutionEnabled: false,
-profilerCausesRecompilation: true,
-heapProfilerPresent: false,
-canOverrideDeviceMetrics: false,
-timelineSupportsFrameInstrumentation: false,
-timelineCanMonitorMainThread: false,
-canOverrideGeolocation: false,
-canOverrideDeviceOrientation: false,
-canShowFPSCounter: false
+canShowFPSCounter: false,
+canContinuouslyPaint: false,
+canInspectWorkers: false
 }
 
 
 WebInspector.Settings = function()
 {
 this._eventSupport = new WebInspector.Object();
+this._registry =   ({});
 
 this.colorFormat = this.createSetting("colorFormat", "original");
 this.consoleHistory = this.createSetting("consoleHistory", []);
-this.debuggerEnabled = this.createSetting("debuggerEnabled", false);
 this.domWordWrap = this.createSetting("domWordWrap", true);
-this.profilerEnabled = this.createSetting("profilerEnabled", false);
 this.eventListenersFilter = this.createSetting("eventListenersFilter", "all");
 this.lastActivePanel = this.createSetting("lastActivePanel", "elements");
 this.lastViewedScriptFile = this.createSetting("lastViewedScriptFile", "application");
@@ -5653,9 +4883,10 @@
 this.userAgent = this.createSetting("userAgent", "");
 this.deviceMetrics = this.createSetting("deviceMetrics", "");
 this.deviceFitWindow = this.createSetting("deviceFitWindow", false);
-this.showScriptFolders = this.createSetting("showScriptFolders", true);
 this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false);
 this.showPaintRects = this.createSetting("showPaintRects", false);
+this.continuousPainting = this.createSetting("continuousPainting", false);
+this.showDebugBorders = this.createSetting("showDebugBorders", false);
 this.showFPSCounter = this.createSetting("showFPSCounter", false);
 this.showShadowDOM = this.createSetting("showShadowDOM", false);
 this.zoomLevel = this.createSetting("zoomLevel", 0);
@@ -5671,30 +4902,35 @@
 this.cssReloadEnabled = this.createSetting("cssReloadEnabled", false);
 this.cssReloadTimeout = this.createSetting("cssReloadTimeout", 1000);
 this.showCpuOnTimelineRuler = this.createSetting("showCpuOnTimelineRuler", false);
+this.timelineStackFramesToCapture = this.createSetting("timelineStackFramesToCapture", 30);
+this.timelineLimitStackFramesFlag = this.createSetting("timelineLimitStackFramesFlag", false);
 this.showMetricsRulers = this.createSetting("showMetricsRulers", false);
 this.emulatedCSSMedia = this.createSetting("emulatedCSSMedia", "print");
 this.showToolbarIcons = this.createSetting("showToolbarIcons", false);
-
-
-
-if (this.breakpoints.get().length > 500000)
-this.breakpoints.set([]);
+this.workerInspectorWidth = this.createSetting("workerInspectorWidth", 600);
+this.workerInspectorHeight = this.createSetting("workerInspectorHeight", 600);
+this.messageURLFilters = this.createSetting("messageURLFilters", {});
+this.splitVerticallyWhenDockedToRight = this.createSetting("splitVerticallyWhenDockedToRight", true);
+this.visiblePanels = this.createSetting("visiblePanels", {});
 }
 
 WebInspector.Settings.prototype = {
 
 createSetting: function(key, defaultValue)
 {
-return new WebInspector.Setting(key, defaultValue, this._eventSupport);
+if (!this._registry[key])
+this._registry[key] = new WebInspector.Setting(key, defaultValue, this._eventSupport, window.localStorage);
+return this._registry[key];
 }
 }
 
 
-WebInspector.Setting = function(name, defaultValue, eventSupport)
+WebInspector.Setting = function(name, defaultValue, eventSupport, storage)
 {
 this._name = name;
 this._defaultValue = defaultValue;
 this._eventSupport = eventSupport;
+this._storage = storage;
 }
 
 WebInspector.Setting.prototype = {
@@ -5719,11 +4955,11 @@
 return this._value;
 
 this._value = this._defaultValue;
-if (window.localStorage != null && this._name in window.localStorage) {
+if (this._storage && this._name in this._storage) {
 try {
-this._value = JSON.parse(window.localStorage[this._name]);
+this._value = JSON.parse(this._storage[this._name]);
 } catch(e) {
-window.localStorage.removeItem(this._name);
+delete this._storage[this._name];
 }
 }
 return this._value;
@@ -5732,9 +4968,9 @@
 set: function(value)
 {
 this._value = value;
-if (window.localStorage != null) {
+if (this._storage) {
 try {
-window.localStorage[this._name] = JSON.stringify(value);
+this._storage[this._name] = JSON.stringify(value);
 } catch(e) {
 console.error("Error saving setting with name:" + this._name);
 }
@@ -5753,13 +4989,19 @@
 
 this.snippetsSupport = this._createExperiment("snippetsSupport", "Snippets support");
 this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling");
-this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart");
+this.nativeMemoryTimeline = this._createExperiment("nativeMemoryTimeline", "Native memory timeline");
 this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection");
 this.canvasInspection = this._createExperiment("canvasInspection ", "Canvas inspection");
 this.sass = this._createExperiment("sass", "Support for Sass");
 this.codemirror = this._createExperiment("codemirror", "Use CodeMirror editor");
 this.cssRegions = this._createExperiment("cssRegions", "CSS Regions Support");
 this.showOverridesInDrawer = this._createExperiment("showOverridesInDrawer", "Show Overrides in drawer");
+this.fileSystemProject = this._createExperiment("fileSystemProject", "File system folders in Sources Panel");
+this.showWhitespaceInEditor = this._createExperiment("showWhitespaceInEditor", "Show whitespace characters in editor");
+this.textEditorSmartBraces = this._createExperiment("textEditorSmartBraces", "Enable smart braces in text editor");
+this.customizableToolbar = this._createExperiment("customizableToolbar", "Enable toolbar customization");
+this.cpuFlameChart = this._createExperiment("cpuFlameChart", "Show Flame Chart in CPU Profiler");
+this.shortcutPanelSwitch = this._createExperiment("shortcutPanelSwitch", "Enable Ctrl/Cmd + 1-9 shortcut to switch panels");
 
 this._cleanUpSetting();
 }
@@ -5864,6 +5106,55 @@
 }
 }
 
+
+WebInspector.VersionController = function()
+{
+}
+
+WebInspector.VersionController.currentVersion = 2;
+
+WebInspector.VersionController.prototype = {
+updateVersion: function()
+{
+var versionSetting = WebInspector.settings.createSetting("inspectorVersion", 0);
+var currentVersion = WebInspector.VersionController.currentVersion;
+var oldVersion = versionSetting.get();
+var methodsToRun = this._methodsToRunToUpdateVersion(oldVersion, currentVersion);
+for (var i = 0; i < methodsToRun.length; ++i)
+this[methodsToRun[i]].call(this);
+versionSetting.set(currentVersion);
+},
+
+
+_methodsToRunToUpdateVersion: function(oldVersion, currentVersion)
+{
+var result = [];
+for (var i = oldVersion; i < currentVersion; ++i)
+result.push("_updateVersionFrom" + i + "To" + (i + 1));
+return result;
+},
+
+_updateVersionFrom0To1: function()
+{
+this._clearBreakpointsWhenTooMany(WebInspector.settings.breakpoints, 500000);
+},
+
+_updateVersionFrom1To2: function()
+{
+var versionSetting = WebInspector.settings.createSetting("previouslyViewedFiles", []);
+versionSetting.set([]);
+},
+
+
+_clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCount)
+{
+
+
+if (breakpointsSetting.get().length > maxBreakpointsCount)
+breakpointsSetting.set([]);
+}
+}
+
 WebInspector.settings = new WebInspector.Settings();
 WebInspector.experimentsSettings = new WebInspector.ExperimentsSettings();
 
@@ -5887,13 +5178,27 @@
 
 WebInspector.View._cssFileToVisibleViewCount = {};
 WebInspector.View._cssFileToStyleElement = {};
+WebInspector.View._cssUnloadTimeout = 2000;
 
 WebInspector.View.prototype = {
+
+statusBarText: function()
+{
+return null;
+},
+
 markAsRoot: function()
 {
+WebInspector.View._assert(!this.element.parentElement, "Attempt to mark as root attached node");
 this._isRoot = true;
 },
 
+
+parentView: function()
+{
+return this._parentView;
+},
+
 isShowing: function()
 {
 return this._isShowing;
@@ -6123,6 +5428,8 @@
 
 registerRequiredCSS: function(cssFile)
 {
+if (window.flattenImports)
+cssFile = cssFile.split("/").reverse()[0];
 this._cssFiles.push(cssFile);
 },
 
@@ -6167,22 +5474,32 @@
 
 _disableCSSIfNeeded: function()
 {
+var scheduleUnload = !!WebInspector.View._cssUnloadTimer;
+
 for (var i = 0; i < this._cssFiles.length; ++i) {
 var cssFile = this._cssFiles[i];
 
-var viewsWithCSSFile = WebInspector.View._cssFileToVisibleViewCount[cssFile];
-viewsWithCSSFile--;
-WebInspector.View._cssFileToVisibleViewCount[cssFile] = viewsWithCSSFile;
-
-if (!viewsWithCSSFile)
-this._doUnloadCSS(cssFile);
+if (!--WebInspector.View._cssFileToVisibleViewCount[cssFile])
+scheduleUnload = true;
 }
-},
 
-_doUnloadCSS: function(cssFile)
+function doUnloadCSS()
 {
-var styleElement = WebInspector.View._cssFileToStyleElement[cssFile];
-styleElement.disabled = true;
+delete WebInspector.View._cssUnloadTimer;
+
+for (cssFile in WebInspector.View._cssFileToVisibleViewCount) {
+if (WebInspector.View._cssFileToVisibleViewCount.hasOwnProperty(cssFile)
+&& !WebInspector.View._cssFileToVisibleViewCount[cssFile])
+WebInspector.View._cssFileToStyleElement[cssFile].disabled = true;
+}
+}
+
+if (scheduleUnload) {
+if (WebInspector.View._cssUnloadTimer)
+clearTimeout(WebInspector.View._cssUnloadTimer);
+
+WebInspector.View._cssUnloadTimer = setTimeout(doUnloadCSS, WebInspector.View._cssUnloadTimeout)
+}
 },
 
 printViewHierarchy: function()
@@ -6307,6 +5624,983 @@
 
 
 
+WebInspector.installDragHandle = function(element, elementDragStart, elementDrag, elementDragEnd, cursor)
+{
+element.addEventListener("mousedown", WebInspector._elementDragStart.bind(WebInspector, elementDragStart, elementDrag, elementDragEnd, cursor), false);
+}
+
+
+WebInspector._elementDragStart = function(elementDragStart, elementDrag, elementDragEnd, cursor, event)
+{
+
+if (event.button || (WebInspector.isMac() && event.ctrlKey))
+return;
+
+if (WebInspector._elementDraggingEventListener)
+return;
+
+if (elementDragStart && !elementDragStart(event))
+return;
+
+if (WebInspector._elementDraggingGlassPane) {
+WebInspector._elementDraggingGlassPane.dispose();
+delete WebInspector._elementDraggingGlassPane;
+}
+
+var targetDocument = event.target.ownerDocument;
+
+WebInspector._elementDraggingEventListener = elementDrag;
+WebInspector._elementEndDraggingEventListener = elementDragEnd;
+WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument;
+
+targetDocument.addEventListener("mousemove", WebInspector._elementDragMove, true);
+targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, true);
+targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragging, true);
+
+targetDocument.body.style.cursor = cursor;
+
+event.preventDefault();
+}
+
+WebInspector._mouseOutWhileDragging = function()
+{
+WebInspector._unregisterMouseOutWhileDragging();
+WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane();
+}
+
+WebInspector._unregisterMouseOutWhileDragging = function()
+{
+if (!WebInspector._mouseOutWhileDraggingTargetDocument)
+return;
+WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout", WebInspector._mouseOutWhileDragging, true);
+delete WebInspector._mouseOutWhileDraggingTargetDocument;
+}
+
+WebInspector._elementDragMove = function(event)
+{
+if (WebInspector._elementDraggingEventListener(event))
+WebInspector._cancelDragEvents(event);
+}
+
+WebInspector._cancelDragEvents = function(event)
+{
+var targetDocument = event.target.ownerDocument;
+targetDocument.removeEventListener("mousemove", WebInspector._elementDragMove, true);
+targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true);
+WebInspector._unregisterMouseOutWhileDragging();
+
+targetDocument.body.style.removeProperty("cursor");
+
+if (WebInspector._elementDraggingGlassPane)
+WebInspector._elementDraggingGlassPane.dispose();
+
+delete WebInspector._elementDraggingGlassPane;
+delete WebInspector._elementDraggingEventListener;
+delete WebInspector._elementEndDraggingEventListener;
+}
+
+WebInspector._elementDragEnd = function(event)
+{
+var elementDragEnd = WebInspector._elementEndDraggingEventListener;
+
+WebInspector._cancelDragEvents(event);
+
+event.preventDefault();
+if (elementDragEnd)
+elementDragEnd(event);
+}
+
+
+WebInspector.GlassPane = function()
+{
+this.element = document.createElement("div");
+this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;";
+this.element.id = "glass-pane-for-drag";
+document.body.appendChild(this.element);
+WebInspector._glassPane = this;
+}
+
+WebInspector.GlassPane.prototype = {
+dispose: function()
+{
+delete WebInspector._glassPane;
+WebInspector.inspectorView.focus();
+if (this.element.parentElement)
+this.element.parentElement.removeChild(this.element);
+}
+}
+
+WebInspector.isBeingEdited = function(element)
+{
+if (element.hasStyleClass("text-prompt") || element.nodeName === "INPUT")
+return true;
+
+if (!WebInspector.__editingCount)
+return false;
+
+while (element) {
+if (element.__editing)
+return true;
+element = element.parentElement;
+}
+return false;
+}
+
+WebInspector.markBeingEdited = function(element, value)
+{
+if (value) {
+if (element.__editing)
+return false;
+element.__editing = true;
+WebInspector.__editingCount = (WebInspector.__editingCount || 0) + 1;
+} else {
+if (!element.__editing)
+return false;
+delete element.__editing;
+--WebInspector.__editingCount;
+}
+return true;
+}
+
+
+WebInspector.EditingConfig = function(commitHandler, cancelHandler, context)
+{
+this.commitHandler = commitHandler;
+this.cancelHandler = cancelHandler
+this.context = context;
+
+
+this.pasteHandler;
+
+
+this.multiline;
+
+
+this.customFinishHandler;
+}
+
+WebInspector.EditingConfig.prototype = {
+setPasteHandler: function(pasteHandler)
+{
+this.pasteHandler = pasteHandler;
+},
+
+
+setMultilineOptions: function(initialValue, mode, theme, lineWrapping, smartIndent)
+{
+this.multiline = true;
+this.initialValue = initialValue;
+this.mode = mode;
+this.theme = theme;
+this.lineWrapping = lineWrapping;
+this.smartIndent = smartIndent;
+},
+
+setCustomFinishHandler: function(customFinishHandler)
+{
+this.customFinishHandler = customFinishHandler;
+}
+}
+
+WebInspector.CSSNumberRegex = /^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;
+
+WebInspector.StyleValueDelimiters = " \xA0\t\n\"':;,/()";
+
+
+
+WebInspector._valueModificationDirection = function(event)
+{
+var direction = null;
+if (event.type === "mousewheel") {
+if (event.wheelDeltaY > 0)
+direction = "Up";
+else if (event.wheelDeltaY < 0)
+direction = "Down";
+} else {
+if (event.keyIdentifier === "Up" || event.keyIdentifier === "PageUp")
+direction = "Up";
+else if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
+direction = "Down";        
+}
+return direction;
+}
+
+
+WebInspector._modifiedHexValue = function(hexString, event)
+{
+var direction = WebInspector._valueModificationDirection(event);
+if (!direction)
+return hexString;
+
+var number = parseInt(hexString, 16);
+if (isNaN(number) || !isFinite(number))
+return hexString;
+
+var maxValue = Math.pow(16, hexString.length) - 1;
+var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
+var delta;
+
+if (arrowKeyOrMouseWheelEvent)
+delta = (direction === "Up") ? 1 : -1;
+else
+delta = (event.keyIdentifier === "PageUp") ? 16 : -16;
+
+if (event.shiftKey)
+delta *= 16;
+
+var result = number + delta;
+if (result < 0)
+result = 0; 
+else if (result > maxValue)
+return hexString;
+
+
+var resultString = result.toString(16).toUpperCase();
+for (var i = 0, lengthDelta = hexString.length - resultString.length; i < lengthDelta; ++i)
+resultString = "0" + resultString;
+return resultString;
+}
+
+
+WebInspector._modifiedFloatNumber = function(number, event)
+{
+var direction = WebInspector._valueModificationDirection(event);
+if (!direction)
+return number;
+
+var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
+
+
+
+var changeAmount = 1;
+if (event.shiftKey && !arrowKeyOrMouseWheelEvent)
+changeAmount = 100;
+else if (event.shiftKey || !arrowKeyOrMouseWheelEvent)
+changeAmount = 10;
+else if (event.altKey)
+changeAmount = 0.1;
+
+if (direction === "Down")
+changeAmount *= -1;
+
+
+
+var result = Number((number + changeAmount).toFixed(6));
+if (!String(result).match(WebInspector.CSSNumberRegex))
+return null;
+
+return result;
+}
+
+
+WebInspector.handleElementValueModifications = function(event, element, finishHandler, suggestionHandler, customNumberHandler)
+{
+var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down" || event.type === "mousewheel");
+var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
+if (!arrowKeyOrMouseWheelEvent && !pageKeyPressed)
+return false;
+
+var selection = window.getSelection();
+if (!selection.rangeCount)
+return false;
+
+var selectionRange = selection.getRangeAt(0);
+if (!selectionRange.commonAncestorContainer.isSelfOrDescendant(element))
+return false;
+
+var originalValue = element.textContent;
+var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.StyleValueDelimiters, element);
+var wordString = wordRange.toString();
+
+if (suggestionHandler && suggestionHandler(wordString))
+return false;
+
+var replacementString;
+var prefix, suffix, number;
+
+var matches;
+matches = /(.*#)([\da-fA-F]+)(.*)/.exec(wordString);
+if (matches && matches.length) {
+prefix = matches[1];
+suffix = matches[3];
+number = WebInspector._modifiedHexValue(matches[2], event);
+
+if (customNumberHandler)
+number = customNumberHandler(number);
+
+replacementString = prefix + number + suffix;
+} else {
+matches = /(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);
+if (matches && matches.length) {
+prefix = matches[1];
+suffix = matches[3];
+number = WebInspector._modifiedFloatNumber(parseFloat(matches[2]), event);
+
+
+if (number === null)                
+return false;
+
+if (customNumberHandler)
+number = customNumberHandler(number);
+
+replacementString = prefix + number + suffix;
+}
+}
+
+if (replacementString) {
+var replacementTextNode = document.createTextNode(replacementString);
+
+wordRange.deleteContents();
+wordRange.insertNode(replacementTextNode);
+
+var finalSelectionRange = document.createRange();
+finalSelectionRange.setStart(replacementTextNode, 0);
+finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
+
+selection.removeAllRanges();
+selection.addRange(finalSelectionRange);
+
+event.handled = true;
+event.preventDefault();
+
+if (finishHandler)
+finishHandler(originalValue, replacementString);
+
+return true;
+}
+return false;
+}
+
+
+WebInspector.startEditing = function(element, config)
+{
+if (!WebInspector.markBeingEdited(element, true))
+return null;
+
+config = config || new WebInspector.EditingConfig(function() {}, function() {});
+var committedCallback = config.commitHandler;
+var cancelledCallback = config.cancelHandler;
+var pasteCallback = config.pasteHandler;
+var context = config.context;
+var isMultiline = config.multiline || false;
+var oldText = isMultiline ? config.initialValue : getContent(element);
+var moveDirection = "";
+var oldTabIndex;
+var codeMirror;
+var cssLoadView;
+
+
+function consumeCopy(e)
+{
+e.consume();
+}
+
+if (isMultiline) {
+loadScript("CodeMirrorTextEditor.js");
+cssLoadView = new WebInspector.CodeMirrorCSSLoadView();
+cssLoadView.show(element);
+WebInspector.setCurrentFocusElement(element);
+element.addEventListener("copy", consumeCopy, true);
+codeMirror = window.CodeMirror(element, {
+mode: config.mode,
+lineWrapping: config.lineWrapping,
+smartIndent: config.smartIndent,
+autofocus: true,
+theme: config.theme,
+value: oldText
+});
+} else {
+element.addStyleClass("editing");
+
+oldTabIndex = element.getAttribute("tabIndex");
+if (typeof oldTabIndex !== "number" || oldTabIndex < 0)
+element.tabIndex = 0;
+WebInspector.setCurrentFocusElement(element);
+}
+
+
+function blurEventListener(e) {
+if (!isMultiline || !e || !e.relatedTarget || !e.relatedTarget.isSelfOrDescendant(element))
+editingCommitted.call(element);
+}
+
+function getContent(element) {
+if (isMultiline)
+return codeMirror.getValue();
+
+if (element.tagName === "INPUT" && element.type === "text")
+return element.value;
+
+return element.textContent;
+}
+
+
+function cleanUpAfterEditing()
+{
+WebInspector.markBeingEdited(element, false);
+
+element.removeEventListener("blur", blurEventListener, isMultiline);
+element.removeEventListener("keydown", keyDownEventListener, true);
+if (pasteCallback)
+element.removeEventListener("paste", pasteEventListener, true);
+
+WebInspector.restoreFocusFromElement(element);
+
+if (isMultiline) {
+element.removeEventListener("copy", consumeCopy, true);
+cssLoadView.detach();
+return;
+}
+
+this.removeStyleClass("editing");
+
+if (typeof oldTabIndex !== "number")
+element.removeAttribute("tabIndex");
+else
+this.tabIndex = oldTabIndex;
+this.scrollTop = 0;
+this.scrollLeft = 0;
+}
+
+
+function editingCancelled()
+{
+if (isMultiline)
+codeMirror.setValue(oldText);
+else {
+if (this.tagName === "INPUT" && this.type === "text")
+this.value = oldText;
+else
+this.textContent = oldText;
+}
+
+cleanUpAfterEditing.call(this);
+
+cancelledCallback(this, context);
+}
+
+
+function editingCommitted()
+{
+cleanUpAfterEditing.call(this);
+
+committedCallback(this, getContent(this), oldText, context, moveDirection);
+}
+
+function defaultFinishHandler(event)
+{
+var isMetaOrCtrl = WebInspector.isMac() ?
+event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
+event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+if (isEnterKey(event) && (event.isMetaOrCtrlForTest || !isMultiline || isMetaOrCtrl))
+return "commit";
+else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code || event.keyIdentifier === "U+001B")
+return "cancel";
+else if (!isMultiline && event.keyIdentifier === "U+0009") 
+return "move-" + (event.shiftKey ? "backward" : "forward");
+}
+
+function handleEditingResult(result, event)
+{
+if (result === "commit") {
+editingCommitted.call(element);
+event.consume(true);
+} else if (result === "cancel") {
+editingCancelled.call(element);
+event.consume(true);
+} else if (result && result.startsWith("move-")) {
+moveDirection = result.substring(5);
+if (event.keyIdentifier !== "U+0009")
+blurEventListener();
+}
+}
+
+function pasteEventListener(event)
+{
+var result = pasteCallback(event);
+handleEditingResult(result, event);
+}
+
+function keyDownEventListener(event)
+{
+var handler = config.customFinishHandler || defaultFinishHandler;
+var result = handler(event);
+handleEditingResult(result, event);
+}
+
+element.addEventListener("blur", blurEventListener, isMultiline);
+element.addEventListener("keydown", keyDownEventListener, true);
+if (pasteCallback)
+element.addEventListener("paste", pasteEventListener, true);
+
+return {
+cancel: editingCancelled.bind(element),
+commit: editingCommitted.bind(element),
+codeMirror: codeMirror 
+};
+}
+
+
+Number.secondsToString = function(seconds, higherResolution)
+{
+if (!isFinite(seconds))
+return "-";
+
+if (seconds === 0)
+return "0";
+
+var ms = seconds * 1000;
+if (higherResolution && ms < 1000)
+return WebInspector.UIString("%.3f\u2009ms", ms);
+else if (ms < 1000)
+return WebInspector.UIString("%.0f\u2009ms", ms);
+
+if (seconds < 60)
+return WebInspector.UIString("%.2f\u2009s", seconds);
+
+var minutes = seconds / 60;
+if (minutes < 60)
+return WebInspector.UIString("%.1f\u2009min", minutes);
+
+var hours = minutes / 60;
+if (hours < 24)
+return WebInspector.UIString("%.1f\u2009hrs", hours);
+
+var days = hours / 24;
+return WebInspector.UIString("%.1f\u2009days", days);
+}
+
+
+Number.bytesToString = function(bytes)
+{
+if (bytes < 1024)
+return WebInspector.UIString("%.0f\u2009B", bytes);
+
+var kilobytes = bytes / 1024;
+if (kilobytes < 100)
+return WebInspector.UIString("%.1f\u2009KB", kilobytes);
+if (kilobytes < 1024)
+return WebInspector.UIString("%.0f\u2009KB", kilobytes);
+
+var megabytes = kilobytes / 1024;
+if (megabytes < 100)
+return WebInspector.UIString("%.1f\u2009MB", megabytes);
+else
+return WebInspector.UIString("%.0f\u2009MB", megabytes);
+}
+
+Number.withThousandsSeparator = function(num)
+{
+var str = num + "";
+var re = /(\d+)(\d{3})/;
+while (str.match(re))
+str = str.replace(re, "$1\u2009$2"); 
+return str;
+}
+
+WebInspector.useLowerCaseMenuTitles = function()
+{
+return WebInspector.platform() === "windows";
+}
+
+WebInspector.formatLocalized = function(format, substitutions, formatters, initialValue, append)
+{
+return String.format(WebInspector.UIString(format), substitutions, formatters, initialValue, append);
+}
+
+WebInspector.openLinkExternallyLabel = function()
+{
+return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in new tab" : "Open Link in New Tab");
+}
+
+WebInspector.copyLinkAddressLabel = function()
+{
+return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy link address" : "Copy Link Address");
+}
+
+WebInspector.platform = function()
+{
+if (!WebInspector._platform)
+WebInspector._platform = InspectorFrontendHost.platform();
+return WebInspector._platform;
+}
+
+WebInspector.isMac = function()
+{
+if (typeof WebInspector._isMac === "undefined")
+WebInspector._isMac = WebInspector.platform() === "mac";
+
+return WebInspector._isMac;
+}
+
+WebInspector.isWin = function()
+{
+if (typeof WebInspector._isWin === "undefined")
+WebInspector._isWin = WebInspector.platform() === "windows";
+
+return WebInspector._isWin;
+}
+
+WebInspector.PlatformFlavor = {
+WindowsVista: "windows-vista",
+MacTiger: "mac-tiger",
+MacLeopard: "mac-leopard",
+MacSnowLeopard: "mac-snowleopard",
+MacLion: "mac-lion",
+MacMountainLion: "mac-mountain-lion"
+}
+
+WebInspector.platformFlavor = function()
+{
+function detectFlavor()
+{
+const userAgent = navigator.userAgent;
+
+if (WebInspector.platform() === "windows") {
+var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
+if (match && match[1] >= 6)
+return WebInspector.PlatformFlavor.WindowsVista;
+return null;
+} else if (WebInspector.platform() === "mac") {
+var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
+if (!match || match[1] != 10)
+return WebInspector.PlatformFlavor.MacSnowLeopard;
+switch (Number(match[2])) {
+case 4:
+return WebInspector.PlatformFlavor.MacTiger;
+case 5:
+return WebInspector.PlatformFlavor.MacLeopard;
+case 6:
+return WebInspector.PlatformFlavor.MacSnowLeopard;
+case 7:
+return WebInspector.PlatformFlavor.MacLion;
+case 8:
+return WebInspector.PlatformFlavor.MacMountainLion;
+default:
+return "";
+}
+}
+}
+
+if (!WebInspector._platformFlavor)
+WebInspector._platformFlavor = detectFlavor();
+
+return WebInspector._platformFlavor;
+}
+
+WebInspector.port = function()
+{
+if (!WebInspector._port)
+WebInspector._port = InspectorFrontendHost.port();
+
+return WebInspector._port;
+}
+
+WebInspector.installPortStyles = function()
+{
+var platform = WebInspector.platform();
+document.body.addStyleClass("platform-" + platform);
+var flavor = WebInspector.platformFlavor();
+if (flavor)
+document.body.addStyleClass("platform-" + flavor);
+var port = WebInspector.port();
+document.body.addStyleClass("port-" + port);
+}
+
+WebInspector._windowFocused = function(event)
+{
+if (event.target.document.nodeType === Node.DOCUMENT_NODE)
+document.body.removeStyleClass("inactive");
+}
+
+WebInspector._windowBlurred = function(event)
+{
+if (event.target.document.nodeType === Node.DOCUMENT_NODE)
+document.body.addStyleClass("inactive");
+}
+
+WebInspector.previousFocusElement = function()
+{
+return WebInspector._previousFocusElement;
+}
+
+WebInspector.currentFocusElement = function()
+{
+return WebInspector._currentFocusElement;
+}
+
+WebInspector._focusChanged = function(event)
+{
+WebInspector.setCurrentFocusElement(event.target);
+}
+
+WebInspector._textInputTypes = ["text", "search", "tel", "url", "email", "password"].keySet(); 
+WebInspector._isTextEditingElement = function(element)
+{
+if (element instanceof HTMLInputElement)
+return element.type in WebInspector._textInputTypes;
+
+if (element instanceof HTMLTextAreaElement)
+return true;
+
+return false;
+}
+
+WebInspector.setCurrentFocusElement = function(x)
+{
+if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAncestor(x))
+return;
+if (WebInspector._currentFocusElement !== x)
+WebInspector._previousFocusElement = WebInspector._currentFocusElement;
+WebInspector._currentFocusElement = x;
+
+if (WebInspector._currentFocusElement) {
+WebInspector._currentFocusElement.focus();
+
+
+
+
+var selection = window.getSelection();
+if (!WebInspector._isTextEditingElement(WebInspector._currentFocusElement) && selection.isCollapsed && !WebInspector._currentFocusElement.isInsertionCaretInside()) {
+var selectionRange = WebInspector._currentFocusElement.ownerDocument.createRange();
+selectionRange.setStart(WebInspector._currentFocusElement, 0);
+selectionRange.setEnd(WebInspector._currentFocusElement, 0);
+
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+}
+} else if (WebInspector._previousFocusElement)
+WebInspector._previousFocusElement.blur();
+}
+
+WebInspector.restoreFocusFromElement = function(element)
+{
+if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement()))
+WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());
+}
+
+WebInspector.setToolbarColors = function(backgroundColor, color)
+{
+if (!WebInspector._themeStyleElement) {
+WebInspector._themeStyleElement = document.createElement("style");
+document.head.appendChild(WebInspector._themeStyleElement);
+}
+WebInspector._themeStyleElement.textContent =
+"#toolbar {\
+             background-image: none !important;\
+             background-color: " + backgroundColor + " !important;\
+         }\
+         \
+         .toolbar-label {\
+             color: " + color + " !important;\
+             text-shadow: none;\
+         }";
+}
+
+WebInspector.resetToolbarColors = function()
+{
+if (WebInspector._themeStyleElement)
+WebInspector._themeStyleElement.textContent = "";
+}
+
+
+WebInspector.highlightSearchResult = function(element, offset, length, domChanges)
+{
+var result = WebInspector.highlightSearchResults(element, [{offset: offset, length: length }], domChanges);
+return result.length ? result[0] : null;
+}
+
+
+WebInspector.highlightSearchResults = function(element, resultRanges, changes)
+{
+return WebInspector.highlightRangesWithStyleClass(element, resultRanges, "webkit-search-result", changes);
+}
+
+
+WebInspector.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, changes)
+{
+changes = changes || [];
+var highlightNodes = [];
+var lineText = element.textContent;
+var ownerDocument = element.ownerDocument;
+var textNodeSnapshot = ownerDocument.evaluate(".//text()", element, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+
+var snapshotLength = textNodeSnapshot.snapshotLength;
+if (snapshotLength === 0)
+return highlightNodes;
+
+var nodeRanges = [];
+var rangeEndOffset = 0;
+for (var i = 0; i < snapshotLength; ++i) {
+var range = {};
+range.offset = rangeEndOffset;
+range.length = textNodeSnapshot.snapshotItem(i).textContent.length;
+rangeEndOffset = range.offset + range.length;
+nodeRanges.push(range);
+}
+
+var startIndex = 0;
+for (var i = 0; i < resultRanges.length; ++i) {
+var startOffset = resultRanges[i].offset;
+var endOffset = startOffset + resultRanges[i].length;
+
+while (startIndex < snapshotLength && nodeRanges[startIndex].offset + nodeRanges[startIndex].length <= startOffset)
+startIndex++;
+var endIndex = startIndex;
+while (endIndex < snapshotLength && nodeRanges[endIndex].offset + nodeRanges[endIndex].length < endOffset)
+endIndex++;
+if (endIndex === snapshotLength)
+break;
+
+var highlightNode = ownerDocument.createElement("span");
+highlightNode.className = styleClass;
+highlightNode.textContent = lineText.substring(startOffset, endOffset);
+
+var lastTextNode = textNodeSnapshot.snapshotItem(endIndex);
+var lastText = lastTextNode.textContent;
+lastTextNode.textContent = lastText.substring(endOffset - nodeRanges[endIndex].offset);
+changes.push({ node: lastTextNode, type: "changed", oldText: lastText, newText: lastTextNode.textContent });
+
+if (startIndex === endIndex) {
+lastTextNode.parentElement.insertBefore(highlightNode, lastTextNode);
+changes.push({ node: highlightNode, type: "added", nextSibling: lastTextNode, parent: lastTextNode.parentElement });
+highlightNodes.push(highlightNode);
+
+var prefixNode = ownerDocument.createTextNode(lastText.substring(0, startOffset - nodeRanges[startIndex].offset));
+lastTextNode.parentElement.insertBefore(prefixNode, highlightNode);
+changes.push({ node: prefixNode, type: "added", nextSibling: highlightNode, parent: lastTextNode.parentElement });
+} else {
+var firstTextNode = textNodeSnapshot.snapshotItem(startIndex);
+var firstText = firstTextNode.textContent;
+var anchorElement = firstTextNode.nextSibling;
+
+firstTextNode.parentElement.insertBefore(highlightNode, anchorElement);
+changes.push({ node: highlightNode, type: "added", nextSibling: anchorElement, parent: firstTextNode.parentElement });
+highlightNodes.push(highlightNode);
+
+firstTextNode.textContent = firstText.substring(0, startOffset - nodeRanges[startIndex].offset);
+changes.push({ node: firstTextNode, type: "changed", oldText: firstText, newText: firstTextNode.textContent });
+
+for (var j = startIndex + 1; j < endIndex; j++) {
+var textNode = textNodeSnapshot.snapshotItem(j);
+var text = textNode.textContent;
+textNode.textContent = "";
+changes.push({ node: textNode, type: "changed", oldText: text, newText: textNode.textContent });
+}
+}
+startIndex = endIndex;
+nodeRanges[startIndex].offset = endOffset;
+nodeRanges[startIndex].length = lastTextNode.textContent.length;
+
+}
+return highlightNodes;
+}
+
+WebInspector.applyDomChanges = function(domChanges)
+{
+for (var i = 0, size = domChanges.length; i < size; ++i) {
+var entry = domChanges[i];
+switch (entry.type) {
+case "added":
+entry.parent.insertBefore(entry.node, entry.nextSibling);
+break;
+case "changed":
+entry.node.textContent = entry.newText;
+break;
+}
+}
+}
+
+WebInspector.revertDomChanges = function(domChanges)
+{
+for (var i = domChanges.length - 1; i >= 0; --i) {
+var entry = domChanges[i];
+switch (entry.type) {
+case "added":
+if (entry.node.parentElement)
+entry.node.parentElement.removeChild(entry.node);
+break;
+case "changed":
+entry.node.textContent = entry.oldText;
+break;
+}
+}
+}
+
+WebInspector._coalescingLevel = 0;
+
+WebInspector.startBatchUpdate = function()
+{
+if (!WebInspector._coalescingLevel)
+WebInspector._postUpdateHandlers = new Map();
+WebInspector._coalescingLevel++;
+}
+
+WebInspector.endBatchUpdate = function()
+{
+if (--WebInspector._coalescingLevel)
+return;
+
+var handlers = WebInspector._postUpdateHandlers;
+delete WebInspector._postUpdateHandlers;
+
+var keys = handlers.keys();
+for (var i = 0; i < keys.length; ++i) {
+var object = keys[i];
+var methods = handlers.get(object).keys();
+for (var j = 0; j < methods.length; ++j)
+methods[j].call(object);
+}
+}
+
+
+WebInspector.invokeOnceAfterBatchUpdate = function(object, method)
+{
+if (!WebInspector._coalescingLevel) {
+method.call(object);
+return;
+}
+
+var methods = WebInspector._postUpdateHandlers.get(object);
+if (!methods) {
+methods = new Map();
+WebInspector._postUpdateHandlers.put(object, methods);
+}
+methods.put(method);
+}
+
+
+WebInspector.CodeMirrorCSSLoadView = function()
+{
+WebInspector.View.call(this);
+this.element.addStyleClass("hidden");
+this.registerRequiredCSS("cm/codemirror.css");
+this.registerRequiredCSS("cm/cmdevtools.css");
+}
+
+WebInspector.CodeMirrorCSSLoadView.prototype = {
+__proto__: WebInspector.View.prototype
+}
+
+;(function() {
+
+function windowLoaded()
+{
+window.addEventListener("focus", WebInspector._windowFocused, false);
+window.addEventListener("blur", WebInspector._windowBlurred, false);
+document.addEventListener("focus", WebInspector._focusChanged.bind(this), true);
+window.removeEventListener("DOMContentLoaded", windowLoaded, false);
+}
+
+window.addEventListener("DOMContentLoaded", windowLoaded, false);
+
+})();
+
+
+
+
+
+
 WebInspector.HelpScreen = function(title)
 {
 WebInspector.View.call(this);
@@ -6393,6 +6687,28 @@
 }
 
 
+WebInspector.HelpScreenUntilReload = function(title, message)
+{
+WebInspector.HelpScreen.call(this, title);
+var p = this.contentElement.createChild("p");
+p.addStyleClass("help-section");
+p.textContent = message;
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this.hide, this);
+}
+
+WebInspector.HelpScreenUntilReload.prototype = {
+
+willHide: function()
+{
+WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this.hide, this);
+WebInspector.HelpScreen.prototype.willHide.call(this);
+},
+
+__proto__: WebInspector.HelpScreen.prototype
+}
+
+
+
 
 
 
@@ -6408,6 +6724,16 @@
 }
 
 WebInspector.InspectorFrontendHostStub.prototype = {
+getSelectionBackgroundColor: function()
+{
+return "#6e86ff";
+},
+
+getSelectionForegroundColor: function()
+{
+return "#ffffff";
+},
+
 platform: function()
 {
 var match = navigator.userAgent.match(/Windows NT/);
@@ -6443,6 +6769,10 @@
 {
 },
 
+setAttachedWindowWidth: function(width)
+{
+},
+
 moveWindowBy: function(x, y)
 {
 },
@@ -6460,11 +6790,6 @@
 return undefined;
 },
 
-hiddenPanels: function()
-{
-return WebInspector.queryParamsObject["hiddenPanels"] || "";
-},
-
 inspectedURLChanged: function(url)
 {
 document.title = WebInspector.UIString(Preferences.applicationTitle, url);
@@ -6560,30 +6885,45 @@
 return loadXHR(url);
 },
 
+supportsFileSystems: function()
+{
+return false;
+},
+
+requestFileSystems: function()
+{
+},
+
+addFileSystem: function()
+{
+},
+
+removeFileSystem: function(fileSystemPath)
+{
+},
+
+isolatedFileSystem: function(fileSystemId, registeredName)
+{
+return null;
+},
+
 setZoomFactor: function(zoom)
 {
 },
 
-canInspectWorkers: function()
+isUnderTest: function()
 {
-return true;
+return false;
 }
 }
 
 InspectorFrontendHost = new WebInspector.InspectorFrontendHostStub();
-Preferences.localizeUI = false;
-
-
-WebInspector.clipboardAccessDeniedMessage = function()
-{
-return "";
-}
 
 
 WebInspector.ClipboardAccessDeniedScreen = function()
 {
 WebInspector.HelpScreen.call(this, WebInspector.UIString("Clipboard access is denied"));
-var platformMessage = WebInspector.clipboardAccessDeniedMessage();
+var platformMessage = WebInspector.UIString("You need to install a Chrome extension that grants clipboard access to Developer Tools.");
 if (platformMessage) {
 var p = this.contentElement.createChild("p");
 p.addStyleClass("help-section");
@@ -6631,7 +6971,7 @@
 
 canSave: function()
 {
-return InspectorFrontendHost.canSave();
+return true;
 },
 
 
@@ -6754,6 +7094,18 @@
 return this._type;
 },
 
+
+isEnabled: function()
+{
+return !this._disabled;
+},
+
+
+setEnabled: function(enabled)
+{
+this._disabled = !enabled;
+},
+
 _buildDescriptor: function()
 {
 switch (this._type) {
@@ -6771,6 +7123,7 @@
 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled)
 {
 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disabled);
+
 this._items = [];
 }
 
@@ -6784,6 +7137,7 @@
 return item;
 },
 
+
 appendSubMenuItem: function(label, disabled)
 {
 var item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled);
@@ -6806,6 +7160,7 @@
 this._pendingSeparator = true;
 },
 
+
 _pushItem: function(item)
 {
 if (this._pendingSeparator) {
@@ -6853,8 +7208,8 @@
 if (menuObject.length) {
 WebInspector._contextMenu = this;
 InspectorFrontendHost.showContextMenu(this._event, menuObject);
-}
 this._event.consume();
+}
 },
 
 showSoftMenu: function()
@@ -7469,6 +7824,309 @@
 
 
 
+WebInspector.SuggestBoxDelegate = function()
+{
+}
+
+WebInspector.SuggestBoxDelegate.prototype = {
+
+applySuggestion: function(suggestion, isIntermediateSuggestion) { },
+
+
+acceptSuggestion: function() { },
+}
+
+
+WebInspector.SuggestBox = function(suggestBoxDelegate, anchorElement, className)
+{
+this._suggestBoxDelegate = suggestBoxDelegate;
+this._anchorElement = anchorElement;
+this._length = 0;
+this._selectedIndex = -1;
+this._selectedElement = null;
+this._boundOnScroll = this._onScrollOrResize.bind(this, true);
+this._boundOnResize = this._onScrollOrResize.bind(this, false);
+window.addEventListener("scroll", this._boundOnScroll, true);
+window.addEventListener("resize", this._boundOnResize, true);
+
+this._bodyElement = anchorElement.ownerDocument.body;
+this._element = anchorElement.ownerDocument.createElement("div");
+this._element.className = "suggest-box " + (className || "");
+this._element.addEventListener("mousedown", this._onBoxMouseDown.bind(this), true);
+this.containerElement = this._element.createChild("div", "container");
+this.contentElement = this.containerElement.createChild("div", "content");
+}
+
+WebInspector.SuggestBox.prototype = {
+
+visible: function()
+{
+return !!this._element.parentElement;
+},
+
+
+_onScrollOrResize: function(isScroll, event)
+{
+if (isScroll && this._element.isAncestor(event.target) || !this.visible())
+return;
+this._updateBoxPosition(this._anchorBox);
+},
+
+
+_updateBoxPosition: function(anchorBox)
+{
+this._anchorBox = anchorBox;
+
+
+this.contentElement.style.display = "inline-block";
+document.body.appendChild(this.contentElement);
+this.contentElement.positionAt(0, 0);
+var contentWidth = this.contentElement.offsetWidth;
+var contentHeight = this.contentElement.offsetHeight;
+this.contentElement.style.display = "block";
+this.containerElement.appendChild(this.contentElement);
+
+const spacer = 6;
+const suggestBoxPaddingX = 21;
+const suggestBoxPaddingY = 2;
+
+var maxWidth = document.body.offsetWidth - anchorBox.x - spacer;
+var width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
+var paddedWidth = contentWidth + suggestBoxPaddingX;
+var boxX = anchorBox.x;
+if (width < paddedWidth) {
+
+maxWidth = document.body.offsetWidth - spacer;
+width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
+boxX = document.body.offsetWidth - width;
+}
+
+var boxY;
+var aboveHeight = anchorBox.y;
+var underHeight = document.body.offsetHeight - anchorBox.y - anchorBox.height;
+var maxHeight = Math.max(underHeight, aboveHeight) - spacer;
+var height = Math.min(contentHeight, maxHeight - suggestBoxPaddingY) + suggestBoxPaddingY;
+if (underHeight >= aboveHeight) {
+
+boxY = anchorBox.y + anchorBox.height;
+this._element.removeStyleClass("above-anchor");
+this._element.addStyleClass("under-anchor");
+} else {
+
+boxY = anchorBox.y - height;
+this._element.removeStyleClass("under-anchor");
+this._element.addStyleClass("above-anchor");
+}
+
+this._element.positionAt(boxX, boxY);
+this._element.style.width = width + "px";
+this._element.style.height = height + "px";
+},
+
+
+_onBoxMouseDown: function(event)
+{
+event.preventDefault();
+},
+
+hide: function()
+{
+if (!this.visible())
+return;
+
+this._element.parentElement.removeChild(this._element);
+delete this._selectedElement;
+},
+
+removeFromElement: function()
+{
+window.removeEventListener("scroll", this._boundOnScroll, true);
+window.removeEventListener("resize", this._boundOnResize, true);
+this.hide();
+},
+
+
+_applySuggestion: function(text, isIntermediateSuggestion)
+{
+if (!this.visible() || !(text || this._selectedElement))
+return false;
+
+var suggestion = text || this._selectedElement.textContent;
+if (!suggestion)
+return false;
+
+this._suggestBoxDelegate.applySuggestion(suggestion, isIntermediateSuggestion);
+return true;
+},
+
+
+acceptSuggestion: function(text)
+{
+var result = this._applySuggestion(text, false);
+this.hide();
+if (!result)
+return false;
+
+this._suggestBoxDelegate.acceptSuggestion();
+
+return true;
+},
+
+
+_selectClosest: function(shift, isCircular)
+{
+if (!this._length)
+return false;
+
+var index = this._selectedIndex + shift;
+
+if (isCircular)
+index = (this._length + index) % this._length;
+else
+index = Number.constrain(index, 0, this._length - 1);
+
+this._selectItem(index);
+this._applySuggestion(undefined, true);
+return true;
+},
+
+
+_onItemMouseDown: function(text, event)
+{
+this.acceptSuggestion(text);
+event.consume(true);
+},
+
+
+_createItemElement: function(prefix, text)
+{
+var element = document.createElement("div");
+element.className = "suggest-box-content-item source-code";
+element.tabIndex = -1;
+if (prefix && prefix.length && !text.indexOf(prefix)) {
+var prefixElement = element.createChild("span", "prefix");
+prefixElement.textContent = prefix;
+var suffixElement = element.createChild("span", "suffix");
+suffixElement.textContent = text.substring(prefix.length);
+} else {
+var suffixElement = element.createChild("span", "suffix");
+suffixElement.textContent = text;
+}
+element.addEventListener("mousedown", this._onItemMouseDown.bind(this, text), false);
+return element;
+},
+
+
+_updateItems: function(items, selectedIndex, userEnteredText)
+{
+this._length = items.length;
+this.contentElement.removeChildren();
+
+for (var i = 0; i < items.length; ++i) {
+var item = items[i];
+var currentItemElement = this._createItemElement(userEnteredText, item);
+this.contentElement.appendChild(currentItemElement);
+}
+
+this._selectedElement = null;
+if (typeof selectedIndex === "number")
+this._selectItem(selectedIndex);
+},
+
+
+_selectItem: function(index)
+{
+if (this._selectedElement)
+this._selectedElement.classList.remove("selected");
+
+this._selectedIndex = index;
+this._selectedElement = this.contentElement.children[index];
+this._selectedElement.classList.add("selected");
+
+this._selectedElement.scrollIntoViewIfNeeded(false);
+},
+
+
+_canShowBox: function(completions, canShowForSingleItem, userEnteredText)
+{
+if (!completions || !completions.length)
+return false;
+
+if (completions.length > 1)
+return true;
+
+
+return canShowForSingleItem && completions[0] !== userEnteredText;
+},
+
+_rememberRowCountPerViewport: function()
+{
+if (!this.contentElement.firstChild)
+return;
+
+this._rowCountPerViewport = Math.floor(this.containerElement.offsetHeight / this.contentElement.firstChild.offsetHeight);
+},
+
+
+updateSuggestions: function(anchorBox, completions, selectedIndex, canShowForSingleItem, userEnteredText)
+{
+if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)) {
+this._updateItems(completions, selectedIndex, userEnteredText);
+this._updateBoxPosition(anchorBox);
+if (!this.visible())
+this._bodyElement.appendChild(this._element);
+this._rememberRowCountPerViewport();
+} else
+this.hide();
+},
+
+
+upKeyPressed: function()
+{
+return this._selectClosest(-1, true);
+},
+
+
+downKeyPressed: function()
+{
+return this._selectClosest(1, true);
+},
+
+
+pageUpKeyPressed: function()
+{
+return this._selectClosest(-this._rowCountPerViewport, false);
+},
+
+
+pageDownKeyPressed: function()
+{
+return this._selectClosest(this._rowCountPerViewport, false);
+},
+
+
+enterKeyPressed: function()
+{
+var hasSelectedItem = !!this._selectedElement;
+this.acceptSuggestion();
+
+
+
+return hasSelectedItem;
+},
+
+
+tabKeyPressed: function()
+{
+return this.enterKeyPressed();
+}
+}
+
+
+
+
+
+
 WebInspector.TextPrompt = function(completions, stopCharacters)
 {
 
@@ -7538,7 +8196,7 @@
 this._element.addEventListener("selectstart", this._boundSelectStart, false);
 
 if (typeof this._suggestBoxClassName === "string")
-this._suggestBox = new WebInspector.TextPrompt.SuggestBox(this, this._element, this._suggestBoxClassName);
+this._suggestBox = new WebInspector.SuggestBox(this, this._element, this._suggestBoxClassName);
 
 return this.proxyElement;
 },
@@ -7840,7 +8498,7 @@
 
 _completionsReady: function(selection, auto, originalWordPrefixRange, reverse, completions, selectedIndex)
 {
-if (!this._waitingForCompletions || !completions || !completions.length) {
+if (!this._waitingForCompletions || !completions.length) {
 this.hideSuggestBox();
 return;
 }
@@ -7861,7 +8519,7 @@
 this._userEnteredText = fullWordRange.toString();
 
 if (this._suggestBox)
-this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), completions, selectedIndex, !this.isCaretAtEndOfPrompt());
+this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), completions, selectedIndex, !this.isCaretAtEndOfPrompt(), this._userEnteredText);
 
 var wordPrefixLength = originalWordPrefixRange.toString().length;
 
@@ -7923,7 +8581,7 @@
 selection.addRange(finalSelectionRange);
 }
 } else
-this.applySuggestion(completionText, completions.length > 1, originalWordPrefixRange);
+this._applySuggestion(completionText, completions.length > 1, originalWordPrefixRange);
 },
 
 _completeCommonPrefix: function()
@@ -7941,7 +8599,13 @@
 },
 
 
-applySuggestion: function(completionText, isIntermediateSuggestion, originalPrefixRange)
+applySuggestion: function(completionText, isIntermediateSuggestion)
+{
+this._applySuggestion(completionText, isIntermediateSuggestion);
+},
+
+
+_applySuggestion: function(completionText, isIntermediateSuggestion, originalPrefixRange)
 {
 var wordPrefixLength;
 if (originalPrefixRange)
@@ -8012,7 +8676,7 @@
 
 isSuggestBoxVisible: function()
 {
-return this._suggestBox && this._suggestBox.visible;
+return this._suggestBox && this._suggestBox.visible();
 },
 
 isCaretInsidePrompt: function()
@@ -8116,7 +8780,7 @@
 enterKeyPressed: function(event)
 {
 if (this.isSuggestBoxVisible())
-return this._suggestBox.enterKeyPressed(event);
+return this._suggestBox.enterKeyPressed();
 
 return false;
 },
@@ -8124,7 +8788,7 @@
 upKeyPressed: function(event)
 {
 if (this.isSuggestBoxVisible())
-return this._suggestBox.upKeyPressed(event);
+return this._suggestBox.upKeyPressed();
 
 return false;
 },
@@ -8132,7 +8796,7 @@
 downKeyPressed: function(event)
 {
 if (this.isSuggestBoxVisible())
-return this._suggestBox.downKeyPressed(event);
+return this._suggestBox.downKeyPressed();
 
 return false;
 },
@@ -8140,7 +8804,7 @@
 pageUpKeyPressed: function(event)
 {
 if (this.isSuggestBoxVisible())
-return this._suggestBox.pageUpKeyPressed(event);
+return this._suggestBox.pageUpKeyPressed();
 
 return false;
 },
@@ -8148,7 +8812,7 @@
 pageDownKeyPressed: function(event)
 {
 if (this.isSuggestBoxVisible())
-return this._suggestBox.pageDownKeyPressed(event);
+return this._suggestBox.pageDownKeyPressed();
 
 return false;
 },
@@ -8300,301 +8964,6 @@
 }
 
 
-WebInspector.TextPrompt.SuggestBox = function(textPrompt, inputElement, className)
-{
-this._textPrompt = textPrompt;
-this._inputElement = inputElement;
-this._length = 0;
-this._selectedIndex = -1;
-this._selectedElement = null;
-this._boundOnScroll = this._onscrollresize.bind(this, true);
-this._boundOnResize = this._onscrollresize.bind(this, false);
-window.addEventListener("scroll", this._boundOnScroll, true);
-window.addEventListener("resize", this._boundOnResize, true);
-
-this._bodyElement = inputElement.ownerDocument.body;
-this._element = inputElement.ownerDocument.createElement("div");
-this._element.className = "suggest-box " + (className || "");
-this._element.addEventListener("mousedown", this._onboxmousedown.bind(this), true);
-this.containerElement = this._element.createChild("div", "container");
-this.contentElement = this.containerElement.createChild("div", "content");
-}
-
-WebInspector.TextPrompt.SuggestBox.prototype = {
-get visible()
-{
-return !!this._element.parentElement;
-},
-
-get hasSelection()
-{
-return !!this._selectedElement;
-},
-
-_onscrollresize: function(isScroll, event)
-{
-if (isScroll && this._element.isAncestor(event.target) || !this.visible)
-return;
-this._updateBoxPositionWithExistingAnchor();
-},
-
-_updateBoxPositionWithExistingAnchor: function()
-{
-this._updateBoxPosition(this._anchorBox);
-},
-
-
-_updateBoxPosition: function(anchorBox)
-{
-
-this.contentElement.style.display = "inline-block";
-document.body.appendChild(this.contentElement);
-this.contentElement.positionAt(0, 0);
-var contentWidth = this.contentElement.offsetWidth;
-var contentHeight = this.contentElement.offsetHeight;
-this.contentElement.style.display = "block";
-this.containerElement.appendChild(this.contentElement);
-
-
-this._anchorBox = anchorBox;
-const spacer = 6;
-
-const suggestBoxPaddingX = 21;
-var maxWidth = document.body.offsetWidth - anchorBox.x - spacer;
-var width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
-var paddedWidth = contentWidth + suggestBoxPaddingX;
-var boxX = anchorBox.x;
-if (width < paddedWidth) {
-
-maxWidth = document.body.offsetWidth - spacer;
-width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
-boxX = document.body.offsetWidth - width;
-}
-
-const suggestBoxPaddingY = 2;
-var boxY;
-var aboveHeight = anchorBox.y;
-var underHeight = document.body.offsetHeight - anchorBox.y - anchorBox.height;
-var maxHeight = Math.max(underHeight, aboveHeight) - spacer;
-var height = Math.min(contentHeight, maxHeight - suggestBoxPaddingY) + suggestBoxPaddingY;
-if (underHeight >= aboveHeight) {
-
-boxY = anchorBox.y + anchorBox.height;
-this._element.removeStyleClass("above-anchor");
-this._element.addStyleClass("under-anchor");
-} else {
-
-boxY = anchorBox.y - height;
-this._element.removeStyleClass("under-anchor");
-this._element.addStyleClass("above-anchor");
-}
-
-this._element.positionAt(boxX, boxY);
-this._element.style.width = width + "px";
-this._element.style.height = height + "px";
-},
-
-_onboxmousedown: function(event)
-{
-event.preventDefault();
-},
-
-hide: function()
-{
-if (!this.visible)
-return;
-
-this._element.parentElement.removeChild(this._element);
-delete this._selectedElement;
-},
-
-removeFromElement: function()
-{
-window.removeEventListener("scroll", this._boundOnScroll, true);
-window.removeEventListener("resize", this._boundOnResize, true);
-this.hide();
-},
-
-
-_applySuggestion: function(text, isIntermediateSuggestion)
-{
-if (!this.visible || !(text || this._selectedElement))
-return false;
-
-var suggestion = text || this._selectedElement.textContent;
-if (!suggestion)
-return false;
-
-this._textPrompt.applySuggestion(suggestion, isIntermediateSuggestion);
-return true;
-},
-
-
-acceptSuggestion: function(text)
-{
-var result = this._applySuggestion(text, false);
-this.hide();
-if (!result)
-return false;
-
-this._textPrompt.acceptSuggestion();
-
-return true;
-},
-
-
-_selectClosest: function(shift, isCircular)
-{
-if (!this._length)
-return false;
-
-var index = this._selectedIndex + shift;
-
-if (isCircular)
-index = (this._length + index) % this._length;
-else
-index = Number.constrain(index, 0, this._length - 1);
-
-this._selectItem(index);
-this._applySuggestion(undefined, true);
-return true;
-},
-
-
-updateSuggestions: function(anchorBox, completions, selectedIndex, canShowForSingleItem)
-{
-if (this._suggestTimeout) {
-clearTimeout(this._suggestTimeout);
-delete this._suggestTimeout;
-}
-this._completionsReady(anchorBox, completions, selectedIndex, canShowForSingleItem);
-},
-
-_onItemMouseDown: function(text, event)
-{
-this.acceptSuggestion(text);
-event.consume(true);
-},
-
-_createItemElement: function(prefix, text)
-{
-var element = document.createElement("div");
-element.className = "suggest-box-content-item source-code";
-element.tabIndex = -1;
-if (prefix && prefix.length && !text.indexOf(prefix)) {
-var prefixElement = element.createChild("span", "prefix");
-prefixElement.textContent = prefix;
-var suffixElement = element.createChild("span", "suffix");
-suffixElement.textContent = text.substring(prefix.length);
-} else {
-var suffixElement = element.createChild("span", "suffix");
-suffixElement.textContent = text;
-}
-element.addEventListener("mousedown", this._onItemMouseDown.bind(this, text), false);
-return element;
-},
-
-
-_updateItems: function(items, selectedIndex)
-{
-this._length = items.length;
-this.contentElement.removeChildren();
-
-var userEnteredText = this._textPrompt._userEnteredText;
-for (var i = 0; i < items.length; ++i) {
-var item = items[i];
-var currentItemElement = this._createItemElement(userEnteredText, item);
-this.contentElement.appendChild(currentItemElement);
-}
-
-this._selectedElement = null;
-if (typeof selectedIndex === "number")
-this._selectItem(selectedIndex);
-},
-
-
-_selectItem: function(index)
-{
-if (this._selectedElement)
-this._selectedElement.classList.remove("selected");
-
-this._selectedIndex = index;
-this._selectedElement = this.contentElement.children[index];
-this._selectedElement.classList.add("selected");
-
-this._selectedElement.scrollIntoViewIfNeeded(false);
-},
-
-
-_canShowBox: function(completions, canShowForSingleItem)
-{
-if (!completions || !completions.length)
-return false;
-
-if (completions.length > 1)
-return true;
-
-
-return canShowForSingleItem && completions[0] !== this._textPrompt._userEnteredText;
-},
-
-_rememberRowCountPerViewport: function()
-{
-if (!this.contentElement.firstChild)
-return;
-
-this._rowCountPerViewport = Math.floor(this.containerElement.offsetHeight / this.contentElement.firstChild.offsetHeight);
-},
-
-
-_completionsReady: function(anchorBox, completions, selectedIndex, canShowForSingleItem)
-{
-if (this._canShowBox(completions, canShowForSingleItem)) {
-this._updateItems(completions, selectedIndex);
-this._updateBoxPosition(anchorBox);
-if (!this.visible)
-this._bodyElement.appendChild(this._element);
-this._rememberRowCountPerViewport();
-} else
-this.hide();
-},
-
-upKeyPressed: function(event)
-{
-return this._selectClosest(-1, true);
-},
-
-downKeyPressed: function(event)
-{
-return this._selectClosest(1, true);
-},
-
-pageUpKeyPressed: function(event)
-{
-return this._selectClosest(-this._rowCountPerViewport, false);
-},
-
-pageDownKeyPressed: function(event)
-{
-return this._selectClosest(this._rowCountPerViewport, false);
-},
-
-enterKeyPressed: function(event)
-{
-var hasSelectedItem = !!this._selectedElement;
-this.acceptSuggestion();
-
-
-
-return hasSelectedItem;
-},
-
-tabKeyPressed: function(event)
-{
-return this.enterKeyPressed(event);
-}
-}
-
 
 
 
@@ -8619,9 +8988,9 @@
 
 WebInspector.Popover.prototype = {
 
-show: function(element, anchor, preferredWidth, preferredHeight)
+show: function(element, anchor, preferredWidth, preferredHeight, arrowDirection)
 {
-this._innerShow(null, element, anchor, preferredWidth, preferredHeight);
+this._innerShow(null, element, anchor, preferredWidth, preferredHeight, arrowDirection);
 },
 
 
@@ -8631,7 +9000,7 @@
 },
 
 
-_innerShow: function(view, contentElement, anchor, preferredWidth, preferredHeight)
+_innerShow: function(view, contentElement, anchor, preferredWidth, preferredHeight, arrowDirection)
 {
 if (this._disposed)
 return;
@@ -8654,7 +9023,7 @@
 else
 this._contentDiv.appendChild(this.contentElement);
 
-this._positionElement(anchor, preferredWidth, preferredHeight);
+this._positionElement(anchor, preferredWidth, preferredHeight, arrowDirection);
 
 if (this._popoverHelper) {
 contentElement.addEventListener("mousemove", this._popoverHelper._killHidePopoverTimer.bind(this._popoverHelper), true);
@@ -8686,7 +9055,8 @@
 this._contentDiv.addStyleClass("fixed-height");
 },
 
-_positionElement: function(anchorElement, preferredWidth, preferredHeight)
+
+_positionElement: function(anchorElement, preferredWidth, preferredHeight, arrowDirection)
 {
 const borderWidth = 25;
 const scrollerWidth = this._hasFixedHeight ? 0 : 11;
@@ -8699,16 +9069,16 @@
 const totalWidth = window.innerWidth;
 const totalHeight = window.innerHeight;
 
-var anchorBox = anchorElement.boxInWindow(window);
+var anchorBox = anchorElement instanceof AnchorBox ? anchorElement : anchorElement.boxInWindow(window);
 var newElementPosition = { x: 0, y: 0, width: preferredWidth + scrollerWidth, height: preferredHeight };
 
 var verticalAlignment;
 var roomAbove = anchorBox.y;
 var roomBelow = totalHeight - anchorBox.y - anchorBox.height;
 
-if (roomAbove > roomBelow) {
+if ((roomAbove > roomBelow) || (arrowDirection === WebInspector.Popover.Orientation.Bottom)) {
 
-if (anchorBox.y > newElementPosition.height + arrowHeight + borderRadius)
+if ((anchorBox.y > newElementPosition.height + arrowHeight + borderRadius) || (arrowDirection === WebInspector.Popover.Orientation.Bottom))
 newElementPosition.y = anchorBox.y - newElementPosition.height - arrowHeight;
 else {
 newElementPosition.y = borderRadius;
@@ -8718,11 +9088,11 @@
 newElementPosition.height = preferredHeight;
 }
 }
-verticalAlignment = "bottom";
+verticalAlignment = WebInspector.Popover.Orientation.Bottom;
 } else {
 
 newElementPosition.y = anchorBox.y + anchorBox.height + arrowHeight;
-if (newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight) {
+if ((newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight) && (arrowDirection !== WebInspector.Popover.Orientation.Top)) {
 newElementPosition.height = totalHeight - anchorBox.y - anchorBox.height - borderRadius * 2 - arrowHeight;
 if (this._hasFixedHeight && newElementPosition.height < preferredHeight) {
 newElementPosition.y = totalHeight - preferredHeight - borderRadius;
@@ -8730,7 +9100,7 @@
 }
 }
 
-verticalAlignment = "top";
+verticalAlignment = WebInspector.Popover.Orientation.Top;
 }
 
 var horizontalAlignment;
@@ -8750,7 +9120,7 @@
 newElementPosition.width = totalWidth - borderRadius * 2;
 newElementPosition.height += scrollerWidth;
 horizontalAlignment = "left";
-if (verticalAlignment === "bottom")
+if (verticalAlignment === WebInspector.Popover.Orientation.Bottom)
 newElementPosition.y -= scrollerWidth;
 
 this._popupArrowElement.style.left = Math.max(0, anchorBox.x - borderRadius * 2 - arrowOffset) + "px";
@@ -8786,9 +9156,19 @@
 this._timeout = timeout;
 },
 
+
+_eventInHoverElement: function(event)
+{
+if (!this._hoverElement)
+return false;
+var box = this._hoverElement instanceof AnchorBox ? this._hoverElement : this._hoverElement.boxInWindow();
+return (box.x <= event.clientX && event.clientX <= box.x + box.width &&
+box.y <= event.clientY && event.clientY <= box.y + box.height);
+},
+
 _mouseDown: function(event)
 {
-if (this._disableOnClick || !event.target.isSelfOrDescendant(this._hoverElement))
+if (this._disableOnClick || !this._eventInHoverElement(event))
 this.hidePopover();
 else {
 this._killHidePopoverTimer();
@@ -8799,7 +9179,7 @@
 _mouseMove: function(event)
 {
 
-if (event.target.isSelfOrDescendant(this._hoverElement))
+if (this._eventInHoverElement(event))
 return;
 
 this._startHidePopoverTimer();
@@ -8818,7 +9198,7 @@
 {
 if (!this.isPopoverVisible())
 return;
-if (event.relatedTarget && !event.relatedTarget.isSelfOrDescendant(this._hoverElement))
+if (!this._eventInHoverElement(event))
 this._startHidePopoverTimer();
 },
 
@@ -8903,6 +9283,85 @@
 }
 
 
+WebInspector.Popover.Orientation = {
+Top: "top",
+Bottom: "bottom"
+}
+
+
+WebInspector.PopoverContentHelper = function(title)
+{
+this._contentTable = document.createElement("table");
+var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "popover-details-title");
+titleCell.colSpan = 2;
+var titleRow = document.createElement("tr");
+titleRow.appendChild(titleCell);
+this._contentTable.appendChild(titleRow);
+}
+
+WebInspector.PopoverContentHelper.prototype = {
+contentTable: function()
+{
+return this._contentTable;
+},
+
+
+_createCell: function(content, styleName)
+{
+var text = document.createElement("label");
+text.appendChild(document.createTextNode(content));
+var cell = document.createElement("td");
+cell.className = "popover-details";
+if (styleName)
+cell.className += " " + styleName;
+cell.textContent = content;
+return cell;
+},
+
+appendTextRow: function(title, content)
+{
+var row = document.createElement("tr");
+row.appendChild(this._createCell(title, "popover-details-row-title"));
+row.appendChild(this._createCell(content, "popover-details-row-data"));
+this._contentTable.appendChild(row);
+},
+
+
+appendElementRow: function(title, content, titleStyle)
+{
+var row = document.createElement("tr");
+var titleCell = this._createCell(title, "popover-details-row-title");
+if (titleStyle)
+titleCell.addStyleClass(titleStyle);
+row.appendChild(titleCell);
+var cell = document.createElement("td");
+cell.className = "details";
+cell.appendChild(content);
+row.appendChild(cell);
+this._contentTable.appendChild(row);
+},
+
+appendStackTrace: function(title, stackTrace, callFrameLinkifier)
+{
+this.appendTextRow("", "");
+var framesTable = document.createElement("table");
+for (var i = 0; i < stackTrace.length; ++i) {
+var stackFrame = stackTrace[i];
+var row = document.createElement("tr");
+row.className = "details";
+row.appendChild(this._createCell(stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)"), "function-name"));
+row.appendChild(this._createCell(" @ "));
+var linkCell = document.createElement("td");
+var urlElement = callFrameLinkifier(stackFrame);
+linkCell.appendChild(urlElement);
+row.appendChild(linkCell);
+framesTable.appendChild(row);
+}
+this.appendElementRow(title, framesTable, "popover-stacktrace-title");
+}
+}
+
+
 
 
 
@@ -9009,7 +9468,7 @@
 this._headerElement = this.element.createChild("div", "tabbed-pane-header");
 this._headerContentsElement = this._headerElement.createChild("div", "tabbed-pane-header-contents");
 this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-pane-header-tabs");
-this._contentElement = this.element.createChild("div", "tabbed-pane-content");
+this._contentElement = this.element.createChild("div", "tabbed-pane-content scroll-target");
 this._tabs = [];
 this._tabsHistory = [];
 this._tabsById = {};
@@ -9061,6 +9520,15 @@
 },
 
 
+setTabDelegate: function(delegate)
+{
+var tabs = this._tabs.slice();
+for (var i = 0; i < tabs.length; ++i)
+tabs[i].setDelegate(delegate);
+this._delegate = delegate;
+},
+
+
 onMouseUp: function(event)
 {
 
@@ -9072,6 +9540,7 @@
 appendTab: function(id, tabTitle, view, tabTooltip, userGesture)
 {
 var tab = new WebInspector.TabbedPaneTab(this, id, tabTitle, this._closeableTabs, view, tabTooltip);
+tab.setDelegate(this._delegate);
 this._tabsById[id] = tab;
 
 this._tabs.push(tab);
@@ -9119,24 +9588,25 @@
 },
 
 
-closeAllTabs: function(userGesture)
+allTabs: function()
 {
+var result = [];
 var tabs = this._tabs.slice();
 for (var i = 0; i < tabs.length; ++i)
-this._innerCloseTab(tabs[i].id, userGesture);
-this._updateTabElements();
+result.push(tabs[i].id);
+return result;
 },
 
 
-closeOtherTabs: function(id)
+otherTabs: function(id)
 {
+var result = [];
 var tabs = this._tabs.slice();
 for (var i = 0; i < tabs.length; ++i) {
 if (tabs[i].id !== id)
-this._innerCloseTab(tabs[i].id, true);
+result.push(tabs[i].id);
 }
-this._updateTabElements();
-this.selectTab(id, true);
+return result;
 },
 
 
@@ -9552,6 +10022,12 @@
 },
 
 
+setDelegate: function(delegate)
+{
+this._delegate = delegate;
+},
+
+
 _createTabElement: function(measuring)
 {
 var tabElement = document.createElement("div");
@@ -9589,7 +10065,7 @@
 _tabClicked: function(event)
 {
 if (this._closeable && (event.button === 1 || event.target.hasStyleClass("tabbed-pane-header-tab-close-button")))
-this._tabbedPane.closeTab(this.id, true);
+this._closeTabs([this.id]);
 },
 
 
@@ -9600,27 +10076,37 @@
 this._tabbedPane.selectTab(this.id, true);
 },
 
+
+_closeTabs: function(ids)
+{
+if (this._delegate) {
+this._delegate.closeTabs(this._tabbedPane, ids);
+return;
+}
+this._tabbedPane.closeTabs(ids, true);
+},
+
 _tabContextMenu: function(event)
 {
 function close()
 {
-this._tabbedPane.closeTab(this.id, true);
+this._closeTabs([this.id]);
 }
 
 function closeOthers()
 {
-this._tabbedPane.closeOtherTabs(this.id);
+this._closeTabs(this._tabbedPane.otherTabs(this.id));
 }
 
 function closeAll()
 {
-this._tabbedPane.closeAllTabs(true);
+this._closeTabs(this._tabbedPane.allTabs(this.id));
 }
 
 var contextMenu = new WebInspector.ContextMenu(event);
 contextMenu.appendItem(WebInspector.UIString("Close"), close.bind(this));
-contextMenu.appendItem(WebInspector.UIString("Close Others"), closeOthers.bind(this));
-contextMenu.appendItem(WebInspector.UIString("Close All"), closeAll.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Close others" : "Close Others"), closeOthers.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Close all" : "Close All"), closeAll.bind(this));
 contextMenu.show();
 },
 
@@ -9684,6 +10170,131 @@
 }
 
 
+WebInspector.TabbedPaneTabDelegate = function()
+{
+}
+
+WebInspector.TabbedPaneTabDelegate.prototype = {
+
+closeTabs: function(tabbedPane, ids) { }
+}
+
+
+
+
+
+
+WebInspector.ViewportControl = function(provider)
+{
+this.element = document.createElement("div");
+this.element.className = "fill";
+this.element.style.overflow = "auto";
+this._topGapElement = this.element.createChild("div");
+this._contentElement = this.element.createChild("div");
+this._bottomGapElement = this.element.createChild("div");
+
+this._provider = provider;
+this.element.addEventListener("scroll", this._onScroll.bind(this), false);
+this._firstVisibleIndex = 0;
+this._lastVisibleIndex = -1;
+}
+
+
+WebInspector.ViewportControl.Provider = function() 
+{
+}
+
+WebInspector.ViewportControl.Provider.prototype = { 
+
+itemCount: function() { return 0; },
+
+
+itemElement: function(index) { return null; }
+}
+
+WebInspector.ViewportControl.prototype = {
+
+contentElement: function()
+{
+return this._contentElement;
+},
+
+refresh: function()
+{
+if (!this.element.clientHeight)
+return;  
+
+var itemCount = this._provider.itemCount();
+if (!itemCount)
+return;
+
+if (!this._rowHeight) {
+var firstElement = this._provider.itemElement(0);
+this._rowHeight = firstElement.measurePreferredSize(this._contentElement).height;
+}
+
+var visibleFrom = this.element.scrollTop;
+var visibleTo = visibleFrom + this.element.clientHeight;
+
+this._firstVisibleIndex = Math.floor(visibleFrom / this._rowHeight);
+this._lastVisibleIndex = Math.min(Math.ceil(visibleTo / this._rowHeight), itemCount) - 1;
+
+this._topGapElement.style.height = (this._rowHeight * this._firstVisibleIndex) + "px";
+this._bottomGapElement.style.height = (this._rowHeight * (itemCount - this._lastVisibleIndex - 1)) + "px"; 
+
+this._contentElement.removeChildren();
+for (var i = this._firstVisibleIndex; i <= this._lastVisibleIndex; ++i)
+this._contentElement.appendChild(this._provider.itemElement(i));
+},
+
+
+_onScroll: function(event)
+{
+this.refresh();
+},
+
+
+rowsPerViewport: function()
+{
+return Math.floor(this.element.clientHeight / this._rowHeight);
+},
+
+
+firstVisibleIndex: function()
+{
+return this._firstVisibleIndex;
+},
+
+
+lastVisibleIndex: function()
+{
+return this._lastVisibleIndex;
+},
+
+
+renderedElementAt: function(index)
+{
+if (index < this._firstVisibleIndex)
+return null;
+if (index > this._lastVisibleIndex)
+return null;
+return this._contentElement.childNodes[index - this._firstVisibleIndex];
+},
+
+
+scrollItemIntoView: function(index, makeLast)
+{
+if (index > this._firstVisibleIndex && index < this._lastVisibleIndex)
+return;
+
+if (makeLast)
+this.element.scrollTop = this._rowHeight * (index + 1) - this.element.clientHeight;
+else
+this.element.scrollTop = this._rowHeight * index;
+}
+}
+
+
 
 
 
@@ -9703,6 +10314,8 @@
 this._drawerContentsElement.className = "drawer-contents";
 this.element.appendChild(this._drawerContentsElement);
 this._viewStatusBar = document.createElement("div");
+this._viewStatusBar.addEventListener("webkitTransitionEnd", this.immediatelyFinishAnimation.bind(this), false);
+this._viewStatusBar.style.opacity = 0;
 this._bottomStatusBar = document.getElementById("bottom-status-bar-container");
 }
 
@@ -9744,6 +10357,7 @@
 document.body.addStyleClass("drawer-visible");
 this._floatingStatusBarContainer.insertBefore(document.getElementById("panel-status-bar"), this._floatingStatusBarContainer.firstElementChild);
 this._bottomStatusBar.appendChild(this._viewStatusBar);
+this._view.detach();
 this._view.markAsRoot();
 this._view.show(this._drawerContentsElement);
 
@@ -9751,24 +10365,30 @@
 return;
 
 var height = this._constrainHeight(this._savedHeight || this.element.offsetHeight);
-var animations = [
-{element: this.element, end: {height: height}},
-{element: this._mainElement, end: {bottom: height}},
-{element: this._floatingStatusBarContainer, start: {"padding-left": this._bottomStatusBar.offsetLeft}, end: {"padding-left": 0}},
-{element: this._viewStatusBar, start: {opacity: 0}, end: {opacity: 1}}
-];
+
+this._floatingStatusBarContainer.style.paddingLeft = this._bottomStatusBar.offsetLeft + "px";
+
+this._getAnimationStyles(animationType).forEach(document.body.addStyleClass, document.body);
 
 function animationFinished()
 {
 WebInspector.inspectorView.currentPanel().doResize();
 if (this._view && this._view.afterShow)
 this._view.afterShow();
-delete this._currentAnimation;
 }
 
-this._currentAnimation = WebInspector.animateStyle(animations, this._animationDuration(animationType), animationFinished.bind(this));
+this._animationFinished = animationFinished.bind(this);
+
+
+console.assert(this._viewStatusBar.style.opacity === "0");
+
 if (animationType === WebInspector.Drawer.AnimationType.Immediately)
-this._currentAnimation.forceComplete();
+this.immediatelyFinishAnimation();
+
+this.element.style.height = height + "px";
+this._mainElement.style.bottom = height + "px";
+this._floatingStatusBarContainer.style.paddingLeft = 0;
+this._viewStatusBar.style.opacity = 1;
 },
 
 hide: function(animationType)
@@ -9787,12 +10407,7 @@
 WebInspector.inspectorView.currentPanel().statusBarResized();
 document.body.addStyleClass("drawer-visible");
 
-var animations = [
-{element: this._mainElement, end: {bottom: 0}},
-{element: this.element, end: {height: 0}},
-{element: this._floatingStatusBarContainer, start: {"padding-left": 0}, end: {"padding-left": this._bottomStatusBar.offsetLeft} },
-{element: this._viewStatusBar, start: {opacity: 1}, end: {opacity: 0}}
-];
+this._getAnimationStyles(animationType).forEach(document.body.addStyleClass, document.body);
 
 function animationFinished()
 {
@@ -9803,12 +10418,20 @@
 this._bottomStatusBar.appendChild(document.getElementById("panel-status-bar"));
 this._drawerContentsElement.removeChildren();
 document.body.removeStyleClass("drawer-visible");
-delete this._currentAnimation;
 }
 
-this._currentAnimation = WebInspector.animateStyle(animations, this._animationDuration(animationType), animationFinished.bind(this));
+this._animationFinished = animationFinished.bind(this);
+
+
+console.assert(this._viewStatusBar.style.opacity === "1");
+
 if (animationType === WebInspector.Drawer.AnimationType.Immediately)
-this._currentAnimation.forceComplete();
+this.immediatelyFinishAnimation();
+
+this.element.style.height = 0;
+this._mainElement.style.bottom = 0;
+this._floatingStatusBarContainer.style.paddingLeft = this._bottomStatusBar.offsetLeft + "px";
+this._viewStatusBar.style.opacity = 0;
 },
 
 resize: function()
@@ -9825,19 +10448,23 @@
 
 immediatelyFinishAnimation: function()
 {
-if (this._currentAnimation)
-this._currentAnimation.forceComplete();
+document.body.removeStyleClass("animate");
+document.body.removeStyleClass("animate-slow");
+if (this._animationFinished) {
+this._animationFinished();
+delete this._animationFinished;
+}
 },
 
-_animationDuration: function(animationType)
+_getAnimationStyles: function(animationType)
 {
 switch (animationType) {
 case WebInspector.Drawer.AnimationType.Slow:
-return 2000;
+return ["animate", "animate-slow"];
 case WebInspector.Drawer.AnimationType.Normal:
-return 250;
+return ["animate"];
 default:
-return 0;
+return [];
 }
 },
 
@@ -9950,6 +10577,7 @@
 clearMessages: function()
 {
 this.messages = [];
+delete this._previousMessage;
 
 this.errors = 0;
 this.warnings = 0;
@@ -10024,6 +10652,7 @@
 
 },
 
+
 location: function()
 {
 
@@ -10037,11 +10666,15 @@
 
 
 WebInspector.ConsoleMessage.MessageSource = {
-HTML: "html",
 XML: "xml",
 JS: "javascript",
 Network: "network",
 ConsoleAPI: "console-api",
+Storage: "storage",
+AppCache: "appcache",
+Rendering: "rendering",
+CSS: "css",
+Security: "security",
 Other: "other"
 }
 
@@ -10049,17 +10682,19 @@
 Log: "log",
 Dir: "dir",
 DirXML: "dirxml",
+Table: "table",
 Trace: "trace",
 Clear: "clear",
 StartGroup: "startGroup",
 StartGroupCollapsed: "startGroupCollapsed",
 EndGroup: "endGroup",
 Assert: "assert",
-Result: "result"
+Result: "result",
+Profile: "profile",
+ProfileEnd: "profileEnd"
 }
 
 WebInspector.ConsoleMessage.MessageLevel = {
-Tip: "tip",
 Log: "log",
 Warning: "warning",
 Error: "error",
@@ -10124,6 +10759,8 @@
 this._stackTrace = stackTrace;
 this._request = requestId ? WebInspector.networkLog.requestForId(requestId) : null;
 this._isOutdated = isOutdated;
+this._dataGrids = [];
+this._dataGridParents = new Map();
 
 this._customFormatters = {
 "object": this._formatParameterAsObject,
@@ -10134,6 +10771,24 @@
 }
 
 WebInspector.ConsoleMessageImpl.prototype = {
+wasShown: function()
+{
+for (var i = 0; this._dataGrids && i < this._dataGrids.length; ++i) {
+var dataGrid = this._dataGrids[i];
+var parentElement = this._dataGridParents.get(dataGrid);
+dataGrid.show(parentElement);
+}
+},
+
+willHide: function()
+{
+for (var i = 0; this._dataGrids && i < this._dataGrids.length; ++i) {
+var dataGrid = this._dataGrids[i];
+this._dataGridParents.put(dataGrid, dataGrid.element.parentElement);
+dataGrid.detach();
+}
+},
+
 _formatMessage: function()
 {
 this._formattedMessage = document.createElement("span");
@@ -10159,6 +10814,19 @@
 var args = ["%O", obj];
 this._messageElement = this._format(args);
 break;
+case WebInspector.ConsoleMessage.MessageType.Profile:
+var title = WebInspector.ProfilesPanelDescriptor.resolveProfileTitle(this._messageText);
+this._messageElement = document.createTextNode(WebInspector.UIString("Profile '%s' started.", title));
+break;
+case WebInspector.ConsoleMessage.MessageType.ProfileEnd:
+var hashIndex = this._messageText.lastIndexOf("#");
+var title = WebInspector.ProfilesPanelDescriptor.resolveProfileTitle(this._messageText.substring(0, hashIndex));
+var uid = this._messageText.substring(hashIndex + 1);
+var format = WebInspector.UIString("Profile '%s' finished.", "%_");
+var link = WebInspector.linkifyURLAsNode("webkit-profile://CPU/" + uid, title);
+this._messageElement = document.createElement("span");
+this._formatWithSubstitutionString(format, [link], this._messageElement);
+break;
 default:
 var args = this._parameters || [this._messageText];
 this._messageElement = this._format(args);
@@ -10293,12 +10961,17 @@
 
 if (shouldFormatMessage) {
 
-var result = this._formatWithSubstitutionString(parameters, formattedResult);
+var result = this._formatWithSubstitutionString(parameters[0].description, parameters.slice(1), formattedResult);
 parameters = result.unusedSubstitutions;
 if (parameters.length)
 formattedResult.appendChild(document.createTextNode(" "));
 }
 
+if (this.type === WebInspector.ConsoleMessage.MessageType.Table) {
+formattedResult.appendChild(this._formatParameterAsTable(parameters));
+return formattedResult;
+}
+
 
 for (var i = 0; i < parameters.length; ++i) {
 
@@ -10362,6 +11035,9 @@
 var section = new WebInspector.ObjectPropertiesSection(obj, titleElement);
 section.enableContextMenu();
 elem.appendChild(section.element);
+
+var note = section.titleElement.createChild("span", "object-info-state-note");
+note.title = WebInspector.UIString("Object state below is captured upon first expansion");
 },
 
 
@@ -10383,7 +11059,7 @@
 titleElement.createTextChild(": ");
 }
 
-this._appendPropertyPreview(titleElement, property);
+titleElement.appendChild(this._renderPropertyPreview(property));
 }
 if (preview.overflow)
 titleElement.createChild("span").textContent = "\u2026";
@@ -10392,28 +11068,35 @@
 },
 
 
-_appendPropertyPreview: function(titleElement, property)
+_renderPropertyPreview: function(property)
 {
-var span = titleElement.createChild("span", "console-formatted-" + property.type);
+var span = document.createElement("span");
+span.className = "console-formatted-" + property.type;
 
 if (property.type === "function") {
 span.textContent = "function";
-return;
+return span;
 }
 
 if (property.type === "object" && property.subtype === "regexp") {
 span.addStyleClass("console-formatted-string");
 span.textContent = property.value;
-return;
+return span;
 }
 
 if (property.type === "object" && property.subtype === "node" && property.value) {
 span.addStyleClass("console-formatted-preview-node");
 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(span, property.value);
-return;
+return span;
+}
+
+if (property.type === "string") {
+span.textContent = "\"" + property.value + "\"";
+return span;
 }
 
 span.textContent = property.value;
+return span;
 },
 
 _formatParameterAsNode: function(object, elem)
@@ -10444,6 +11127,7 @@
 return this.type !== WebInspector.ConsoleMessage.MessageType.DirXML && !!array.preview;
 },
 
+
 _formatParameterAsArray: function(array, elem)
 {
 if (this.useArrayPreviewInFormatter(array)) {
@@ -10458,6 +11142,53 @@
 array.getOwnProperties(this._printArray.bind(this, array, elem));
 },
 
+
+_formatParameterAsTable: function(parameters)
+{
+var element = document.createElement("span");
+var table = parameters[0];
+if (!table || !table.preview)
+return element;
+
+var columnNames = [];
+var preview = table.preview;
+var rows = [];
+for (var i = 0; i < preview.properties.length; ++i) {
+var rowProperty = preview.properties[i];
+var rowPreview = rowProperty.valuePreview;
+if (!rowPreview)
+continue;
+
+var rowValue = {};
+const maxColumnsToRender = 20;
+for (var j = 0; j < rowPreview.properties.length && columnNames.length < maxColumnsToRender; ++j) {
+var cellProperty = rowPreview.properties[j];
+if (columnNames.indexOf(cellProperty.name) === -1)
+columnNames.push(cellProperty.name);
+rowValue[cellProperty.name] = this._renderPropertyPreview(cellProperty);
+}
+rows.push([rowProperty.name, rowValue]);
+}
+
+var flatValues = [];
+for (var i = 0; i < rows.length; ++i) {
+var rowName = rows[i][0];
+var rowValue = rows[i][1];
+flatValues.push(rowName);
+for (var j = 0; j < columnNames.length; ++j)
+flatValues.push(rowValue[columnNames[j]]);
+}
+
+if (!flatValues.length)
+return element;
+columnNames.unshift(WebInspector.UIString("(index)"));
+var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues);
+dataGrid.renderInline();
+this._dataGrids.push(dataGrid);
+this._dataGridParents.put(dataGrid, element);
+return element;
+},
+
 _formatParameterAsString: function(output, elem)
 {
 var span = document.createElement("span");
@@ -10491,7 +11222,7 @@
 {
 if (index - lastNonEmptyIndex <= 1)
 return;
-var span = elem.createChild(span, "console-formatted-undefined");
+var span = elem.createChild("span", "console-formatted-undefined");
 span.textContent = WebInspector.UIString("undefined × %d", index - lastNonEmptyIndex - 1);
 }
 
@@ -10522,9 +11253,9 @@
 return this._formatParameter(output, output.subtype && output.subtype === "array", false);
 },
 
-_formatWithSubstitutionString: function(parameters, formattedResult)
+_formatWithSubstitutionString: function(format, parameters, formattedResult)
 {
-var formatters = {}
+var formatters = {};
 
 function parameterFormatter(force, obj)
 {
@@ -10550,6 +11281,11 @@
 return Math.floor(obj.value);
 }
 
+function bypassFormatter(obj)
+{
+return (obj instanceof Node) ? obj : "";
+}
+
 var currentStyle = null;
 function styleFormatter(obj)
 {
@@ -10587,12 +11323,14 @@
 
 formatters.O = parameterFormatter.bind(this, true);
 
+formatters._ = bypassFormatter;
+
 function append(a, b)
 {
 if (b instanceof Node)
 a.appendChild(b);
-else if (b) {
-var toAppend = WebInspector.linkifyStringAsFragment(b.toString());
+else if (typeof b !== "undefined") {
+var toAppend = WebInspector.linkifyStringAsFragment(String(b));
 if (currentStyle) {
 var wrapper = document.createElement('span');
 for (var key in currentStyle)
@@ -10606,7 +11344,7 @@
 }
 
 
-return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
+return String.format(format, parameters, formatters, formattedResult, append);
 },
 
 clearHighlight: function()
@@ -10639,7 +11377,6 @@
 regexObject.lastIndex = 0;
 var text = element.textContent;
 var match = regexObject.exec(text);
-var offset = 0;
 var matchRanges = [];
 while (match) {
 matchRanges.push({ offset: match.index, length: match[0].length });
@@ -10665,9 +11402,6 @@
 this._element = element;
 
 switch (this.level) {
-case WebInspector.ConsoleMessage.MessageLevel.Tip:
-element.addStyleClass("console-tip-level");
-break;
 case WebInspector.ConsoleMessage.MessageLevel.Log:
 element.addStyleClass("console-log-level");
 break;
@@ -10717,6 +11451,9 @@
 },
 
 updateRepeatCount: function() {
+if (!this._element)
+return;
+
 if (!this.repeatCountElement) {
 this.repeatCountElement = document.createElement("span");
 this.repeatCountElement.className = "bubble";
@@ -10731,9 +11468,6 @@
 {
 var sourceString;
 switch (this.source) {
-case WebInspector.ConsoleMessage.MessageSource.HTML:
-sourceString = "HTML";
-break;
 case WebInspector.ConsoleMessage.MessageSource.XML:
 sourceString = "XML";
 break;
@@ -10746,6 +11480,21 @@
 case WebInspector.ConsoleMessage.MessageSource.ConsoleAPI:
 sourceString = "ConsoleAPI";
 break;
+case WebInspector.ConsoleMessage.MessageSource.Storage:
+sourceString = "Storage";
+break;
+case WebInspector.ConsoleMessage.MessageSource.AppCache:
+sourceString = "AppCache";
+break;
+case WebInspector.ConsoleMessage.MessageSource.Rendering:
+sourceString = "Rendering";
+break;
+case WebInspector.ConsoleMessage.MessageSource.CSS:
+sourceString = "CSS";
+break;
+case WebInspector.ConsoleMessage.MessageSource.Security:
+sourceString = "Security";
+break;
 case WebInspector.ConsoleMessage.MessageSource.Other:
 sourceString = "Other";
 break;
@@ -10778,13 +11527,14 @@
 case WebInspector.ConsoleMessage.MessageType.Result:
 typeString = "Result";
 break;
+case WebInspector.ConsoleMessage.MessageType.Profile:
+case WebInspector.ConsoleMessage.MessageType.ProfileEnd:
+typeString = "Profiling";
+break;
 }
 
 var levelString;
 switch (this.level) {
-case WebInspector.ConsoleMessage.MessageLevel.Tip:
-levelString = "Tip";
-break;
 case WebInspector.ConsoleMessage.MessageLevel.Log:
 levelString = "Log";
 break;
@@ -10869,7 +11619,11 @@
 WebInspector.View.call(this);
 
 this.element.id = "console-view";
-this.messages = [];
+this._messageLevelFilters = {};
+this._messageURLFilters = WebInspector.settings.messageURLFilters.get();
+this._visibleMessages = [];
+this._messages = [];
+this._urlToMessageCount = {};
 
 this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."), "clear-status-bar-item");
 this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this);
@@ -10927,9 +11681,9 @@
 
 this.allElement = createFilterElement.call(this, "all", WebInspector.UIString("All"));
 createDividerElement.call(this);
-this.errorElement = createFilterElement.call(this, "errors", WebInspector.UIString("Errors"));
-this.warningElement = createFilterElement.call(this, "warnings", WebInspector.UIString("Warnings"));
-this.logElement = createFilterElement.call(this, "logs", WebInspector.UIString("Logs"));
+this.errorElement = createFilterElement.call(this, "error", WebInspector.UIString("Errors"));
+this.warningElement = createFilterElement.call(this, "warning", WebInspector.UIString("Warnings"));
+this.logElement = createFilterElement.call(this, "log", WebInspector.UIString("Logs"));
 this.debugElement = createFilterElement.call(this, "debug", WebInspector.UIString("Debug"));
 
 this.filter(this.allElement, false);
@@ -10978,12 +11732,9 @@
 
 _addFrame: function(contextList)
 {
-var option = document.createElement("option");
-option.text = contextList.displayName;
-option.title = contextList.url;
+var option = this._frameSelector.createOption(contextList.displayName, contextList.url);
 option._contextList = contextList;
 contextList._consoleOption = option;
-this._frameSelector.addOption(option);
 contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated, this._frameUpdated, this);
 contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded, this._contextAdded, this);
 this._frameChanged();
@@ -11025,11 +11776,8 @@
 {
 if (!WebInspector.runtimeModel.currentExecutionContext())
 WebInspector.runtimeModel.setCurrentExecutionContext(executionContext);
-var option = document.createElement("option");
-option.text = executionContext.name;
-option.title = executionContext.id;
+var option = this._contextSelector.createOption(executionContext.name, executionContext.id);
 option._executionContext = executionContext;
-this._contextSelector.addOption(option);
 },
 
 
@@ -11079,30 +11827,24 @@
 {
 function unselectAll()
 {
+this._messageLevelFilters = {};
+
 this.allElement.removeStyleClass("selected");
 this.errorElement.removeStyleClass("selected");
 this.warningElement.removeStyleClass("selected");
 this.logElement.removeStyleClass("selected");
 this.debugElement.removeStyleClass("selected");
-
-this.messagesElement.classList.remove("filter-all", "filter-errors", "filter-warnings", "filter-logs", "filter-debug");
 }
 
-var targetFilterClass = "filter-" + target.category;
-
 if (target.category === "all") {
-if (target.hasStyleClass("selected")) {
-
-return;
-}
-
 unselectAll.call(this);
+target.addStyleClass("selected");
+this._messageLevelFilters = {error: true, warning: true, log: true, debug: true};
 } else {
 
 if (this.allElement.hasStyleClass("selected")) {
+this._messageLevelFilters = {};
 this.allElement.removeStyleClass("selected");
-this.messagesElement.removeStyleClass("filter-all");
-}
 }
 
 if (!selectMultiple) {
@@ -11111,22 +11853,30 @@
 unselectAll.call(this);
 
 target.addStyleClass("selected");
-this.messagesElement.addStyleClass(targetFilterClass);
 
-return;
-}
+this._messageLevelFilters = {};
+this._messageLevelFilters[target.category] = true;
+} else {
 
 if (target.hasStyleClass("selected")) {
 
 
 target.removeStyleClass("selected");
-this.messagesElement.removeStyleClass(targetFilterClass);
+
+if (this._messageLevelFilters[target.category])
+delete this._messageLevelFilters[target.category];
+
 } else {
 
 
 target.addStyleClass("selected");
-this.messagesElement.addStyleClass(targetFilterClass);
+
+this._messageLevelFilters[target.category] = true;
 }
+}
+}
+
+this._updateMessageList();
 },
 
 willHide: function()
@@ -11201,39 +11951,51 @@
 
 _consoleMessageAdded: function(event)
 {
-this._appendConsoleMessage(event.data);
+var message =   (event.data);
+this._messages.push(message);
+
+if (this._urlToMessageCount[message.url])
+this._urlToMessageCount[message.url]++;
+else
+this._urlToMessageCount[message.url] = 1;
+
+if (this._shouldBeVisible(message))
+this._appendConsoleMessage(message);
 },
 
-_appendConsoleMessage: function(msg)
+_appendConsoleMessage: function(message)
 {
 
 
-if (!this._isScrollIntoViewScheduled() && ((msg instanceof WebInspector.ConsoleCommandResult) || this.messagesElement.isScrolledToBottom()))
+if (!this._isScrollIntoViewScheduled() && ((message instanceof WebInspector.ConsoleCommandResult) || this.messagesElement.isScrolledToBottom()))
 this._scheduleScrollIntoView();
 
-this.messages.push(msg);
+this._visibleMessages.push(message);
 
-if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
+if (message.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
 var parentGroup = this.currentGroup.parentGroup
 if (parentGroup)
 this.currentGroup = parentGroup;
 } else {
-if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
+if (message.type === WebInspector.ConsoleMessage.MessageType.StartGroup || message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
 var group = new WebInspector.ConsoleGroup(this.currentGroup);
 this.currentGroup.messagesElement.appendChild(group.element);
 this.currentGroup = group;
+message.group = group;
+}
+this.currentGroup.addMessage(message);
 }
 
-this.currentGroup.addMessage(msg);
-}
-
-this.dispatchEventToListeners(WebInspector.ConsoleView.Events.EntryAdded, msg);
+this.dispatchEventToListeners(WebInspector.ConsoleView.Events.EntryAdded, message);
 },
 
 _consoleCleared: function()
 {
 this._scrolledToBottom = true;
-this.messages = [];
+for (var i = 0; i < this._visibleMessages.length; ++i)
+this._visibleMessages[i].willHide();
+this._visibleMessages = [];
+this._messages = [];
 
 this.currentGroup = this.topGroup;
 this.topGroup.messagesElement.removeChildren();
@@ -11268,6 +12030,28 @@
 }
 contextMenu.appendCheckboxItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Preserve log upon navigation" : "Preserve Log upon Navigation"), preserveLogItemAction.bind(this), WebInspector.settings.preserveConsoleLog.get());
 
+var sourceElement = event.target.enclosingNodeOrSelfWithClass("console-message");
+
+var filterSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Filter"));
+
+if (sourceElement && sourceElement.message.url)
+filterSubMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Hide messages from %s" : "Hide Messages from %s", new WebInspector.ParsedURL(sourceElement.message.url).displayName), this._addMessageURLFilter.bind(this, sourceElement.message.url));
+
+filterSubMenu.appendSeparator();
+var unhideAll = filterSubMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Unhide all" : "Unhide All"), this._removeMessageURLFilter.bind(this));
+filterSubMenu.appendSeparator();
+
+var hasFilters = false;
+for (var url in this._messageURLFilters) {
+if (this._messageURLFilters.hasOwnProperty(url)) {
+filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)", new WebInspector.ParsedURL(url).displayName, this._urlToMessageCount[url]), this._removeMessageURLFilter.bind(this, url), true);
+hasFilters = true;
+}
+}
+
+filterSubMenu.setEnabled(hasFilters || (sourceElement && sourceElement.message.url));
+unhideAll.setEnabled(hasFilters);
+
 contextMenu.appendSeparator();
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear console" : "Clear Console"), this._requestClearMessages.bind(this));
 
@@ -11281,6 +12065,73 @@
 contextMenu.show();
 },
 
+
+_addMessageURLFilter: function(url)
+{
+this._messageURLFilters[url] = true;
+WebInspector.settings.messageURLFilters.set(this._messageURLFilters);
+this._updateMessageList();
+},
+
+
+_removeMessageURLFilter: function(url)
+{
+if (!url)
+this._messageURLFilters = {};
+else
+delete this._messageURLFilters[url];
+
+WebInspector.settings.messageURLFilters.set(this._messageURLFilters);
+
+this._updateMessageList();
+},
+
+
+_shouldBeVisible: function(message)
+{
+return (message.type === WebInspector.ConsoleMessage.MessageType.StartGroup || message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed || message.type === WebInspector.ConsoleMessage.MessageType.EndGroup) ||
+((!message.url || !this._messageURLFilters[message.url]) && (!message.level || this._messageLevelFilters[message.level]));
+},
+
+
+_updateMessageList: function()
+{
+var group = this.topGroup;
+var sourceMessages = this._messages;
+var visibleMessageIndex = 0;
+var newVisibleMessages = [];
+var anchor = null;
+for (var i = 0; i < sourceMessages.length; i++) {
+var sourceMessage = sourceMessages[i];
+var visibleMessage = this._visibleMessages[visibleMessageIndex];
+
+if (visibleMessage === sourceMessage) {
+visibleMessageIndex++;
+if (this._shouldBeVisible(visibleMessage)) {
+newVisibleMessages.push(visibleMessage);
+if (sourceMessage.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
+anchor = group.element;
+group = group.parentGroup || group;
+} else if (sourceMessage.type === WebInspector.ConsoleMessage.MessageType.StartGroup || sourceMessage.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
+group = sourceMessage.group;
+anchor = group.messagesElement.firstChild;
+}
+} else {
+visibleMessage.willHide();
+visibleMessage.toMessageElement().removeSelf();
+}
+} else {
+if (this._shouldBeVisible(sourceMessage)) {
+group.addMessage(sourceMessage, anchor ? anchor.nextSibling : group.messagesElement.firstChild);
+newVisibleMessages.push(sourceMessage);
+anchor = sourceMessage.toMessageElement();
+}
+}
+}
+
+this._visibleMessages = newVisibleMessages;
+},
+
 _monitoringXHREnabledSettingChanged: function(event)
 {
 ConsoleAgent.setMonitoringXHREnabled(event.data);
@@ -11374,8 +12225,9 @@
 {
 if (!result)
 return;
-
-this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, originatingCommand, this._linkifier));
+var message = new WebInspector.ConsoleCommandResult(result, wasThrown, originatingCommand, this._linkifier);
+this._messages.push(message);
+this._appendConsoleMessage(message);
 },
 
 _appendCommand: function(text, newPromptText, useCommandLineAPI, showResultOnly)
@@ -11383,6 +12235,7 @@
 if (!showResultOnly) {
 var commandMessage = new WebInspector.ConsoleCommand(text);
 WebInspector.console.interruptRepeatCount();
+this._messages.push(commandMessage);
 this._appendConsoleMessage(commandMessage);
 }
 this.prompt.text = newPromptText;
@@ -11419,6 +12272,14 @@
 }
 
 WebInspector.ConsoleCommand.prototype = {
+wasShown: function()
+{
+},
+
+willHide: function()
+{
+},
+
 clearHighlight: function()
 {
 var highlightedMessage = this._formattedCommand;
@@ -11516,20 +12377,23 @@
 }
 
 WebInspector.ConsoleGroup.prototype = {
-addMessage: function(msg)
-{
-var element = msg.toMessageElement();
 
-if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
+addMessage: function(message, node)
+{
+var element = message.toMessageElement();
+
+if (message.type === WebInspector.ConsoleMessage.MessageType.StartGroup || message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
 this.messagesElement.parentNode.insertBefore(element, this.messagesElement);
 element.addEventListener("click", this._titleClicked.bind(this), false);
 var groupElement = element.enclosingNodeOrSelfWithClass("console-group");
-if (groupElement && msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+if (groupElement && message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
 groupElement.addStyleClass("collapsed");
-} else
-this.messagesElement.appendChild(element);
+} else {
+this.messagesElement.insertBefore(element, node || null);
+message.wasShown();
+}
 
-if (element.previousSibling && msg.originatingCommand && element.previousSibling.command === msg.originatingCommand)
+if (element.previousSibling && message.originatingCommand && element.previousSibling.command === message.originatingCommand)
 element.previousSibling.addStyleClass("console-adjacent-user-command-result");
 },
 
@@ -11572,7 +12436,7 @@
 this.element.addStyleClass(name);
 this._panelName = name;
 
-this._shortcuts = {};
+this._shortcuts =   ({});
 
 WebInspector.settings[this._sidebarWidthSettingName()] = WebInspector.settings.createSetting(this._sidebarWidthSettingName(), undefined);
 }
@@ -11593,12 +12457,19 @@
 
 wasShown: function()
 {
+var panelStatusBar = document.getElementById("panel-status-bar")
+var drawerViewAnchor = document.getElementById("drawer-view-anchor");
 var statusBarItems = this.statusBarItems;
 if (statusBarItems) {
 this._statusBarItemContainer = document.createElement("div");
 for (var i = 0; i < statusBarItems.length; ++i)
 this._statusBarItemContainer.appendChild(statusBarItems[i]);
-document.getElementById("panel-status-bar").appendChild(this._statusBarItemContainer);
+panelStatusBar.insertBefore(this._statusBarItemContainer, drawerViewAnchor);
+}
+var statusBarText = this.statusBarText();
+if (statusBarText) {
+this._statusBarTextElement = statusBarText;
+panelStatusBar.appendChild(statusBarText);
 }
 
 this.focus();
@@ -11609,6 +12480,10 @@
 if (this._statusBarItemContainer && this._statusBarItemContainer.parentNode)
 this._statusBarItemContainer.parentNode.removeChild(this._statusBarItemContainer);
 delete this._statusBarItemContainer;
+
+if (this._statusBarTextElement && this._statusBarTextElement.parentNode)
+this._statusBarTextElement.parentNode.removeChild(this._statusBarTextElement);
+delete this._statusBarTextElement;
 },
 
 reset: function()
@@ -11669,7 +12544,7 @@
 },
 
 
-createSidebarView: function(parentElement, position, defaultWidth)
+createSidebarView: function(parentElement, position, defaultWidth, defaultHeight)
 {
 if (this.splitView)
 return;
@@ -11677,7 +12552,7 @@
 if (!parentElement)
 parentElement = this.element;
 
-this.splitView = new WebInspector.SidebarView(position || WebInspector.SidebarView.SidebarPosition.Left, this._sidebarWidthSettingName(), defaultWidth);
+this.splitView = new WebInspector.SidebarView(position, this._sidebarWidthSettingName(), defaultWidth, defaultHeight);
 this.splitView.show(parentElement);
 this.splitView.addEventListener(WebInspector.SidebarView.EventTypes.Resized, this.sidebarResized.bind(this));
 
@@ -11742,10 +12617,8 @@
 {
 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
 var handler = this._shortcuts[shortcutKey];
-if (handler) {
-handler(event);
+if (handler && handler(event))
 event.handled = true;
-}
 },
 
 
@@ -11799,7 +12672,7 @@
 if (this._panel)
 return this._panel;
 if (this._scriptName)
-importScript(this._scriptName);
+loadScript(this._scriptName);
 this._panel = new WebInspector[this._className];
 return this._panel;
 },
@@ -11863,6 +12736,7 @@
 return panel;
 },
 
+
 currentPanel: function()
 {
 return this._currentPanel;
@@ -11874,6 +12748,9 @@
 if (this._currentPanel === x)
 return;
 
+
+WebInspector.searchController.cancelSearch();
+
 if (this._currentPanel)
 this._currentPanel.detach();
 
@@ -11882,8 +12759,6 @@
 if (x) {
 x.show();
 this.dispatchEventToListeners(WebInspector.InspectorView.Events.PanelSelected);
-
-WebInspector.searchController.cancelSearch();
 }
 for (var panelName in WebInspector.panels) {
 if (WebInspector.panels[panelName] === x) {
@@ -11894,6 +12769,12 @@
 }
 },
 
+
+defaultFocusedElement: function()
+{
+return this._currentPanel ? this._currentPanel.defaultFocusedElement() : null;
+},
+
 _keyPress: function(event)
 {
 
@@ -11910,7 +12791,8 @@
 return;
 
 
-if (!event.shiftKey && !event.altKey && event.keyCode > 0x30 && event.keyCode < 0x3A) {
+var panelShortcutEnabled = WebInspector.experimentsSettings.shortcutPanelSwitch.isEnabled();
+if (panelShortcutEnabled && !event.shiftKey && !event.altKey && event.keyCode > 0x30 && event.keyCode < 0x3A) {
 var panelName = this._panelOrder[event.keyCode - 0x31];
 if (panelName) {
 this.showPanel(panelName);
@@ -12457,7 +13339,7 @@
 {
 var anchor = document.createElement("a");
 anchor.preferredPanel = "scripts";
-anchor.href = sanitizeHref(uiSourceCode.url);
+anchor.href = sanitizeHref(uiSourceCode.originURL());
 anchor.uiSourceCode = uiSourceCode;
 anchor.lineNumber = lineNumber;
 return anchor;
@@ -12470,7 +13352,7 @@
 var uiSourceCode = searchResult.uiSourceCode;
 var searchMatches = searchResult.searchMatches;
 
-var fileTreeElement = this._addFileTreeElement(uiSourceCode.url, searchMatches.length, this._searchResults.length - 1);
+var fileTreeElement = this._addFileTreeElement(uiSourceCode.originURL(), searchMatches.length, this._searchResults.length - 1);
 },
 
 
@@ -12622,21 +13504,15 @@
 this._itemsGraphsElement.id = "resources-graphs";
 this.element.appendChild(this._itemsGraphsElement);
 
-this._dividersElement = document.createElement("div");
-this._dividersElement.className = "resources-dividers";
-this.element.appendChild(this._dividersElement);
+this._dividersElement = this.element.createChild("div", "resources-dividers");
 
 this._gridHeaderElement = document.createElement("div"); 
-
-this._eventDividersElement = document.createElement("div");
-this._eventDividersElement.className = "resources-event-dividers";
-this._gridHeaderElement.appendChild(this._eventDividersElement);
-
-this._dividersLabelBarElement = document.createElement("div");
-this._dividersLabelBarElement.className = "resources-dividers-label-bar";
-this._gridHeaderElement.appendChild(this._dividersLabelBarElement);
-
+this._eventDividersElement = this._gridHeaderElement.createChild("div", "resources-event-dividers");
+this._dividersLabelBarElement = this._gridHeaderElement.createChild("div", "resources-dividers-label-bar");
 this.element.appendChild(this._gridHeaderElement);
+
+this._leftCurtainElement = this.element.createChild("div", "timeline-cpu-curtain-left");
+this._rightCurtainElement = this.element.createChild("div", "timeline-cpu-curtain-right");
 }
 
 WebInspector.TimelineGrid.prototype = {
@@ -12678,8 +13554,9 @@
 var divider = this._dividersElement.firstChild;
 var dividerLabelBar = this._dividersLabelBarElement.firstChild;
 
-var paddingLeft = calculator.paddingLeft;
-for (var i = paddingLeft ? 0 : 1; i <= dividerCount; ++i) {
+var firstDivider = calculator.paddingLeft > 0 ? 0 : 1;
+var sliceRemainder = (calculator.minimumBoundary() - calculator.zeroTime()) % slice;
+for (var i = firstDivider; i <= dividerCount; ++i) {
 if (!divider) {
 divider = document.createElement("div");
 divider.className = "resources-divider";
@@ -12694,29 +13571,13 @@
 this._dividersLabelBarElement.appendChild(dividerLabelBar);
 }
 
-if (i === (paddingLeft ? 0 : 1)) {
-divider.addStyleClass("first");
-dividerLabelBar.addStyleClass("first");
-} else {
-divider.removeStyleClass("first");
-dividerLabelBar.removeStyleClass("first");
-}
-
-if (i === dividerCount) {
-divider.addStyleClass("last");
-dividerLabelBar.addStyleClass("last");
-} else {
-divider.removeStyleClass("last");
-dividerLabelBar.removeStyleClass("last");
-}
-
 var left;
 if (!slice) {
-left = dividersElementClientWidth / dividerCount * i + paddingLeft;
+left = dividersElementClientWidth / dividerCount * i;
 dividerLabelBar._labelElement.textContent = "";
 } else {
-left = calculator.computePosition(calculator.minimumBoundary() + slice * i);
-dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i);
+left = calculator.computePosition(calculator.minimumBoundary() + slice * i - sliceRemainder);
+dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i - sliceRemainder);
 }
 var percentLeft = 100 * left / dividersElementClientWidth;
 this._setDividerAndBarLeft(divider, dividerLabelBar, percentLeft);
@@ -12778,9 +13639,26 @@
 this._eventDividersElement.removeStyleClass("hidden");
 },
 
+hideCurtains: function()
+{
+this._leftCurtainElement.addStyleClass("hidden");
+this._rightCurtainElement.addStyleClass("hidden");
+},
+
+
+showCurtains: function(gapOffset, gapWidth)
+{
+this._leftCurtainElement.style.width = gapOffset + "px";
+this._leftCurtainElement.removeStyleClass("hidden");
+this._rightCurtainElement.style.left = (gapOffset + gapWidth) + "px";
+this._rightCurtainElement.removeStyleClass("hidden");
+},
+
 setScrollAndDividerTop: function(scrollTop, dividersTop)
 {
 this._dividersElement.style.top = scrollTop + "px";
+this._leftCurtainElement.style.top = scrollTop + "px";
+this._rightCurtainElement.style.top = scrollTop + "px";
 }
 }
 
@@ -12798,6 +13676,9 @@
 minimumBoundary: function() { },
 
 
+zeroTime: function() { },
+
+
 maximumBoundary: function() { },
 
 
@@ -12809,6 +13690,382 @@
 
 
 
+WebInspector.OverviewGrid = function(prefix)
+{
+this.element = document.createElement("div");
+this.element.className = "fill";
+this.element.id = prefix + "-overview-container";
+
+this._grid = new WebInspector.TimelineGrid();
+this._grid.element.id = prefix + "-overview-grid";
+this._grid.setScrollAndDividerTop(0, 0);
+
+this.element.appendChild(this._grid.element);
+
+this._window = new WebInspector.OverviewGrid.Window(this.element, this._grid.dividersLabelBarElement);
+}
+
+WebInspector.OverviewGrid.prototype = {
+
+clientWidth: function()
+{
+return this.element.clientWidth;
+},
+
+
+updateDividers: function(calculator)
+{
+this._grid.updateDividers(calculator);
+},
+
+
+addEventDividers: function(dividers)
+{
+this._grid.addEventDividers(dividers);
+},
+
+removeEventDividers: function()
+{
+this._grid.removeEventDividers();
+},
+
+
+setWindowPosition: function(start, end)
+{
+this._window._setWindowPosition(start, end);
+},
+
+reset: function()
+{
+this._window.reset();
+},
+
+
+windowLeft: function()
+{
+return this._window.windowLeft;
+},
+
+
+windowRight: function()
+{
+return this._window.windowRight;
+},
+
+
+setWindow: function(left, right)
+{
+this._window._setWindow(left, right);
+},
+
+
+addEventListener: function(eventType, listener, thisObject)
+{
+this._window.addEventListener(eventType, listener, thisObject);
+},
+
+
+zoom: function(zoomFactor, referencePoint)
+{
+this._window._zoom(zoomFactor, referencePoint);
+}
+}
+
+
+WebInspector.OverviewGrid.MinSelectableSize = 12;
+
+WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3;
+
+WebInspector.OverviewGrid.ResizerOffset = 3.5; 
+
+
+WebInspector.OverviewGrid.Window = function(parentElement, dividersLabelBarElement)
+{
+this._parentElement = parentElement;
+this._dividersLabelBarElement = dividersLabelBarElement;
+
+WebInspector.installDragHandle(this._parentElement, this._startWindowSelectorDragging.bind(this), this._windowSelectorDragging.bind(this), this._endWindowSelectorDragging.bind(this), "ew-resize");
+WebInspector.installDragHandle(this._dividersLabelBarElement, this._startWindowDragging.bind(this), this._windowDragging.bind(this), null, "move");
+
+this.windowLeft = 0.0;
+this.windowRight = 1.0;
+
+this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(this), true);
+this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.bind(this), true);
+
+this._overviewWindowElement = document.createElement("div");
+this._overviewWindowElement.className = "overview-grid-window";
+parentElement.appendChild(this._overviewWindowElement);
+
+this._overviewWindowBordersElement = document.createElement("div");
+this._overviewWindowBordersElement.className = "overview-grid-window-rulers";
+parentElement.appendChild(this._overviewWindowBordersElement);
+
+var overviewDividersBackground = document.createElement("div");
+overviewDividersBackground.className = "overview-grid-dividers-background";
+parentElement.appendChild(overviewDividersBackground);
+
+this._leftResizeElement = document.createElement("div");
+this._leftResizeElement.className = "overview-grid-window-resizer";
+this._leftResizeElement.style.left = 0;
+parentElement.appendChild(this._leftResizeElement);
+WebInspector.installDragHandle(this._leftResizeElement, this._resizerElementStartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew-resize");
+
+this._rightResizeElement = document.createElement("div");
+this._rightResizeElement.className = "overview-grid-window-resizer overview-grid-window-resizer-right";
+this._rightResizeElement.style.right = 0;
+parentElement.appendChild(this._rightResizeElement);
+WebInspector.installDragHandle(this._rightResizeElement, this._resizerElementStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "ew-resize");
+}
+
+WebInspector.OverviewGrid.Events = {
+WindowChanged: "WindowChanged"
+}
+
+WebInspector.OverviewGrid.Window.prototype = {
+reset: function()
+{
+this.windowLeft = 0.0;
+this.windowRight = 1.0;
+
+this._overviewWindowElement.style.left = "0%";
+this._overviewWindowElement.style.width = "100%";
+this._overviewWindowBordersElement.style.left = "0%";
+this._overviewWindowBordersElement.style.right = "0%";
+this._leftResizeElement.style.left = "0%";
+this._rightResizeElement.style.left = "100%";
+},
+
+
+_resizerElementStartDragging: function(event)
+{
+this._resizerParentOffsetLeft = event.pageX - event.offsetX - event.target.offsetLeft;
+event.preventDefault();
+return true;
+},
+
+
+_leftResizeElementDragging: function(event)
+{
+this._resizeWindowLeft(event.pageX - this._resizerParentOffsetLeft);
+event.preventDefault();
+},
+
+
+_rightResizeElementDragging: function(event)
+{
+this._resizeWindowRight(event.pageX - this._resizerParentOffsetLeft);
+event.preventDefault();
+},
+
+
+_startWindowSelectorDragging: function(event)
+{
+this._offsetLeft = event.pageX - event.offsetX;
+var position = event.pageX - this._offsetLeft;
+this._overviewWindowSelector = new WebInspector.OverviewGrid.WindowSelector(this._parentElement, position);
+return true;
+},
+
+
+_windowSelectorDragging: function(event)
+{
+this._overviewWindowSelector._updatePosition(event.pageX - this._offsetLeft);
+event.preventDefault();
+},
+
+
+_endWindowSelectorDragging: function(event)
+{
+var window = this._overviewWindowSelector._close(event.pageX - this._offsetLeft);
+delete this._overviewWindowSelector;
+if (window.end === window.start) { 
+var middle = window.end;
+window.start = Math.max(0, middle - WebInspector.OverviewGrid.MinSelectableSize / 2);
+window.end = Math.min(this._parentElement.clientWidth, middle + WebInspector.OverviewGrid.MinSelectableSize / 2);
+} else if (window.end - window.start < WebInspector.OverviewGrid.MinSelectableSize) {
+if (this._parentElement.clientWidth - window.end > WebInspector.OverviewGrid.MinSelectableSize)
+window.end = window.start + WebInspector.OverviewGrid.MinSelectableSize;
+else
+window.start = window.end - WebInspector.OverviewGrid.MinSelectableSize;
+}
+this._setWindowPosition(window.start, window.end);
+},
+
+
+_startWindowDragging: function(event)
+{
+this._dragStartPoint = event.pageX;
+this._dragStartLeft = this.windowLeft;
+this._dragStartRight = this.windowRight;
+return true;
+},
+
+
+_windowDragging: function(event)
+{
+event.preventDefault();
+var delta = (event.pageX - this._dragStartPoint) / this._parentElement.clientWidth;
+if (this._dragStartLeft + delta < 0)
+delta = -this._dragStartLeft;
+
+if (this._dragStartRight + delta > 1)
+delta = 1 - this._dragStartRight;
+
+this._setWindow(this._dragStartLeft + delta, this._dragStartRight + delta);
+},
+
+
+_resizeWindowLeft: function(start)
+{
+
+if (start < 10)
+start = 0;
+else if (start > this._rightResizeElement.offsetLeft -  4)
+start = this._rightResizeElement.offsetLeft - 4;
+this._setWindowPosition(start, null);
+},
+
+
+_resizeWindowRight: function(end)
+{
+
+if (end > this._parentElement.clientWidth - 10)
+end = this._parentElement.clientWidth;
+else if (end < this._leftResizeElement.offsetLeft + WebInspector.OverviewGrid.MinSelectableSize)
+end = this._leftResizeElement.offsetLeft + WebInspector.OverviewGrid.MinSelectableSize;
+this._setWindowPosition(null, end);
+},
+
+_resizeWindowMaximum: function()
+{
+this._setWindowPosition(0, this._parentElement.clientWidth);
+},
+
+
+_setWindow: function(left, right)
+{
+var clientWidth = this._parentElement.clientWidth;
+this._setWindowPosition(left * clientWidth, right * clientWidth);
+},
+
+
+_setWindowPosition: function(start, end)
+{
+var clientWidth = this._parentElement.clientWidth;
+const rulerAdjustment = 1 / clientWidth;
+if (typeof start === "number") {
+this.windowLeft = start / clientWidth;
+this._leftResizeElement.style.left = this.windowLeft * 100 + "%";
+this._overviewWindowElement.style.left = this.windowLeft * 100 + "%";
+this._overviewWindowBordersElement.style.left = (this.windowLeft - rulerAdjustment) * 100 + "%";
+}
+if (typeof end === "number") {
+this.windowRight = end / clientWidth;
+this._rightResizeElement.style.left = this.windowRight * 100 + "%";
+}
+this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%";
+this._overviewWindowBordersElement.style.right = (1 - this.windowRight + 2 * rulerAdjustment) * 100 + "%";
+this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged);
+},
+
+
+_onMouseWheel: function(event)
+{
+const zoomFactor = 1.1;
+const mouseWheelZoomSpeed = 1 / 120;
+
+if (typeof event.wheelDeltaY === "number" && event.wheelDeltaY) {
+var referencePoint = event.offsetX;
+this._zoom(Math.pow(zoomFactor, -event.wheelDeltaY * mouseWheelZoomSpeed), referencePoint);
+}
+if (typeof event.wheelDeltaX === "number" && event.wheelDeltaX) {
+var offset = Math.round(event.wheelDeltaX * WebInspector.OverviewGrid.WindowScrollSpeedFactor);
+var windowLeft = this._leftResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset;
+var windowRight = this._rightResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset;
+
+if (windowLeft - offset < 0)
+offset = windowLeft;
+
+if (windowRight - offset > this._parentElement.clientWidth)
+offset = windowRight - this._parentElement.clientWidth;
+
+this._setWindowPosition(windowLeft - offset, windowRight - offset);
+
+event.preventDefault();
+}
+},
+
+
+_zoom: function(factor, referencePoint)
+{
+var left = this._leftResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset;
+var right = this._rightResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset;
+
+var delta = factor * (right - left);
+if (factor < 1 && delta < WebInspector.OverviewGrid.MinSelectableSize)
+return;
+var max = this._parentElement.clientWidth;
+if (typeof referencePoint !== "number")
+referencePoint = (right + left) / 2;
+left = Math.max(0, Math.min(max - delta, referencePoint + (left - referencePoint) * factor));
+right = Math.min(max, left + delta);
+this._setWindowPosition(left, right);
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+WebInspector.OverviewGrid.WindowSelector = function(parent, position)
+{
+this._startPosition = position;
+this._width = parent.offsetWidth;
+this._windowSelector = document.createElement("div");
+this._windowSelector.className = "overview-grid-window-selector";
+this._windowSelector.style.left = this._startPosition + "px";
+this._windowSelector.style.right = this._width - this._startPosition + "px";
+parent.appendChild(this._windowSelector);
+}
+
+WebInspector.OverviewGrid.WindowSelector.prototype = {
+_createSelectorElement: function(parent, left, width, height)
+{
+var selectorElement = document.createElement("div");
+selectorElement.className = "overview-grid-window-selector";
+selectorElement.style.left = left + "px";
+selectorElement.style.width = width + "px";
+selectorElement.style.top = "0px";
+selectorElement.style.height = height + "px";
+parent.appendChild(selectorElement);
+return selectorElement;
+},
+
+_close: function(position)
+{
+position = Math.max(0, Math.min(position, this._width));
+this._windowSelector.parentNode.removeChild(this._windowSelector);
+return this._startPosition < position ? {start: this._startPosition, end: position} : {start: position, end: this._startPosition};
+},
+
+_updatePosition: function(position)
+{
+position = Math.max(0, Math.min(position, this._width));
+if (position < this._startPosition) {
+this._windowSelector.style.left = position + "px";
+this._windowSelector.style.right = this._width - this._startPosition + "px";
+} else {
+this._windowSelector.style.left = this._startPosition + "px";
+this._windowSelector.style.right = this._width - position + "px";
+}
+}
+}
+
+
+
+
+
+
 WebInspector.ContentProvider = function() { }
 
 WebInspector.ContentProvider.prototype = {
@@ -12832,6 +14089,26 @@
 }
 
 
+WebInspector.ContentProvider.performSearchInContent = function(content, query, caseSensitive, isRegex)
+{
+var regex = createSearchRegex(query, caseSensitive, isRegex);
+
+var result = [];
+var lineEndings = content.lineEndings();
+for (var i = 0; i < lineEndings.length; ++i) {
+var lineStart = i > 0 ? lineEndings[i - 1] + 1 : 0;
+var lineEnd = lineEndings[i];
+var lineContent = content.substring(lineStart, lineEnd);
+if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r")
+lineContent = lineContent.substring(0, lineContent.length - 1)
+
+if (regex.exec(lineContent))
+result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent));
+}
+return result;
+}
+
+
 
 
 
@@ -13129,6 +14406,17 @@
 ResponseHeadersChanged: "ResponseHeadersChanged",
 }
 
+
+WebInspector.NetworkRequest.InitiatorType = {
+Other: "other",
+Parser: "parser",
+Redirect: "redirect",
+Script: "script"
+}
+
+
+WebInspector.NetworkRequest.NameValue;
+
 WebInspector.NetworkRequest.prototype = {
 
 get requestId()
@@ -13440,6 +14728,12 @@
 },
 
 
+get domain()
+{
+return this._parsedURL.host;
+},
+
+
 get redirectSource()
 {
 if (this.redirects && this.redirects.length > 0)
@@ -13450,6 +14744,7 @@
 set redirectSource(x)
 {
 this._redirectSource = x;
+delete this._initiatorInfo;
 },
 
 
@@ -13499,7 +14794,7 @@
 
 this._sortedRequestHeaders = [];
 this._sortedRequestHeaders = this.requestHeaders.slice();
-this._sortedRequestHeaders.sort(function(a,b) { return a.name.toLowerCase().localeCompare(b.name.toLowerCase()) });
+this._sortedRequestHeaders.sort(function(a,b) { return a.name.toLowerCase().compareTo(b.name.toLowerCase()) });
 return this._sortedRequestHeaders;
 },
 
@@ -13584,7 +14879,7 @@
 
 this._sortedResponseHeaders = [];
 this._sortedResponseHeaders = this.responseHeaders.slice();
-this._sortedResponseHeaders.sort(function(a,b) { return a.name.toLowerCase().localeCompare(b.name.toLowerCase()) });
+this._sortedResponseHeaders.sort(function(a, b) { return a.name.toLowerCase().compareTo(b.name.toLowerCase()); });
 return this._sortedResponseHeaders;
 },
 
@@ -13652,15 +14947,8 @@
 {
 function parseNameValue(pair)
 {
-var parameter = {};
 var splitPair = pair.split("=", 2);
-
-parameter.name = splitPair[0];
-if (splitPair.length === 1)
-parameter.value = "";
-else
-parameter.value = splitPair[1];
-return parameter;
+return {name: splitPair[0], value: splitPair[1] || ""};
 }
 return queryString.split("&").map(parseNameValue);
 },
@@ -13675,6 +14963,8 @@
 if (headers[i].name.toLowerCase() === headerName)
 values.push(headers[i].value);
 }
+if (!values.length)
+return undefined;
 
 if (headerName === "set-cookie")
 return values.join("\n");
@@ -13716,7 +15006,7 @@
 return;
 }
 if (typeof this._content !== "undefined") {
-callback(this.content || null, this._contentEncoded, this._mimeType);
+callback(this.content || null, this._contentEncoded, this.type.canonicalMimeType());
 return;
 }
 this._pendingContentCallbacks.push(callback);
@@ -13796,6 +15086,40 @@
 },
 
 
+initiatorInfo: function()
+{
+if (this._initiatorInfo)
+return this._initiatorInfo;
+
+var type = WebInspector.NetworkRequest.InitiatorType.Other;
+var url = "";
+var lineNumber = -Infinity;
+var columnNumber = -Infinity;
+
+if (this.redirectSource) {
+type = WebInspector.NetworkRequest.InitiatorType.Redirect;
+url = this.redirectSource.url;
+} else if (this.initiator) {
+if (this.initiator.type === NetworkAgent.InitiatorType.Parser) {
+type = WebInspector.NetworkRequest.InitiatorType.Parser;
+url = this.initiator.url;
+lineNumber = this.initiator.lineNumber;
+} else if (this.initiator.type === NetworkAgent.InitiatorType.Script) {
+var topFrame = this.initiator.stackTrace[0];
+if (topFrame.url) {
+type = WebInspector.NetworkRequest.InitiatorType.Script;
+url = topFrame.url;
+lineNumber = topFrame.lineNumber;
+columnNumber = topFrame.columnNumber;
+}
+}
+}
+
+this._initiatorInfo = {type: type, url: url, source: WebInspector.displayNameForURL(url), lineNumber: lineNumber, columnNumber: columnNumber};
+return this._initiatorInfo;
+},
+
+
 frames: function()
 {
 return this._frames;
@@ -13810,10 +15134,7 @@
 
 addFrameError: function(errorMessage, time)
 {
-var errorObject = {};
-errorObject.errorMessage = errorMessage;
-errorObject.time = time;
-this._pushFrame(errorObject);
+this._pushFrame({errorMessage: errorMessage, time: time});
 },
 
 
@@ -13821,16 +15142,16 @@
 {
 response.time = time;
 if (sent)
-response.sent = true;
+response.sent = sent;
 this._pushFrame(response);
 },
 
-_pushFrame: function(object)
+
+_pushFrame: function(frameOrError)
 {
-if (this._frames.length >= 100) {
+if (this._frames.length >= 100)
 this._frames.splice(0, 10);
-}
-this._frames.push(object);
+this._frames.push(frameOrError);
 },
 
 __proto__: WebInspector.Object.prototype
@@ -13842,18 +15163,17 @@
 
 
 
-WebInspector.UISourceCode = function(workspace, uri, url, contentType, isEditable)
+WebInspector.UISourceCode = function(project, path, originURL, url, contentType, isEditable)
 {
-this._workspace = workspace;
-this._uri = uri;
+this._project = project;
+this._path = path;
+this._originURL = originURL;
 this._url = url;
-this._parsedURL = new WebInspector.ParsedURL(url);
 this._contentType = contentType;
 this._isEditable = isEditable;
 
 this._requestContentCallbacks = [];
-
-this._liveLocations = [];
+this._liveLocations = new Set();
 
 this._consoleMessages = [];
 
@@ -13883,29 +15203,55 @@
 },
 
 
+path: function()
+{
+return this._path;
+},
+
+
+name: function()
+{
+return this._path[this._path.length - 1];
+},
+
+
+displayName: function()
+{
+var displayName = this.name() || (this._project.displayName() + "/" + this._path.join("/"));
+return displayName.trimEnd(100);
+},
+
+
 uri: function()
 {
-return this._uri;
+if (!this._project.id())
+return this._path.join("/");
+if (!this._path.length)
+return this._project.id();
+return this._project.id() + "/" + this._path.join("/");
 },
 
 
-urlChanged: function(url)
+originURL: function()
 {
-this._url = url;
-this._parsedURL = new WebInspector.ParsedURL(this._url);
+return this._originURL;
+},
+
+
+rename: function(newName)
+{
+if (!this._path.length)
+return;
+this._path[this._path.length - 1] = newName;
+this._url = newName;
+this._originURL = newName;
 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, null);
 },
 
 
-get parsedURL()
-{
-return this._parsedURL;
-},
-
-
 contentURL: function()
 {
-return this._url;
+return this.originURL();
 },
 
 
@@ -13939,6 +15285,12 @@
 },
 
 
+project: function()
+{
+return this._project;
+},
+
+
 requestContent: function(callback)
 {
 if (this._content || this._contentLoaded) {
@@ -13947,18 +15299,62 @@
 }
 this._requestContentCallbacks.push(callback);
 if (this._requestContentCallbacks.length === 1)
-this._workspace.requestFileContent(this, this._fireContentAvailable.bind(this));
+this._project.requestFileContent(this, this._fireContentAvailable.bind(this));
+},
+
+checkContentUpdated: function()
+{
+if (!this._project.canSetFileContent())
+return;
+if (this._checkingContent)
+return;
+this._checkingContent = true;
+this._project.requestFileContent(this, contentLoaded.bind(this));
+
+function contentLoaded(updatedContent)
+{
+if (updatedContent === null) {
+var workingCopy = this.workingCopy();
+this._commitContent("", false);
+this.setWorkingCopy(workingCopy);
+delete this._checkingContent;
+return;
+}
+if (typeof this._lastAcceptedContent === "string" && this._lastAcceptedContent === updatedContent) {
+delete this._checkingContent;
+return;
+}
+if (this._content === updatedContent) {
+delete this._lastAcceptedContent;
+delete this._checkingContent;
+return;
+}
+
+if (!this.isDirty()) {
+this._commitContent(updatedContent, false);
+delete this._checkingContent;
+return;
+}
+
+var shouldUpdate = window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));
+if (shouldUpdate)
+this._commitContent(updatedContent, false);
+else
+this._lastAcceptedContent = updatedContent;
+delete this._checkingContent;
+}
 },
 
 
 requestOriginalContent: function(callback)
 {
-this._workspace.requestFileContent(this, callback);
+this._project.requestFileContent(this, callback);
 },
 
 
-_commitContent: function(content)
+_commitContent: function(content, shouldSetContentInProject)
 {
+delete this._lastAcceptedContent;
 this._content = content;
 this._contentLoaded = true;
 
@@ -13972,18 +15368,18 @@
 var oldWorkingCopy = this._workingCopy;
 delete this._workingCopy;
 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()});
-this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: this._content });
 if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
 WebInspector.fileManager.save(this._url, this._content, false);
 WebInspector.fileManager.close(this._url);
 }
-this._workspace.setFileContent(this, this._content, function() { });
+if (shouldSetContentInProject)
+this._project.setFileContent(this, this._content, function() { });
 },
 
 
 addRevision: function(content)
 {
-this._commitContent(content);
+this._commitContent(content, true);
 },
 
 _restoreRevisionHistory: function()
@@ -13993,8 +15389,18 @@
 
 var registry = WebInspector.Revision._revisionHistoryRegistry();
 var historyItems = registry[this.url];
-if (!historyItems || !historyItems.length)
+if (!historyItems)
 return;
+
+function filterOutStale(historyItem)
+{
+return historyItem.loaderId === WebInspector.resourceTreeModel.mainFrame.loaderId;
+}
+
+historyItems = historyItems.filter(filterOutStale);
+if (!historyItems.length)
+return;
+
 for (var i = 0; i < historyItems.length; ++i) {
 var content = window.localStorage[historyItems[i].key];
 var timestamp = new Date(historyItems[i].timestamp);
@@ -14075,6 +15481,11 @@
 return this._content;
 },
 
+resetWorkingCopy: function()
+{
+this.setWorkingCopy(this._content);
+},
+
 
 setWorkingCopy: function(newWorkingCopy)
 {
@@ -14096,7 +15507,7 @@
 return;
 }
 
-this._commitContent(this._workingCopy);
+this._commitContent(this._workingCopy, true);
 callback(null);
 
 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
@@ -14139,7 +15550,7 @@
 return;
 }
 
-this._workspace.searchInFileContent(this, query, caseSensitive, isRegex, callback);
+this._project.searchInFileContent(this, query, caseSensitive, isRegex, callback);
 },
 
 
@@ -14178,7 +15589,7 @@
 
 addLiveLocation: function(liveLocation)
 {
-this._liveLocations.push(liveLocation);
+this._liveLocations.add(liveLocation);
 },
 
 
@@ -14189,9 +15600,9 @@
 
 updateLiveLocations: function()
 {
-var locationsCopy = this._liveLocations.slice();
-for (var i = 0; i < locationsCopy.length; ++i)
-locationsCopy[i].update();
+var items = this._liveLocations.items();
+for (var i = 0; i < items.length; ++i)
+items[i].update();
 },
 
 
@@ -14285,8 +15696,12 @@
 
 setSourceMapping: function(sourceMapping)
 {
+var wasIdentity = this._sourceMapping ? this._sourceMapping.isIdentity() : true;
 this._sourceMapping = sourceMapping;
-this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMappingChanged, null);
+var data = {}
+data.isIdentity = sourceMapping ? sourceMapping.isIdentity() : true;
+data.identityHasChanged = data.isIdentity !== wasIdentity;
+this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMappingChanged, data);
 },
 
 __proto__: WebInspector.Object.prototype
@@ -14299,20 +15714,12 @@
 
 WebInspector.UISourceCodeProvider.Events = {
 UISourceCodeAdded: "UISourceCodeAdded",
-TemporaryUISourceCodeAdded: "TemporaryUISourceCodeAdded",
-TemporaryUISourceCodeRemoved: "TemporaryUISourceCodeRemoved",
 UISourceCodeRemoved: "UISourceCodeRemoved"
 }
 
 WebInspector.UISourceCodeProvider.prototype = {
 
 uiSourceCodes: function() {},
-
-
-addEventListener: function(eventType, listener, thisObject) { },
-
-
-removeEventListener: function(eventType, listener, thisObject) { }
 }
 
 
@@ -14334,6 +15741,15 @@
 url: function()
 {
 return this.uiSourceCode.contentURL();
+},
+
+
+linkText: function()
+{
+var linkText = this.uiSourceCode.name() || (this.uiSourceCode.project().displayName() + "/" + this.uiSourceCode.path().join("/"));
+if (typeof this.lineNumber === "number")
+linkText += ":" + (this.lineNumber + 1);
+return linkText;
 }
 }
 
@@ -14472,7 +15888,7 @@
 
 contentURL: function()
 {
-return this._uiSourceCode.url;
+return this._uiSourceCode.originURL();
 },
 
 
@@ -14531,8 +15947,9 @@
 
 
 
-WebInspector.CSSStyleModel = function()
+WebInspector.CSSStyleModel = function(workspace)
 {
+this._workspace = workspace;
 this._pendingCommandsMajorState = [];
 
 this._locations = [];
@@ -14540,6 +15957,7 @@
 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this);
 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
 this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding();
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this);
 this._namedFlowCollections = {};
 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this);
 InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
@@ -14877,13 +16295,23 @@
 },
 
 
+_mainFrameCreatedOrNavigated: function(event)
+{
+this._resetSourceMappings();
+this._resourceBinding._reset();
+},
+
+
 setSourceMapping: function(url, sourceMapping)
 {
+if (sourceMapping)
 this._sourceMappings[url] = sourceMapping;
+else
+delete this._sourceMappings[url];
 this._updateLocations();
 },
 
-resetSourceMappings: function()
+_resetSourceMappings: function()
 {
 this._sourceMappings = {};
 },
@@ -14913,29 +16341,18 @@
 },
 
 
-_rawLocationToUILocation: function(rawLocation)
+rawLocationToUILocation: function(rawLocation)
 {
 var sourceMapping = this._sourceMappings[rawLocation.url];
-return sourceMapping ? sourceMapping.rawLocationToUILocation(rawLocation) : null;
-},
-
-
-toggleInlineVisibility: function(nodeId)
-{
-
-function callback(inlineStyles)
-{
-var visibility = inlineStyles.getLiveProperty("visibility");
-if (visibility) {
-if (visibility.value === "hidden")
-visibility.setText("", false, true);
-else
-visibility.setValue("hidden", false, true);
-} else
-inlineStyles.appendProperty("visibility", "hidden");
+if (sourceMapping) {
+var uiLocation = sourceMapping.rawLocationToUILocation(rawLocation);
+if (uiLocation)
+return uiLocation;
 }
-
-this.getInlineStylesAsync(nodeId, callback.bind(this));
+var uiSourceCode = this._workspace.uiSourceCodeForURL(rawLocation.url);
+if (!uiSourceCode)
+return null;
+return new WebInspector.UILocation(uiSourceCode, rawLocation.lineNumber, rawLocation.columnNumber);
 },
 
 __proto__: WebInspector.Object.prototype
@@ -14952,7 +16369,7 @@
 uiLocation: function()
 {
 var cssLocation =   (this.rawLocation());
-return WebInspector.cssModel._rawLocationToUILocation(cssLocation);
+return WebInspector.cssModel.rawLocationToUILocation(cssLocation);
 },
 
 dispose: function()
@@ -14967,10 +16384,11 @@
 }
 
 
-WebInspector.CSSLocation = function(url, lineNumber)
+WebInspector.CSSLocation = function(url, lineNumber, columnNumber)
 {
 this.url = url;
 this.lineNumber = lineNumber;
+this.columnNumber = columnNumber || 0;
 }
 
 
@@ -15118,10 +16536,9 @@
 if (error) {
 console.error(error);
 userCallback(null);
-} else {
+} else
 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
 }
-}
 
 if (!this.id)
 throw "No style id";
@@ -15134,6 +16551,35 @@
 appendProperty: function(name, value, userCallback)
 {
 this.insertPropertyAt(this.allProperties.length, name, value, userCallback);
+},
+
+
+setText: function(text, userCallback)
+{
+
+function callback(error, payload)
+{
+WebInspector.cssModel._pendingCommandsMajorState.pop();
+if (!userCallback)
+return;
+
+if (error) {
+console.error(error);
+userCallback(null);
+} else
+userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
+}
+
+if (!this.id)
+throw "No style id";
+
+if (typeof this.cssText === "undefined") {
+userCallback(null);
+return;
+}
+
+WebInspector.cssModel._pendingCommandsMajorState.push(true);
+CSSAgent.setStyleText(this.id, text, callback);
 }
 }
 
@@ -15148,13 +16594,12 @@
 this.selectorRange = payload.selectorList.range;
 this.sourceLine = payload.sourceLine;
 this.sourceURL = payload.sourceURL;
-if (payload.sourceURL)
-this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, payload.sourceLine);
 this.origin = payload.origin;
 this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
 this.style.parentRule = this;
 if (payload.media)
 this.media = WebInspector.CSSMedia.parseMediaArrayPayload(payload.media);
+this._setRawLocation(payload);
 }
 
 
@@ -15164,6 +16609,20 @@
 }
 
 WebInspector.CSSRule.prototype = {
+_setRawLocation: function(payload)
+{
+if (!payload.sourceURL)
+return;
+if (this.selectorRange) {
+var resource = WebInspector.resourceTreeModel.resourceForURL(payload.sourceURL);
+if (resource && resource.type === WebInspector.resourceTypes.Stylesheet) {
+this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, this.selectorRange.startLine, this.selectorRange.startColumn);
+return;
+}
+}
+this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, payload.sourceLine);
+},
+
 get isUserAgent()
 {
 return this.origin === "user-agent";
@@ -15182,11 +16641,20 @@
 get isRegular()
 {
 return this.origin === "regular";
+},
+
+
+isSourceNavigable: function()
+{
+if (!this.sourceURL)
+return false;
+var resource = WebInspector.resourceTreeModel.resourceForURL(this.sourceURL);
+return !!resource && resource.contentType() === WebInspector.resourceTypes.Stylesheet;
 }
 }
 
 
-WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, text)
+WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, text, range)
 {
 this.ownerStyle = ownerStyle;
 this.index = index;
@@ -15197,6 +16665,7 @@
 this.parsedOk = parsedOk;
 this.implicit = implicit;
 this.text = text;
+this.range = range;
 }
 
 
@@ -15208,7 +16677,7 @@
 
 
 var result = new WebInspector.CSSProperty(
-ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.text);
+ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.text, payload.range);
 return result;
 }
 
@@ -15329,6 +16798,20 @@
 
 WebInspector.cssModel._pendingCommandsMajorState.push(false);
 CSSAgent.toggleProperty(this.ownerStyle.id, this.index, disabled, callback.bind(this));
+},
+
+
+uiLocation: function(forName)
+{
+if (!this.range || !this.ownerStyle || !this.ownerStyle.parentRule || !this.ownerStyle.parentRule.sourceURL)
+return null;
+
+var range = this.range;
+var line = forName ? range.startLine : range.endLine;
+
+var column = forName ? range.startColumn : range.endColumn - 1;
+var rawLocation = new WebInspector.CSSLocation(this.ownerStyle.parentRule.sourceURL, line, column);
+return WebInspector.cssModel.rawLocationToUILocation(rawLocation);
 }
 }
 
@@ -15422,9 +16905,7 @@
 
 WebInspector.CSSStyleModelResourceBinding = function()
 {
-this._frameAndURLToStyleSheetId = {};
-this._styleSheetIdToHeader = {};
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
+this._reset();
 }
 
 WebInspector.CSSStyleModelResourceBinding.prototype = {
@@ -15476,14 +16957,6 @@
 },
 
 
-_inspectedURLChanged: function(event)
-{
-
-this._frameAndURLToStyleSheetId = {};
-this._styleSheetIdToHeader = {};
-},
-
-
 _loadStyleSheetHeaders: function(callback)
 {
 
@@ -15570,6 +17043,13 @@
 fakeURL += "/";
 fakeURL += "inspector-stylesheet";
 return fakeURL;
+},
+
+_reset: function()
+{
+
+this._frameAndURLToStyleSheetId = {};
+this._styleSheetIdToHeader = {};
 }
 }
 
@@ -15701,17 +17181,16 @@
 "image/png":                   {"image": true},
 "image/gif":                   {"image": true},
 "image/bmp":                   {"image": true},
-"image/svg+xml":               {"image": true},
+"image/svg+xml":               {"image": true, "font": true},
 "image/vnd.microsoft.icon":    {"image": true},
 "image/webp":                  {"image": true},
 "image/x-icon":                {"image": true},
 "image/x-xbitmap":             {"image": true},
 "font/ttf":                    {"font": true},
 "font/opentype":               {"font": true},
-"font/woff":                   {"font": true},
+"application/font-woff":       {"font": true},
 "application/x-font-type1":    {"font": true},
 "application/x-font-ttf":      {"font": true},
-"application/x-font-woff":     {"font": true},
 "application/x-truetype-font": {"font": true},
 "text/javascript":             {"script": true},
 "text/ecmascript":             {"script": true},
@@ -15760,7 +17239,7 @@
 for (var name in headersMap) {
 var values = headersMap[name].split("\n");
 for (var i = 0; i < values.length; ++i)
-result.push({ name: name, value: values[i] });
+result.push({name: name, value: values[i]});
 }
 return result;
 },
@@ -15802,7 +17281,7 @@
 
 if (!this._mimeTypeIsConsistentWithType(networkRequest)) {
 WebInspector.console.addMessage(WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.Network,
-WebInspector.ConsoleMessage.MessageLevel.Warning,
+WebInspector.ConsoleMessage.MessageLevel.Log,
 WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s: \"%s\".", networkRequest.type.title(), networkRequest.mimeType, networkRequest.url),
 WebInspector.ConsoleMessage.MessageType.Log,
 "",
@@ -15865,7 +17344,7 @@
 
 if (!redirectResponse)
 return;
-this.responseReceived(requestId, frameId, loaderId, time, "Other", redirectResponse);
+this.responseReceived(requestId, frameId, loaderId, time, PageAgent.ResourceType.Other, redirectResponse);
 networkRequest = this._appendRedirect(requestId, time, request.url);
 } else
 networkRequest = this._createNetworkRequest(requestId, frameId, loaderId, request.url, documentURL, initiator);
@@ -15980,7 +17459,6 @@
 
 networkRequest.requestMethod = "GET";
 networkRequest.requestHeaders = this._headersMapToHeadersArray(request.headers);
-networkRequest.webSocketRequestKey3 = request.requestKey3;
 networkRequest.startTime = time;
 
 this._updateNetworkRequest(networkRequest);
@@ -15996,7 +17474,6 @@
 networkRequest.statusCode = response.status;
 networkRequest.statusText = response.statusText;
 networkRequest.responseHeaders = this._headersMapToHeadersArray(response.headers);
-networkRequest.webSocketChallengeResponse = response.challengeResponse;
 networkRequest.responseReceivedTime = time;
 
 this._updateNetworkRequest(networkRequest);
@@ -16229,6 +17706,7 @@
 InspectorBackend.registerPageDispatcher(new WebInspector.PageDispatcher(this));
 
 this._pendingConsoleMessages = {};
+this._securityOriginFrameCount = {};
 }
 
 WebInspector.ResourceTreeModel.EventTypes = {
@@ -16236,12 +17714,15 @@
 FrameNavigated: "FrameNavigated",
 FrameDetached: "FrameDetached",
 MainFrameNavigated: "MainFrameNavigated",
+MainFrameCreatedOrNavigated: "MainFrameCreatedOrNavigated",
 ResourceAdded: "ResourceAdded",
 WillLoadCachedResources: "WillLoadCachedResources",
 CachedResourcesLoaded: "CachedResourcesLoaded",
 DOMContentLoaded: "DOMContentLoaded",
 OnLoad: "OnLoad",
-InspectedURLChanged: "InspectedURLChanged"
+InspectedURLChanged: "InspectedURLChanged",
+SecurityOriginAdded: "SecurityOriginAdded",
+SecurityOriginRemoved: "SecurityOriginRemoved"
 }
 
 WebInspector.ResourceTreeModel.prototype = {
@@ -16279,12 +17760,59 @@
 },
 
 
-_addFrame: function(frame)
+_addFrame: function(frame, aboutToNavigate)
 {
 this._frames[frame.id] = frame;
 if (frame.isMainFrame())
 this.mainFrame = frame;
 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, frame);
+if (!aboutToNavigate)
+this._addSecurityOrigin(frame.securityOrigin);
+if (frame.isMainFrame())
+this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, frame);
+},
+
+
+_addSecurityOrigin: function(securityOrigin)
+{
+if (!this._securityOriginFrameCount[securityOrigin]) {
+this._securityOriginFrameCount[securityOrigin] = 1;
+this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, securityOrigin);
+return;
+}
+this._securityOriginFrameCount[securityOrigin] += 1;
+},
+
+
+_removeSecurityOrigin: function(securityOrigin)
+{
+console.assert(this._securityOriginFrameCount[securityOrigin]);
+if (this._securityOriginFrameCount[securityOrigin] === 1) {
+delete this._securityOriginFrameCount[securityOrigin];
+this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, securityOrigin);
+return;
+}
+this._securityOriginFrameCount[securityOrigin] -= 1;
+},
+
+
+securityOrigins: function()
+{
+return Object.keys(this._securityOriginFrameCount);
+},
+
+
+_handleMainFrameDetached: function(mainFrame)
+{
+
+function removeOriginForFrame(frame)
+{
+for (var i = 0; i < frame.childFrames.length; ++i)
+removeOriginForFrame.call(this, frame.childFrames[i]);
+if (!frame.isMainFrame())
+this._removeSecurityOrigin(frame.securityOrigin);
+}
+removeOriginForFrame.call(this, WebInspector.resourceTreeModel.mainFrame);
 },
 
 
@@ -16294,26 +17822,35 @@
 if (!this._cachedResourcesProcessed)
 return;
 var frame = this._frames[framePayload.id];
+var addedOrigin;
 if (frame) {
 
+this._removeSecurityOrigin(frame.securityOrigin);
 frame._navigate(framePayload);
+addedOrigin = frame.securityOrigin;
 } else {
 
 var parentFrame = this._frames[framePayload.parentId];
 frame = new WebInspector.ResourceTreeFrame(this, parentFrame, framePayload);
 if (frame.isMainFrame() && this.mainFrame) {
+this._handleMainFrameDetached(this.mainFrame);
 
 this._frameDetached(this.mainFrame.id);
 }
-this._addFrame(frame);
+this._addFrame(frame, true);
+addedOrigin = frame.securityOrigin;
 }
 
 if (frame.isMainFrame())
 WebInspector.inspectedPageURL = frame.url;
 
 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, frame);
-if (frame.isMainFrame())
+if (frame.isMainFrame()) {
 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, frame);
+this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, frame);
+}
+if (addedOrigin)
+this._addSecurityOrigin(addedOrigin);
 
 
 var resources = frame.resources();
@@ -16335,6 +17872,7 @@
 if (!frame)
 return;
 
+this._removeSecurityOrigin(frame.securityOrigin);
 if (frame.parentFrame)
 frame.parentFrame._removeChildFrame(frame);
 else
@@ -16392,6 +17930,12 @@
 },
 
 
+frames: function() 
+{
+return Object.values(this._frames);
+},
+
+
 _consoleMessageAdded: function(event)
 {
 var msg =   (event.data);
@@ -16496,7 +18040,7 @@
 this._loaderId = payload.loaderId;
 this._name = payload.name;
 this._url = payload.url;
-this._securityOrigin = payload.securityOrigin || "";
+this._securityOrigin = payload.securityOrigin;
 this._mimeType = payload.mimeType;
 
 
@@ -16564,7 +18108,7 @@
 this._loaderId = framePayload.loaderId;
 this._name = framePayload.name;
 this._url = framePayload.url;
-this._securityOrigin = framePayload.securityOrigin || "";
+this._securityOrigin = framePayload.securityOrigin;
 this._mimeType = framePayload.mimeType;
 
 var mainResource = this._resourcesMap[this._url];
@@ -16691,6 +18235,35 @@
 frameDetached: function(frameId)
 {
 this._resourceTreeModel._frameDetached(frameId);
+},
+
+frameStartedLoading: function(frameId)
+{
+},
+
+frameStoppedLoading: function(frameId)
+{
+},
+
+frameScheduledNavigation: function(frameId, delay)
+{
+},
+
+frameClearedScheduledNavigation: function(frameId)
+{
+},
+
+javascriptDialogOpening: function(message)
+{
+},
+
+javascriptDialogClosed: function()
+{
+},
+
+scriptsEnabled: function(isEnabled)
+{
+WebInspector.settings.javaScriptDisabled.set(!isEnabled);
 }
 }
 
@@ -16759,6 +18332,34 @@
 }
 
 
+WebInspector.ParsedURL.splitURL = function(url)
+{
+var parsedURL = new WebInspector.ParsedURL(url);
+var origin;
+var folderPath;
+var name;
+if (parsedURL.isValid) {
+origin = parsedURL.scheme + "://" + parsedURL.host;
+if (parsedURL.port)
+origin += ":" + parsedURL.port;
+folderPath = parsedURL.folderPathComponents;
+name = parsedURL.lastPathComponent;
+if (parsedURL.queryParams)
+name += "?" + parsedURL.queryParams;
+} else {
+origin = "";
+folderPath = "";
+name = url;
+}
+var result = [origin];
+var splittedPath = folderPath.split("/");
+for (var i = 1; i < splittedPath.length; ++i)
+result.push(splittedPath[i]);
+result.push(name);
+return result;
+}
+
+
 WebInspector.ParsedURL.completeURL = function(baseURL, href)
 {
 if (href) {
@@ -16776,6 +18377,8 @@
 
 var parsedURL = baseURL.asParsedURL();
 if (parsedURL) {
+if (parsedURL.isDataURL())
+return href;
 var path = href;
 if (path.charAt(0) !== "/") {
 var basePath = parsedURL.path;
@@ -16818,8 +18421,8 @@
 return this.url;
 
 this._displayName = this.lastPathComponent;
-if (!this._displayName)
-this._displayName = this.host;
+if (!this._displayName && this.host)
+this._displayName = this.host + "/";
 if (!this._displayName && this.url)
 this._displayName = this.url.trimURL(WebInspector.inspectedPageDomain ? WebInspector.inspectedPageDomain : "");
 if (this._displayName === "/")
@@ -16885,7 +18488,7 @@
 
 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
 if (uiSourceCode)
-return uiSourceCode.parsedURL.displayName;
+return uiSourceCode.displayName();
 
 if (!WebInspector.inspectedPageURL)
 return url.trimURL("");
@@ -16899,7 +18502,11 @@
 return url.substring(index);
 }
 
-return parsedURL ? url.trimURL(parsedURL.host) : url;
+if (!parsedURL)
+return url;
+
+var displayName = url.trimURL(parsedURL.host);
+return displayName === "/" ? parsedURL.host + "/" : displayName;
 }
 
 
@@ -16940,16 +18547,6 @@
     return container;
 }
 
-WebInspector._linkifierPlugins = [];
-
-/**
- * @param {function(string):string} plugin
- */
-WebInspector.registerLinkifierPlugin = function(plugin)
-{
-    WebInspector._linkifierPlugins.push(plugin);
-}
-
 /**
  * @param {string} string
  * @return {DocumentFragment}
@@ -16964,9 +18561,6 @@
      */
     function linkifier(title, url, lineNumber)
     {
-        for (var i = 0; i < WebInspector._linkifierPlugins.length; ++i)
-            title = WebInspector._linkifierPlugins[i](title);
-
         var isExternal = !WebInspector.resourceForURL(url);
         var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined, isExternal);
         if (typeof(lineNumber) !== "undefined") {
@@ -17033,7 +18627,6 @@
 {
     var linkText = WebInspector.formatLinkText(url, lineNumber);
     var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
-    anchor.preferredPanel = "resources";
     anchor.lineNumber = lineNumber;
     return anchor;
 }
@@ -17245,12 +18838,14 @@
 WebInspector.TimelineManager.prototype = {
     /**
      * @param {number=} maxCallStackDepth
+     * @param {boolean=} includeDomCounters
+     * @param {boolean=} includeNativeMemoryStatistics
      */
-    start: function(maxCallStackDepth)
+    start: function(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics)
     {
         this._enablementCount++;
         if (this._enablementCount === 1)
-            TimelineAgent.start(maxCallStackDepth, this._started.bind(this));
+            TimelineAgent.start(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics, this._started.bind(this));
     },
 
     stop: function()
@@ -17900,6 +19495,7 @@
 
 /*
  * Copyright (C) 2008 Nokia Inc.  All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -17928,25 +19524,37 @@
 
 /**
  * @constructor
+ * @param {string} securityOrigin
+ * @param {boolean} isLocalStorage
  */
-WebInspector.DOMStorage = function(id, domain, isLocalStorage)
+WebInspector.DOMStorage = function(securityOrigin, isLocalStorage)
 {
-    this._id = id;
-    this._domain = domain;
+    this._securityOrigin = securityOrigin;
     this._isLocalStorage = isLocalStorage;
 }
 
+/**
+ * @param {string} securityOrigin
+ * @param {boolean} isLocalStorage
+ * @return {DOMStorageAgent.StorageId}
+ */
+WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage)
+{
+    return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage };
+}
+
 WebInspector.DOMStorage.prototype = {
-    /** @return {string} */
+
+    /** @return {DOMStorageAgent.StorageId} */
     get id()
     {
-        return this._id;
+        return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isLocalStorage);
     },
 
     /** @return {string} */
-    get domain()
+    get securityOrigin()
     {
-        return this._domain;
+        return this._securityOrigin;
     },
 
     /** @return {boolean} */
@@ -17956,30 +19564,30 @@
     },
 
     /**
-     * @param {function(?Protocol.Error, Array.<DOMStorageAgent.Entry>):void=} callback
+     * @param {function(?Protocol.Error, Array.<DOMStorageAgent.Item>):void=} callback
      */
-    getEntries: function(callback)
+    getItems: function(callback)
     {
-        DOMStorageAgent.getDOMStorageEntries(this._id, callback);
+        DOMStorageAgent.getDOMStorageItems(this.id, callback);
     },
 
     /**
      * @param {string} key
      * @param {string} value
-     * @param {function(?Protocol.Error, boolean):void=} callback
+     * @param {function(?Protocol.Error):void=} callback
      */
     setItem: function(key, value, callback)
     {
-        DOMStorageAgent.setDOMStorageItem(this._id, key, value, callback);
+        DOMStorageAgent.setDOMStorageItem(this.id, key, value, callback);
     },
 
     /**
      * @param {string} key
-     * @param {function(?Protocol.Error, boolean):void=} callback
+     * @param {function(?Protocol.Error):void=} callback
      */
     removeItem: function(key, callback)
     {
-        DOMStorageAgent.removeDOMStorageItem(this._id, key, callback);
+        DOMStorageAgent.removeDOMStorageItem(this.id, key, callback);
     }
 }
 
@@ -17992,29 +19600,127 @@
     this._storages = {};
     InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this));
     DOMStorageAgent.enable();
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
 }
 
 WebInspector.DOMStorageModel.Events = {
     DOMStorageAdded: "DOMStorageAdded",
-    DOMStorageUpdated: "DOMStorageUpdated"
+    DOMStorageRemoved: "DOMStorageRemoved",
+    DOMStorageItemsCleared: "DOMStorageItemsCleared",
+    DOMStorageItemRemoved: "DOMStorageItemRemoved",
+    DOMStorageItemAdded: "DOMStorageItemAdded",
+    DOMStorageItemUpdated: "DOMStorageItemUpdated"
 }
 
 WebInspector.DOMStorageModel.prototype = {
+
     /**
-     * @param {WebInspector.DOMStorage} domStorage
+     * @param {WebInspector.Event} event
      */
-    _addDOMStorage: function(domStorage)
+    _securityOriginAdded: function(event)
     {
-        this._storages[domStorage.id] = domStorage;
-        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, domStorage);
+        var securityOrigin = /** @type {string} */ (event.data);
+        var localStorageKey = this._storageKey(securityOrigin, true);
+        console.assert(!this._storages[localStorageKey]);
+        var localStorage = new WebInspector.DOMStorage(securityOrigin, true);
+        this._storages[localStorageKey] = localStorage;
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, localStorage);
+
+        var sessionStorageKey = this._storageKey(securityOrigin, false);
+        console.assert(!this._storages[sessionStorageKey]);
+        var sessionStorage = new WebInspector.DOMStorage(securityOrigin, false);
+        this._storages[sessionStorageKey] = sessionStorage;
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, sessionStorage);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _securityOriginRemoved: function(event)
+    {
+        var securityOrigin = /** @type {string} */ (event.data);
+        var localStorageKey = this._storageKey(securityOrigin, true);
+        var localStorage = this._storages[localStorageKey];
+        console.assert(localStorage);
+        delete this._storages[localStorageKey];
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, localStorage);
+
+        var sessionStorageKey = this._storageKey(securityOrigin, false);
+        var sessionStorage = this._storages[sessionStorageKey];
+        console.assert(sessionStorage);
+        delete this._storages[sessionStorageKey];
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, sessionStorage);
+    },
+
+    /**
+     * @param {string} securityOrigin
+     * @param {boolean} isLocalStorage
+     * @return {string}
+     */
+    _storageKey: function(securityOrigin, isLocalStorage)
+    {
+        return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin, isLocalStorage));
     },
 
     /**
      * @param {DOMStorageAgent.StorageId} storageId
      */
-    _domStorageUpdated: function(storageId)
+    _domStorageItemsCleared: function(storageId)
     {
-        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageUpdated, this._storages[storageId]);
+        var domStorage = this.storageForId(storageId);
+        var storageData = {
+            storage: domStorage
+        };
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemsCleared, storageData);
+    },
+
+    /**
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
+     */
+    _domStorageItemRemoved: function(storageId, key)
+    {
+        var domStorage = this.storageForId(storageId);
+        var storageData = {
+            storage: domStorage,
+            key: key
+        };
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemRemoved, storageData);
+    },
+
+    /**
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
+     * @param {string} newValue
+     */
+    _domStorageItemAdded: function(storageId, key, newValue)
+    {
+        var domStorage = this.storageForId(storageId);
+        var storageData = {
+            storage: domStorage,
+            key: key,
+            newValue: newValue
+        };
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemAdded, storageData);
+    },
+
+    /**
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
+     * @param {string} oldValue
+     * @param {string} newValue
+     */
+    _domStorageItemUpdated: function(storageId, key, oldValue, newValue)
+    {
+        var domStorage = this._storages[storageId];
+        var storageData = {
+            storage: domStorage,
+            key: key,
+            oldValue: oldValue,
+            newValue: newValue
+        };
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemUpdated, storageData);
     },
 
     /**
@@ -18023,7 +19729,7 @@
      */
     storageForId: function(storageId)
     {
-        return this._storages[storageId];
+        return this._storages[JSON.stringify(storageId)];
     },
 
     /**
@@ -18032,8 +19738,8 @@
     storages: function()
     {
         var result = [];
-        for (var storageId in this._storages)
-            result.push(this._storages[storageId]);
+        for (var id in this._storages)
+            result.push(this._storages[id]);
         return result;
     },
 
@@ -18053,23 +19759,42 @@
 WebInspector.DOMStorageDispatcher.prototype = {
 
     /**
-     * @param {DOMStorageAgent.Entry} payload
+     * @param {DOMStorageAgent.StorageId} storageId
      */
-    addDOMStorage: function(payload)
+    domStorageItemsCleared: function(storageId)
     {
-        this._model._addDOMStorage(new WebInspector.DOMStorage(
-            payload.id,
-            payload.origin,
-            payload.isLocalStorage));
+        this._model._domStorageItemsCleared(storageId);
     },
 
     /**
-     * @param {string} storageId
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
      */
-    domStorageUpdated: function(storageId)
+    domStorageItemRemoved: function(storageId, key)
     {
-        this._model._domStorageUpdated(storageId);
-    }
+        this._model._domStorageItemRemoved(storageId, key);
+    },
+
+    /**
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
+     * @param {string} newValue
+     */
+    domStorageItemAdded: function(storageId, key, newValue)
+    {
+        this._model._domStorageItemAdded(storageId, key, newValue);
+    },
+
+    /**
+     * @param {DOMStorageAgent.StorageId} storageId
+     * @param {string} key
+     * @param {string} oldValue
+     * @param {string} newValue
+     */
+    domStorageItemUpdated: function(storageId, key, oldValue, newValue)
+    {
+        this._model._domStorageItemUpdated(storageId, key, oldValue, newValue);
+    },
 }
 
 /**
@@ -18107,10 +19832,13 @@
 /**
  * @constructor
  * @extends {WebInspector.View}
- * @param {function(WebInspector.DataGridNode, number, string, string)=} editCallback
+ * @param {!Array.<!WebInspector.DataGrid.ColumnDescriptor>} columnsArray
+ * @param {function(WebInspector.DataGridNode, string, string, string)=} editCallback
  * @param {function(WebInspector.DataGridNode)=} deleteCallback
+ * @param {function()=} refreshCallback
+ * @param {function(!WebInspector.ContextMenu, WebInspector.DataGridNode)=} contextMenuCallback
  */
-WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
+WebInspector.DataGrid = function(columnsArray, editCallback, deleteCallback, refreshCallback, contextMenuCallback)
 {
     WebInspector.View.call(this);
     this.registerRequiredCSS("dataGrid.css");
@@ -18133,14 +19861,12 @@
 
     // FIXME: Add a createCallback which is different from editCallback and has different
     // behavior when creating a new node.
-    if (editCallback) {
+    if (editCallback)
         this._dataTable.addEventListener("dblclick", this._ondblclick.bind(this), false);
-        this._editCallback = editCallback;
-    }
-    if (deleteCallback)
-        this._deleteCallback = deleteCallback;
-
-    this.aligned = {};
+    this._editCallback = editCallback;
+    this._deleteCallback = deleteCallback;
+    this._refreshCallback = refreshCallback;
+    this._contextMenuCallback = contextMenuCallback;
 
     this._scrollContainer = document.createElement("div");
     this._scrollContainer.className = "data-container";
@@ -18151,10 +19877,19 @@
 
     var headerRow = document.createElement("tr");
     var columnGroup = document.createElement("colgroup");
-    this._columnCount = 0;
+    columnGroup.span = columnsArray.length;
 
-    for (var columnIdentifier in columns) {
-        var column = columns[columnIdentifier];
+    var fillerRow = document.createElement("tr");
+    fillerRow.className = "filler";
+
+    this._columnsArray = columnsArray;
+    this.columns = {};
+
+    for (var i = 0; i < columnsArray.length; ++i) {
+        var column = columnsArray[i];
+        column.ordinal = i;
+        var columnIdentifier = column.identifier = column.id || i;
+        this.columns[columnIdentifier] = column;
         if (column.disclosure)
             this.disclosureColumnIdentifier = columnIdentifier;
 
@@ -18186,49 +19921,22 @@
             cell.addStyleClass("sortable");
         }
 
-        if (column.aligned)
-            this.aligned[columnIdentifier] = column.aligned;
-
         headerRow.appendChild(cell);
-
-        ++this._columnCount;
+        fillerRow.createChild("td", columnIdentifier + "-column");
     }
 
-    columnGroup.span = this._columnCount;
-
-    var cell = document.createElement("th");
-    cell.className = "corner";
-    headerRow.appendChild(cell);
+    headerRow.createChild("th", "corner");
+    fillerRow.createChild("td", "corner");
+    columnGroup.createChild("col", "corner");
 
     this._headerTableColumnGroup = columnGroup;
     this._headerTable.appendChild(this._headerTableColumnGroup);
     this.headerTableBody.appendChild(headerRow);
 
-    var fillerRow = document.createElement("tr");
-    fillerRow.className = "filler";
-
-    for (var columnIdentifier in columns) {
-        var column = columns[columnIdentifier];
-        var td = document.createElement("td");
-        td.className = columnIdentifier + "-column";
-        fillerRow.appendChild(td);
-    }
-
     this._dataTableColumnGroup = columnGroup.cloneNode(true);
     this._dataTable.appendChild(this._dataTableColumnGroup);
     this.dataTableBody.appendChild(fillerRow);
 
-    this.columns = columns || {};
-    this._columnsArray = [];
-    for (var columnIdentifier in columns) {
-        columns[columnIdentifier].ordinal = this._columnsArray.length;
-        columns[columnIdentifier].identifier = columnIdentifier;
-        this._columnsArray.push(columns[columnIdentifier]);
-    }
-
-    for (var i = 0; i < this._columnsArray.length; ++i)
-        this._columnsArray[i].bodyElement = this._dataTableColumnGroup.children[i];
-
     this.selectedNode = null;
     this.expandNodesWhenArrowing = false;
     this.setRootNode(new WebInspector.DataGridNode());
@@ -18237,9 +19945,26 @@
     this._columnWidthsInitialized = false;
 }
 
+/** @typedef {{id: ?string, editable: boolean, longText: ?boolean, sort: WebInspector.DataGrid.Order, sortable: boolean, align: WebInspector.DataGrid.Align}} */
+WebInspector.DataGrid.ColumnDescriptor;
+
 WebInspector.DataGrid.Events = {
     SelectedNode: "SelectedNode",
-    DeselectedNode: "DeselectedNode"
+    DeselectedNode: "DeselectedNode",
+    SortingChanged: "SortingChanged",
+    ColumnsResized: "ColumnsResized"
+}
+
+/** @enum {string} */
+WebInspector.DataGrid.Order = {
+    Ascending: "ascending",
+    Descending: "descending"
+}
+
+/** @enum {string} */
+WebInspector.DataGrid.Align = {
+    Center: "center",
+    Right: "right"
 }
 
 /**
@@ -18252,22 +19977,15 @@
     if (!numColumns)
         return null;
 
-    var columns = {};
-
-    for (var i = 0; i < columnNames.length; ++i) {
-        var column = {};
-        column.width = columnNames[i].length;
-        column.title = columnNames[i];
-        column.sortable = true;
-
-        columns[columnNames[i]] = column;
-    }
+    var columns = [];
+    for (var i = 0; i < columnNames.length; ++i)
+        columns.push({title: columnNames[i], width: columnNames[i].length, sortable: true});
 
     var nodes = [];
     for (var i = 0; i < values.length / numColumns; ++i) {
         var data = {};
         for (var j = 0; j < columnNames.length; ++j)
-            data[columnNames[j]] = values[numColumns * i + j];
+            data[j] = values[numColumns * i + j];
 
         var node = new WebInspector.DataGridNode(data, false);
         node.selectable = false;
@@ -18279,13 +19997,13 @@
     for (var i = 0; i < length; ++i)
         dataGrid.rootNode().appendChild(nodes[i]);
 
-    dataGrid.addEventListener("sorting changed", sortDataGrid, this);
+    dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, sortDataGrid, this);
 
     function sortDataGrid()
     {
         var nodes = dataGrid._rootNode.children.slice();
-        var sortColumnIdentifier = dataGrid.sortColumnIdentifier;
-        var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1;
+        var sortColumnIdentifier = dataGrid.sortColumnIdentifier();
+        var sortDirection = dataGrid.isSortOrderAscending() ? 1 : -1;
         var columnIsNumeric = true;
 
         for (var i = 0; i < nodes.length; i++) {
@@ -18297,6 +20015,8 @@
         {
             var item1 = dataGridNode1.data[sortColumnIdentifier];
             var item2 = dataGridNode2.data[sortColumnIdentifier];
+            item1 = item1 instanceof Node ? item1.textContent : String(item1);
+            item2 = item2 instanceof Node ? item2.textContent : String(item2);
 
             var comparison;
             if (columnIsNumeric) {
@@ -18319,6 +20039,9 @@
 }
 
 WebInspector.DataGrid.prototype = {
+    /**
+     * @param {!WebInspector.DataGridNode} rootNode
+     */
     setRootNode: function(rootNode)
     {
         if (this._rootNode) {
@@ -18326,6 +20049,7 @@
             this._rootNode.dataGrid = null;
             this._rootNode._isRoot = false;
         }
+        /** @type {!WebInspector.DataGridNode} */
         this._rootNode = rootNode;
         rootNode._isRoot = true;
         rootNode.hasChildren = false;
@@ -18334,36 +20058,37 @@
         rootNode.dataGrid = this;
     },
 
+    /**
+     * @return {!WebInspector.DataGridNode}
+     */
     rootNode: function()
     {
         return this._rootNode;
     },
 
-    get refreshCallback()
-    {
-        return this._refreshCallback;
-    },
-
-    set refreshCallback(refreshCallback)
-    {
-        this._refreshCallback = refreshCallback;
-    },
-
     _ondblclick: function(event)
     {
         if (this._editing || this._editingNode)
             return;
 
+        var columnIdentifier = this.columnIdentifierFromNode(event.target);
+        if (!columnIdentifier || !this.columns[columnIdentifier].editable)
+            return;
         this._startEditing(event.target);
     },
 
-    _startEditingColumnOfDataGridNode: function(node, column)
+    /**
+     * @param {!WebInspector.DataGridNode} node
+     * @param {number} columnOrdinal
+     */
+    _startEditingColumnOfDataGridNode: function(node, columnOrdinal)
     {
         this._editing = true;
+        /** @type {WebInspector.DataGridNode} */
         this._editingNode = node;
         this._editingNode.select();
 
-        var element = this._editingNode._element.children[column];
+        var element = this._editingNode._element.children[columnOrdinal];
         WebInspector.startEditing(element, this._startEditingConfig(element));
         window.getSelection().setBaseAndExtent(element, 0, element, 1);
     },
@@ -18383,7 +20108,7 @@
 
         // Force editing the 1st column when editing the creation node
         if (this._editingNode.isCreationNode)
-            return this._startEditingColumnOfDataGridNode(this._editingNode, 0);
+            return this._startEditingColumnOfDataGridNode(this._editingNode, this._nextEditableColumn(-1));
 
         this._editing = true;
         WebInspector.startEditing(element, this._startEditingConfig(element));
@@ -18391,6 +20116,10 @@
         window.getSelection().setBaseAndExtent(element, 0, element, 1);
     },
 
+    renderInline: function()
+    {
+        this.element.addStyleClass("inline");
+    },
 
     _startEditingConfig: function(element)
     {
@@ -18399,12 +20128,12 @@
 
     _editingCommitted: function(element, newText, oldText, context, moveDirection)
     {
-        // FIXME: We need more column identifiers here throughout this function.
-        // Not needed yet since only editable DataGrid is DOM Storage, which is Key - Value.
-
-        // FIXME: Better way to do this than regular expressions?
-        var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1], 10);
-
+        var columnIdentifier = this.columnIdentifierFromNode(element);
+        if (!columnIdentifier) {
+            this._editingCancelled(element);
+            return;
+        }
+        var columnOrdinal = this.columns[columnIdentifier].ordinal;
         var textBeforeEditing = this._editingNode.data[columnIdentifier];
         var currentEditingNode = this._editingNode;
 
@@ -18413,29 +20142,33 @@
                 return;
 
             if (moveDirection === "forward") {
-                if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange)
+            var firstEditableColumn = this._nextEditableColumn(-1);
+                if (currentEditingNode.isCreationNode && columnOrdinal === firstEditableColumn && !wasChange)
                     return;
 
-                if (columnIdentifier === 0)
-                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 1);
+                var nextEditableColumn = this._nextEditableColumn(columnOrdinal);
+                if (nextEditableColumn !== -1)
+                    return this._startEditingColumnOfDataGridNode(currentEditingNode, nextEditableColumn);
 
                 var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true);
                 if (nextDataGridNode)
-                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0);
+                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, firstEditableColumn);
                 if (currentEditingNode.isCreationNode && wasChange) {
                     this.addCreationNode(false);
-                    return this._startEditingColumnOfDataGridNode(this.creationNode, 0);
+                    return this._startEditingColumnOfDataGridNode(this.creationNode, firstEditableColumn);
                 }
                 return;
             }
 
             if (moveDirection === "backward") {
-                if (columnIdentifier === 1)
-                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 0);
-                    var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true);
+                var prevEditableColumn = this._nextEditableColumn(columnOrdinal, true);
+                if (prevEditableColumn !== -1)
+                    return this._startEditingColumnOfDataGridNode(currentEditingNode, prevEditableColumn);
 
+                var lastEditableColumn = this._nextEditableColumn(this._columnsArray.length, true);
+                var nextDataGridNode = currentEditingNode.traversePreviousNode(true, true);
                 if (nextDataGridNode)
-                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1);
+                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, lastEditableColumn);
                 return;
             }
         }
@@ -18467,9 +20200,25 @@
     },
 
     /**
+     * @param {number} columnOrdinal
+     * @param {boolean=} moveBackward
+     * @return {number}
+     */
+    _nextEditableColumn: function(columnOrdinal, moveBackward)
+    {
+        var increment = moveBackward ? -1 : 1;
+        var columns = this._columnsArray;
+        for (var i = columnOrdinal + increment; (i >= 0) && (i < columns.length); i += increment) {
+            if (columns[i].editable)
+                return i;
+        }
+        return -1;
+    },
+
+    /**
      * @return {?string}
      */
-    get sortColumnIdentifier()
+    sortColumnIdentifier: function()
     {
         if (!this._sortColumnCell)
             return null;
@@ -18479,15 +20228,23 @@
     /**
      * @return {?string}
      */
-    get sortOrder()
+    sortOrder: function()
     {
         if (!this._sortColumnCell || this._sortColumnCell.hasStyleClass("sort-ascending"))
-            return "ascending";
+            return WebInspector.DataGrid.Order.Ascending;
         if (this._sortColumnCell.hasStyleClass("sort-descending"))
-            return "descending";
+            return WebInspector.DataGrid.Order.Descending;
         return null;
     },
 
+    /**
+     * @return {boolean}
+     */
+    isSortOrderAscending: function()
+    {
+        return !this._sortColumnCell || this._sortColumnCell.hasStyleClass("sort-ascending");
+    },
+
     get headerTableBody()
     {
         if ("_headerTableBody" in this)
@@ -18573,16 +20330,15 @@
     autoSizeColumns: function(minPercent, maxPercent, maxDescentLevel)
     {
         var widths = [];
-        var columnIdentifiers = Object.keys(this.columns);
-        for (var i = 0; i < columnIdentifiers.length; ++i)
-            widths[i] = (this.columns[columnIdentifiers[i]].title || "").length;
+        for (var i = 0; i < this._columnsArray.length; ++i)
+            widths.push((this._columnsArray[i].title || "").length);
 
         maxDescentLevel = maxDescentLevel || 0;
         var children = this._enumerateChildren(this._rootNode, [], maxDescentLevel + 1);
         for (var i = 0; i < children.length; ++i) {
             var node = children[i];
-            for (var j = 0; j < columnIdentifiers.length; ++j) {
-                var text = node.data[columnIdentifiers[j]] || "";
+            for (var j = 0; j < this._columnsArray.length; ++j) {
+                var text = node.data[this._columnsArray[j].identifier] || "";
                 if (text.length > widths[j])
                     widths[j] = text.length;
             }
@@ -18590,8 +20346,8 @@
 
         widths = this._autoSizeWidths(widths, minPercent, maxPercent);
 
-        for (var i = 0; i < columnIdentifiers.length; ++i)
-            this.columns[columnIdentifiers[i]].element.style.width = widths[i] + "%";
+        for (var i = 0; i < this._columnsArray.length; ++i)
+            this._columnsArray[i].element.style.width = widths[i] + "%";
         this._columnWidthsInitialized = false;
         this.updateWidths();
     },
@@ -18627,7 +20383,7 @@
 var headerTableColumns = this._headerTableColumnGroup.children;
 
 var tableWidth = this._dataTable.offsetWidth;
-var numColumns = headerTableColumns.length;
+var numColumns = headerTableColumns.length - 1; 
 
 
 if (!this._columnWidthsInitialized && this.element.offsetWidth) {
@@ -18644,74 +20400,82 @@
 this._columnWidthsInitialized = true;
 }
 this._positionResizers();
-this.dispatchEventToListeners("width changed");
+this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);
 },
 
-columnWidthsMap: function()
+
+setName: function(name)
 {
-var result = {};
+this._columnWeightsSetting = WebInspector.settings.createSetting("dataGrid-" + name + "-columnWeights", {});
+this._loadColumnWeights();
+},
+
+_loadColumnWeights: function()
+{
+if (!this._columnWeightsSetting)
+return;
+var weights = this._columnWeightsSetting.get();
 for (var i = 0; i < this._columnsArray.length; ++i) {
-var width = this._headerTableColumnGroup.children[i].style.width;
-result[this._columnsArray[i].columnIdentifier] = parseFloat(width);
+var column = this._columnsArray[i];
+var weight = weights[column.identifier];
+if (weight)
+column.weight = weight;
 }
-return result;
+this.applyColumnWeights();
 },
 
-applyColumnWidthsMap: function(columnWidthsMap)
+_saveColumnWeights: function()
 {
-for (var columnIdentifier in this.columns) {
-var column = this.columns[columnIdentifier];
-var width = (columnWidthsMap[columnIdentifier] || 0) + "%";
-this._headerTableColumnGroup.children[column.ordinal].style.width = width;
-this._dataTableColumnGroup.children[column.ordinal].style.width = width;
+if (!this._columnWeightsSetting)
+return;
+var weights = {};
+for (var i = 0; i < this._columnsArray.length; ++i) {
+var column = this._columnsArray[i];
+weights[column.identifier] = column.weight;
+}
+this._columnWeightsSetting.set(weights);
+},
+
+wasShown: function()
+{
+this._loadColumnWeights();
+},
+
+applyColumnWeights: function()
+{
+var sumOfWeights = 0.0;
+for (var i = 0; i < this._columnsArray.length; ++i) {
+var column = this._columnsArray[i];
+if (this.isColumnVisible(column))
+sumOfWeights += column.weight;
+}
+var factor = 100 / sumOfWeights;
+
+for (var i = 0; i < this._columnsArray.length; ++i) {
+var column = this._columnsArray[i];
+var width = this.isColumnVisible(column) ? ((factor * column.weight) + "%"): "0%";
+this._headerTableColumnGroup.children[i].style.width = width;
+this._dataTableColumnGroup.children[i].style.width = width;
 }
 
-
-delete this._columnWidthsInitialized;
-this.updateWidths();
+this._positionResizers();
+this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);
 },
 
-isColumnVisible: function(columnIdentifier)
+
+isColumnVisible: function(column)
 {
-var column = this.columns[columnIdentifier];
-var columnElement = column.element;
-return !columnElement.hidden;
+return !column.hidden;
 },
 
-showColumn: function(columnIdentifier)
+
+setColumnVisible: function(columnIdentifier, visible)
 {
-var column = this.columns[columnIdentifier];
-var columnElement = column.element;
-if (!columnElement.hidden)
+if (visible === !this.columns[columnIdentifier].hidden)
 return;
 
-columnElement.hidden = false;
-columnElement.removeStyleClass("hidden");
-
-var columnBodyElement = column.bodyElement;
-columnBodyElement.hidden = false;
-columnBodyElement.removeStyleClass("hidden");
-},
-
-hideColumn: function(columnIdentifier)
-{
-var column = this.columns[columnIdentifier];
-var columnElement = column.element;
-if (columnElement.hidden)
-return;
-
-var oldWidth = parseFloat(columnElement.style.width);
-
-columnElement.hidden = true;
-columnElement.addStyleClass("hidden");
-columnElement.style.width = 0;
-
-var columnBodyElement = column.bodyElement;
-columnBodyElement.hidden = true;
-columnBodyElement.addStyleClass("hidden");
-columnBodyElement.style.width = 0;
-
-this._columnWidthsInitialized = false;
+this.columns[columnIdentifier].hidden = !visible;
+this.element.enableStyleClass("hide-" + columnIdentifier + "-column", !visible);
 },
 
 get scrollContainer()
@@ -18732,7 +20496,7 @@
 _positionResizers: function()
 {
 var headerTableColumns = this._headerTableColumnGroup.children;
-var numColumns = headerTableColumns.length;
+var numColumns = headerTableColumns.length - 1; 
 var left = 0;
 var previousResizer = null;
 
@@ -18756,22 +20520,28 @@
 
 left += this.headerTableBody.rows[0].cells[i].offsetWidth;
 
-var columnIsVisible = !this._headerTableColumnGroup.children[i].hidden;
-if (columnIsVisible) {
+if (!this._columnsArray[i].hidden) {
 resizer.style.removeProperty("display");
+if (resizer._position !== left) {
+resizer._position = left;
 resizer.style.left = left + "px";
-resizer.leftNeighboringColumnID = i;
+}
+resizer.leftNeighboringColumnIndex = i;
 if (previousResizer)
-previousResizer.rightNeighboringColumnID = i;
+previousResizer.rightNeighboringColumnIndex = i;
 previousResizer = resizer;
 } else {
+if (previousResizer && previousResizer._position !== left) {
+previousResizer._position = left;
+previousResizer.style.left = left + "px";
+}
 resizer.style.setProperty("display", "none");
-resizer.leftNeighboringColumnID = 0;
-resizer.rightNeighboringColumnID = 0;
+resizer.leftNeighboringColumnIndex = 0;
+resizer.rightNeighboringColumnIndex = 0;
 }
 }
 if (previousResizer)
-previousResizer.rightNeighboringColumnID = numColumns - 1;
+previousResizer.rightNeighboringColumnIndex = numColumns - 1;
 },
 
 addCreationNode: function(hasChildren)
@@ -18881,13 +20651,12 @@
 if (this._deleteCallback) {
 handled = true;
 this._deleteCallback(this.selectedNode);
+this.changeNodeAfterDeletion();
 }
 } else if (isEnterKey(event)) {
 if (this._editCallback) {
 handled = true;
-
-
-this._startEditing(this.selectedNode._element.children[0]);
+this._startEditing(this.selectedNode._element.children[this._nextEditableColumn(-1)]);
 }
 }
 
@@ -18900,17 +20669,36 @@
 event.consume(true);
 },
 
+changeNodeAfterDeletion: function()
+{
+var nextSelectedNode = this.selectedNode.traverseNextNode(true);
+while (nextSelectedNode && !nextSelectedNode.selectable)
+nextSelectedNode = nextSelectedNode.traverseNextNode(true);
+
+if (!nextSelectedNode || nextSelectedNode.isCreationNode) {
+nextSelectedNode = this.selectedNode.traversePreviousNode(true);
+while (nextSelectedNode && !nextSelectedNode.selectable)
+nextSelectedNode = nextSelectedNode.traversePreviousNode(true);
+}
+
+if (nextSelectedNode) {
+nextSelectedNode.reveal();
+nextSelectedNode.select();
+}
+},
+
+
 dataGridNodeFromNode: function(target)
 {
 var rowElement = target.enclosingNodeOrSelfWithNodeName("tr");
 return rowElement && rowElement._dataGridNode;
 },
 
-dataGridNodeFromPoint: function(x, y)
+
+columnIdentifierFromNode: function(target)
 {
-var node = this._dataTable.ownerDocument.elementFromPoint(x, y);
-var rowElement = node.enclosingNodeOrSelfWithNodeName("tr");
-return rowElement && rowElement._dataGridNode;
+var cellElement = target.enclosingNodeOrSelfWithNodeName("td");
+return cellElement && cellElement.columnIdentifier_;
 },
 
 _clickInHeaderCell: function(event)
@@ -18919,25 +20707,20 @@
 if (!cell || !cell.columnIdentifier || !cell.hasStyleClass("sortable"))
 return;
 
-var sortOrder = this.sortOrder;
+var sortOrder = WebInspector.DataGrid.Order.Ascending;
+if ((cell === this._sortColumnCell) && this.isSortOrderAscending())
+sortOrder = WebInspector.DataGrid.Order.Descending;
 
 if (this._sortColumnCell)
 this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");
-
-if (cell == this._sortColumnCell) {
-if (sortOrder === "ascending")
-sortOrder = "descending";
-else
-sortOrder = "ascending";
-}
-
 this._sortColumnCell = cell;
 
 cell.addStyleClass("sort-" + sortOrder);
 
-this.dispatchEventToListeners("sorting changed");
+this.dispatchEventToListeners(WebInspector.DataGrid.Events.SortingChanged);
 },
 
+
 markColumnAsSortedBy: function(columnIdentifier, sortOrder)
 {
 if (this._sortColumnCell)
@@ -18981,12 +20764,17 @@
 
 if (this._editCallback) {
 if (gridNode === this.creationNode)
-contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
-else
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add new" : "Add New"), this._startEditing.bind(this, event.target));
+else {
+var columnIdentifier = this.columnIdentifierFromNode(event.target);
+if (columnIdentifier && this.columns[columnIdentifier].editable)
 contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
 }
+}
 if (this._deleteCallback && gridNode !== this.creationNode)
 contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
+if (this._contextMenuCallback)
+this._contextMenuCallback(contextMenu, gridNode);
 }
 
 contextMenu.show();
@@ -19030,7 +20818,7 @@
 _startResizerDragging: function(event)
 {
 this._currentResizer = event.target;
-return !!this._currentResizer.rightNeighboringColumnID
+return !!this._currentResizer.rightNeighboringColumnIndex
 },
 
 _resizerDragging: function(event)
@@ -19039,13 +20827,15 @@
 if (!resizer)
 return;
 
+var tableWidth = this._dataTable.offsetWidth; 
+
 
 
 var dragPoint = event.clientX - this.element.totalOffsetLeft();
 
 
-var leftCellIndex = resizer.leftNeighboringColumnID;
-var rightCellIndex = resizer.rightNeighboringColumnID;
+var leftCellIndex = resizer.leftNeighboringColumnIndex;
+var rightCellIndex = resizer.rightNeighboringColumnIndex;
 var firstRowCells = this.headerTableBody.rows[0].cells;
 var leftEdgeOfPreviousColumn = 0;
 for (var i = 0; i < leftCellIndex; i++)
@@ -19064,31 +20854,43 @@
 
 var leftMinimum = leftEdgeOfPreviousColumn + this.ColumnResizePadding;
 var rightMaximum = rightEdgeOfNextColumn - this.ColumnResizePadding;
+if (leftMinimum > rightMaximum)
+return;
 
 dragPoint = Number.constrain(dragPoint, leftMinimum, rightMaximum);
 
 resizer.style.left = (dragPoint - this.CenterResizerOverBorderAdjustment) + "px";
 
-var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / this._dataTable.offsetWidth) * 100) + "%";
+var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / tableWidth) * 100) + "%";
 this._headerTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
 this._dataTableColumnGroup.children[leftCellIndex].style.width = percentLeftColumn;
 
-var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / this._dataTable.offsetWidth) * 100) + "%";
+var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / tableWidth) * 100) + "%";
 this._headerTableColumnGroup.children[rightCellIndex].style.width =  percentRightColumn;
 this._dataTableColumnGroup.children[rightCellIndex].style.width = percentRightColumn;
 
+var leftColumn = this._columnsArray[leftCellIndex];
+var rightColumn = this._columnsArray[rightCellIndex];
+if (leftColumn.weight || rightColumn.weight) {
+var sumOfWeights = leftColumn.weight + rightColumn.weight;
+var delta = rightEdgeOfNextColumn - leftEdgeOfPreviousColumn;
+leftColumn.weight = (dragPoint - leftEdgeOfPreviousColumn) * sumOfWeights / delta;
+rightColumn.weight = (rightEdgeOfNextColumn - dragPoint) * sumOfWeights / delta;
+}
+
 this._positionResizers();
 event.preventDefault();
-this.dispatchEventToListeners("width changed");
+this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);
 },
 
 _endResizerDragging: function(event)
 {
 this._currentResizer = null;
-this.dispatchEventToListeners("width changed");
+this._saveColumnWeights();
+this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);
 },
 
-ColumnResizePadding: 10,
+ColumnResizePadding: 24,
 
 CenterResizerOverBorderAdjustment: 3,
 
@@ -19109,17 +20911,22 @@
 this._shouldRefreshChildren = true;
 this._data = data || {};
 this.hasChildren = hasChildren || false;
+
 this.children = [];
 this.dataGrid = null;
 this.parent = null;
+
 this.previousSibling = null;
+
 this.nextSibling = null;
 this.disclosureToggleWidth = 10;
 }
 
 WebInspector.DataGridNode.prototype = {
+
 selectable: true,
 
+
 _isRoot: false,
 
 get element()
@@ -19143,13 +20950,16 @@
 this._element.addStyleClass("revealed");
 
 this.createCells();
+this._element.createChild("td", "corner");
+
 return this._element;
 },
 
 createCells: function()
 {
-for (var columnIdentifier in this.dataGrid.columns) {
-var cell = this.createCell(columnIdentifier);
+var columnsArray = this.dataGrid._columnsArray;
+for (var i = 0; i < columnsArray.length; ++i) {
+var cell = this.createCell(columnsArray[i].identifier);
 this._element.appendChild(cell);
 }
 },
@@ -19194,17 +21004,8 @@
 if (!this._element)
 return;
 
-if (this._hasChildren)
-{
-this._element.addStyleClass("parent");
-if (this.expanded)
-this._element.addStyleClass("expanded");
-}
-else
-{
-this._element.removeStyleClass("parent");
-this._element.removeStyleClass("expanded");
-}
+this._element.enableStyleClass("parent", this._hasChildren);
+this._element.enableStyleClass("expanded", this._hasChildren && this.expanded);
 },
 
 get hasChildren()
@@ -19219,12 +21020,8 @@
 
 this._revealed = x;
 
-if (this._element) {
-if (this._revealed)
-this._element.addStyleClass("revealed");
-else
-this._element.removeStyleClass("revealed");
-}
+if (this._element)
+this._element.enableStyleClass("revealed", this._revealed);
 
 for (var i = 0; i < this.children.length; ++i)
 this.children[i].revealed = x && this.expanded;
@@ -19243,7 +21040,7 @@
 
 get leftPadding()
 {
-if (typeof(this._leftPadding) === "number")
+if (typeof this._leftPadding === "number")
 return this._leftPadding;
 
 this._leftPadding = this.depth * this.dataGrid.indentWidth;
@@ -19295,23 +21092,37 @@
 
 this._element.removeChildren();
 this.createCells();
+this._element.createChild("td", "corner");
 },
 
-createCell: function(columnIdentifier)
+
+createTD: function(columnIdentifier)
 {
 var cell = document.createElement("td");
 cell.className = columnIdentifier + "-column";
+cell.columnIdentifier_ = columnIdentifier;
 
-var alignment = this.dataGrid.aligned[columnIdentifier];
+var alignment = this.dataGrid.columns[columnIdentifier].align;
 if (alignment)
 cell.addStyleClass(alignment);
 
+return cell;
+},
+
+
+createCell: function(columnIdentifier)
+{
+var cell = this.createTD(columnIdentifier);
+
 var data = this.data[columnIdentifier];
 var div = document.createElement("div");
 if (data instanceof Node)
 div.appendChild(data);
-else
+else {
 div.textContent = data;
+if (this.dataGrid.columns[columnIdentifier].longText)
+div.title = data;
+}
 cell.appendChild(div);
 
 if (columnIdentifier === this.dataGrid.disclosureColumnIdentifier) {
@@ -19459,8 +21270,6 @@
 
 for (var i = 0; i < this.children.length; ++i)
 this.children[i].revealed = false;
-
-this.dispatchEventToListeners("collapsed");
 },
 
 collapseRecursively: function()
@@ -19473,6 +21282,8 @@
 }
 },
 
+populate: function() { },
+
 expand: function()
 {
 if (!this.hasChildren || this.expanded)
@@ -19488,7 +21299,7 @@
 for (var i = 0; i < this.children.length; ++i)
 this.children[i]._detach();
 
-this.dispatchEventToListeners("populate");
+this.populate();
 
 if (this._attached) {
 for (var i = 0; i < this.children.length; ++i) {
@@ -19506,8 +21317,6 @@
 this._element.addStyleClass("expanded");
 
 this._expanded = true;
-
-this.dispatchEventToListeners("expanded");
 },
 
 expandRecursively: function()
@@ -19531,8 +21340,6 @@
 }
 
 this.element.scrollIntoViewIfNeeded(false);
-
-this.dispatchEventToListeners("revealed");
 },
 
 
@@ -19550,10 +21357,8 @@
 if (this._element)
 this._element.addStyleClass("selected");
 
-if (!supressSelectedEvent) {
-this.dispatchEventToListeners("selected");
+if (!supressSelectedEvent)
 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.SelectedNode);
-}
 },
 
 revealAndSelect: function()
@@ -19576,16 +21381,15 @@
 if (this._element)
 this._element.removeStyleClass("selected");
 
-if (!supressDeselectedEvent) {
-this.dispatchEventToListeners("deselected");
+if (!supressDeselectedEvent)
 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.DeselectedNode);
-}
 },
 
+
 traverseNextNode: function(skipHidden, stayWithin, dontPopulate, info)
 {
 if (!dontPopulate && this.hasChildren)
-this.dispatchEventToListeners("populate");
+this.populate();
 
 if (info)
 info.depthChange = 0;
@@ -19617,15 +21421,16 @@
 return (!skipHidden || node.revealed) ? node.nextSibling : null;
 },
 
+
 traversePreviousNode: function(skipHidden, dontPopulate)
 {
 var node = (!skipHidden || this.revealed) ? this.previousSibling : null;
 if (!dontPopulate && node && node.hasChildren)
-node.dispatchEventToListeners("populate");
+node.populate();
 
 while (node && ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null)) {
 if (!dontPopulate && node.hasChildren)
-node.dispatchEventToListeners("populate");
+node.populate();
 node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null);
 }
 
@@ -19638,6 +21443,7 @@
 return this.parent;
 },
 
+
 isEventWithinDisclosureTriangle: function(event)
 {
 if (!this.hasChildren)
@@ -19847,45 +21653,35 @@
 
 
 
-WebInspector.CookiesTable = function(expandable, deleteCallback, refreshCallback)
+WebInspector.CookiesTable = function(expandable, refreshCallback, selectedCallback)
 {
 WebInspector.View.call(this);
 this.element.className = "fill";
 
-var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
-columns[0].title = WebInspector.UIString("Name");
-columns[0].sortable = true;
-columns[0].disclosure = expandable;
-columns[0].width = "24%";
-columns[0].sort = "ascending";
-columns[1].title = WebInspector.UIString("Value");
-columns[1].sortable = true;
-columns[1].width = "34%";
-columns[2].title = WebInspector.UIString("Domain");
-columns[2].sortable = true;
-columns[2].width = "7%";
-columns[3].title = WebInspector.UIString("Path");
-columns[3].sortable = true;
-columns[3].width = "7%";
-columns[4].title = WebInspector.UIString("Expires / Max-Age");
-columns[4].sortable = true;
-columns[4].width = "7%";
-columns[5].title = WebInspector.UIString("Size");
-columns[5].aligned = "right";
-columns[5].sortable = true;
-columns[5].width = "7%";
-columns[6].title = WebInspector.UIString("HTTP");
-columns[6].aligned = "centered";
-columns[6].sortable = true;
-columns[6].width = "7%";
-columns[7].title = WebInspector.UIString("Secure");
-columns[7].aligned = "centered";
-columns[7].sortable = true;
-columns[7].width = "7%";
+var readOnly = expandable;
+this._refreshCallback = refreshCallback;
 
-this._dataGrid = new WebInspector.DataGrid(columns, undefined, deleteCallback ? this._onDeleteFromGrid.bind(this, deleteCallback) : undefined);
-this._dataGrid.addEventListener("sorting changed", this._rebuildTable, this);
-this._dataGrid.refreshCallback = refreshCallback;
+var columns = [
+{id: "name", title: WebInspector.UIString("Name"), sortable: true, disclosure: expandable, sort: WebInspector.DataGrid.Order.Ascending, longText: true, weight: 24},
+{id: "value", title: WebInspector.UIString("Value"), sortable: true, longText: true, weight: 34},
+{id: "domain", title: WebInspector.UIString("Domain"), sortable: true, weight: 7},
+{id: "path", title: WebInspector.UIString("Path"), sortable: true, weight: 7},
+{id: "expires", title: WebInspector.UIString("Expires / Max-Age"), sortable: true, weight: 7},
+{id: "size", title: WebInspector.UIString("Size"), sortable: true, align: WebInspector.DataGrid.Align.Right, weight: 7},
+{id: "httpOnly", title: WebInspector.UIString("HTTP"), sortable: true, align: WebInspector.DataGrid.Align.Center, weight: 7},
+{id: "secure", title: WebInspector.UIString("Secure"), sortable: true, align: WebInspector.DataGrid.Align.Center, weight: 7}
+];
+
+if (readOnly)
+this._dataGrid = new WebInspector.DataGrid(columns);
+else
+this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onDeleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this));
+
+this._dataGrid.setName("cookiesTable");
+this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this);
+
+if (selectedCallback)
+this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, selectedCallback, this);
 
 this._nextSelectedCookie =   (null);
 
@@ -19894,22 +21690,35 @@
 }
 
 WebInspector.CookiesTable.prototype = {
-updateWidths: function()
+
+_clearAndRefresh: function(domain)
 {
-if (this._dataGrid)
-this._dataGrid.updateWidths();
+this.clear(domain);
+this._refresh();
 },
 
+
+_onContextMenu: function(contextMenu, node)
+{
+if (node === this._dataGrid.creationNode)
+return;
+var cookie = node.cookie;
+var domain = cookie.domain();
+if (domain)
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all from \"%s\"" : "Clear All from \"%s\"", domain), this._clearAndRefresh.bind(this, domain));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all" : "Clear All"), this._clearAndRefresh.bind(this, null));
+},
+
+
 setCookies: function(cookies)
 {
-this._data = [{cookies: cookies}];
-this._rebuildTable();
+this.setCookieFolders([{cookies: cookies}]);
 },
 
 
-addCookiesFolder: function(folderName, cookies)
+setCookieFolders: function(cookieFolders)
 {
-this._data.push({cookies: cookies, folderName: folderName});
+this._data = cookieFolders;
 this._rebuildTable();
 },
 
@@ -19920,6 +21729,18 @@
 return node ? node.cookie : null;
 },
 
+
+clear: function(domain)
+{
+for (var i = 0, length = this._data.length; i < length; ++i) {
+var cookies = this._data[i].cookies;
+for (var j = 0, cookieCount = cookies.length; j < cookieCount; ++j) {
+if (!domain || cookies[j].domain() === domain)
+cookies[j].remove();
+}
+}
+},
+
 _rebuildTable: function()
 {
 var selectedCookie = this._nextSelectedCookie || this.selectedCookie();
@@ -19928,7 +21749,7 @@
 for (var i = 0; i < this._data.length; ++i) {
 var item = this._data[i];
 if (item.folderName) {
-var groupData = [ item.folderName, "", "", "", "", this._totalSize(item.cookies), "", "" ];
+var groupData = {name: item.folderName, value: "", domain: "", path: "", expires: "", size: this._totalSize(item.cookies), httpOnly: "", secure: ""};
 var groupNode = new WebInspector.DataGridNode(groupData);
 groupNode.selectable = true;
 this._dataGrid.rootNode().appendChild(groupNode);
@@ -19968,11 +21789,11 @@
 
 _sortCookies: function(cookies)
 {
-var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1;
 
-function localeCompare(getter, cookie1, cookie2)
+function compareTo(getter, cookie1, cookie2)
 {
-return sortDirection * (getter.apply(cookie1) + "").localeCompare(getter.apply(cookie2) + "")
+return sortDirection * (getter.apply(cookie1) + "").compareTo(getter.apply(cookie2) + "")
 }
 
 function numberCompare(getter, cookie1, cookie2)
@@ -19996,16 +21817,16 @@
 }
 
 var comparator;
-switch (parseInt(this._dataGrid.sortColumnIdentifier, 10)) {
-case 0: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.name); break;
-case 1: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.value); break;
-case 2: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.domain); break;
-case 3: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.path); break;
-case 4: comparator = expiresCompare; break;
-case 5: comparator = numberCompare.bind(null, WebInspector.Cookie.prototype.size); break;
-case 6: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.httpOnly); break;
-case 7: comparator = localeCompare.bind(null, WebInspector.Cookie.prototype.secure); break;
-default: localeCompare.bind(null, WebInspector.Cookie.prototype.name);
+switch (this._dataGrid.sortColumnIdentifier()) {
+case "name": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.name); break;
+case "value": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.value); break;
+case "domain": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.domain); break;
+case "path": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.path); break;
+case "expires": comparator = expiresCompare; break;
+case "size": comparator = numberCompare.bind(null, WebInspector.Cookie.prototype.size); break;
+case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.httpOnly); break;
+case "secure": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.secure); break;
+default: compareTo.bind(null, WebInspector.Cookie.prototype.name);
 }
 
 cookies.sort(comparator);
@@ -20015,22 +21836,22 @@
 _createGridNode: function(cookie)
 {
 var data = {};
-data[0] = cookie.name();
-data[1] = cookie.value();
-data[2] = cookie.domain() || "";
-data[3] = cookie.path() || "";
+data.name = cookie.name();
+data.value = cookie.value();
+data.domain = cookie.domain() || "";
+data.path = cookie.path() || "";
 if (cookie.type() === WebInspector.Cookie.Type.Request)
-data[4] = "";
+data.expires = "";
 else if (cookie.maxAge())
-data[4] = Number.secondsToString(parseInt(cookie.maxAge(), 10));
+data.expires = Number.secondsToString(parseInt(cookie.maxAge(), 10));
 else if (cookie.expires())
-data[4] = new Date(cookie.expires()).toGMTString();
+data.expires = new Date(cookie.expires()).toGMTString();
 else
-data[4] = WebInspector.UIString("Session");
-data[5] = cookie.size();
+data.expires = WebInspector.UIString("Session");
+data.size = cookie.size();
 const checkmark = "\u2713";
-data[6] = (cookie.httpOnly() ? checkmark : "");
-data[7] = (cookie.secure() ? checkmark : "");
+data.httpOnly = (cookie.httpOnly() ? checkmark : "");
+data.secure = (cookie.secure() ? checkmark : "");
 
 var node = new WebInspector.DataGridNode(data);
 node.cookie = cookie;
@@ -20038,13 +21859,20 @@
 return node;
 },
 
-_onDeleteFromGrid: function(deleteCallback, node)
+_onDeleteCookie: function(node)
 {
 var cookie = node.cookie;
 var neighbour = node.traverseNextNode() || node.traversePreviousNode();
 if (neighbour)
 this._nextSelectedCookie = neighbour.cookie;
-deleteCallback(cookie);
+cookie.remove();
+this._refresh();
+},
+
+_refresh: function()
+{
+if (this._refreshCallback)
+this._refreshCallback();
 },
 
 __proto__: WebInspector.View.prototype
@@ -20065,6 +21893,10 @@
 this._deleteButton.visible = false;
 this._deleteButton.addEventListener("click", this._deleteButtonClicked, this);
 
+this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-storage-status-bar-item");
+this._clearButton.visible = false;
+this._clearButton.addEventListener("click", this._clearButtonClicked, this);
+
 this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
 this._refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 
@@ -20080,7 +21912,7 @@
 WebInspector.CookieItemsView.prototype = {
 get statusBarItems()
 {
-return [this._refreshButton.element, this._deleteButton.element];
+return [this._refreshButton.element, this._clearButton.element, this._deleteButton.element];
 },
 
 wasShown: function()
@@ -20099,13 +21931,14 @@
 },
 
 
-_updateWithCookies: function(allCookies, isAdvanced)
+_updateWithCookies: function(allCookies)
 {
-this._cookies = isAdvanced ? this._filterCookiesForDomain(allCookies) : allCookies;
+this._cookies = this._filterCookiesForDomain(allCookies);
 
 if (!this._cookies.length) {
 
 this._emptyView.show(this.element);
+this._clearButton.visible = false;
 this._deleteButton.visible = false;
 if (this._cookiesTable)
 this._cookiesTable.detach();
@@ -20113,16 +21946,15 @@
 }
 
 if (!this._cookiesTable)
-this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(false, this._deleteCookie.bind(this), this._update.bind(this)) : new WebInspector.SimpleCookiesTable();
+this._cookiesTable = new WebInspector.CookiesTable(false, this._update.bind(this), this._showDeleteButton.bind(this));
 
 this._cookiesTable.setCookies(this._cookies);
 this._emptyView.detach();
 this._cookiesTable.show(this.element);
-if (isAdvanced) {
 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
 Number.bytesToString(this._totalSize));
-this._deleteButton.visible = true;
-}
+this._clearButton.visible = true;
+this._deleteButton.visible = !!this._cookiesTable.selectedCookie();
 },
 
 
@@ -20157,18 +21989,29 @@
 return cookies;
 },
 
-
-_deleteCookie: function(cookie)
+clear: function()
 {
-PageAgent.deleteCookie(cookie.name(), this._cookieDomain);
+this._cookiesTable.clear();
 this._update();
 },
 
+_clearButtonClicked: function()
+{
+this.clear();
+},
+
+_showDeleteButton: function()
+{
+this._deleteButton.visible = true;
+},
+
 _deleteButtonClicked: function()
 {
 var selectedCookie = this._cookiesTable.selectedCookie();
-if (selectedCookie)
-this._deleteCookie(selectedCookie);
+if (selectedCookie) {
+selectedCookie.remove();
+this._update();
+}
 },
 
 _refreshButtonClicked: function(event)
@@ -20189,46 +22032,6 @@
 }
 
 
-WebInspector.SimpleCookiesTable = function()
-{
-WebInspector.View.call(this);
-
-var columns = {};
-columns[0] = {};
-columns[1] = {};
-columns[0].title = WebInspector.UIString("Name");
-columns[1].title = WebInspector.UIString("Value");
-
-this._dataGrid = new WebInspector.DataGrid(columns);
-this._dataGrid.autoSizeColumns(20, 80);
-this._dataGrid.show(this.element);
-}
-
-WebInspector.SimpleCookiesTable.prototype = {
-
-setCookies: function(cookies)
-{
-this._dataGrid.rootNode().removeChildren();
-var addedCookies = {};
-for (var i = 0; i < cookies.length; ++i) {
-if (addedCookies[cookies[i].name()])
-continue;
-addedCookies[cookies[i].name()] = true;
-var data = {};
-data[0] = cookies[i].name();
-data[1] = cookies[i].value();
-
-var node = new WebInspector.DataGridNode(data, false);
-node.selectable = true;
-this._dataGrid.rootNode().appendChild(node);
-}
-this._dataGrid.rootNode().children[0].selected = true;
-},
-
-__proto__: WebInspector.View.prototype
-}
-
-
 
 
 
@@ -20423,16 +22226,12 @@
 {
 IndexedDBAgent.enable();
 
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameNavigated, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
 
-this._frames = {};
 this._databases = new Map();
-this._frameIdsBySecurityOrigin = {};
 this._databaseNamesBySecurityOrigin = {};
-
-this.refreshDatabaseNames();
+this._reset();
 }
 
 WebInspector.IndexedDBModel.KeyTypes = {
@@ -20528,11 +22327,19 @@
 }
 
 WebInspector.IndexedDBModel.prototype = {
+_reset: function()
+{
+for (var securityOrigin in this._databaseNamesBySecurityOrigin)
+this._removeOrigin(securityOrigin);
+var securityOrigins = WebInspector.resourceTreeModel.securityOrigins();
+for (var i = 0; i < securityOrigins.length; ++i)
+this._addOrigin(securityOrigins[i]);
+},
+
 refreshDatabaseNames: function()
 {
-this._reset();
-if (WebInspector.resourceTreeModel.mainFrame)
-this._framesNavigatedRecursively(WebInspector.resourceTreeModel.mainFrame);
+for (var securityOrigin in this._databaseNamesBySecurityOrigin)
+this._loadDatabaseNames(securityOrigin);
 },
 
 
@@ -20542,82 +22349,37 @@
 },
 
 
-_framesNavigatedRecursively: function(resourceTreeFrame)
+clearObjectStore: function(databaseId, objectStoreName, callback)
 {
-this._processFrameNavigated(resourceTreeFrame);
-for (var i = 0; i < resourceTreeFrame.childFrames.length; ++i)
-this._framesNavigatedRecursively(resourceTreeFrame.childFrames[i]);
+IndexedDBAgent.clearObjectStore(databaseId.securityOrigin, databaseId.name, objectStoreName, callback);
 },
 
 
-_frameNavigated: function(event)
+_securityOriginAdded: function(event)
 {
-var resourceTreeFrame =   (event.data);
-this._processFrameNavigated(resourceTreeFrame);
+var securityOrigin =   (event.data);
+this._addOrigin(securityOrigin);
 },
 
 
-_frameDetached: function(event)
+_securityOriginRemoved: function(event)
 {
-var resourceTreeFrame =   (event.data);
-this._originRemovedFromFrame(resourceTreeFrame.id);
-},
-
-_reset: function()
-{
-for (var frameId in this._frames)
-this._originRemovedFromFrame(frameId);
+var securityOrigin =   (event.data);
+this._removeOrigin(securityOrigin);
 },
 
 
-_processFrameNavigated: function(resourceTreeFrame)
+_addOrigin: function(securityOrigin)
 {
-if (resourceTreeFrame.securityOrigin === "null")
-return;
-if (this._frameIdsBySecurityOrigin[resourceTreeFrame.securityOrigin])
-this._originAddedToFrame(resourceTreeFrame.id, resourceTreeFrame.securityOrigin);
-else
-this._loadDatabaseNamesForFrame(resourceTreeFrame.id);
-},
-
-
-_originAddedToFrame: function(frameId, securityOrigin)
-{
-if (!this._frameIdsBySecurityOrigin[securityOrigin]) {
-this._frameIdsBySecurityOrigin[securityOrigin] = [];
-this._frameIdsBySecurityOrigin[securityOrigin].push(frameId);
+console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);
 this._databaseNamesBySecurityOrigin[securityOrigin] = [];
-}
-this._frames[frameId] = new WebInspector.IndexedDBModel.Frame(frameId, securityOrigin);
+this._loadDatabaseNames(securityOrigin);
 },
 
 
-_originRemovedFromFrame: function(frameId)
+_removeOrigin: function(securityOrigin)
 {
-var currentSecurityOrigin = this._frames[frameId] ? this._frames[frameId].securityOrigin : null;
-if (!currentSecurityOrigin)
-return;
-
-delete this._frames[frameId];
-
-var frameIdsForOrigin = this._frameIdsBySecurityOrigin[currentSecurityOrigin];
-for (var i = 0; i < frameIdsForOrigin; ++i) {
-if (frameIdsForOrigin[i] === frameId) {
-frameIdsForOrigin.splice(i, 1);
-break;
-}
-}
-if (!frameIdsForOrigin.length)
-this._originRemoved(currentSecurityOrigin);
-},
-
-
-_originRemoved: function(securityOrigin)
-{
-var frameIdsForOrigin = this._frameIdsBySecurityOrigin[securityOrigin];
-for (var i = 0; i < frameIdsForOrigin; ++i)
-delete this._frames[frameIdsForOrigin[i]];
-delete this._frameIdsBySecurityOrigin[securityOrigin];
+console.assert(this._databaseNamesBySecurityOrigin[securityOrigin]);
 for (var i = 0; i < this._databaseNamesBySecurityOrigin[securityOrigin].length; ++i)
 this._databaseRemoved(securityOrigin, this._databaseNamesBySecurityOrigin[securityOrigin][i]);
 delete this._databaseNamesBySecurityOrigin[securityOrigin];
@@ -20631,7 +22393,7 @@
 newDatabaseNames[databaseNames[i]] = true;
 var oldDatabaseNames = {};
 for (var i = 0; i < this._databaseNamesBySecurityOrigin[securityOrigin].length; ++i)
-oldDatabaseNames[databaseNames[i]] = true;
+oldDatabaseNames[this._databaseNamesBySecurityOrigin[securityOrigin][i]] = true;
 
 this._databaseNamesBySecurityOrigin[securityOrigin] = databaseNames;
 
@@ -20643,9 +22405,6 @@
 if (!oldDatabaseNames[databaseName])
 this._databaseAdded(securityOrigin, databaseName);
 }
-
-if (!this._databaseNamesBySecurityOrigin[securityOrigin].length)
-this._originRemoved(securityOrigin);
 },
 
 
@@ -20663,45 +22422,27 @@
 },
 
 
-_loadDatabaseNamesForFrame: function(frameId)
+_loadDatabaseNames: function(securityOrigin)
 {
 
-function callback(error, securityOriginWithDatabaseNames)
+function callback(error, databaseNames)
 {
 if (error) {
 console.error("IndexedDBAgent error: " + error);
 return;
 }
 
-var databaseNames = securityOriginWithDatabaseNames.databaseNames;
-var oldSecurityOrigin = this._frames[frameId] ? this._frames[frameId].securityOrigin : null;
-if (!oldSecurityOrigin || oldSecurityOrigin !== securityOriginWithDatabaseNames.securityOrigin) {
-this._originRemovedFromFrame(frameId);
-this._originAddedToFrame(frameId, securityOriginWithDatabaseNames.securityOrigin);
-}
-this._updateOriginDatabaseNames(securityOriginWithDatabaseNames.securityOrigin, securityOriginWithDatabaseNames.databaseNames);
+if (!this._databaseNamesBySecurityOrigin[securityOrigin])
+return;
+this._updateOriginDatabaseNames(securityOrigin, databaseNames);
 }
 
-IndexedDBAgent.requestDatabaseNamesForFrame(frameId, callback.bind(this));
-},
-
-
-_assertFrameId: function(databaseId)
-{
-var frameIds = this._frameIdsBySecurityOrigin[databaseId.securityOrigin];
-if (!frameIds || !frameIds.length)
-return null;
-
-return frameIds[0];
+IndexedDBAgent.requestDatabaseNames(securityOrigin, callback.bind(this));
 },
 
 
 _loadDatabase: function(databaseId)
 {
-var frameId = this._assertFrameId(databaseId);
-if (!frameId)
-return;
-
 
 function callback(error, databaseWithObjectStores)
 {
@@ -20710,11 +22451,10 @@
 return;
 }
 
-if (!this._frames[frameId])
+if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
 return;
-
 var databaseModel = new WebInspector.IndexedDBModel.Database(databaseId, databaseWithObjectStores.version, databaseWithObjectStores.intVersion);
-this._databases.put(databaseId, databaseModel); 
+this._databases.put(databaseId, databaseModel);
 for (var i = 0; i < databaseWithObjectStores.objectStores.length; ++i) {
 var objectStore = databaseWithObjectStores.objectStores[i];
 var objectStoreIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);
@@ -20731,7 +22471,7 @@
 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseLoaded, databaseModel);
 }
 
-IndexedDBAgent.requestDatabase(frameId, databaseId.name, callback.bind(this));
+IndexedDBAgent.requestDatabase(databaseId.securityOrigin, databaseId.name, callback.bind(this));
 },
 
 
@@ -20749,10 +22489,6 @@
 
 _requestData: function(databaseId, databaseName, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback)
 {
-var frameId = this._assertFrameId(databaseId);
-if (!frameId)
-return;
-
 
 function innerCallback(error, dataEntries, hasMore)
 {
@@ -20761,9 +22497,8 @@
 return;
 }
 
-if (!this._frames[frameId])
+if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
 return;
-
 var entries = [];
 for (var i = 0; i < dataEntries.length; ++i) {
 var key = WebInspector.RemoteObject.fromPayload(dataEntries[i].key);
@@ -20775,7 +22510,7 @@
 }
 
 var keyRange = WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);
-IndexedDBAgent.requestData(frameId, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange ? keyRange : undefined, innerCallback.bind(this));
+IndexedDBAgent.requestData(databaseId.securityOrigin, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange ? keyRange : undefined, innerCallback.bind(this));
 },
 
 __proto__: WebInspector.Object.prototype
@@ -20790,14 +22525,6 @@
 }
 
 
-WebInspector.IndexedDBModel.Frame = function(frameId, securityOrigin)
-{
-this.frameId = frameId;
-this.securityOrigin = securityOrigin;
-this.databaseNames = {};
-}
-
-
 WebInspector.IndexedDBModel.DatabaseId = function(securityOrigin, name)
 {
 this.securityOrigin = securityOrigin;
@@ -20900,7 +22627,7 @@
 
 function hueDrag(element, dragX, dragY)
 {
-this.hsv[0] = (dragY / this.slideHeight);
+this._hsv[0] = dragY / this.slideHeight;
 
 this._onchange();
 }
@@ -20921,15 +22648,15 @@
 dragX = initialHelperOffset.x;
 }
 
-this.hsv[1] = dragX / this.dragWidth;
-this.hsv[2] = (this.dragHeight - dragY) / this.dragHeight;
+this._hsv[1] = dragX / this.dragWidth;
+this._hsv[2] = (this.dragHeight - dragY) / this.dragHeight;
 
 this._onchange();
 }
 
 function alphaDrag()
 {
-this.hsv[3] = this._alphaElement.value / 100;
+this._hsv[3] = this._alphaElement.value / 100;
 
 this._onchange();
 }
@@ -20939,76 +22666,6 @@
 ColorChanged: "ColorChanged"
 };
 
-WebInspector.Spectrum.hsvaToRGBA = function(h, s, v, a)
-{
-var r, g, b;
-
-var i = Math.floor(h * 6);
-var f = h * 6 - i;
-var p = v * (1 - s);
-var q = v * (1 - f * s);
-var t = v * (1 - (1 - f) * s);
-
-switch(i % 6) {
-case 0:
-r = v, g = t, b = p;
-break;
-case 1:
-r = q, g = v, b = p;
-break;
-case 2:
-r = p, g = v, b = t;
-break;
-case 3:
-r = p, g = q, b = v;
-break;
-case 4:
-r = t, g = p, b = v;
-break;
-case 5:
-r = v, g = p, b = q;
-break;
-}
-
-return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a];
-};
-
-WebInspector.Spectrum.rgbaToHSVA = function(r, g, b, a)
-{
-r = r / 255;
-g = g / 255;
-b = b / 255;
-
-var max = Math.max(r, g, b);
-var min = Math.min(r, g, b);
-var h;
-var s;
-var v = max;
-
-var d = max - min;
-s = max ? d / max : 0;
-
-if(max === min) {
-
-h = 0;
-} else {
-switch(max) {
-case r:
-h = (g - b) / d + (g < b ? 6 : 0);
-break;
-case g:
-h = (b - r) / d + 2;
-break;
-case b:
-h = (r - g) / d + 4;
-break;
-}
-h /= 6;
-}
-return [h, s, v, a];
-};
-
-
 
 WebInspector.Spectrum.draggable = function(element, onmove, onstart, onstop) {
 
@@ -21081,38 +22738,23 @@
 
 WebInspector.Spectrum.prototype = {
 
-set color(color)
+setColor: function(color)
 {
-var rgba = (color.rgba || color.rgb).slice(0);
-
-if (rgba.length === 3)
-rgba[3] = 1;
-
-this.hsv = WebInspector.Spectrum.rgbaToHSVA(rgba[0], rgba[1], rgba[2], rgba[3]);
+this._hsv = color.hsva();
 },
 
-get color()
+
+color: function()
 {
-var rgba = WebInspector.Spectrum.hsvaToRGBA(this.hsv[0], this.hsv[1], this.hsv[2], this.hsv[3]);
-var color;
-
-if (rgba[3] === 1)
-color = WebInspector.Color.fromRGB(rgba[0], rgba[1], rgba[2]);
-else
-color = WebInspector.Color.fromRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
-
-var colorValue = color.toString(this.outputColorFormat);
-if (!colorValue)
-colorValue = color.toString(); 
-return new WebInspector.Color(colorValue);
+return WebInspector.Color.fromHSVA(this._hsv, this._outputColorFormat());
 },
 
-get outputColorFormat()
+_outputColorFormat: function()
 {
 var cf = WebInspector.Color.Format;
 var format = this._originalFormat;
 
-if (this.hsv[3] === 1) {
+if (this._hsv[3] === 1) {
 
 if (format === cf.RGBA)
 format = cf.RGB;
@@ -21129,11 +22771,6 @@
 return format;
 },
 
-get colorHueOnly()
-{
-var rgba = WebInspector.Spectrum.hsvaToRGBA(this.hsv[0], 1, 1, 1);
-return WebInspector.Color.fromRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
-},
 
 set displayText(text)
 {
@@ -21143,14 +22780,14 @@
 _onchange: function()
 {
 this._updateUI();
-this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged, this.color);
+this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged, this.color());
 },
 
 _updateHelperLocations: function()
 {
-var h = this.hsv[0];
-var s = this.hsv[1];
-var v = this.hsv[2];
+var h = this._hsv[0];
+var s = this._hsv[1];
+var v = this._hsv[2];
 
 
 var dragX = s * this.dragWidth;
@@ -21167,27 +22804,17 @@
 var slideY = (h * this.slideHeight) - this.slideHelperHeight;
 this.slideHelper.style.top = slideY + "px";
 
-this._alphaElement.value = this.hsv[3] * 100;
+this._alphaElement.value = this._hsv[3] * 100;
 },
 
 _updateUI: function()
 {
 this._updateHelperLocations();
 
-var rgb = (this.color.rgba || this.color.rgb).slice(0);
+this._draggerElement.style.backgroundColor = WebInspector.Color.fromHSVA([this._hsv[0], 1, 1, 1]).toString(WebInspector.Color.Format.RGB);
+this._swatchInnerElement.style.backgroundColor = this.color().toString(WebInspector.Color.Format.RGB);
 
-if (rgb.length === 3)
-rgb[3] = 1;
-
-var rgbHueOnly = this.colorHueOnly.rgb;
-
-var flatColor = "rgb(" + rgbHueOnly[0] + ", " + rgbHueOnly[1] + ", " + rgbHueOnly[2] + ")";
-var fullColor = "rgba(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ", " + rgb[3] + ")";
-
-this._draggerElement.style.backgroundColor = flatColor;
-this._swatchInnerElement.style.backgroundColor = fullColor;
-
-this._alphaElement.value = this.hsv[3] * 100;
+this._alphaElement.value = this._hsv[3] * 100;
 },
 
 wasShown: function()
@@ -21249,8 +22876,8 @@
 
 this._anchorElement = element;
 
-this._spectrum.color = color;
-this._spectrum._originalFormat = format || color.format;
+this._spectrum.setColor(color);
+this._spectrum._originalFormat = format !== WebInspector.Color.Format.Original ? format : color.format();
 this.reposition(element);
 
 document.addEventListener("mousedown", this._hideProxy, false);
@@ -21326,109 +22953,152 @@
 
 WebInspector.SidebarPane = function(title)
 {
-this.element = document.createElement("div");
-this.element.className = "pane";
+WebInspector.View.call(this);
+this.element.className = "sidebar-pane";
 
 this.titleElement = document.createElement("div");
-this.titleElement.className = "title";
-this.titleElement.tabIndex = 0;
-this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false);
-this.titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
+this.titleElement.className = "sidebar-pane-toolbar";
 
-this.bodyElement = document.createElement("div");
-this.bodyElement.className = "body";
+this.bodyElement = this.element.createChild("div", "body");
 
-this.element.appendChild(this.titleElement);
-this.element.appendChild(this.bodyElement);
+this._title = title;
 
-this.title = title;
-this.growbarVisible = false;
-this.expanded = false;
+this._expandCallback = null;
+}
+
+WebInspector.SidebarPane.EventTypes = {
+wasShown: "wasShown"
 }
 
 WebInspector.SidebarPane.prototype = {
-get title()
+title: function()
 {
 return this._title;
 },
 
-set title(x)
+
+prepareContent: function(callback)
 {
-if (this._title === x)
-return;
-this._title = x;
-this.titleElement.textContent = x;
-},
-
-get growbarVisible()
-{
-return this._growbarVisible;
-},
-
-set growbarVisible(x)
-{
-if (this._growbarVisible === x)
-return;
-
-this._growbarVisible = x;
-
-if (x && !this._growbarElement) {
-this._growbarElement = document.createElement("div");
-this._growbarElement.className = "growbar";
-this.element.appendChild(this._growbarElement);
-} else if (!x && this._growbarElement) {
-if (this._growbarElement.parentNode)
-this._growbarElement.parentNode(this._growbarElement);
-delete this._growbarElement;
-}
-},
-
-get expanded()
-{
-return this._expanded;
-},
-
-set expanded(x)
-{
-if (x)
-this.expand();
-else
-this.collapse();
+if (callback)
+callback();
 },
 
 expand: function()
 {
-if (this._expanded)
-return;
-this._expanded = true;
+this.prepareContent(this.onContentReady.bind(this));
+},
+
+onContentReady: function()
+{
+if (this._expandCallback)
+this._expandCallback();
+else
+this._expandPending = true;
+},
+
+
+setExpandCallback: function(callback)
+{
+this._expandCallback = callback;
+if (this._expandPending) {
+delete this._expandPending;
+this._expandCallback();
+}
+},
+
+wasShown: function()
+{
+WebInspector.View.prototype.wasShown.call(this);
+this.dispatchEventToListeners(WebInspector.SidebarPane.EventTypes.wasShown);
+},
+
+__proto__: WebInspector.View.prototype
+}
+
+
+WebInspector.SidebarPaneTitle = function(container, pane)
+{
+this._pane = pane;
+
+this.element = container.createChild("div", "sidebar-pane-title");
+this.element.textContent = pane.title();
+this.element.tabIndex = 0;
+this.element.addEventListener("click", this._toggleExpanded.bind(this), false);
+this.element.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
+this.element.appendChild(this._pane.titleElement);
+
+this._pane.setExpandCallback(this._expand.bind(this));
+}
+
+WebInspector.SidebarPaneTitle.prototype = {
+
+_expand: function()
+{
 this.element.addStyleClass("expanded");
-this.onexpand();
+this._pane.show(this.element.parentNode, this.element.nextSibling);
 },
 
-onexpand: function()
+_collapse: function()
 {
-},
-
-collapse: function()
-{
-if (!this._expanded)
-return;
-this._expanded = false;
 this.element.removeStyleClass("expanded");
+if (this._pane.element.parentNode == this.element.parentNode)
+this._pane.detach();
 },
 
-toggleExpanded: function()
+_toggleExpanded: function()
 {
-this.expanded = !this.expanded;
+if (this.element.hasStyleClass("expanded"))
+this._collapse();
+else
+this._pane.expand();
 },
 
+
 _onTitleKeyDown: function(event)
 {
 if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code)
-this.toggleExpanded();
+this._toggleExpanded();
+}
+}
+
+
+WebInspector.SidebarPaneStack = function()
+{
+WebInspector.View.call(this);
+this.element.className = "sidebar-pane-stack fill";
+this.registerRequiredCSS("sidebarPane.css");
+}
+
+WebInspector.SidebarPaneStack.prototype = {
+
+addPane: function(pane)
+{
+new WebInspector.SidebarPaneTitle(this.element, pane);
 },
 
-__proto__: WebInspector.Object.prototype
+__proto__: WebInspector.View.prototype
+}
+
+
+WebInspector.SidebarTabbedPane = function()
+{
+WebInspector.TabbedPane.call(this);
+this.element.addStyleClass("sidebar-tabbed-pane");
+this.registerRequiredCSS("sidebarPane.css");
+}
+
+WebInspector.SidebarTabbedPane.prototype = {
+
+addPane: function(pane)
+{
+var title = pane.title();
+this.appendTab(title, title, pane);
+pane.element.appendChild(pane.titleElement);
+pane.setExpandCallback(this.selectTab.bind(this, title));
+
+},
+
+__proto__: WebInspector.TabbedPane.prototype
 }
 
 
@@ -21439,6 +23109,7 @@
 WebInspector.ElementsTreeOutline = function(omitRootDOMNode, selectEnabled, showInElementsPanelEnabled, contextMenuCallback, setPseudoClassCallback)
 {
 this.element = document.createElement("ol");
+this.element.className = "elements-tree-outline";
 this.element.addEventListener("mousedown", this._onmousedown.bind(this), false);
 this.element.addEventListener("mousemove", this._onmousemove.bind(this), false);
 this.element.addEventListener("mouseout", this._onmouseout.bind(this), false);
@@ -21565,6 +23236,18 @@
 this._selectedNodeChanged();
 },
 
+
+editing: function()
+{
+var node = this.selectedDOMNode();
+if (!node)
+return false;
+var treeElement = this.findTreeElement(node);
+if (!treeElement)
+return false;
+return treeElement._editing || false;
+},
+
 update: function()
 {
 var selectedNode = this.selectedTreeElement ? this.selectedTreeElement.representedObject : null;
@@ -21874,7 +23557,7 @@
 return;
 
 if (!treeElement._editing && WebInspector.KeyboardShortcut.hasNoModifiers(keyboardEvent) && keyboardEvent.keyCode === WebInspector.KeyboardShortcut.Keys.H.code) {
-WebInspector.cssModel.toggleInlineVisibility(node.id);
+this._toggleHideShortcut(node);
 event.consume(true);
 return;
 }
@@ -21896,7 +23579,7 @@
 WebInspector.domAgent.inspectElement(treeElement.representedObject.id);
 }
 var contextMenu = new WebInspector.ContextMenu(event);
-contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Elements panel" : "Reveal in Elements Panel"), focusElement.bind(this));
 contextMenu.show();
 },
 
@@ -21904,7 +23587,7 @@
 {
 var treeElement = this._treeElementFromEvent(event);
 if (!treeElement)
-return false;
+return;
 
 var isTag = treeElement.representedObject.nodeType() === Node.ELEMENT_NODE;
 var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
@@ -22001,6 +23684,40 @@
 return newTreeItem;
 },
 
+
+_toggleHideShortcut: function(node, userCallback)
+{
+function resolvedNode(object)
+{
+if (!object)
+return;
+
+function toggleClassAndInjectStyleRule()
+{
+const className = "__web-inspector-hide-shortcut__";
+const styleTagId = "__web-inspector-hide-shortcut-style__";
+const styleRule = ".__web-inspector-hide-shortcut__, .__web-inspector-hide-shortcut__ * { visibility: hidden !important; }";
+
+this.classList.toggle(className);
+
+var style = document.head.querySelector("style#" + styleTagId);
+if (style)
+return;
+
+style = document.createElement("style");
+style.id = styleTagId;
+style.type = "text/css";
+style.innerHTML = styleRule;
+document.head.appendChild(style);
+}
+
+object.callFunction(toggleClassAndInjectStyleRule, undefined, userCallback);
+object.release();
+}
+
+WebInspector.RemoteObject.resolveNode(node, "", resolvedNode);
+},
+
 __proto__: TreeOutline.prototype
 }
 
@@ -22420,6 +24137,16 @@
 this.expandedChildrenLimit = Math.max(this.representedObject._childNodeCount, this.expandedChildrenLimit + WebInspector.ElementsTreeElement.InitialChildrenLimit);
 },
 
+expandRecursively: function()
+{
+function callback()
+{
+TreeElement.prototype.expandRecursively.call(this, Number.MAX_VALUE);
+}
+
+this.representedObject.getSubtree(-1, callback.bind(this));
+},
+
 onexpand: function()
 {
 if (this._elementCloseTag)
@@ -22572,7 +24299,7 @@
 this.treeOutline._populateContextMenu(contextMenu, this.representedObject);
 
 contextMenu.appendSeparator();
-contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Scroll into view" : "Scroll Into View"), this._scrollIntoView.bind(this)); 
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Scroll into view" : "Scroll into View"), this._scrollIntoView.bind(this)); 
 },
 
 _populateForcedPseudoStateItems: function(subMenu)
@@ -22782,7 +24509,7 @@
 {
 if (error)
 return;
-if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
+if (this._editing)
 return;
 
 function consume(event)
@@ -22795,7 +24522,6 @@
 
 this._htmlEditElement = document.createElement("div");
 this._htmlEditElement.className = "source-code elements-tree-editor";
-this._htmlEditElement.textContent = initialValue;
 
 
 var child = this.listItemElement.firstChild;
@@ -22812,9 +24538,10 @@
 
 this.updateSelection();
 
-function commit()
+
+function commit(element, newValue)
 {
-commitCallback(initialValue, this._htmlEditElement.textContent);
+commitCallback(initialValue, newValue);
 dispose.call(this);
 }
 
@@ -22840,7 +24567,7 @@
 }
 
 var config = new WebInspector.EditingConfig(commit.bind(this), dispose.bind(this));
-config.setMultiline(true);
+config.setMultilineOptions(initialValue, { name: "xml", htmlMode: true }, "web-inspector-html", true, true);
 this._editing = WebInspector.startEditing(this._htmlEditElement, config);
 },
 
@@ -22899,9 +24626,17 @@
 }
 }
 
-if (oldText !== newText)
+if (!attributeName.trim() && !newText.trim()) {
+element.removeSelf();
+moveToNextAttributeIfNeeded.call(this);
+return;
+}
+
+if (oldText !== newText) {
 this.representedObject.setAttribute(attributeName, newText, moveToNextAttributeIfNeeded.bind(this));
-else
+return;
+}
+
 moveToNextAttributeIfNeeded.call(this);
 },
 
@@ -24196,17 +25931,17 @@
 
 getOwnProperties: function(callback)
 {
-this._getProperties(true, callback);
+this.doGetProperties(true, callback);
 },
 
 
 getAllProperties: function(callback)
 {
-this._getProperties(false, callback);
+this.doGetProperties(false, callback);
 },
 
 
-_getProperties: function(ownProperties, callback)
+doGetProperties: function(ownProperties, callback)
 {
 if (!this._objectId) {
 callback([]);
@@ -24262,6 +25997,18 @@
 return;
 }
 
+this.doSetObjectPropertyValue(result, name, callback);
+
+if (result._objectId)
+RuntimeAgent.releaseObject(result._objectId);
+}
+},
+
+
+doSetObjectPropertyValue: function(result, name, callback)
+{
+
+
 var setPropertyValueFunction = "function(a, b) { this[a] = b; }";
 
 
@@ -24270,9 +26017,6 @@
 
 delete result.description; 
 RuntimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{ value:name }, result], true, undefined, undefined, propertySetCallback.bind(this));
-if (result._objectId)
-RuntimeAgent.releaseObject(result._objectId);
-}
 
 
 function propertySetCallback(error, result, wasThrown)
@@ -24352,6 +26096,94 @@
 }
 
 
+
+WebInspector.ScopeRemoteObject = function(objectId, scopeRef, type, subtype, value, description, preview)
+{
+WebInspector.RemoteObject.call(this, objectId, type, subtype, value, description, preview);
+this._scopeRef = scopeRef;
+this._savedScopeProperties = undefined;
+};
+
+
+WebInspector.ScopeRemoteObject.fromPayload = function(payload, scopeRef)
+{
+if (scopeRef)
+return new WebInspector.ScopeRemoteObject(payload.objectId, scopeRef, payload.type, payload.subtype, payload.value, payload.description, payload.preview);
+else
+return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.preview);
+}
+
+WebInspector.ScopeRemoteObject.prototype = {
+
+doGetProperties: function(ownProperties, callback)
+{
+if (this._savedScopeProperties) {
+
+
+
+callback(this._savedScopeProperties.slice(), []);
+return;
+}
+
+
+function wrappedCallback(properties, internalProperties)
+{
+if (this._scopeRef && properties instanceof Array)
+this._savedScopeProperties = properties.slice();
+callback(properties, internalProperties);
+}
+
+WebInspector.RemoteObject.prototype.doGetProperties.call(this, ownProperties, wrappedCallback.bind(this));
+},
+
+
+doSetObjectPropertyValue: function(result, name, callback)
+{
+var newValue;
+
+switch (result.type) {
+case "undefined":
+newValue = {};
+break;
+case "object":
+case "function":
+newValue = { objectId: result.objectId };
+break;
+default:
+newValue = { value: result.value };
+}
+
+DebuggerAgent.setVariableValue(this._scopeRef.number, name, newValue, this._scopeRef.callFrameId, this._scopeRef.functionId, setVariableValueCallback.bind(this));
+
+
+function setVariableValueCallback(error)
+{
+if (error) {
+callback(error);
+return;
+}
+if (this._savedScopeProperties) {
+for (var i = 0; i < this._savedScopeProperties.length; i++) {
+if (this._savedScopeProperties[i].name === name)
+this._savedScopeProperties[i].value = WebInspector.RemoteObject.fromPayload(result);
+}
+}
+callback();
+}
+},
+
+__proto__: WebInspector.RemoteObject.prototype
+};
+
+
+WebInspector.ScopeRef = function(number, callFrameId, functionId)
+{
+this.number = number;
+this.callFrameId = callFrameId;
+this.functionId = functionId;
+}
+
+
 WebInspector.RemoteObjectProperty = function(name, value, descriptor)
 {
 this.name = name;
@@ -24468,7 +26300,9 @@
 
 get hasChildren()
 {
-return typeof this._value === "object" && this._value !== null && !!Object.keys(this._value).length;
+if ((typeof this._value !== "object") || (this._value === null))
+return false;
+return !!Object.keys(  (this._value)).length;
 },
 
 
@@ -24488,13 +26322,14 @@
 {
 if (!this.hasChildren)
 return [];
+var value =   (this._value);
 
 function buildProperty(propName)
 {
 return new WebInspector.RemoteObjectProperty(propName, new WebInspector.LocalJSONObject(this._value[propName]));
 }
 if (!this._cachedChildren)
-this._cachedChildren = Object.keys(this._value || {}).map(buildProperty.bind(this));
+this._cachedChildren = Object.keys(value).map(buildProperty.bind(this));
 return this._cachedChildren;
 },
 
@@ -24562,7 +26397,7 @@
 {
 if (!properties)
 return;
-this.updateProperties(properties);
+this.updateProperties(properties, internalProperties);
 }
 
 if (this.ignoreHasOwnProperty)
@@ -24571,7 +26406,7 @@
 this.object.getOwnProperties(callback.bind(this));
 },
 
-updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
+updateProperties: function(properties, internalProperties, rootTreeElementConstructor, rootPropertyComparer)
 {
 if (!rootTreeElementConstructor)
 rootTreeElementConstructor = this.treeElementConstructor;
@@ -24579,25 +26414,20 @@
 if (!rootPropertyComparer)
 rootPropertyComparer = WebInspector.ObjectPropertiesSection.CompareProperties;
 
-if (this.extraProperties)
+if (this.extraProperties) {
 for (var i = 0; i < this.extraProperties.length; ++i)
 properties.push(this.extraProperties[i]);
-
-properties.sort(rootPropertyComparer);
+}
 
 this.propertiesTreeOutline.removeChildren();
 
-for (var i = 0; i < properties.length; ++i) {
-if (this.skipProto && properties[i].name === "__proto__")
-continue;
-properties[i].parentObject = this.object;
-}
+WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.propertiesTreeOutline,
+properties, internalProperties,
+rootTreeElementConstructor, rootPropertyComparer,
+this.skipProto, this.object);
 
 this.propertiesForTest = properties;
 
-for (var i = 0; i < properties.length; ++i)
-this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i]));
-
 if (!this.propertiesTreeOutline.children.length) {
 var title = document.createElement("div");
 title.className = "info";
@@ -24918,15 +26748,28 @@
 treeElement.removeChildren();
 if (!properties)
 return;
+if (!internalProperties)
+internalProperties = [];
 
-properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
+WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement, properties, internalProperties,
+treeElement.treeOutline.section.treeElementConstructor, WebInspector.ObjectPropertiesSection.CompareProperties,
+treeElement.treeOutline.section.skipProto, value);
+}
+
+value.getOwnProperties(callback);
+}
+
+
+WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeElement, properties, internalProperties, treeElementConstructor, comparator, skipProto, value) {
+properties.sort(comparator);
+
 for (var i = 0; i < properties.length; ++i) {
-if (treeElement.treeOutline.section.skipProto && properties[i].name === "__proto__")
+if (skipProto && properties[i].name === "__proto__")
 continue;
 properties[i].parentObject = value;
-treeElement.appendChild(new treeElement.treeOutline.section.treeElementConstructor(properties[i]));
+treeElement.appendChild(new treeElementConstructor(properties[i]));
 }
-if (value.type === "function") {
+if (value && value.type === "function") {
 
 
 
@@ -24946,14 +26789,11 @@
 if (internalProperties) {
 for (var i = 0; i < internalProperties.length; i++) {
 internalProperties[i].parentObject = value;
-treeElement.appendChild(new treeElement.treeOutline.section.treeElementConstructor(internalProperties[i]));
+treeElement.appendChild(new treeElementConstructor(internalProperties[i]));
 } 
 }
 }
 
-value.getOwnProperties(callback);
-}
-
 
 WebInspector.FunctionScopeMainTreeElement = function(remoteObject)
 {
@@ -25008,9 +26848,18 @@
 title = WebInspector.UIString("Global");
 isTrueObject = true;
 break;
+default:
+console.error("Unknown scope type: " + scope.type);
+continue;
 }
 
-var remoteObject = WebInspector.RemoteObject.fromPayload(scope.object);
+var scopeRef;
+if (isTrueObject)
+scopeRef = undefined;
+else 
+scopeRef = new WebInspector.ScopeRef(i, undefined, this._remoteObject.objectId);
+
+var remoteObject = WebInspector.ScopeRemoteObject.fromPayload(scope.object, scopeRef);
 if (isTrueObject) {
 var property = WebInspector.RemoteObjectProperty.fromScopeValue(title, remoteObject);
 property.parentObject = null;
@@ -25061,6 +26910,7 @@
 }
 
 WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100;
+WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold = 250000;
 
 
 WebInspector.ArrayGroupingTreeElement._populateArray = function(treeElement, object, fromIndex, toIndex)
@@ -25071,16 +26921,36 @@
 
 WebInspector.ArrayGroupingTreeElement._populateRanges = function(treeElement, object, fromIndex, toIndex, topLevel)
 {
-object.callFunctionJSON(packRanges, [{value: fromIndex}, {value: toIndex}, {value: WebInspector.ArrayGroupingTreeElement._bucketThreshold}], callback.bind(this));
+object.callFunctionJSON(packRanges, [{value: fromIndex}, {value: toIndex}, {value: WebInspector.ArrayGroupingTreeElement._bucketThreshold}, {value: WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}], callback.bind(this));
 
 
-function packRanges(fromIndex, toIndex, bucketThreshold)
+function packRanges(fromIndex, toIndex, bucketThreshold, sparseIterationThreshold)
 {
-var count = 0;
+var ownPropertyNames = null;
+function doLoop(iterationCallback)
+{
+if (toIndex - fromIndex < sparseIterationThreshold) {
 for (var i = fromIndex; i <= toIndex; ++i) {
 if (i in this)
+iterationCallback(i);
+}
+} else {
+ownPropertyNames = ownPropertyNames || Object.getOwnPropertyNames(this);
+for (var i = 0; i < ownPropertyNames.length; ++i) {
+var name = ownPropertyNames[i];
+var index = name >>> 0;
+if (String(index) === name && fromIndex <= index && index <= toIndex)
+iterationCallback(index);
+}
+}
+}
+
+var count = 0;
+function countIterationCallback()
+{
 ++count;
 }
+doLoop.call(this, countIterationCallback);
 
 var bucketSize = count;
 if (count <= bucketThreshold)
@@ -25092,10 +26962,8 @@
 count = 0;
 var groupStart = -1;
 var groupEnd = 0;
-for (var i = fromIndex; i <= toIndex; ++i) {
-if (!(i in this))
-continue;
-
+function loopIterationCallback(i)
+{
 if (groupStart === -1)
 groupStart = i;
 
@@ -25106,6 +26974,7 @@
 groupStart = -1;
 }
 }
+doLoop.call(this, loopIterationCallback);
 
 if (count > 0)
 ranges.push([groupStart, groupEnd, count]);
@@ -25135,19 +27004,30 @@
 
 WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeElement, object, fromIndex, toIndex)
 {
-object.callFunction(buildArrayFragment, [{value: fromIndex}, {value: toIndex}], processArrayFragment.bind(this));
+object.callFunction(buildArrayFragment, [{value: fromIndex}, {value: toIndex}, {value: WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}], processArrayFragment.bind(this));
 
 
-function buildArrayFragment(fromIndex, toIndex)
+function buildArrayFragment(fromIndex, toIndex, sparseIterationThreshold)
 {
 var result = Object.create(null);
+if (toIndex - fromIndex < sparseIterationThreshold) {
 for (var i = fromIndex; i <= toIndex; ++i) {
 if (i in this)
 result[i] = this[i];
 }
+} else {
+var ownPropertyNames = Object.getOwnPropertyNames(this);
+for (var i = 0; i < ownPropertyNames.length; ++i) {
+var name = ownPropertyNames[i];
+var index = name >>> 0;
+if (String(index) === name && fromIndex <= index && index <= toIndex)
+result[index] = this[index];
+}
+}
 return result;
 }
 
+
 function processArrayFragment(arrayFragment)
 {
 arrayFragment.getAllProperties(processProperties.bind(this));
@@ -25181,7 +27061,8 @@
 var names = Object.getOwnPropertyNames(this);
 for (var i = 0; i < names.length; ++i) {
 var name = names[i];
-if (!isNaN(name))
+
+if (String(name >>> 0) === name && name >>> 0 !== 0xffffffff)
 continue;
 var descriptor = Object.getOwnPropertyDescriptor(this, name);
 if (descriptor)
@@ -25291,7 +27172,7 @@
 return;
 }
 var container = document.createElement("div");
-container.style.display = "inline-block";
+container.className = "inline-block";
 
 var title = container.createChild("div", "function-popover-title source-code");
 var functionName = title.createChild("span", "function-name");
@@ -25314,8 +27195,9 @@
 popoverContentElement.textContent = "\"" + popoverContentElement.textContent + "\"";
 popover.show(popoverContentElement, anchorElement);
 } else {
+if (result.subtype === "node")
+result.highlightAsDOMNode();
 popoverContentElement = document.createElement("div");
-
 this._titleElement = document.createElement("div");
 this._titleElement.className = "source-frame-popover-title monospace";
 this._titleElement.textContent = result.description;
@@ -25342,6 +27224,7 @@
 
 _onHideObjectPopover: function()
 {
+WebInspector.domAgent.hideDOMNodeHighlight();
 if (this._linkifier) {
 this._linkifier.reset();
 delete this._linkifier;
@@ -25374,6 +27257,7 @@
 WebInspector.NativeBreakpointsSidebarPane = function(title)
 {
 WebInspector.SidebarPane.call(this, title);
+this.registerRequiredCSS("breakpointsList.css");
 
 this.listElement = document.createElement("ol");
 this.listElement.className = "breakpoint-list";
@@ -25635,7 +27519,7 @@
 this._removeBreakpoint(node, type);
 this._saveBreakpoints();
 }
-contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint.bind(this));
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), removeBreakpoint.bind(this));
 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all DOM breakpoints" : "Remove All DOM Breakpoints"), this._removeAllBreakpoints.bind(this));
 contextMenu.show();
 },
@@ -25655,7 +27539,7 @@
 var element = this._breakpointElements[breakpointId];
 if (!element)
 return;
-this.expanded = true;
+this.expand();
 element.addStyleClass("breakpoint-hit");
 this._highlightedElement = element;
 },
@@ -25718,10 +27602,71 @@
 }
 },
 
+
+createProxy: function(panel)
+{
+var proxy = new WebInspector.DOMBreakpointsSidebarPane.Proxy(this, panel);
+if (!this._proxies)
+this._proxies = [];
+this._proxies.push(proxy);
+return proxy;
+},
+
+onContentReady: function()
+{
+for (var i = 0; i != this._proxies.length; i++)
+this._proxies[i].onContentReady();
+},
+
 __proto__: WebInspector.NativeBreakpointsSidebarPane.prototype
 }
 
 
+WebInspector.DOMBreakpointsSidebarPane.Proxy = function(pane, panel)
+{
+WebInspector.View._assert(!pane.titleElement.firstChild, "Cannot create proxy for a sidebar pane with a toolbar");
+
+WebInspector.SidebarPane.call(this, pane.title());
+this.registerRequiredCSS("breakpointsList.css");
+
+this._wrappedPane = pane;
+this._panel = panel;
+
+this.bodyElement.removeSelf();
+this.bodyElement = this._wrappedPane.bodyElement;
+}
+
+WebInspector.DOMBreakpointsSidebarPane.Proxy.prototype = {
+expand: function()
+{
+this._wrappedPane.expand();
+},
+
+onContentReady: function()
+{
+if (!this._panel.isShowing())
+return;
+
+this._reattachBody();
+WebInspector.SidebarPane.prototype.onContentReady.call(this);
+},
+
+wasShown: function()
+{
+WebInspector.SidebarPane.prototype.wasShown.call(this);
+this._reattachBody();
+},
+
+_reattachBody: function()
+{
+if (this.bodyElement.parentNode !== this.element)
+this.element.appendChild(this.bodyElement);
+},
+
+__proto__: WebInspector.SidebarPane.prototype
+}
+
+
 WebInspector.domBreakpointsSidebarPane = null;
 
 
@@ -25729,250 +27674,137 @@
 
 
 
-WebInspector.Color = function(str)
+WebInspector.Color = function(rgba, format, originalText)
 {
-this.value = str;
-this._parse();
+this._rgba = rgba;
+this._originalText = originalText;
+this._format = format;
+if (typeof this._rgba[3] === "undefined")
+this._rgba[3] = 1;
+for (var i = 0; i < 4; ++i) {
+if (this._rgba[i] < 0)
+this._rgba[i] = 0;
+if (this._rgba[i] > 1)
+this._rgba[i] = 1;
+}
 }
 
 
-WebInspector.Color.fromRGBA = function(r, g, b, a)
+WebInspector.Color.parse = function(text)
 {
-return new WebInspector.Color("rgba(" + r + "," + g + "," + b + "," + (typeof a === "undefined" ? 1 : a) + ")");
+
+var value = text.toLowerCase().replace(/\s+/g, "");
+var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
+var match = value.match(simple);
+if (match) {
+if (match[1]) { 
+var hex = match[1].toUpperCase();
+var format;
+if (hex.length === 3) {
+format = WebInspector.Color.Format.ShortHEX;
+hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
+} else
+format = WebInspector.Color.Format.HEX;
+var r = parseInt(hex.substring(0,2), 16);
+var g = parseInt(hex.substring(2,4), 16);
+var b = parseInt(hex.substring(4,6), 16);
+return new WebInspector.Color([r / 255, g / 255, b / 255, 1], format, text);
 }
 
-WebInspector.Color.fromRGB = function(r, g, b)
+if (match[2]) { 
+var rgbString = match[2].split(/\s*,\s*/);
+var rgba = [ WebInspector.Color._parseRgbNumeric(rgbString[0]),
+WebInspector.Color._parseRgbNumeric(rgbString[1]),
+WebInspector.Color._parseRgbNumeric(rgbString[2]), 1 ];
+return new WebInspector.Color(rgba, WebInspector.Color.Format.RGB, text);
+}
+
+if (match[3]) { 
+var nickname = match[3].toLowerCase();
+if (nickname in WebInspector.Color.Nicknames) {
+var rgba = WebInspector.Color.Nicknames[nickname];
+var color = WebInspector.Color.fromRGBA(rgba);
+color._format = WebInspector.Color.Format.Nickname;
+color._originalText = nickname;
+return color;
+}
+return null;
+}
+
+if (match[4]) { 
+var hslString = match[4].replace(/%/g, "").split(/\s*,\s*/);
+var hsla = [ WebInspector.Color._parseHueNumeric(hslString[0]),
+WebInspector.Color._parseSatLightNumeric(hslString[1]),
+WebInspector.Color._parseSatLightNumeric(hslString[2]), 1 ];
+var rgba = WebInspector.Color._hsl2rgb(hsla);
+return new WebInspector.Color(rgba, WebInspector.Color.Format.HSL, text);
+}
+
+return null;
+}
+
+
+var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
+match = value.match(advanced);
+if (match) {
+if (match[1]) { 
+var rgbaString = match[1].split(/\s*,\s*/);
+var rgba = [ WebInspector.Color._parseRgbNumeric(rgbaString[0]),
+WebInspector.Color._parseRgbNumeric(rgbaString[1]),
+WebInspector.Color._parseRgbNumeric(rgbaString[2]),
+WebInspector.Color._parseAlphaNumeric(rgbaString[3]) ];
+return new WebInspector.Color(rgba, WebInspector.Color.Format.RGBA, text);
+}
+
+if (match[2]) { 
+var hslaString = match[2].replace(/%/g, "").split(/\s*,\s*/);
+var hsla = [ WebInspector.Color._parseHueNumeric(hslaString[0]),
+WebInspector.Color._parseSatLightNumeric(hslaString[1]),
+WebInspector.Color._parseSatLightNumeric(hslaString[2]),
+WebInspector.Color._parseAlphaNumeric(hslaString[3]) ];
+var rgba = WebInspector.Color._hsl2rgb(hsla);
+return new WebInspector.Color(rgba, WebInspector.Color.Format.HSLA, text);
+}
+}
+
+return null;
+}
+
+
+WebInspector.Color.fromRGBA = function(rgba)
 {
-return new WebInspector.Color("rgb(" + r + "," + g + "," + b + ")");
+return new WebInspector.Color([rgba[0] / 255, rgba[1] / 255, rgba[2] / 255, rgba[3]]);
+}
+
+
+WebInspector.Color.fromHSVA = function(hsva, format)
+{
+var h = hsva[0];
+var s = hsva[1];
+var v = hsva[2];
+
+var t = (2 - s) * v;
+s *= v / (t < 1 ? t : 2 - t);
+var hsla = [h, s, t / 2, hsva[3]];
+
+return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla), format);
 }
 
 WebInspector.Color.prototype = {
 
-get shorthex()
+format: function()
 {
-if ("_short" in this)
-return this._short;
-
-if (!this.simple)
-return "";
-
-var hex = this.hex;
-if (hex.charAt(0) === hex.charAt(1) && hex.charAt(2) === hex.charAt(3) && hex.charAt(4) === hex.charAt(5))
-this._short = hex.charAt(0) + hex.charAt(2) + hex.charAt(4);
-else
-this._short = hex;
-
-return this._short;
+return this._format;
 },
 
 
-get hex()
+hsla: function()
 {
-if (!this.simple)
-return "";
-
-return this._hex;
-},
-
-set hex(x)
-{
-this._hex = x;
-},
-
-
-get rgb()
-{
-if (this._rgb)
-return this._rgb;
-
-if (this.simple)
-this._rgb = this._hexToRGB(this.hex);
-else {
-var rgba = this.rgba;
-this._rgb = [rgba[0], rgba[1], rgba[2]];
-}
-
-return this._rgb;
-},
-
-set rgb(x)
-{
-this._rgb = x;
-},
-
-
-get hsl()
-{
-if (this._hsl)
-return this._hsl;
-
-this._hsl = this._rgbToHSL(this.rgb);
-return this._hsl;
-},
-
-set hsl(x)
-{
-this._hsl = x;
-},
-
-
-get nickname()
-{
-if (typeof this._nickname !== "undefined") 
-return this._nickname;
-else
-return "";
-},
-
-set nickname(x)
-{
-this._nickname = x;
-},
-
-
-get rgba()
-{
-return this._rgba;
-},
-
-set rgba(x)
-{
-this._rgba = x;
-},
-
-
-get hsla()
-{
+if (this._hsla)
 return this._hsla;
-},
-
-set hsla(x)
-{
-this._hsla = x;
-},
-
-
-hasShortHex: function()
-{
-var shorthex = this.shorthex;
-return (!!shorthex && shorthex.length === 3);
-},
-
-
-toString: function(format)
-{
-if (!format)
-format = this.format;
-
-switch (format) {
-case "original":
-return this.value;
-case "rgb":
-return "rgb(" + this.rgb.join(", ") + ")";
-case "rgba":
-return "rgba(" + this.rgba.join(", ") + ")";
-case "hsl":
-var hsl = this.hsl;
-return "hsl(" + hsl[0] + ", " + hsl[1] + "%, " + hsl[2] + "%)";
-case "hsla":
-var hsla = this.hsla;
-return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
-case "hex":
-return "#" + this.hex;
-case "shorthex":
-return "#" + this.shorthex;
-case "nickname":
-return this.nickname;
-}
-
-throw "invalid color format";
-},
-
-
-toProtocolRGBA: function()
-{
-if (this._protocolRGBA)
-return this._protocolRGBA;
-
-var components = this.rgba;
-if (components)
-this._protocolRGBA = { r: Number(components[0]), g: Number(components[1]), b: Number(components[2]), a: Number(components[3]) };
-else {
-components = this.rgb;
-this._protocolRGBA = { r: Number(components[0]), g: Number(components[1]), b: Number(components[2]) };
-}
-return this._protocolRGBA;
-},
-
-
-_clamp: function(value, min, max)
-{
-if (value < min)
-return min;
-if (value > max)
-return max;
-return value;
-},
-
-
-_individualRGBValueToFloatValue: function(rgbValue)
-{
-if (typeof rgbValue === "number")
-return this._clamp(rgbValue, 0, 255);
-
-if (rgbValue.indexOf("%") === -1) {
-var intValue = parseInt(rgbValue, 10);
-return this._clamp(intValue, 0, 255);
-}
-
-var percentValue = parseFloat(rgbValue);
-return this._clamp(percentValue, 0, 100) * 2.55;
-},
-
-
-_individualRGBValueToHexValue: function(rgbValue)
-{
-var floatValue = this._individualRGBValueToFloatValue(rgbValue);
-var hex = Math.round(floatValue).toString(16);
-if (hex.length === 1)
-hex = "0" + hex;
-return hex;
-},
-
-
-_rgbStringsToHex: function(rgb)
-{
-var r = this._individualRGBValueToHexValue(rgb[0]);
-var g = this._individualRGBValueToHexValue(rgb[1]);
-var b = this._individualRGBValueToHexValue(rgb[2]);
-return (r + g + b).toUpperCase();
-},
-
-
-_rgbToHex: function(rgb)
-{
-var r = this._individualRGBValueToHexValue(rgb[0]);
-var g = this._individualRGBValueToHexValue(rgb[1]);
-var b = this._individualRGBValueToHexValue(rgb[2]);
-return (r + g + b).toUpperCase();
-},
-
-
-_hexToRGB: function(hex)
-{
-var r = parseInt(hex.substring(0,2), 16);
-var g = parseInt(hex.substring(2,4), 16);
-var b = parseInt(hex.substring(4,6), 16);
-
-return [r, g, b];
-},
-
-
-_rgbToHSL: function(rgb)
-{
-var r = this._individualRGBValueToFloatValue(rgb[0]) / 255;
-var g = this._individualRGBValueToFloatValue(rgb[1]) / 255;
-var b = this._individualRGBValueToFloatValue(rgb[2]) / 255;
+var r = this._rgba[0];
+var g = this._rgba[1];
+var b = this._rgba[2];
 var max = Math.max(r, g, b);
 var min = Math.min(r, g, b);
 var diff = max - min;
@@ -25981,11 +27813,11 @@
 if (min === max)
 var h = 0;
 else if (r === max)
-var h = ((60 * (g - b) / diff) + 360) % 360;
+var h = ((1/6 * (g - b) / diff) + 1) % 1;
 else if (g === max)
-var h = (60 * (b - r) / diff) + 120;
+var h = (1/6 * (b - r) / diff) + 1/3;
 else
-var h = (60 * (r - g) / diff) + 240;
+var h = (1/6 * (r - g) / diff) + 2/3;
 
 var l = 0.5 * add;
 
@@ -25998,19 +27830,179 @@
 else
 var s = diff / (2 - add);
 
-h = Math.round(h);
-s = Math.round(s*100);
-l = Math.round(l*100);
-
-return [h, s, l];
+this._hsla = [h, s, l, this._rgba[3]];
+return this._hsla;
 },
 
 
-_hslToRGB: function(hsl)
+hsva: function()
 {
-var h = parseFloat(hsl[0]) / 360;
-var s = parseFloat(hsl[1]) / 100;
-var l = parseFloat(hsl[2]) / 100;
+var hsla = this.hsla();
+var h = hsla[0];
+var s = hsla[1];
+var l = hsla[2];
+
+s *= l < 0.5 ? l : 1 - l;
+return [h, s, (l + s), hsla[3]];
+},
+
+
+hasAlpha: function()
+{
+if (this._rgba[3] !== 1)
+return true;
+return this._format === WebInspector.Color.Format.RGBA ||
+this._format === WebInspector.Color.Format.HSLA;
+},
+
+
+canBeShortHex: function()
+{
+for (var i = 0; i < 3; ++i) {
+var c = Math.round(this._rgba[i] * 255);
+if ((c >> 4) !== (c & 0xF))
+return false;
+}
+return true;
+},
+
+
+toString: function(format)
+{
+if (!format)
+format = this._format;
+
+
+function toRgbValue(value)
+{
+return Math.round(value * 255);
+}
+
+
+function toHexValue(value)
+{
+var hex = Math.round(value * 255).toString(16);
+return hex.length === 1 ? "0" + hex : hex;
+}
+
+
+function toShortHexValue(value)
+{
+return (Math.round(value * 255) >> 4).toString(16);
+}
+
+switch (format) {
+case WebInspector.Color.Format.Original:
+return this._originalText;
+case WebInspector.Color.Format.RGB:
+return String.sprintf("rgb(%d, %d, %d)", toRgbValue(this._rgba[0]), toRgbValue(this._rgba[1]), toRgbValue(this._rgba[2]));
+case WebInspector.Color.Format.RGBA:
+return String.sprintf("rgba(%d, %d, %d, %f)", toRgbValue(this._rgba[0]), toRgbValue(this._rgba[1]), toRgbValue(this._rgba[2]), this._rgba[3]);
+case WebInspector.Color.Format.HSL:
+var hsl = this.hsla();
+return String.sprintf("hsl(%d, %d%, %d%)", Math.round(hsl[0] * 360), Math.round(hsl[1] * 100), Math.round(hsl[2] * 100));
+case WebInspector.Color.Format.HSLA:
+var hsla = this.hsla();
+return String.sprintf("hsla(%d, %d%, %d%, %f)", Math.round(hsla[0] * 360), Math.round(hsla[1] * 100), Math.round(hsla[2] * 100), hsla[3]);
+case WebInspector.Color.Format.HEX:
+return String.sprintf("#%s%s%s", toHexValue(this._rgba[0]), toHexValue(this._rgba[1]), toHexValue(this._rgba[2])).toUpperCase();
+case WebInspector.Color.Format.ShortHEX:
+return String.sprintf("#%s%s%s", toShortHexValue(this._rgba[0]), toShortHexValue(this._rgba[1]), toShortHexValue(this._rgba[2])).toUpperCase();
+case WebInspector.Color.Format.Nickname:
+return this.nickname();
+}
+
+return this._originalText;
+},
+
+
+_canonicalRGBA: function()
+{
+var rgba = new Array(3);
+for (var i = 0; i < 3; ++i)
+rgba[i] = Math.round(this._rgba[i] * 255);
+if (this._rgba[3] !== 1)
+rgba.push(this._rgba[3]);
+return rgba;
+},
+
+
+nickname: function()
+{
+if (!WebInspector.Color._rgbaToNickname) {
+WebInspector.Color._rgbaToNickname = {};
+for (var nickname in WebInspector.Color.Nicknames) {
+var rgba = WebInspector.Color.Nicknames[nickname];
+WebInspector.Color._rgbaToNickname[rgba] = nickname;
+}
+}
+
+return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()];
+},
+
+
+toProtocolRGBA: function()
+{
+var rgba = this._canonicalRGBA();
+var result = { r: rgba[0], g: rgba[1], b: rgba[2] };
+if (rgba[3] !== 1)
+result.a = rgba[3];
+return result;
+}
+}
+
+
+WebInspector.Color._parseRgbNumeric = function(value)
+{
+var parsed = parseInt(value, 10);
+if (value.indexOf("%") !== -1)
+parsed /= 100;
+else
+parsed /= 255;
+return parsed;
+}
+
+
+WebInspector.Color._parseHueNumeric = function(value)
+{
+return isNaN(value) ? 0 : (parseFloat(value) / 360) % 1;
+}
+
+
+WebInspector.Color._parseSatLightNumeric = function(value)
+{
+return parseFloat(value) / 100;
+}
+
+
+WebInspector.Color._parseAlphaNumeric = function(value)
+{
+return isNaN(value) ? 0 : parseFloat(value);
+}
+
+
+WebInspector.Color._hsl2rgb = function(hsl)
+{
+var h = hsl[0];
+var s = hsl[1];
+var l = hsl[2];
+
+function hue2rgb(p, q, h)
+{
+if (h < 0)
+h += 1;
+else if (h > 1)
+h -= 1;
+
+if ((h * 6) < 1)
+return p + (q - p) * h * 6;
+else if ((h * 2) < 1)
+return q;
+else if ((h * 3) < 2)
+return p + (q - p) * ((2 / 3) - h) * 6;
+else
+return p;
+}
 
 if (s < 0)
 s = 0;
@@ -26026,434 +28018,164 @@
 var tg = h;
 var tb = h - (1 / 3);
 
-var r = Math.round(hueToRGB(p, q, tr) * 255);
-var g = Math.round(hueToRGB(p, q, tg) * 255);
-var b = Math.round(hueToRGB(p, q, tb) * 255);
-return [r, g, b];
-
-function hueToRGB(p, q, h) {
-if (h < 0)
-h += 1;
-else if (h > 1)
-h -= 1;
-
-if ((h * 6) < 1)
-return p + (q - p) * h * 6;
-else if ((h * 2) < 1)
-return q;
-else if ((h * 3) < 2)
-return p + (q - p) * ((2 / 3) - h) * 6;
-else
-return p;
+var r = hue2rgb(p, q, tr);
+var g = hue2rgb(p, q, tg);
+var b = hue2rgb(p, q, tb);
+return [r, g, b, hsl[3]];
 }
-},
-
-
-_rgbaToHSLA: function(rgba, alpha)
-{
-var hsl = this._rgbToHSL(rgba)
-hsl.push(alpha);
-return hsl;
-},
-
-
-_hslaToRGBA: function(hsla, alpha)
-{
-var rgb = this._hslToRGB(hsla);
-rgb.push(alpha);
-return rgb;
-},
-
-_parse: function()
-{
-
-var value = this.value.toLowerCase().replace(/%|\s+/g, "");
-if (value in WebInspector.Color.AdvancedNickNames) {
-this.format = "nickname";
-var set = WebInspector.Color.AdvancedNickNames[value];
-this.simple = false;
-this.rgba = set[0];
-this.hsla = set[1];
-this.nickname = set[2];
-this.alpha = set[0][3];
-return;
-}
-
-
-var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
-var match = this.value.match(simple);
-if (match) {
-this.simple = true;
-
-if (match[1]) { 
-var hex = match[1].toUpperCase();
-if (hex.length === 3) {
-this.format = "shorthex";
-this.hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
-} else {
-this.format = "hex";
-this.hex = hex;
-}
-} else if (match[2]) { 
-this.format = "rgb";
-var rgb = match[2].split(/\s*,\s*/);
-this.rgb = rgb;
-this.hex = this._rgbStringsToHex(rgb);
-} else if (match[3]) { 
-var nickname = match[3].toLowerCase();
-if (nickname in WebInspector.Color.Nicknames) {
-this.format = "nickname";
-this.hex = WebInspector.Color.Nicknames[nickname];
-} else 
-throw "unknown color name";
-} else if (match[4]) { 
-this.format = "hsl";
-var hsl = match[4].replace(/%/g, "").split(/\s*,\s*/);
-this.hsl = hsl;
-this.rgb = this._hslToRGB(hsl);
-this.hex = this._rgbToHex(this.rgb);
-}
-
-
-var hex = this.hex;
-if (hex && hex in WebInspector.Color.HexTable) {
-var set = WebInspector.Color.HexTable[hex];
-this.rgb = set[0];
-this.hsl = set[1];
-this.nickname = set[2];
-}
-
-return;
-}
-
-
-var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
-match = this.value.match(advanced);
-if (match) {
-this.simple = false;
-if (match[1]) { 
-this.format = "rgba";
-this.rgba = match[1].split(/\s*,\s*/);
-this.rgba[3] = this.alpha = this._clamp(this.rgba[3], 0, 1);
-this.hsla = this._rgbaToHSLA(this.rgba, this.alpha);
-} else if (match[2]) { 
-this.format = "hsla";
-this.hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
-this.hsla[3] = this.alpha = this._clamp(this.hsla[3], 0, 1);
-this.rgba = this._hslaToRGBA(this.hsla, this.alpha);
-}
-
-return;
-}
-
-
-throw "could not parse color";
-}
-}
-
-
-WebInspector.Color.HexTable = {
-"000000": [[0, 0, 0], [0, 0, 0], "black"],
-"000080": [[0, 0, 128], [240, 100, 25], "navy"],
-"00008B": [[0, 0, 139], [240, 100, 27], "darkBlue"],
-"0000CD": [[0, 0, 205], [240, 100, 40], "mediumBlue"],
-"0000FF": [[0, 0, 255], [240, 100, 50], "blue"],
-"006400": [[0, 100, 0], [120, 100, 20], "darkGreen"],
-"008000": [[0, 128, 0], [120, 100, 25], "green"],
-"008080": [[0, 128, 128], [180, 100, 25], "teal"],
-"008B8B": [[0, 139, 139], [180, 100, 27], "darkCyan"],
-"00BFFF": [[0, 191, 255], [195, 100, 50], "deepSkyBlue"],
-"00CED1": [[0, 206, 209], [181, 100, 41], "darkTurquoise"],
-"00FA9A": [[0, 250, 154], [157, 100, 49], "mediumSpringGreen"],
-"00FF00": [[0, 255, 0], [120, 100, 50], "lime"],
-"00FF7F": [[0, 255, 127], [150, 100, 50], "springGreen"],
-"00FFFF": [[0, 255, 255], [180, 100, 50], "cyan"],
-"191970": [[25, 25, 112], [240, 64, 27], "midnightBlue"],
-"1E90FF": [[30, 144, 255], [210, 100, 56], "dodgerBlue"],
-"20B2AA": [[32, 178, 170], [177, 70, 41], "lightSeaGreen"],
-"228B22": [[34, 139, 34], [120, 61, 34], "forestGreen"],
-"2E8B57": [[46, 139, 87], [146, 50, 36], "seaGreen"],
-"2F4F4F": [[47, 79, 79], [180, 25, 25], "darkSlateGray"],
-"32CD32": [[50, 205, 50], [120, 61, 50], "limeGreen"],
-"3CB371": [[60, 179, 113], [147, 50, 47], "mediumSeaGreen"],
-"40E0D0": [[64, 224, 208], [174, 72, 56], "turquoise"],
-"4169E1": [[65, 105, 225], [225, 73, 57], "royalBlue"],
-"4682B4": [[70, 130, 180], [207, 44, 49], "steelBlue"],
-"483D8B": [[72, 61, 139], [248, 39, 39], "darkSlateBlue"],
-"48D1CC": [[72, 209, 204], [178, 60, 55], "mediumTurquoise"],
-"4B0082": [[75, 0, 130], [275, 100, 25], "indigo"],
-"556B2F": [[85, 107, 47], [82, 39, 30], "darkOliveGreen"],
-"5F9EA0": [[95, 158, 160], [182, 25, 50], "cadetBlue"],
-"6495ED": [[100, 149, 237], [219, 79, 66], "cornflowerBlue"],
-"66CDAA": [[102, 205, 170], [160, 51, 60], "mediumAquaMarine"],
-"696969": [[105, 105, 105], [0, 0, 41], "dimGray"],
-"6A5ACD": [[106, 90, 205], [248, 53, 58], "slateBlue"],
-"6B8E23": [[107, 142, 35], [80, 60, 35], "oliveDrab"],
-"708090": [[112, 128, 144], [210, 13, 50], "slateGray"],
-"778899": [[119, 136, 153], [210, 14, 53], "lightSlateGray"],
-"7B68EE": [[123, 104, 238], [249, 80, 67], "mediumSlateBlue"],
-"7CFC00": [[124, 252, 0], [90, 100, 49], "lawnGreen"],
-"7FFF00": [[127, 255, 0], [90, 100, 50], "chartreuse"],
-"7FFFD4": [[127, 255, 212], [160, 100, 75], "aquamarine"],
-"800000": [[128, 0, 0], [0, 100, 25], "maroon"],
-"800080": [[128, 0, 128], [300, 100, 25], "purple"],
-"808000": [[128, 128, 0], [60, 100, 25], "olive"],
-"808080": [[128, 128, 128], [0, 0, 50], "gray"],
-"87CEEB": [[135, 206, 235], [197, 71, 73], "skyBlue"],
-"87CEFA": [[135, 206, 250], [203, 92, 75], "lightSkyBlue"],
-"8A2BE2": [[138, 43, 226], [271, 76, 53], "blueViolet"],
-"8B0000": [[139, 0, 0], [0, 100, 27], "darkRed"],
-"8B008B": [[139, 0, 139], [300, 100, 27], "darkMagenta"],
-"8B4513": [[139, 69, 19], [25, 76, 31], "saddleBrown"],
-"8FBC8F": [[143, 188, 143], [120, 25, 65], "darkSeaGreen"],
-"90EE90": [[144, 238, 144], [120, 73, 75], "lightGreen"],
-"9370D8": [[147, 112, 219], [260, 60, 65], "mediumPurple"],
-"9400D3": [[148, 0, 211], [282, 100, 41], "darkViolet"],
-"98FB98": [[152, 251, 152], [120, 93, 79], "paleGreen"],
-"9932CC": [[153, 50, 204], [280, 61, 50], "darkOrchid"],
-"9ACD32": [[154, 205, 50], [80, 61, 50], "yellowGreen"],
-"A0522D": [[160, 82, 45], [19, 56, 40], "sienna"],
-"A52A2A": [[165, 42, 42], [0, 59, 41], "brown"],
-"A9A9A9": [[169, 169, 169], [0, 0, 66], "darkGray"],
-"ADD8E6": [[173, 216, 230], [195, 53, 79], "lightBlue"],
-"ADFF2F": [[173, 255, 47], [84, 100, 59], "greenYellow"],
-"AFEEEE": [[175, 238, 238], [180, 65, 81], "paleTurquoise"],
-"B0C4DE": [[176, 196, 222], [214, 41, 78], "lightSteelBlue"],
-"B0E0E6": [[176, 224, 230], [187, 52, 80], "powderBlue"],
-"B22222": [[178, 34, 34], [0, 68, 42], "fireBrick"],
-"B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenrod"],
-"BA55D3": [[186, 85, 211], [288, 59, 58], "mediumOrchid"],
-"BC8F8F": [[188, 143, 143], [0, 25, 65], "rosyBrown"],
-"BDB76B": [[189, 183, 107], [56, 38, 58], "darkKhaki"],
-"C0C0C0": [[192, 192, 192], [0, 0, 75], "silver"],
-"C71585": [[199, 21, 133], [322, 81, 43], "mediumVioletRed"],
-"CD5C5C": [[205, 92, 92], [0, 53, 58], "indianRed"],
-"CD853F": [[205, 133, 63], [30, 59, 53], "peru"],
-"D2691E": [[210, 105, 30], [25, 75, 47], "chocolate"],
-"D2B48C": [[210, 180, 140], [34, 44, 69], "tan"],
-"D3D3D3": [[211, 211, 211], [0, 0, 83], "lightGrey"],
-"D87093": [[219, 112, 147], [340, 60, 65], "paleVioletRed"],
-"D8BFD8": [[216, 191, 216], [300, 24, 80], "thistle"],
-"DA70D6": [[218, 112, 214], [302, 59, 65], "orchid"],
-"DAA520": [[218, 165, 32], [43, 74, 49], "goldenrod"],
-"DC143C": [[237, 164, 61], [35, 83, 58], "crimson"],
-"DCDCDC": [[220, 220, 220], [0, 0, 86], "gainsboro"],
-"DDA0DD": [[221, 160, 221], [300, 47, 75], "plum"],
-"DEB887": [[222, 184, 135], [34, 57, 70], "burlyWood"],
-"E0FFFF": [[224, 255, 255], [180, 100, 94], "lightCyan"],
-"E6E6FA": [[230, 230, 250], [240, 67, 94], "lavender"],
-"E9967A": [[233, 150, 122], [15, 72, 70], "darkSalmon"],
-"EE82EE": [[238, 130, 238], [300, 76, 72], "violet"],
-"EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenrod"],
-"F08080": [[240, 128, 128], [0, 79, 72], "lightCoral"],
-"F0E68C": [[240, 230, 140], [54, 77, 75], "khaki"],
-"F0F8FF": [[240, 248, 255], [208, 100, 97], "aliceBlue"],
-"F0FFF0": [[240, 255, 240], [120, 100, 97], "honeyDew"],
-"F0FFFF": [[240, 255, 255], [180, 100, 97], "azure"],
-"F4A460": [[244, 164, 96], [28, 87, 67], "sandyBrown"],
-"F5DEB3": [[245, 222, 179], [39, 77, 83], "wheat"],
-"F5F5DC": [[245, 245, 220], [60, 56, 91], "beige"],
-"F5F5F5": [[245, 245, 245], [0, 0, 96], "whiteSmoke"],
-"F5FFFA": [[245, 255, 250], [150, 100, 98], "mintCream"],
-"F8F8FF": [[248, 248, 255], [240, 100, 99], "ghostWhite"],
-"FA8072": [[250, 128, 114], [6, 93, 71], "salmon"],
-"FAEBD7": [[250, 235, 215], [34, 78, 91], "antiqueWhite"],
-"FAF0E6": [[250, 240, 230], [30, 67, 94], "linen"],
-"FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenrodYellow"],
-"FDF5E6": [[253, 245, 230], [39, 85, 95], "oldLace"],
-"FF0000": [[255, 0, 0], [0, 100, 50], "red"],
-"FF00FF": [[255, 0, 255], [300, 100, 50], "magenta"],
-"FF1493": [[255, 20, 147], [328, 100, 54], "deepPink"],
-"FF4500": [[255, 69, 0], [16, 100, 50], "orangeRed"],
-"FF6347": [[255, 99, 71], [9, 100, 64], "tomato"],
-"FF69B4": [[255, 105, 180], [330, 100, 71], "hotPink"],
-"FF7F50": [[255, 127, 80], [16, 100, 66], "coral"],
-"FF8C00": [[255, 140, 0], [33, 100, 50], "darkOrange"],
-"FFA07A": [[255, 160, 122], [17, 100, 74], "lightSalmon"],
-"FFA500": [[255, 165, 0], [39, 100, 50], "orange"],
-"FFB6C1": [[255, 182, 193], [351, 100, 86], "lightPink"],
-"FFC0CB": [[255, 192, 203], [350, 100, 88], "pink"],
-"FFD700": [[255, 215, 0], [51, 100, 50], "gold"],
-"FFDAB9": [[255, 218, 185], [28, 100, 86], "peachPuff"],
-"FFDEAD": [[255, 222, 173], [36, 100, 84], "navajoWhite"],
-"FFE4B5": [[255, 228, 181], [38, 100, 85], "moccasin"],
-"FFE4C4": [[255, 228, 196], [33, 100, 88], "bisque"],
-"FFE4E1": [[255, 228, 225], [6, 100, 94], "mistyRose"],
-"FFEBCD": [[255, 235, 205], [36, 100, 90], "blanchedAlmond"],
-"FFEFD5": [[255, 239, 213], [37, 100, 92], "papayaWhip"],
-"FFF0F5": [[255, 240, 245], [340, 100, 97], "lavenderBlush"],
-"FFF5EE": [[255, 245, 238], [25, 100, 97], "seaShell"],
-"FFF8DC": [[255, 248, 220], [48, 100, 93], "cornsilk"],
-"FFFACD": [[255, 250, 205], [54, 100, 90], "lemonChiffon"],
-"FFFAF0": [[255, 250, 240], [40, 100, 97], "floralWhite"],
-"FFFAFA": [[255, 250, 250], [0, 100, 99], "snow"],
-"FFFF00": [[255, 255, 0], [60, 100, 50], "yellow"],
-"FFFFE0": [[255, 255, 224], [60, 100, 94], "lightYellow"],
-"FFFFF0": [[255, 255, 240], [60, 100, 97], "ivory"],
-"FFFFFF": [[255, 255, 255], [0, 100, 100], "white"]
-};
-
 
 WebInspector.Color.Nicknames = {
-"aliceblue": "F0F8FF",
-"antiquewhite": "FAEBD7",
-"aqua": "00FFFF",
-"aquamarine": "7FFFD4",
-"azure": "F0FFFF",
-"beige": "F5F5DC",
-"bisque": "FFE4C4",
-"black": "000000",
-"blanchedalmond": "FFEBCD",
-"blue": "0000FF",
-"blueviolet": "8A2BE2",
-"brown": "A52A2A",
-"burlywood": "DEB887",
-"cadetblue": "5F9EA0",
-"chartreuse": "7FFF00",
-"chocolate": "D2691E",
-"coral": "FF7F50",
-"cornflowerblue": "6495ED",
-"cornsilk": "FFF8DC",
-"crimson": "DC143C",
-"cyan": "00FFFF",
-"darkblue": "00008B",
-"darkcyan": "008B8B",
-"darkgoldenrod": "B8860B",
-"darkgray": "A9A9A9",
-"darkgreen": "006400",
-"darkkhaki": "BDB76B",
-"darkmagenta": "8B008B",
-"darkolivegreen": "556B2F",
-"darkorange": "FF8C00",
-"darkorchid": "9932CC",
-"darkred": "8B0000",
-"darksalmon": "E9967A",
-"darkseagreen": "8FBC8F",
-"darkslateblue": "483D8B",
-"darkslategray": "2F4F4F",
-"darkturquoise": "00CED1",
-"darkviolet": "9400D3",
-"deeppink": "FF1493",
-"deepskyblue": "00BFFF",
-"dimgray": "696969",
-"dodgerblue": "1E90FF",
-"firebrick": "B22222",
-"floralwhite": "FFFAF0",
-"forestgreen": "228B22",
-"fuchsia": "FF00FF",
-"gainsboro": "DCDCDC",
-"ghostwhite": "F8F8FF",
-"gold": "FFD700",
-"goldenrod": "DAA520",
-"gray": "808080",
-"green": "008000",
-"greenyellow": "ADFF2F",
-"honeydew": "F0FFF0",
-"hotpink": "FF69B4",
-"indianred": "CD5C5C",
-"indigo": "4B0082",
-"ivory": "FFFFF0",
-"khaki": "F0E68C",
-"lavender": "E6E6FA",
-"lavenderblush": "FFF0F5",
-"lawngreen": "7CFC00",
-"lemonchiffon": "FFFACD",
-"lightblue": "ADD8E6",
-"lightcoral": "F08080",
-"lightcyan": "E0FFFF",
-"lightgoldenrodyellow": "FAFAD2",
-"lightgreen": "90EE90",
-"lightgrey": "D3D3D3",
-"lightpink": "FFB6C1",
-"lightsalmon": "FFA07A",
-"lightseagreen": "20B2AA",
-"lightskyblue": "87CEFA",
-"lightslategray": "778899",
-"lightsteelblue": "B0C4DE",
-"lightyellow": "FFFFE0",
-"lime": "00FF00",
-"limegreen": "32CD32",
-"linen": "FAF0E6",
-"magenta": "FF00FF",
-"maroon": "800000",
-"mediumaquamarine": "66CDAA",
-"mediumblue": "0000CD",
-"mediumorchid": "BA55D3",
-"mediumpurple": "9370DB",
-"mediumseagreen": "3CB371",
-"mediumslateblue": "7B68EE",
-"mediumspringgreen": "00FA9A",
-"mediumturquoise": "48D1CC",
-"mediumvioletred": "C71585",
-"midnightblue": "191970",
-"mintcream": "F5FFFA",
-"mistyrose": "FFE4E1",
-"moccasin": "FFE4B5",
-"navajowhite": "FFDEAD",
-"navy": "000080",
-"oldlace": "FDF5E6",
-"olive": "808000",
-"olivedrab": "6B8E23",
-"orange": "FFA500",
-"orangered": "FF4500",
-"orchid": "DA70D6",
-"palegoldenrod": "EEE8AA",
-"palegreen": "98FB98",
-"paleturquoise": "AFEEEE",
-"palevioletred": "DB7093",
-"papayawhip": "FFEFD5",
-"peachpuff": "FFDAB9",
-"peru": "CD853F",
-"pink": "FFC0CB",
-"plum": "DDA0DD",
-"powderblue": "B0E0E6",
-"purple": "800080",
-"red": "FF0000",
-"rosybrown": "BC8F8F",
-"royalblue": "4169E1",
-"saddlebrown": "8B4513",
-"salmon": "FA8072",
-"sandybrown": "F4A460",
-"seagreen": "2E8B57",
-"seashell": "FFF5EE",
-"sienna": "A0522D",
-"silver": "C0C0C0",
-"skyblue": "87CEEB",
-"slateblue": "6A5ACD",
-"slategray": "708090",
-"snow": "FFFAFA",
-"springgreen": "00FF7F",
-"steelblue": "4682B4",
-"tan": "D2B48C",
-"teal": "008080",
-"thistle": "D8BFD8",
-"tomato": "FF6347",
-"turquoise": "40E0D0",
-"violet": "EE82EE",
-"wheat": "F5DEB3",
-"white": "FFFFFF",
-"whitesmoke": "F5F5F5",
-"yellow": "FFFF00",
-"yellowgreen": "9ACD32"
-};
-
-
-WebInspector.Color.AdvancedNickNames = {
-"transparent": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
-"rgba(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
-"hsla(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
+"aliceBlue":          [240,248,255],
+"antiqueWhite":       [250,235,215],
+"aquamarine":         [127,255,212],
+"azure":              [240,255,255],
+"beige":              [245,245,220],
+"bisque":             [255,228,196],
+"black":              [0,0,0],
+"blanchedAlmond":     [255,235,205],
+"blue":               [0,0,255],
+"blueViolet":         [138,43,226],
+"brown":              [165,42,42],
+"burlyWood":          [222,184,135],
+"cadetBlue":          [95,158,160],
+"chartreuse":         [127,255,0],
+"chocolate":          [210,105,30],
+"coral":              [255,127,80],
+"cornflowerBlue":     [100,149,237],
+"cornsilk":           [255,248,220],
+"crimson":            [237,20,61],
+"cyan":               [0,255,255],
+"darkBlue":           [0,0,139],
+"darkCyan":           [0,139,139],
+"darkGoldenrod":      [184,134,11],
+"darkGray":           [169,169,169],
+"darkGreen":          [0,100,0],
+"darkKhaki":          [189,183,107],
+"darkMagenta":        [139,0,139],
+"darkOliveGreen":     [85,107,47],
+"darkOrange":         [255,140,0],
+"darkOrchid":         [153,50,204],
+"darkRed":            [139,0,0],
+"darkSalmon":         [233,150,122],
+"darkSeaGreen":       [143,188,143],
+"darkSlateBlue":      [72,61,139],
+"darkSlateGray":      [47,79,79],
+"darkTurquoise":      [0,206,209],
+"darkViolet":         [148,0,211],
+"deepPink":           [255,20,147],
+"deepSkyBlue":        [0,191,255],
+"dimGray":            [105,105,105],
+"dodgerBlue":         [30,144,255],
+"fireBrick":          [178,34,34],
+"floralWhite":        [255,250,240],
+"forestGreen":        [34,139,34],
+"gainsboro":          [220,220,220],
+"ghostWhite":         [248,248,255],
+"gold":               [255,215,0],
+"goldenrod":          [218,165,32],
+"gray":               [128,128,128],
+"green":              [0,128,0],
+"greenYellow":        [173,255,47],
+"honeyDew":           [240,255,240],
+"hotPink":            [255,105,180],
+"indianRed":          [205,92,92],
+"indigo":             [75,0,130],
+"ivory":              [255,255,240],
+"khaki":              [240,230,140],
+"lavender":           [230,230,250],
+"lavenderBlush":      [255,240,245],
+"lawnGreen":          [124,252,0],
+"lemonChiffon":       [255,250,205],
+"lightBlue":          [173,216,230],
+"lightCoral":         [240,128,128],
+"lightCyan":          [224,255,255],
+"lightGoldenrodYellow":[250,250,210],
+"lightGreen":         [144,238,144],
+"lightGrey":          [211,211,211],
+"lightPink":          [255,182,193],
+"lightSalmon":        [255,160,122],
+"lightSeaGreen":      [32,178,170],
+"lightSkyBlue":       [135,206,250],
+"lightSlateGray":     [119,136,153],
+"lightSteelBlue":     [176,196,222],
+"lightYellow":        [255,255,224],
+"lime":               [0,255,0],
+"limeGreen":          [50,205,50],
+"linen":              [250,240,230],
+"magenta":            [255,0,255],
+"maroon":             [128,0,0],
+"mediumAquaMarine":   [102,205,170],
+"mediumBlue":         [0,0,205],
+"mediumOrchid":       [186,85,211],
+"mediumPurple":       [147,112,219],
+"mediumSeaGreen":     [60,179,113],
+"mediumSlateBlue":    [123,104,238],
+"mediumSpringGreen":  [0,250,154],
+"mediumTurquoise":    [72,209,204],
+"mediumVioletRed":    [199,21,133],
+"midnightBlue":       [25,25,112],
+"mintCream":          [245,255,250],
+"mistyRose":          [255,228,225],
+"moccasin":           [255,228,181],
+"navajoWhite":        [255,222,173],
+"navy":               [0,0,128],
+"oldLace":            [253,245,230],
+"olive":              [128,128,0],
+"oliveDrab":          [107,142,35],
+"orange":             [255,165,0],
+"orangeRed":          [255,69,0],
+"orchid":             [218,112,214],
+"paleGoldenrod":      [238,232,170],
+"paleGreen":          [152,251,152],
+"paleTurquoise":      [175,238,238],
+"paleVioletRed":      [219,112,147],
+"papayaWhip":         [255,239,213],
+"peachPuff":          [255,218,185],
+"peru":               [205,133,63],
+"pink":               [255,192,203],
+"plum":               [221,160,221],
+"powderBlue":         [176,224,230],
+"purple":             [128,0,128],
+"red":                [255,0,0],
+"rosyBrown":          [188,143,143],
+"royalBlue":          [65,105,225],
+"saddleBrown":        [139,69,19],
+"salmon":             [250,128,114],
+"sandyBrown":         [244,164,96],
+"seaGreen":           [46,139,87],
+"seaShell":           [255,245,238],
+"sienna":             [160,82,45],
+"silver":             [192,192,192],
+"skyBlue":            [135,206,235],
+"slateBlue":          [106,90,205],
+"slateGray":          [112,128,144],
+"snow":               [255,250,250],
+"springGreen":        [0,255,127],
+"steelBlue":          [70,130,180],
+"tan":                [210,180,140],
+"teal":               [0,128,128],
+"thistle":            [216,191,216],
+"tomato":             [255,99,71],
+"turquoise":          [64,224,208],
+"violet":             [238,130,238],
+"wheat":              [245,222,179],
+"white":              [255,255,255],
+"whiteSmoke":         [245,245,245],
+"yellow":             [255,255,0],
+"yellowGreen":        [154,205,50],
+"transparent":        [0, 0, 0, 0],
 };
 
 WebInspector.Color.PageHighlight = {
-Content: WebInspector.Color.fromRGBA(111, 168, 220, .66),
-ContentLight: WebInspector.Color.fromRGBA(111, 168, 220, .5),
-ContentOutline: WebInspector.Color.fromRGBA(9, 83, 148),
-Padding: WebInspector.Color.fromRGBA(147, 196, 125, .55),
-PaddingLight: WebInspector.Color.fromRGBA(147, 196, 125, .4),
-Border: WebInspector.Color.fromRGBA(255, 229, 153, .66),
-BorderLight: WebInspector.Color.fromRGBA(255, 229, 153, .5),
-Margin: WebInspector.Color.fromRGBA(246, 178, 107, .66),
-MarginLight: WebInspector.Color.fromRGBA(246, 178, 107, .5)
+Content: WebInspector.Color.fromRGBA([111, 168, 220, .66]),
+ContentLight: WebInspector.Color.fromRGBA([111, 168, 220, .5]),
+ContentOutline: WebInspector.Color.fromRGBA([9, 83, 148]),
+Padding: WebInspector.Color.fromRGBA([147, 196, 125, .55]),
+PaddingLight: WebInspector.Color.fromRGBA([147, 196, 125, .4]),
+Border: WebInspector.Color.fromRGBA([255, 229, 153, .66]),
+BorderLight: WebInspector.Color.fromRGBA([255, 229, 153, .5]),
+Margin: WebInspector.Color.fromRGBA([246, 178, 107, .66]),
+MarginLight: WebInspector.Color.fromRGBA([246, 178, 107, .5])
 }
 
 WebInspector.Color.Format = {
@@ -26474,7 +28196,7 @@
 
 WebInspector.CSSMetadata = function(properties)
 {
-this._values = [];
+this._values =   ([]);
 this._longhands = {};
 this._shorthands = {};
 for (var i = 0; i < properties.length; ++i) {
@@ -26505,7 +28227,7 @@
 }
 
 
-WebInspector.CSSMetadata.cssPropertiesMetainfo = null;
+WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadata([]);
 
 WebInspector.CSSMetadata.isColorAwareProperty = function(propertyName)
 {
@@ -27110,14 +28832,12 @@
 
 WebInspector.CSSMetadata.keywordsForProperty = function(propertyName)
 {
-var acceptedKeywords = ["initial"];
+var acceptedKeywords = ["inherit", "initial"];
 var descriptor = WebInspector.CSSMetadata.descriptor(propertyName);
 if (descriptor && descriptor.values)
 acceptedKeywords.push.apply(acceptedKeywords, descriptor.values);
 if (propertyName in WebInspector.CSSMetadata._colorAwareProperties)
 acceptedKeywords.push.apply(acceptedKeywords, WebInspector.CSSMetadata._colors);
-if (propertyName in WebInspector.CSSMetadata.InheritedProperties)
-acceptedKeywords.push("inherit");
 return new WebInspector.CSSMetadata(acceptedKeywords);
 }
 
@@ -27271,6 +28991,7 @@
 
 
 WebInspector.CSSMetadata.prototype = {
+
 startsWith: function(prefix)
 {
 var firstIndex = this._firstIndexOfPrefix(prefix);
@@ -27385,83 +29106,6 @@
 
 
 
-WebInspector.PanelEnablerView = function(identifier, headingText, disclaimerText, buttonTitle)
-{
-WebInspector.View.call(this);
-this.registerRequiredCSS("panelEnablerView.css");
-
-this.element.addStyleClass("panel-enabler-view");
-this.element.addStyleClass(identifier);
-
-this.contentElement = document.createElement("div");
-this.contentElement.className = "panel-enabler-view-content";
-this.element.appendChild(this.contentElement);
-
-this.imageElement = document.createElement("img");
-this.contentElement.appendChild(this.imageElement);
-
-this.choicesForm = document.createElement("form");
-this.contentElement.appendChild(this.choicesForm);
-
-this.headerElement = document.createElement("h1");
-this.headerElement.textContent = headingText;
-this.choicesForm.appendChild(this.headerElement);
-
-var self = this;
-function enableOption(text, checked) {
-var label = document.createElement("label");
-var option = document.createElement("input");
-option.type = "radio";
-option.name = "enable-option";
-if (checked)
-option.checked = true;
-label.appendChild(option);
-label.appendChild(document.createTextNode(text));
-self.choicesForm.appendChild(label);
-return option;
-};
-
-this.enabledForSession = enableOption(WebInspector.UIString("Only enable for this session"), true);
-this.enabledAlways = enableOption(WebInspector.UIString("Always enable"), false);
-
-this.disclaimerElement = document.createElement("div");
-this.disclaimerElement.className = "panel-enabler-disclaimer";
-this.disclaimerElement.textContent = disclaimerText;
-this.choicesForm.appendChild(this.disclaimerElement);
-
-this.enableButton = document.createElement("button");
-this.enableButton.setAttribute("type", "button");
-this.enableButton.textContent = buttonTitle;
-this.enableButton.addEventListener("click", this._enableButtonCicked.bind(this), false);
-this.choicesForm.appendChild(this.enableButton);
-}
-
-WebInspector.PanelEnablerView.prototype = {
-_enableButtonCicked: function()
-{
-this.dispatchEventToListeners("enable clicked");
-},
-
-onResize: function()
-{
-this.imageElement.removeStyleClass("hidden");
-
-if (this.element.offsetWidth < (this.choicesForm.offsetWidth + this.imageElement.offsetWidth))
-this.imageElement.addStyleClass("hidden");
-},
-
-get alwaysEnabled() {
-return this.enabledAlways.checked;
-},
-
-__proto__: WebInspector.View.prototype
-}
-
-
-
-
-
-
 WebInspector.StatusBarItem = function(element)
 {
 this.element = element;
@@ -27553,17 +29197,12 @@
 if (this._state === x)
 return;
 
-if (this.states === 2) {
-if (x)
-this.element.addStyleClass("toggled-on");
-else
-this.element.removeStyleClass("toggled-on");
-} else {
-if (x !== 0) {
+if (this.states === 2)
+this.element.enableStyleClass("toggled-on", x);
+else {
 this.element.removeStyleClass("toggled-" + this._state);
+if (x !== 0)
 this.element.addStyleClass("toggled-" + x);
-} else
-this.element.removeStyleClass("toggled-" + this._state);
 }
 this._state = x;
 },
@@ -27592,10 +29231,7 @@
 if (this._visible === x)
 return;
 
-if (x)
-this.element.removeStyleClass("hidden");
-else
-this.element.addStyleClass("hidden");
+this.element.enableStyleClass("hidden", !x);
 this._visible = x;
 },
 
@@ -27705,12 +29341,30 @@
 
 WebInspector.StatusBarComboBox.prototype = {
 
+size: function()
+{
+return this._selectElement.childElementCount;
+},
+
+
 addOption: function(option)
 {
 this._selectElement.appendChild(option);
 },
 
 
+createOption: function(label, title, value)
+{
+var option = this._selectElement.createChild("option");
+option.text = label;
+if (title)
+option.title = title;
+if (typeof value !== "undefined")
+option.value = value;
+return option;
+},
+
+
 _applyEnabledState: function()
 {
 this._selectElement.disabled = !this._enabled;
@@ -27755,8 +29409,24 @@
 GutterClick: "gutterClick"
 };
 
+
+WebInspector.TextEditor.GutterClickEventData;
+
 WebInspector.TextEditor.prototype = {
 
+isClean: function() { },
+
+markClean: function() { },
+
+
+cursorPositionToCoordinates: function(lineNumber, column) { return null; },
+
+
+coordinatesToCursorPosition: function(x, y) { return null; },
+
+
+tokenAtTextPosition: function(lineNumber, column) { return null; },
+
 
 set mimeType(mimeType) { },
 
@@ -27770,6 +29440,15 @@
 defaultFocusedElement: function() { },
 
 
+highlightRegex: function(regex, cssClass) { },
+
+
+highlightRange: function(range, cssClass) { },
+
+
+removeHighlight: function(highlightDescriptor) { },
+
+
 revealLine: function(lineNumber) { },
 
 
@@ -27816,7 +29495,7 @@
 scrollToLine: function(lineNumber) { },
 
 
-selection: function(textRange) { },
+selection: function() { },
 
 
 lastSelection: function() { },
@@ -27825,6 +29504,9 @@
 setSelection: function(textRange) { },
 
 
+copyRange: function(range) { },
+
+
 setText: function(text) { },
 
 
@@ -27939,9 +29621,9 @@
 this._gutterPanel.element.addEventListener("mousewheel", forwardWheelEvent.bind(this), false);
 
 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
-this.element.addEventListener("cut", this._handleCut.bind(this), false);
 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
 
+this._wordMovementController = new WebInspector.DefaultTextEditor.WordMovementController(this, this._textModel);
 this._registerShortcuts();
 }
 
@@ -27954,6 +29636,58 @@
 
 WebInspector.DefaultTextEditor.prototype = {
 
+isClean: function()
+{
+return this._textModel.isClean();
+},
+
+markClean: function()
+{
+this._textModel.markClean();
+},
+
+tokenAtTextPosition: function(lineNumber, column)
+{
+return this._mainPanel.tokenAtTextPosition(lineNumber, column);
+},
+
+
+cursorPositionToCoordinates: function(lineNumber, column)
+{
+return this._mainPanel.cursorPositionToCoordinates(lineNumber, column);
+},
+
+
+coordinatesToCursorPosition: function(x, y)
+{
+return this._mainPanel.coordinatesToCursorPosition(x, y);
+},
+
+
+copyRange: function(range)
+{
+return this._textModel.copyRange(range);
+},
+
+
+highlightRegex: function(regex, cssClass)
+{
+return this._mainPanel.highlightRegex(regex, cssClass);
+},
+
+
+removeHighlight: function(highlightDescriptor)
+{
+this._mainPanel.removeHighlight(highlightDescriptor);
+},
+
+
+highlightRange: function(range, cssClass)
+{
+return this._mainPanel.highlightRange(range, cssClass);
+},
+
+
 set mimeType(mimeType)
 {
 this._mainPanel.mimeType = mimeType;
@@ -28121,7 +29855,7 @@
 
 editRange: function(range, text)
 {
-return this._textModel.editRange(range, text);
+return this._textModel.editRange(range, text, this.lastSelection());
 },
 
 _updatePanelOffsets: function()
@@ -28182,21 +29916,8 @@
 
 this._shortcuts = {};
 
-var handleEnterKey = this._mainPanel.handleEnterKey.bind(this._mainPanel);
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Enter.code, WebInspector.KeyboardShortcut.Modifiers.None)] = handleEnterKey;
-
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.CtrlOrMeta)] = this._mainPanel.handleUndoRedo.bind(this._mainPanel, false);
 this._shortcuts[WebInspector.KeyboardShortcut.SelectAll] = this._handleSelectAll.bind(this);
-
-var handleRedo = this._mainPanel.handleUndoRedo.bind(this._mainPanel, true);
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | modifiers.CtrlOrMeta)] = handleRedo;
-if (!WebInspector.isMac())
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey("y", modifiers.CtrlOrMeta)] = handleRedo;
-
-var handleTabKey = this._mainPanel.handleTabKeyPress.bind(this._mainPanel, false);
-var handleShiftTabKey = this._mainPanel.handleTabKeyPress.bind(this._mainPanel, true);
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code)] = handleTabKey;
-this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code, modifiers.Shift)] = handleShiftTabKey;
+this._wordMovementController._registerShortcuts(this._shortcuts);
 },
 
 _handleSelectAll: function()
@@ -28219,12 +29940,7 @@
 e.consume(true);
 return;
 }
-this._mainPanel.handleKeyDown(e);
-},
-
-_handleCut: function(e)
-{
-this._mainPanel.handleCut(e);
+this._mainPanel.handleKeyDown(shortcutKey, e);
 },
 
 _contextMenu: function(event)
@@ -28237,7 +29953,7 @@
 if (target)
 this._delegate.populateLineGutterContextMenu(contextMenu, target.lineNumber);
 else {
-this._mainPanel.contextMenu(event.target, contextMenu);
+this._mainPanel.populateContextMenu(event.target, contextMenu);
 }
 contextMenu.show();
 },
@@ -28256,15 +29972,15 @@
 },
 
 
-selection: function(textRange)
+selection: function()
 {
-return this._mainPanel.getSelection();
+return this._mainPanel.selection();
 },
 
 
 lastSelection: function()
 {
-return this._mainPanel.getLastSelection();
+return this._mainPanel.lastSelection();
 },
 
 
@@ -28326,8 +30042,6 @@
 if (!this.readOnly())
 WebInspector.markBeingEdited(this.element, true);
 
-this._boundSelectionChangeListener = this._mainPanel.handleSelectionChange.bind(this._mainPanel);
-document.addEventListener("selectionchange", this._boundSelectionChangeListener, false);
 this._mainPanel.wasShown();
 },
 
@@ -28335,8 +30049,6 @@
 {
 this._mainPanel.willHide();
 this._gutterPanel.willHide();
-document.removeEventListener("selectionchange", this._boundSelectionChangeListener, false);
-delete this._boundSelectionChangeListener;
 
 if (!this.readOnly())
 WebInspector.markBeingEdited(this.element, false);
@@ -28351,47 +30063,6 @@
 },
 
 
-highlightExpression: function(element, skipClasses, skipTokens)
-{
-
-var tokens = [element];
-var token = element.previousSibling;
-while (token && (skipClasses[token.className] || skipTokens[token.textContent.trim()])) {
-tokens.push(token);
-token = token.previousSibling;
-}
-tokens.reverse();
-
-
-this._mainPanel.beginDomUpdates();
-var parentElement = element.parentElement;
-var nextElement = element.nextSibling;
-var container = document.createElement("span");
-for (var i = 0; i < tokens.length; ++i)
-container.appendChild(tokens[i]);
-parentElement.insertBefore(container, nextElement);
-this._mainPanel.endDomUpdates();
-return container;
-},
-
-
-hideHighlightedExpression: function(highlightElement)
-{
-this._mainPanel.beginDomUpdates();
-var parentElement = highlightElement.parentElement;
-if (parentElement) {
-var child = highlightElement.firstChild;
-while (child) {
-var nextSibling = child.nextSibling;
-parentElement.insertBefore(child, highlightElement);
-child = nextSibling;
-}
-parentElement.removeChild(highlightElement);
-}
-this._mainPanel.endDomUpdates();
-},
-
-
 overrideViewportForTest: function(scrollTop, clientHeight, chunkSize)
 {
 this._mainPanel.overrideViewportForTest(scrollTop, clientHeight, chunkSize);
@@ -28539,7 +30210,7 @@
 
 createNewChunk: function(startLine, endLine)
 {
-throw new Error("createNewChunk() is not implemented");
+throw new Error("createNewChunk() should be implemented by descendants");
 },
 
 _scroll: function()
@@ -28609,6 +30280,10 @@
 
 findVisibleChunks: function(visibleFrom, visibleTo)
 {
+var span = (visibleTo - visibleFrom) * 0.5;
+visibleFrom = Math.max(visibleFrom - span, 0);
+visibleTo = visibleTo + span;
+
 var from = this._findFirstVisibleChunkNumber(visibleFrom);
 for (var to = from + 1; to < this._textChunks.length; ++to) {
 if (this._textChunks[to].offsetTop >= visibleTo)
@@ -28768,6 +30443,7 @@
 }
 
 
+var decorationsToRestore = {};
 for (var lineNumber in this._decorations) {
 lineNumber = parseInt(lineNumber, 10);
 
@@ -28779,18 +30455,20 @@
 continue;
 
 var lineDecorationsCopy = this._decorations[lineNumber].slice();
-for (var i = 0; i < lineDecorationsCopy.length; ++i) {
-var decoration = lineDecorationsCopy[i];
-this.removeDecoration(lineNumber, decoration);
+for (var i = 0; i < lineDecorationsCopy.length; ++i)
+this.removeDecoration(lineNumber, lineDecorationsCopy[i]);
 
-
-if (lineNumber < oldRange.endLine)
-continue;
-
-this.addDecoration(lineNumber + linesDiff, decoration);
+if (lineNumber >= oldRange.endLine)
+decorationsToRestore[lineNumber] = lineDecorationsCopy;
 }
+for (var lineNumber in decorationsToRestore) {
+lineNumber = parseInt(lineNumber, 10);
+var lineDecorationsCopy = decorationsToRestore[lineNumber];
+for (var i = 0; i < lineDecorationsCopy.length; ++i)
+this.addDecoration(lineNumber + linesDiff, lineDecorationsCopy[i]);
 }
 
+
 this.repaintAll();
 } else {
 
@@ -29010,29 +30688,311 @@
 
 this.element.addEventListener("focus", this._handleElementFocus.bind(this), false);
 this.element.addEventListener("textInput", this._handleTextInput.bind(this), false);
+this.element.addEventListener("cut", this._handleCut.bind(this), false);
+this.element.addEventListener("keypress", this._handleKeyPress.bind(this), false);
+
+this._showWhitespace = WebInspector.experimentsSettings.showWhitespaceInEditor.isEnabled();
 
 this._container.addEventListener("focus", this._handleFocused.bind(this), false);
 
+this._highlightDescriptors = [];
+
+this._tokenHighlighter = new WebInspector.TextEditorMainPanel.TokenHighlighter(this, textModel);
+this._braceMatcher = new WebInspector.TextEditorModel.BraceMatcher(textModel);
+this._braceHighlighter = new WebInspector.TextEditorMainPanel.BraceHighlightController(this, textModel, this._braceMatcher);
+this._smartBraceController = new WebInspector.TextEditorMainPanel.SmartBraceController(this, textModel, this._braceMatcher);
+
 this._freeCachedElements();
 this.buildChunks();
+this._registerShortcuts();
 }
 
+WebInspector.TextEditorMainPanel._ConsecutiveWhitespaceChars = {
+1: " ",
+2: "  ",
+4: "    ",
+8: "        ",
+16: "                "
+};
+
 WebInspector.TextEditorMainPanel.prototype = {
+
+tokenAtTextPosition: function(lineNumber, column)
+{
+if (lineNumber >= this._textModel.linesCount || lineNumber < 0)
+return null;
+var line = this._textModel.line(lineNumber);
+if (column >= line.length || column < 0)
+return null;
+var highlight = this._textModel.getAttribute(lineNumber, "highlight");
+if (!highlight)
+return this._tokenAtUnhighlightedLine(line, column);
+function compare(value, object)
+{
+if (value >= object.startColumn && value <= object.endColumn)
+return 0;
+return value - object.startColumn;
+}
+var index = binarySearch(column, highlight.ranges, compare);
+if (index >= 0) {
+var range = highlight.ranges[index];
+return {
+startColumn: range.startColumn,
+endColumn: range.endColumn,
+type: range.token
+};
+}
+return null;
+},
+
+
+cursorPositionToCoordinates: function(lineNumber, column)
+{
+if (lineNumber >= this._textModel.linesCount || lineNumber < 0)
+return null;
+var line = this._textModel.line(lineNumber);
+if (column > line.length || column < 0)
+return null;
+
+var chunk = this.chunkForLine(lineNumber);
+if (!chunk.expanded())
+return null;
+var lineRow = chunk.expandedLineRow(lineNumber);
+var ranges = [{
+startColumn: column,
+endColumn: column,
+token: "measure-cursor-position"
+}];
+var selection = this.selection();
+
+this.beginDomUpdates();
+this._renderRanges(lineRow, line, ranges);
+var spans = lineRow.getElementsByClassName("webkit-measure-cursor-position");
+if (WebInspector.debugDefaultTextEditor)
+console.assert(spans.length === 0);
+var totalOffset = spans[0].totalOffset();
+var height = spans[0].offsetHeight;
+this._paintLineRows([lineRow]);
+this.endDomUpdates();
+
+this._restoreSelection(selection);
+return {
+x: totalOffset.left,
+y: totalOffset.top,
+height: height
+};
+},
+
+
+coordinatesToCursorPosition: function(x, y)
+{
+var element = document.elementFromPoint(x, y);
+if (!element)
+return null;
+var lineRow = element.enclosingNodeOrSelfWithClass("webkit-line-content");
+if (!lineRow)
+return null;
+
+var line = this._textModel.line(lineRow.lineNumber) + " ";
+var ranges = [];
+const prefix = "character-position-";
+for(var i = 0; i < line.length; ++i) {
+ranges.push({
+startColumn: i,
+endColumn: i,
+token: prefix + i
+});
+}
+
+var selection = this.selection();
+
+this.beginDomUpdates();
+this._renderRanges(lineRow, line, ranges);
+var charElement = document.elementFromPoint(x, y);
+this._paintLineRows([lineRow]);
+this.endDomUpdates();
+
+this._restoreSelection(selection);
+var className = charElement.className;
+if (className.indexOf(prefix) < 0)
+return null;
+var column = parseInt(className.substring(className.indexOf(prefix) + prefix.length), 10);
+
+return WebInspector.TextRange.createFromLocation(lineRow.lineNumber, column);
+},
+
+
+_tokenAtUnhighlightedLine: function(line, column)
+{
+var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(this.mimeType);
+tokenizer.condition = tokenizer.createInitialCondition();
+tokenizer.line = line;
+var lastTokenizedColumn = 0;
+while (lastTokenizedColumn < line.length) {
+var newColumn = tokenizer.nextToken(lastTokenizedColumn);
+if (column < newColumn) {
+if (!tokenizer.tokenType)
+return null;
+return {
+startColumn: lastTokenizedColumn,
+endColumn: newColumn - 1,
+type: tokenizer.tokenType
+};
+} else
+lastTokenizedColumn = newColumn;
+}
+return null;
+},
+
+_registerShortcuts: function()
+{
+var keys = WebInspector.KeyboardShortcut.Keys;
+var modifiers = WebInspector.KeyboardShortcut.Modifiers;
+
+this._shortcuts = {};
+
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Enter.code, WebInspector.KeyboardShortcut.Modifiers.None)] = this._handleEnterKey.bind(this);
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.CtrlOrMeta)] = this._handleUndoRedo.bind(this, false);
+
+var handleRedo = this._handleUndoRedo.bind(this, true);
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | modifiers.CtrlOrMeta)] = handleRedo;
+if (!WebInspector.isMac())
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey("y", modifiers.CtrlOrMeta)] = handleRedo;
+
+var handleTabKey = this._handleTabKeyPress.bind(this, false);
+var handleShiftTabKey = this._handleTabKeyPress.bind(this, true);
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code)] = handleTabKey;
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code, modifiers.Shift)] = handleShiftTabKey;
+
+var homeKey = WebInspector.isMac() ? keys.Right : keys.Home;
+var homeModifier = WebInspector.isMac() ? modifiers.Meta : modifiers.None;
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey(homeKey.code, homeModifier)] = this._handleHomeKey.bind(this, false);
+this._shortcuts[WebInspector.KeyboardShortcut.makeKey(homeKey.code, homeModifier | modifiers.Shift)] = this._handleHomeKey.bind(this, true);
+
+this._charOverrides = {};
+
+this._smartBraceController.registerShortcuts(this._shortcuts);
+this._smartBraceController.registerCharOverrides(this._charOverrides);
+},
+
+_handleKeyPress: function(event)
+{
+var char = String.fromCharCode(event.which);
+var handler = this._charOverrides[char];
+if (handler && handler()) {
+event.consume(true);
+return;
+}
+this._keyDownCode = event.keyCode;
+},
+
+
+_handleHomeKey: function(shift)
+{
+var selection = this.selection();
+
+var line = this._textModel.line(selection.endLine);
+var firstNonBlankCharacter = 0;
+while (firstNonBlankCharacter < line.length) {
+var char = line.charAt(firstNonBlankCharacter);
+if (char === " " || char === "\t")
+++firstNonBlankCharacter;
+else
+break;
+}
+if (firstNonBlankCharacter >= line.length || selection.endColumn === firstNonBlankCharacter)
+return false;
+
+selection.endColumn = firstNonBlankCharacter;
+if (!shift)
+selection = selection.collapseToEnd();
+this._restoreSelection(selection);
+return true;
+},
+
+
+highlightRegex: function(regex, cssClass)
+{
+var highlightDescriptor = new WebInspector.TextEditorMainPanel.RegexHighlightDescriptor(new RegExp(regex, "g"), cssClass);
+this._highlightDescriptors.push(highlightDescriptor);
+this._repaintLineRowsAffectedByHighlightDescriptors([highlightDescriptor]);
+return highlightDescriptor;
+},
+
+
+removeHighlight: function(highlightDescriptor)
+{
+this._highlightDescriptors.remove(highlightDescriptor);
+this._repaintLineRowsAffectedByHighlightDescriptors([highlightDescriptor]);
+},
+
+
+highlightRange: function(range, cssClass)
+{
+var highlightDescriptor = new WebInspector.TextEditorMainPanel.RangeHighlightDescriptor(range, cssClass);
+this._highlightDescriptors.push(highlightDescriptor);
+this._repaintLineRowsAffectedByHighlightDescriptors([highlightDescriptor]);
+return highlightDescriptor;
+},
+
+
+_repaintLineRowsAffectedByHighlightDescriptors: function(highlightDescriptors)
+{
+var visibleFrom = this.scrollTop();
+var visibleTo = visibleFrom + this.clientHeight();
+
+var visibleChunks = this.findVisibleChunks(visibleFrom, visibleTo);
+
+var affectedLineRows = [];
+for (var i = visibleChunks.start; i < visibleChunks.end; ++i) {
+var chunk = this._textChunks[i];
+if (!chunk.expanded())
+continue;
+for (var lineNumber = chunk.startLine; lineNumber < chunk.startLine + chunk.linesCount; ++lineNumber) {
+var lineRow = chunk.expandedLineRow(lineNumber);
+var line = this._textModel.line(lineNumber);
+for(var j = 0; j < highlightDescriptors.length; ++j) {
+if (highlightDescriptors[j].affectsLine(lineNumber, line)) {
+affectedLineRows.push(lineRow);
+break;
+}
+}
+}
+}
+if (affectedLineRows.length === 0)
+return;
+var selection = this.selection();
+this._paintLineRows(affectedLineRows);
+this._restoreSelection(selection);
+},
+
+resize: function()
+{
+WebInspector.TextEditorChunkedPanel.prototype.resize.call(this);
+this._repaintLineRowsAffectedByHighlightDescriptors(this._highlightDescriptors);
+},
+
 wasShown: function()
 {
+this._boundSelectionChangeListener = this._handleSelectionChange.bind(this);
+document.addEventListener("selectionchange", this._boundSelectionChangeListener, false);
+
 this._isShowing = true;
 this._attachMutationObserver();
 },
 
 willHide: function()
 {
+document.removeEventListener("selectionchange", this._boundSelectionChangeListener, false);
+delete this._boundSelectionChangeListener;
+
 this._detachMutationObserver();
 this._isShowing = false;
 this._freeCachedElements();
 },
 
 
-contextMenu: function(eventTarget, contextMenu)
+populateContextMenu: function(eventTarget, contextMenu)
 {
 var target = this._enclosingLineRowOrSelf(eventTarget);
 this._delegate.populateTextAreaContextMenu(contextMenu, target && target.lineNumber);
@@ -29080,6 +31040,11 @@
 this._highlighter.mimeType = mimeType;
 },
 
+get mimeType()
+{
+return this._highlighter.mimeType;
+},
+
 
 setReadOnly: function(readOnly, requestFocus)
 {
@@ -29160,7 +31125,7 @@
 this._rangeToMark = range;
 this.revealLine(range.startLine);
 var chunk = this.makeLineAChunk(range.startLine);
-this._paintLine(chunk.element);
+this._paintLines(chunk.startLine, chunk.startLine + 1);
 if (this._markedRangeElement)
 this._markedRangeElement.scrollIntoViewIfNeeded();
 }
@@ -29196,7 +31161,7 @@
 },
 
 
-handleUndoRedo: function(redo)
+_handleUndoRedo: function(redo)
 {
 if (this.readOnly())
 return false;
@@ -29215,12 +31180,12 @@
 },
 
 
-handleTabKeyPress: function(shiftKey)
+_handleTabKeyPress: function(shiftKey)
 {
 if (this.readOnly())
 return false;
 
-var selection = this.getSelection();
+var selection = this.selection();
 if (!selection)
 return false;
 
@@ -29246,12 +31211,12 @@
 return true;
 },
 
-handleEnterKey: function()
+_handleEnterKey: function()
 {
 if (this.readOnly())
 return false;
 
-var range = this.getSelection();
+var range = this.selection();
 if (!range)
 return false;
 
@@ -29296,7 +31261,7 @@
 
 splitChunkOnALine: function(lineNumber, chunkNumber, createSuffixChunk)
 {
-var selection = this.getSelection();
+var selection = this.selection();
 var chunk = WebInspector.TextEditorChunkedPanel.prototype.splitChunkOnALine.call(this, lineNumber, chunkNumber, createSuffixChunk);
 this._restoreSelection(selection);
 return chunk;
@@ -29336,15 +31301,13 @@
 var lastChunk = this._textChunks[toIndex - 1];
 var lastVisibleLine = lastChunk.startLine + lastChunk.linesCount;
 
-var selection = this.getSelection();
+var selection = this.selection();
 
 this._muteHighlightListener = true;
 this._highlighter.highlight(lastVisibleLine);
 delete this._muteHighlightListener;
 
-this._restorePaintLinesOperationsCredit();
 WebInspector.TextEditorChunkedPanel.prototype.expandChunks.call(this, fromIndex, toIndex);
-this._adjustPaintLinesOperationsRefreshValue();
 
 this._restoreSelection(selection);
 },
@@ -29354,151 +31317,112 @@
 {
 if (this._muteHighlightListener)
 return;
-this._restorePaintLinesOperationsCredit();
 this._paintLines(fromLine, toLine, true  );
 },
 
 
-_schedulePaintLines: function(startLine, endLine)
-{
-if (startLine >= endLine)
-return;
-
-if (!this._scheduledPaintLines) {
-this._scheduledPaintLines = [{ startLine: startLine, endLine: endLine }];
-this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 0);
-} else {
-for (var i = 0; i < this._scheduledPaintLines.length; ++i) {
-var chunk = this._scheduledPaintLines[i];
-if (chunk.startLine <= endLine && chunk.endLine >= startLine) {
-chunk.startLine = Math.min(chunk.startLine, startLine);
-chunk.endLine = Math.max(chunk.endLine, endLine);
-return;
-}
-if (chunk.startLine > endLine) {
-this._scheduledPaintLines.splice(i, 0, { startLine: startLine, endLine: endLine });
-return;
-}
-}
-this._scheduledPaintLines.push({ startLine: startLine, endLine: endLine });
-}
-},
-
-
-_paintScheduledLines: function(skipRestoreSelection)
-{
-if (this._paintScheduledLinesTimer)
-clearTimeout(this._paintScheduledLinesTimer);
-delete this._paintScheduledLinesTimer;
-
-if (!this._scheduledPaintLines)
-return;
-
-
-if (this._repaintAllTimer) {
-this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 50);
-return;
-}
-
-var scheduledPaintLines = this._scheduledPaintLines;
-delete this._scheduledPaintLines;
-
-this._restorePaintLinesOperationsCredit();
-this._paintLineChunks(scheduledPaintLines, !skipRestoreSelection);
-this._adjustPaintLinesOperationsRefreshValue();
-},
-
-_restorePaintLinesOperationsCredit: function()
-{
-if (!this._paintLinesOperationsRefreshValue)
-this._paintLinesOperationsRefreshValue = 250;
-this._paintLinesOperationsCredit = this._paintLinesOperationsRefreshValue;
-this._paintLinesOperationsLastRefresh = Date.now();
-},
-
-_adjustPaintLinesOperationsRefreshValue: function()
-{
-var operationsDone = this._paintLinesOperationsRefreshValue - this._paintLinesOperationsCredit;
-if (operationsDone <= 0)
-return;
-var timePast = Date.now() - this._paintLinesOperationsLastRefresh;
-if (timePast <= 0)
-return;
-
-var value = Math.floor(operationsDone / timePast * 50);
-this._paintLinesOperationsRefreshValue = Number.constrain(value, 150, 1500);
-},
-
-
 _paintLines: function(fromLine, toLine, restoreSelection)
 {
-this._paintLineChunks([{ startLine: fromLine, endLine: toLine }], restoreSelection);
-},
-
-
-_paintLineChunks: function(lineChunks, restoreSelection)
-{
-
-
-var visibleFrom = this.scrollTop();
-var firstVisibleLineNumber = this.lineNumberAtOffset(visibleFrom);
-
+var lineRows = [];
 var chunk;
-var selection;
-var invisibleLineRows = [];
-for (var i = 0; i < lineChunks.length; ++i) {
-var lineChunk = lineChunks[i];
-if (this._scheduledPaintLines) {
-this._schedulePaintLines(lineChunk.startLine, lineChunk.endLine);
-continue;
-}
-for (var lineNumber = lineChunk.startLine; lineNumber < lineChunk.endLine; ++lineNumber) {
+for (var lineNumber = fromLine; lineNumber < toLine; ++lineNumber) {
 if (!chunk || lineNumber < chunk.startLine || lineNumber >= chunk.startLine + chunk.linesCount)
 chunk = this.chunkForLine(lineNumber);
 var lineRow = chunk.expandedLineRow(lineNumber);
 if (!lineRow)
 continue;
-if (lineNumber < firstVisibleLineNumber) {
-invisibleLineRows.push(lineRow);
-continue;
+lineRows.push(lineRow);
 }
-if (restoreSelection && !selection)
-selection = this.getSelection();
-this._paintLine(lineRow);
-if (this._paintLinesOperationsCredit < 0) {
-this._schedulePaintLines(lineNumber + 1, lineChunk.endLine);
-break;
-}
-}
-}
+if (lineRows.length === 0)
+return;
 
-for (var i = 0; i < invisibleLineRows.length; ++i) {
-if (restoreSelection && !selection)
-selection = this.getSelection();
-this._paintLine(invisibleLineRows[i]);
-}
+var selection;
+if (restoreSelection)
+selection = this.selection();
+
+this._paintLineRows(lineRows);
 
 if (restoreSelection)
 this._restoreSelection(selection);
 },
 
 
-_paintLine: function(lineRow)
+_paintLineRows: function(lineRows)
 {
-var lineNumber = lineRow.lineNumber;
-
+var highlight = {};
 this.beginDomUpdates();
-try {
-if (this._scheduledPaintLines || this._paintLinesOperationsCredit < 0) {
-this._schedulePaintLines(lineNumber, lineNumber + 1);
-return;
+for(var i = 0; i < this._highlightDescriptors.length; ++i) {
+var highlightDescriptor = this._highlightDescriptors[i];
+this._measureHighlightDescriptor(highlight, lineRows, highlightDescriptor);
 }
 
-var highlight = this._textModel.getAttribute(lineNumber, "highlight");
-if (!highlight)
-return;
+for(var i = 0; i < lineRows.length; ++i)
+this._paintLine(lineRows[i], highlight[lineRows[i].lineNumber]);
 
+this.endDomUpdates();
+},
+
+
+_measureHighlightDescriptor: function(highlight, lineRows, highlightDescriptor)
+{
+var rowsToMeasure = [];
+for(var i = 0; i < lineRows.length; ++i) {
+var lineRow = lineRows[i];
+var line = this._textModel.line(lineRow.lineNumber);
+var ranges = highlightDescriptor.rangesForLine(lineRow.lineNumber, line);
+if (ranges.length === 0)
+continue;
+for(var j = 0; j < ranges.length; ++j)
+ranges[j].token = "measure-span";
+
+this._renderRanges(lineRow, line, ranges);
+rowsToMeasure.push(lineRow);
+}
+
+for(var i = 0; i < rowsToMeasure.length; ++i) {
+var lineRow = rowsToMeasure[i];
+var lineNumber = lineRow.lineNumber;
+var metrics = this._measureSpans(lineRow);
+
+if (!highlight[lineNumber])
+highlight[lineNumber] = [];
+
+highlight[lineNumber].push(new WebInspector.TextEditorMainPanel.LineOverlayHighlight(metrics, highlightDescriptor.cssClass()));
+}
+},
+
+
+_measureSpans: function(lineRow)
+{
+var spans = lineRow.getElementsByClassName("webkit-measure-span");
+var metrics = [];
+for(var i = 0; i < spans.length; ++i)
+metrics.push(new WebInspector.TextEditorMainPanel.ElementMetrics(spans[i]));
+return metrics;
+},
+
+
+_appendOverlayHighlight: function(lineRow, highlight)
+{
+var metrics = highlight.metrics;
+var cssClass = highlight.cssClass;
+for(var i = 0; i < metrics.length; ++i) {
+var highlightSpan = document.createElement("span");
+highlightSpan._isOverlayHighlightElement = true;
+highlightSpan.addStyleClass(cssClass);
+highlightSpan.style.left = metrics[i].left + "px";
+highlightSpan.style.width = metrics[i].width + "px";
+highlightSpan.style.height = metrics[i].height + "px";
+highlightSpan.addStyleClass("text-editor-overlay-highlight");
+lineRow.insertBefore(highlightSpan, lineRow.decorationsElement);
+}
+},
+
+
+_renderRanges: function(lineRow, line, ranges, splitWhitespaceSequences)
+{
 var decorationsElement = lineRow.decorationsElement;
+
 if (!decorationsElement)
 lineRow.removeChildren();
 else {
@@ -29510,9 +31434,6 @@
 }
 }
 
-var line = this._textModel.line(lineNumber);
-var ranges = this._highlighter.orderedRangesPerLine(lineNumber);
-
 if (!line)
 lineRow.insertBefore(document.createElement("br"), decorationsElement);
 
@@ -29520,20 +31441,48 @@
 for(var i = 0; i < ranges.length; i++) {
 var rangeStart = ranges[i].startColumn;
 var rangeEnd = ranges[i].endColumn;
-var rangeToken = ranges[i].token;
 
 if (plainTextStart < rangeStart) {
-this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, rangeStart));
---this._paintLinesOperationsCredit;
+this._insertSpanBefore(lineRow, decorationsElement, line.substring(plainTextStart, rangeStart));
 }
-this._insertSpanBefore(lineRow, decorationsElement, line.substring(rangeStart, rangeEnd + 1), rangeToken);
---this._paintLinesOperationsCredit;
+
+if (splitWhitespaceSequences && ranges[i].token === "whitespace")
+this._renderWhitespaceCharsWithFixedSizeSpans(lineRow, decorationsElement, rangeEnd - rangeStart + 1);
+else
+this._insertSpanBefore(lineRow, decorationsElement, line.substring(rangeStart, rangeEnd + 1), ranges[i].token ? "webkit-" + ranges[i].token : "");
 plainTextStart = rangeEnd + 1;
 }
 if (plainTextStart < line.length) {
-this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, line.length));
---this._paintLinesOperationsCredit;
+this._insertSpanBefore(lineRow, decorationsElement, line.substring(plainTextStart, line.length));
 }
+},
+
+
+_renderWhitespaceCharsWithFixedSizeSpans: function(lineRow, decorationsElement, length)
+{
+for (var whitespaceLength = 16; whitespaceLength > 0; whitespaceLength >>= 1) {
+var cssClass = "webkit-whitespace webkit-whitespace-" + whitespaceLength;
+for (; length >= whitespaceLength; length -= whitespaceLength)
+this._insertSpanBefore(lineRow, decorationsElement, WebInspector.TextEditorMainPanel._ConsecutiveWhitespaceChars[whitespaceLength], cssClass);
+}
+},
+
+
+_paintLine: function(lineRow, overlayHighlight)
+{
+var lineNumber = lineRow.lineNumber;
+
+this.beginDomUpdates();
+try {
+var syntaxHighlight = this._textModel.getAttribute(lineNumber, "highlight");
+
+var line = this._textModel.line(lineNumber);
+var ranges = syntaxHighlight ? syntaxHighlight.ranges : [];
+this._renderRanges(lineRow, line, ranges, this._showWhitespace);
+
+if (overlayHighlight)
+for(var i = 0; i < overlayHighlight.length; ++i)
+this._appendOverlayHighlight(lineRow, overlayHighlight[i]);
 } finally {
 if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
 this._markedRangeElement = WebInspector.highlightSearchResult(lineRow, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
@@ -29562,7 +31511,7 @@
 },
 
 
-getSelection: function(lastUndamagedLineRow)
+selection: function(lastUndamagedLineRow)
 {
 var selection = window.getSelection();
 if (!selection.rangeCount)
@@ -29570,12 +31519,15 @@
 
 if (!this._container.isAncestor(selection.anchorNode) || !this._container.isAncestor(selection.focusNode))
 return null;
+
+if (selection.focusNode.enclosingNodeOrSelfWithClass("webkit-line-decorations", this._container))
+return null;
 var start = this._selectionToPosition(selection.anchorNode, selection.anchorOffset, lastUndamagedLineRow);
 var end = selection.isCollapsed ? start : this._selectionToPosition(selection.focusNode, selection.focusOffset, lastUndamagedLineRow);
 return new WebInspector.TextRange(start.line, start.column, end.line, end.column);
 },
 
-getLastSelection: function()
+lastSelection: function()
 {
 return this._lastSelection;
 },
@@ -29716,7 +31668,10 @@
 }
 
 var span = this._cachedSpans.pop() || document.createElement("span");
-span.className = "webkit-" + className;
+if (!className)
+span.removeAttribute("class");
+else
+span.className = className;
 if (WebInspector.FALSE) 
 span.addStyleClass("debug-fadeout");
 span.textContent = content;
@@ -29854,6 +31809,7 @@
 var startLine = dirtyLines.start;
 var endLine = dirtyLines.end;
 
+var originalSelection = this._lastSelection;
 var editInfo = this._guessEditRangeBasedOnSelection(startLine, endLine, lines);
 if (!editInfo) {
 if (WebInspector.debugDefaultTextEditor)
@@ -29866,11 +31822,11 @@
 editInfo = new WebInspector.DefaultTextEditor.EditInfo(range, lines.join("\n"));
 }
 
-var selection = this.getSelection(collectLinesFromNode);
+var selection = this.selection(collectLinesFromNode);
 
 
 if (editInfo.text === "}" && editInfo.range.isEmpty() && selection.isEmpty() && !this._textModel.line(editInfo.range.endLine).trim()) {
-var offset = this._closingBlockOffset(editInfo.range, selection);
+var offset = this._closingBlockOffset(editInfo.range);
 if (offset >= 0) {
 editInfo.range.startColumn = offset;
 selection.startColumn = offset + 1;
@@ -29878,8 +31834,7 @@
 }
 }
 
-this._textModel.editRange(editInfo.range, editInfo.text);
-this._paintScheduledLines(true);
+this._textModel.editRange(editInfo.range, editInfo.text, originalSelection);
 this._restoreSelection(selection);
 },
 
@@ -29955,27 +31910,13 @@
 },
 
 
-_closingBlockOffset: function(oldRange, selection)
+_closingBlockOffset: function(oldRange)
 {
-var nestingLevel = 1;
-for (var i = oldRange.endLine; i >= 0; --i) {
-var attribute = this._textModel.getAttribute(i, "highlight");
-if (!attribute)
-continue;
-var ranges = attribute.ranges;
-for (var j = ranges.length - 1; j >= 0; j--) {
-var token = ranges[j].token;
-if (token === "block-start") {
-if (!(--nestingLevel)) {
-var lineContent = this._textModel.line(i);
-return lineContent.length - lineContent.trimLeft().length;
-}
-}
-if (token === "block-end")
-++nestingLevel;
-}
-}
+var leftBrace = this._braceMatcher.findLeftCandidate(oldRange.startLine, oldRange.startColumn);
+if (!leftBrace || leftBrace.token !== "block-start")
 return -1;
+var lineContent = this._textModel.line(leftBrace.lineNumber);
+return lineContent.length - lineContent.trimLeft().length;
 },
 
 
@@ -30095,12 +32036,12 @@
 var textContents = [];
 var hasContent = false;
 for (var node = from ? from.nextSibling : this._container; node && node !== to; node = node.traverseNextNode(this._container)) {
-if (node._isDecorationsElement) {
 
+while (node && node !== to && (node._isDecorationsElement || node._isOverlayHighlightElement))
 node = node.nextSibling;
 if (!node || node === to)
 break;
-}
+
 hasContent = true;
 if (node.nodeName.toLowerCase() === "br")
 textContents.push("\n");
@@ -30117,25 +32058,38 @@
 return textContent.split("\n");
 },
 
-handleSelectionChange: function(event)
+
+_handleSelectionChange: function(event)
 {
-var textRange = this.getSelection();
+var textRange = this.selection();
 if (textRange)
 this._lastSelection = textRange;
+
+this._tokenHighlighter.handleSelectionChange(textRange);
+this._braceHighlighter.handleSelectionChange(textRange);
 this._delegate.selectionChanged(textRange);
 },
 
-_handleTextInput: function(e)
+
+_handleTextInput: function(event)
 {
-this._textInputData = e.data;
+this._textInputData = event.data;
 },
 
-handleKeyDown: function(e)
+
+handleKeyDown: function(shortcutKey, event)
 {
-this._keyDownCode = e.keyCode;
+var handler = this._shortcuts[shortcutKey];
+if (handler && handler()) {
+event.consume(true);
+return;
+}
+
+this._keyDownCode = event.keyCode;
 },
 
-handleCut: function(e)
+
+_handleCut: function(event)
 {
 this._keyDownCode = WebInspector.KeyboardShortcut.Keys.Delete.code;
 },
@@ -30152,6 +32106,107 @@
 }
 
 
+WebInspector.TextEditorMainPanel.HighlightDescriptor = function() { }
+
+WebInspector.TextEditorMainPanel.HighlightDescriptor.prototype = {
+
+affectsLine: function(lineNumber, line) { return false; },
+
+
+rangesForLine: function(lineNumber, line) { return []; },
+
+
+cssClass: function() { return ""; },
+}
+
+
+WebInspector.TextEditorMainPanel.RegexHighlightDescriptor = function(regex, cssClass)
+{
+this._cssClass = cssClass;
+this._regex = regex;
+}
+
+WebInspector.TextEditorMainPanel.RegexHighlightDescriptor.prototype = {
+
+affectsLine: function(lineNumber, line)
+{
+this._regex.lastIndex = 0;
+return this._regex.test(line);
+},
+
+
+rangesForLine: function(lineNumber, line)
+{
+var ranges = [];
+var regexResult;
+this._regex.lastIndex = 0;
+while (regexResult = this._regex.exec(line)) {
+ranges.push({
+startColumn: regexResult.index,
+endColumn: regexResult.index + regexResult[0].length - 1
+});
+}
+return ranges;
+},
+
+
+cssClass: function()
+{
+return this._cssClass;
+}
+}
+
+
+WebInspector.TextEditorMainPanel.RangeHighlightDescriptor = function(range, cssClass)
+{
+this._cssClass = cssClass;
+this._range = range;
+}
+
+WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype = {
+
+affectsLine: function(lineNumber, line)
+{
+return this._range.startLine <= lineNumber && lineNumber <= this._range.endLine && line.length > 0;
+},
+
+
+rangesForLine: function(lineNumber, line)
+{
+if (!this.affectsLine(lineNumber, line))
+return [];
+
+var startColumn = lineNumber === this._range.startLine ? this._range.startColumn : 0;
+var endColumn = lineNumber === this._range.endLine ? Math.min(this._range.endColumn, line.length) : line.length;
+return [{
+startColumn: startColumn,
+endColumn: endColumn
+}];
+},
+
+
+cssClass: function()
+{
+return this._cssClass;
+}
+}
+
+
+WebInspector.TextEditorMainPanel.ElementMetrics = function(element)
+{
+this.width = element.offsetWidth;
+this.height = element.offsetHeight;
+this.left = element.offsetLeft;
+}
+
+
+WebInspector.TextEditorMainPanel.LineOverlayHighlight = function(metrics, cssClass)
+{
+this.metrics = metrics;
+this.cssClass = cssClass;
+}
+
+
 WebInspector.TextEditorMainChunk = function(chunkedPanel, startLine, endLine)
 {
 this._chunkedPanel = chunkedPanel;
@@ -30172,6 +32227,7 @@
 }
 
 WebInspector.TextEditorMainChunk.prototype = {
+
 addDecoration: function(decoration)
 {
 this._chunkedPanel.beginDomUpdates();
@@ -30205,6 +32261,7 @@
 this._chunkedPanel.beginDomUpdates();
 this.element.className = "webkit-line-content";
 if (this.element.decorationsElement) {
+if (this.element.decorationsElement.parentElement)
 this.element.removeChild(this.element.decorationsElement);
 delete this.element.decorationsElement;
 }
@@ -30253,7 +32310,7 @@
 this._expanded = true;
 
 if (this.linesCount === 1) {
-this._chunkedPanel._paintLine(this.element);
+this._chunkedPanel._paintLines(this.startLine, this.startLine + 1);
 return;
 }
 
@@ -30376,6 +32433,340 @@
 }
 }
 
+
+WebInspector.TextEditorMainPanel.TokenHighlighter = function(mainPanel, textModel)
+{
+this._mainPanel = mainPanel;
+this._textModel = textModel;
+}
+
+WebInspector.TextEditorMainPanel.TokenHighlighter.prototype = {
+
+handleSelectionChange: function(range)
+{
+if (!range) {
+this._removeHighlight();
+return;
+}
+
+if (range.startLine !== range.endLine) {
+this._removeHighlight();
+return;
+}
+
+range = range.normalize();
+var selectedText = this._textModel.copyRange(range);
+if (selectedText === this._selectedWord)
+return;
+
+if (selectedText === "") {
+this._removeHighlight();
+return;
+}
+
+if (this._isWord(range, selectedText))
+this._highlight(selectedText);
+else
+this._removeHighlight();
+},
+
+
+_regexString: function(word)
+{
+return "\\b" + word + "\\b";
+},
+
+
+_highlight: function(selectedWord)
+{
+this._removeHighlight();
+this._selectedWord = selectedWord;
+this._highlightDescriptor = this._mainPanel.highlightRegex(this._regexString(selectedWord), "text-editor-token-highlight")
+},
+
+_removeHighlight: function()
+{
+if (this._selectedWord) {
+this._mainPanel.removeHighlight(this._highlightDescriptor);
+delete this._selectedWord;
+delete this._highlightDescriptor;
+}
+},
+
+
+_isWord: function(range, selectedText)
+{
+var line = this._textModel.line(range.startLine);
+var leftBound = range.startColumn === 0 || !WebInspector.TextUtils.isWordChar(line.charAt(range.startColumn - 1));
+var rightBound = range.endColumn === line.length || !WebInspector.TextUtils.isWordChar(line.charAt(range.endColumn));
+return leftBound && rightBound && WebInspector.TextUtils.isWord(selectedText);
+}
+}
+
+
+WebInspector.DefaultTextEditor.WordMovementController = function(textEditor, textModel)
+{
+this._textModel = textModel;
+this._textEditor = textEditor;
+}
+
+WebInspector.DefaultTextEditor.WordMovementController.prototype = {
+
+
+_registerShortcuts: function(shortcuts)
+{
+var keys = WebInspector.KeyboardShortcut.Keys;
+var modifiers = WebInspector.KeyboardShortcut.Modifiers;
+
+const wordJumpModifier = WebInspector.isMac() ? modifiers.Alt : modifiers.Ctrl;
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Backspace.code, wordJumpModifier)] = this._handleCtrlBackspace.bind(this);
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Left.code, wordJumpModifier)] = this._handleCtrlArrow.bind(this, "left");
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Right.code, wordJumpModifier)] = this._handleCtrlArrow.bind(this, "right");
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Left.code, modifiers.Shift | wordJumpModifier)] = this._handleCtrlShiftArrow.bind(this, "left");
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Right.code, modifiers.Shift | wordJumpModifier)] = this._handleCtrlShiftArrow.bind(this, "right");
+},
+
+
+_rangeForCtrlArrowMove: function(selection, direction)
+{
+const isStopChar = WebInspector.TextUtils.isStopChar;
+const isSpaceChar = WebInspector.TextUtils.isSpaceChar;
+
+var lineNumber = selection.endLine;
+var column = selection.endColumn;
+if (direction === "left")
+--column;
+
+if (column === -1 && direction === "left") {
+if (lineNumber > 0)
+return new WebInspector.TextRange(selection.startLine, selection.startColumn, lineNumber - 1, this._textModel.line(lineNumber - 1).length);
+else
+return selection.clone();
+}
+
+var line = this._textModel.line(lineNumber);
+if (column === line.length && direction === "right") {
+if (lineNumber + 1 < this._textModel.linesCount)
+return new WebInspector.TextRange(selection.startLine, selection.startColumn, selection.endLine + 1, 0);
+else
+return selection.clone();
+}
+
+var delta = direction === "left" ? -1 : +1;
+var directionDependentEndColumnOffset = (delta + 1) / 2;
+
+if (isSpaceChar(line.charAt(column))) {
+while(column + delta >= 0 && column + delta < line.length && isSpaceChar(line.charAt(column + delta)))
+column += delta;
+if (column + delta < 0 || column + delta === line.length)
+return new WebInspector.TextRange(selection.startLine, selection.startColumn, lineNumber, column + directionDependentEndColumnOffset);
+else
+column += delta;
+}
+
+var group = isStopChar(line.charAt(column));
+
+while(column + delta >= 0 && column + delta < line.length && isStopChar(line.charAt(column + delta)) === group && !isSpaceChar(line.charAt(column + delta)))
+column += delta;
+
+return new WebInspector.TextRange(selection.startLine, selection.startColumn, lineNumber, column + directionDependentEndColumnOffset);
+},
+
+
+_handleCtrlArrow: function(direction)
+{
+var newSelection = this._rangeForCtrlArrowMove(this._textEditor.selection(), direction);
+this._textEditor.setSelection(newSelection.collapseToEnd());
+return true;
+},
+
+
+_handleCtrlShiftArrow: function(direction)
+{
+this._textEditor.setSelection(this._rangeForCtrlArrowMove(this._textEditor.selection(), direction));
+return true;
+},
+
+
+_handleCtrlBackspace: function()
+{
+var selection = this._textEditor.selection();
+if (!selection.isEmpty())
+return false;
+
+var newSelection = this._rangeForCtrlArrowMove(selection, "left");
+this._textModel.editRange(newSelection.normalize(), "", selection);
+
+this._textEditor.setSelection(newSelection.collapseToEnd());
+return true;
+}
+}
+
+
+WebInspector.TextEditorMainPanel.BraceHighlightController = function(textEditor, textModel, braceMatcher)
+{
+this._textEditor = textEditor;
+this._textModel = textModel;
+this._braceMatcher = braceMatcher;
+this._highlightDescriptors = [];
+}
+
+WebInspector.TextEditorMainPanel.BraceHighlightController.prototype = {
+
+activeBraceColumnForCursorPosition: function(line, column)
+{
+var char = line.charAt(column);
+if (WebInspector.TextUtils.isOpeningBraceChar(char))
+return column;
+
+var previousChar = line.charAt(column - 1);
+if (WebInspector.TextUtils.isBraceChar(previousChar))
+return column - 1;
+
+if (WebInspector.TextUtils.isBraceChar(char))
+return column;
+else
+return -1;
+},
+
+
+handleSelectionChange: function(selectionRange)
+{
+if (!selectionRange || !selectionRange.isEmpty()) {
+this._removeHighlight();
+return;
+}
+
+if (this._highlightedRange && this._highlightedRange.compareTo(selectionRange) === 0)
+return;
+
+this._removeHighlight();
+var lineNumber = selectionRange.startLine;
+var column = selectionRange.startColumn;
+var line = this._textModel.line(lineNumber);
+column = this.activeBraceColumnForCursorPosition(line, column);
+if (column < 0)
+return;
+
+var enclosingBraces = this._braceMatcher.enclosingBraces(lineNumber, column);
+if (!enclosingBraces)
+return;
+
+this._highlightedRange = selectionRange;
+this._highlightDescriptors.push(this._textEditor.highlightRange(WebInspector.TextRange.createFromLocation(enclosingBraces.leftBrace.lineNumber, enclosingBraces.leftBrace.column), "text-editor-brace-match"));
+this._highlightDescriptors.push(this._textEditor.highlightRange(WebInspector.TextRange.createFromLocation(enclosingBraces.rightBrace.lineNumber, enclosingBraces.rightBrace.column), "text-editor-brace-match"));
+},
+
+_removeHighlight: function()
+{
+if (!this._highlightDescriptors.length)
+return;
+
+for(var i = 0; i < this._highlightDescriptors.length; ++i)
+this._textEditor.removeHighlight(this._highlightDescriptors[i]);
+
+this._highlightDescriptors = [];
+delete this._highlightedRange;
+}
+}
+
+
+WebInspector.TextEditorMainPanel.SmartBraceController = function(mainPanel, textModel, braceMatcher)
+{
+this._mainPanel = mainPanel;
+this._textModel = textModel;
+this._braceMatcher = braceMatcher
+}
+
+WebInspector.TextEditorMainPanel.SmartBraceController.prototype = {
+
+registerShortcuts: function(shortcuts)
+{
+if (!WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled())
+return;
+
+var keys = WebInspector.KeyboardShortcut.Keys;
+var modifiers = WebInspector.KeyboardShortcut.Modifiers;
+
+shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Backspace.code, modifiers.None)] = this._handleBackspace.bind(this);
+},
+
+
+registerCharOverrides: function(charOverrides)
+{
+if (!WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled())
+return;
+charOverrides["("] = this._handleBracePairInsertion.bind(this, "()");
+charOverrides[")"] = this._handleClosingBraceOverride.bind(this, ")");
+charOverrides["{"] = this._handleBracePairInsertion.bind(this, "{}");
+charOverrides["}"] = this._handleClosingBraceOverride.bind(this, "}");
+},
+
+_handleBackspace: function()
+{
+var selection = this._mainPanel.lastSelection();
+if (!selection || !selection.isEmpty())
+return false;
+
+var column = selection.startColumn;
+if (column == 0)
+return false;
+
+var lineNumber = selection.startLine;
+var line = this._textModel.line(lineNumber);
+if (column === line.length)
+return false;
+
+var pair = line.substr(column - 1, 2);
+if (pair === "()" || pair === "{}") {
+this._textModel.editRange(new WebInspector.TextRange(lineNumber, column - 1, lineNumber, column + 1), "");
+this._mainPanel.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, column - 1));
+return true;
+} else
+return false;
+},
+
+
+_handleBracePairInsertion: function(bracePair)
+{
+var selection = this._mainPanel.lastSelection().normalize();
+if (selection.isEmpty()) {
+var lineNumber = selection.startLine;
+var column = selection.startColumn;
+var line = this._textModel.line(lineNumber);
+if (column < line.length) {
+var char = line.charAt(column);
+if (WebInspector.TextUtils.isWordChar(char) || (!WebInspector.TextUtils.isBraceChar(char) && WebInspector.TextUtils.isStopChar(char)))
+return false;
+}
+}
+this._textModel.editRange(selection, bracePair);
+this._mainPanel.setSelection(WebInspector.TextRange.createFromLocation(selection.startLine, selection.startColumn + 1));
+return true;
+},
+
+
+_handleClosingBraceOverride: function(brace)
+{
+var selection = this._mainPanel.lastSelection().normalize();
+if (!selection || !selection.isEmpty())
+return false;
+
+var lineNumber = selection.startLine;
+var column = selection.startColumn;
+var line = this._textModel.line(lineNumber);
+if (line.charAt(column) !== brace)
+return false;
+
+var braces = this._braceMatcher.enclosingBraces(lineNumber, column);
+if (braces && braces.rightBrace.lineNumber === lineNumber && braces.rightBrace.column === column) {
+this._mainPanel.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, column + 1));
+return true;
+} else
+return false;
+},
+}
+
 WebInspector.debugDefaultTextEditor = false;
 
 
@@ -30387,6 +32778,7 @@
 {
 WebInspector.View.call(this);
 this.element.addStyleClass("script-view");
+this.element.addStyleClass("fill");
 
 this._url = contentProvider.contentURL();
 this._contentProvider = contentProvider;
@@ -30394,7 +32786,7 @@
 var textEditorDelegate = new WebInspector.TextEditorDelegateForSourceFrame(this);
 
 if (WebInspector.experimentsSettings.codemirror.isEnabled()) {
-importScript("CodeMirrorTextEditor.js");
+loadScript("CodeMirrorTextEditor.js");
 this._textEditor = new WebInspector.CodeMirrorTextEditor(this._url, textEditorDelegate);
 } else
 this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
@@ -30411,6 +32803,9 @@
 this._shortcuts = {};
 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = this._commitEditing.bind(this);
 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
+
+this._sourcePositionElement = document.createElement("div");
+this._sourcePositionElement.className = "source-frame-cursor-position";
 }
 
 
@@ -30444,9 +32839,16 @@
 {
 this._ensureContentLoaded();
 this._textEditor.show(this.element);
+this._editorAttached = true;
 this._wasShownOrLoaded();
 },
 
+
+_isEditorShowing: function()
+{
+return this.isShowing() && this._editorAttached;
+},
+
 willHide: function()
 {
 WebInspector.View.prototype.willHide.call(this);
@@ -30456,6 +32858,12 @@
 },
 
 
+statusBarText: function()
+{
+return this._sourcePositionElement;
+},
+
+
 statusBarItems: function()
 {
 return [];
@@ -30500,14 +32908,13 @@
 {
 for (var line in this._messageBubbles) {
 var bubble = this._messageBubbles[line];
-bubble.parentNode.removeChild(bubble);
+var lineNumber = parseInt(line, 10);
+this._textEditor.removeDecoration(lineNumber, bubble);
 }
 
 this._messages = [];
 this._rowMessages = {};
 this._messageBubbles = {};
-
-this._textEditor.doResize();
 },
 
 
@@ -30529,7 +32936,7 @@
 _innerHighlightLineIfNeeded: function()
 {
 if (typeof this._lineToHighlight === "number") {
-if (this.loaded && this._textEditor.isShowing()) {
+if (this.loaded && this._isEditorShowing()) {
 this._textEditor.highlightLine(this._lineToHighlight);
 delete this._lineToHighlight
 }
@@ -30554,7 +32961,7 @@
 _innerRevealLineIfNeeded: function()
 {
 if (typeof this._lineToReveal === "number") {
-if (this.loaded && this._textEditor.isShowing()) {
+if (this.loaded && this._isEditorShowing()) {
 this._textEditor.revealLine(this._lineToReveal);
 delete this._lineToReveal
 }
@@ -30578,9 +32985,9 @@
 _innerScrollToLineIfNeeded: function()
 {
 if (typeof this._lineToScrollTo === "number") {
-if (this.loaded && this._textEditor.isShowing()) {
+if (this.loaded && this._isEditorShowing()) {
 this._textEditor.scrollToLine(this._lineToScrollTo);
-delete this._lineToScrollTo
+delete this._lineToScrollTo;
 }
 }
 },
@@ -30599,7 +33006,7 @@
 
 _innerSetSelectionIfNeeded: function()
 {
-if (this._selectionToSet && this.loaded && this._textEditor.isShowing()) {
+if (this._selectionToSet && this.loaded && this._isEditorShowing()) {
 this._textEditor.setSelection(this._selectionToSet);
 delete this._selectionToSet;
 }
@@ -30625,8 +33032,11 @@
 {
 this._textEditor.mimeType = mimeType;
 
+if (!this._loaded) {
 this._loaded = true;
 this._textEditor.setText(content || "");
+} else
+this._textEditor.editRange(this._textEditor.range(), content || "");
 
 this._textEditor.beginUpdates();
 
@@ -30655,8 +33065,6 @@
 
 this._addExistingMessagesToSource();
 
-this._textEditor.doResize();
-
 this._textEditor.endUpdates();
 },
 
@@ -30810,6 +33218,7 @@
 this.addMessageToSource(this._messages[i].line - 1, this._messages[i]);
 },
 
+
 addMessageToSource: function(lineNumber, msg)
 {
 if (lineNumber >= this._textEditor.linesCount)
@@ -30817,14 +33226,6 @@
 if (lineNumber < 0)
 lineNumber = 0;
 
-var messageBubbleElement = this._messageBubbles[lineNumber];
-if (!messageBubbleElement || messageBubbleElement.nodeType !== Node.ELEMENT_NODE || !messageBubbleElement.hasStyleClass("webkit-html-message-bubble")) {
-messageBubbleElement = document.createElement("div");
-messageBubbleElement.className = "webkit-html-message-bubble";
-this._messageBubbles[lineNumber] = messageBubbleElement;
-this._textEditor.addDecoration(lineNumber, messageBubbleElement);
-}
-
 var rowMessages = this._rowMessages[lineNumber];
 if (!rowMessages) {
 rowMessages = [];
@@ -30842,6 +33243,15 @@
 var rowMessage = { consoleMessage: msg };
 rowMessages.push(rowMessage);
 
+this._textEditor.beginUpdates();
+var messageBubbleElement = this._messageBubbles[lineNumber];
+if (!messageBubbleElement) {
+messageBubbleElement = document.createElement("div");
+messageBubbleElement.className = "webkit-html-message-bubble";
+this._messageBubbles[lineNumber] = messageBubbleElement;
+this._textEditor.addDecoration(lineNumber, messageBubbleElement);
+}
+
 var imageURL;
 switch (msg.level) {
 case WebInspector.ConsoleMessage.MessageLevel.Error:
@@ -30868,6 +33278,7 @@
 rowMessage.element = messageLineElement;
 rowMessage.repeatCount = msg.totalRepeatCount;
 this._updateMessageRepeatCount(rowMessage);
+this._textEditor.endUpdates();
 },
 
 _updateMessageRepeatCount: function(rowMessage)
@@ -30884,6 +33295,7 @@
 rowMessage.repeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", rowMessage.repeatCount);
 },
 
+
 removeMessageFromSource: function(lineNumber, msg)
 {
 if (lineNumber >= this._textEditor.linesCount)
@@ -30938,10 +33350,30 @@
 
 selectionChanged: function(textRange)
 {
+this._updateSourcePosition(textRange);
 this.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged, textRange);
 },
 
 
+_updateSourcePosition: function(textRange)
+{
+if (!textRange)
+return;
+
+if (textRange.isEmpty()) {
+this._sourcePositionElement.textContent = WebInspector.UIString("Line %d, Column %d", textRange.endLine + 1, textRange.endColumn + 1);
+return;
+}
+textRange = textRange.normalize();
+
+var selectedText = this._textEditor.copyRange(textRange);
+if (textRange.startLine === textRange.endLine)
+this._sourcePositionElement.textContent = WebInspector.UIString("%d characters selected", selectedText.length);
+else
+this._sourcePositionElement.textContent = WebInspector.UIString("%d lines, %d characters selected", textRange.endLine - textRange.startLine + 1, selectedText.length);
+},
+
+
 scrollChanged: function(lineNumber)
 {
 this.dispatchEventToListeners(WebInspector.SourceFrame.Events.ScrollChanged, lineNumber);
@@ -31304,12 +33736,12 @@
 contextMenu.show();
 },
 
-_copyImageURL: function(event)
+_copyImageURL: function()
 {
 InspectorFrontendHost.copyText(this.resource.url);
 },
 
-_openInNewTab: function(event)
+_openInNewTab: function()
 {
 InspectorFrontendHost.openInNewTab(this.resource.url);
 },
@@ -31322,49 +33754,71 @@
 
 
 
-WebInspector.SplitView = function(isVertical, sidebarSizeSettingName, defaultSidebarSize)
+WebInspector.SplitView = function(isVertical, sidebarSizeSettingName, defaultSidebarWidth, defaultSidebarHeight)
 {
 WebInspector.View.call(this);
-this._isVertical = isVertical;
 
 this.registerRequiredCSS("splitView.css");
 
 this.element.className = "split-view";
 
-this._firstElement = document.createElement("div");
-this._firstElement.className = "split-view-contents split-view-contents-" + (isVertical ? "vertical" : "horizontal");
-if (isVertical)
-this._firstElement.style.left = 0;
-else
-this._firstElement.style.top = 0;
-this.element.appendChild(this._firstElement);
+this._firstElement = this.element.createChild("div", "split-view-contents scroll-target split-view-contents-first");
+this._secondElement = this.element.createChild("div", "split-view-contents scroll-target split-view-contents-second");
 
-this._secondElement = document.createElement("div");
-this._secondElement.className = "split-view-contents split-view-contents-" + (isVertical ? "vertical" : "horizontal");
-if (isVertical)
-this._secondElement.style.right = 0;
-else
-this._secondElement.style.bottom = 0;
-this.element.appendChild(this._secondElement);
-
-this._resizerElement = document.createElement("div");
-this._resizerElement.className = "split-view-resizer split-view-resizer-" + (isVertical ? "vertical" : "horizontal");
+this._resizerElement = this.element.createChild("div", "split-view-resizer");
 this.installResizer(this._resizerElement);
 this._resizable = true;
-this.element.appendChild(this._resizerElement);
 
-defaultSidebarSize = defaultSidebarSize || 200;
-this._savedSidebarSize = defaultSidebarSize;
+this._savedSidebarWidth = defaultSidebarWidth || 200;
+this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth;
+
+if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 &&
+0 < this._savedSidebarHeight && this._savedSidebarHeight < 1)
+this._useFraction = true;
 
 this._sidebarSizeSettingName = sidebarSizeSettingName;
-if (this._sidebarSizeSettingName)
-WebInspector.settings[this._sidebarSizeSettingName] = WebInspector.settings.createSetting(this._sidebarSizeSettingName, undefined);
 
-this._secondIsSidebar = true;
+this.setSecondIsSidebar(true);
+
+this._innerSetVertical(isVertical);
 }
 
 WebInspector.SplitView.prototype = {
 
+isVertical: function()
+{
+return this._isVertical;
+},
+
+
+setVertical: function(isVertical)
+{
+if (this._isVertical === isVertical)
+return;
+
+this._innerSetVertical(isVertical);
+
+if (this.isShowing())
+this._updateLayout();
+},
+
+
+_innerSetVertical: function(isVertical)
+{
+this.element.removeStyleClass(this._isVertical ? "split-view-vertical" : "split-view-horizontal");
+this._isVertical = isVertical;
+this.element.addStyleClass(this._isVertical ? "split-view-vertical" : "split-view-horizontal");
+},
+
+_updateLayout: function()
+{
+this._updateTotalSize();
+
+delete this._sidebarSize;  
+this.setSidebarSize(this._lastSidebarSize());
+},
+
+
 firstElement: function()
 {
 return this._firstElement;
@@ -31377,9 +33831,29 @@
 },
 
 
+get mainElement()
+{
+return this.isSidebarSecond() ? this.firstElement() : this.secondElement();
+},
+
+
+get sidebarElement()
+{
+return this.isSidebarSecond() ? this.secondElement() : this.firstElement();
+},
+
+
+isSidebarSecond: function()
+{
+return this._secondIsSidebar;
+},
+
+
 setSecondIsSidebar: function(secondIsSidebar)
 {
+this.sidebarElement.removeStyleClass("split-view-sidebar");
 this._secondIsSidebar = secondIsSidebar;
+this.sidebarElement.addStyleClass("split-view-sidebar");
 },
 
 
@@ -31407,16 +33881,6 @@
 sideB.removeStyleClass("maximized");
 this._removeAllLayoutProperties();
 
-this._firstElement.style.right = 0;
-this._firstElement.style.bottom = 0;
-this._firstElement.style.width = "100%";
-this._firstElement.style.height = "100%";
-
-this._secondElement.style.left = 0;
-this._secondElement.style.top = 0;
-this._secondElement.style.width = "100%";
-this._secondElement.style.height = "100%";
-
 this._isShowingOne = true;
 this.setResizable(false);
 this.doResize();
@@ -31433,6 +33897,16 @@
 this._secondElement.style.removeProperty("top");
 this._secondElement.style.removeProperty("width");
 this._secondElement.style.removeProperty("height");
+
+this._resizerElement.style.removeProperty("left");
+this._resizerElement.style.removeProperty("right");
+this._resizerElement.style.removeProperty("top");
+this._resizerElement.style.removeProperty("bottom");
+
+this._resizerElement.style.removeProperty("margin-left");
+this._resizerElement.style.removeProperty("margin-right");
+this._resizerElement.style.removeProperty("margin-top");
+this._resizerElement.style.removeProperty("margin-bottom");
 },
 
 showBoth: function()
@@ -31443,9 +33917,7 @@
 this._secondElement.removeStyleClass("hidden");
 this._secondElement.removeStyleClass("maximized");
 
-
-delete this._sidebarSize;
-this.setSidebarSize(this._lastSidebarSize());
+this._updateLayout();
 
 this.setResizable(true);
 this.doResize();
@@ -31470,6 +33942,11 @@
 return;
 
 size = this.applyConstraints(size);
+if (size < 0) {
+
+this._sidebarSize = size;
+return;
+}
 this._innerSetSidebarSize(size);
 this._saveSidebarSize(size);
 },
@@ -31486,6 +33963,13 @@
 return this._totalSize;
 },
 
+_updateTotalSize: function()
+{
+this._totalSize = this._isVertical ? this.element.offsetWidth : this.element.offsetHeight;
+if (this._useFraction)
+this._sidebarSize = this._lastSidebarSize();
+},
+
 
 _innerSetSidebarSize: function(size)
 {
@@ -31494,28 +33978,38 @@
 
 this._removeAllLayoutProperties();
 
+var sizeValue;
+if (this._useFraction)
+sizeValue = (size / this._totalSize) * 100 + "%";
+else
+sizeValue = size + "px";
+
 if (this._isVertical) {
 var resizerWidth = this._resizerElement.offsetWidth;
 if (this._secondIsSidebar) {
-this._firstElement.style.right = size + "px";
-this._secondElement.style.width = size + "px";
-this._resizerElement.style.right = size - resizerWidth / 2 + "px";
+this._firstElement.style.right = sizeValue;
+this._secondElement.style.width = sizeValue;
+this._resizerElement.style.right = sizeValue;
+this._resizerElement.style.marginRight = -resizerWidth / 2 + "px";
 } else {
-this._firstElement.style.width = size + "px";;
-this._secondElement.style.left = size + "px";;
-this._resizerElement.style.left = size - resizerWidth / 2 + "px";
+this._firstElement.style.width = sizeValue;
+this._secondElement.style.left = sizeValue;
+this._resizerElement.style.left = sizeValue;
+this._resizerElement.style.marginLeft = -resizerWidth / 2 + "px";
 }
 } else {
 var resizerHeight = this._resizerElement.offsetHeight;
 
 if (this._secondIsSidebar) {
-this._firstElement.style.bottom = size + "px";;
-this._secondElement.style.height = size + "px";;
-this._resizerElement.style.bottom = size - resizerHeight / 2 + "px";
+this._firstElement.style.bottom = sizeValue;
+this._secondElement.style.height = sizeValue;
+this._resizerElement.style.bottom = sizeValue;
+this._resizerElement.style.marginBottom = -resizerHeight / 2 + "px";
 } else {
-this._firstElement.style.height = size + "px";;
-this._secondElement.style.top = size + "px";;
-this._resizerElement.style.top = size - resizerHeight / 2 + "px";
+this._firstElement.style.height = sizeValue;
+this._secondElement.style.top = sizeValue;
+this._resizerElement.style.top = sizeValue;
+this._resizerElement.style.marginTop = -resizerHeight / 2 + "px";
 }
 }
 
@@ -31530,19 +34024,20 @@
 size = Math.max(size, minSize);
 if (this._totalSize - size < minSize)
 size = this._totalSize - minSize;
-return size;
+return size < minSize ? -1 : size;
 },
 
 wasShown: function()
 {
-this._totalSize = this._isVertical ? this.element.offsetWidth : this.element.offsetHeight;
-this.setSidebarSize(this._lastSidebarSize());
+this._updateLayout();
 },
 
 onResize: function()
 {
-var oldTotalSize = this._totalSize;
-this._totalSize = this._isVertical ? this.element.offsetWidth : this.element.offsetHeight;
+if (this._sidebarSize < 0)
+this._updateLayout();
+else
+this._updateTotalSize();
 },
 
 
@@ -31573,23 +34068,54 @@
 
 installResizer: function(resizerElement)
 {
-WebInspector.installDragHandle(resizerElement, this._startResizerDragging.bind(this), this._resizerDragging.bind(this), this._endResizerDragging.bind(this), this._isVertical ? "ew-resize" : "ns-resize");
+resizerElement.addEventListener("mousedown", this._onDragStart.bind(this), false);
+},
+
+
+_onDragStart: function(event)
+{
+WebInspector._elementDragStart(this._startResizerDragging.bind(this), this._resizerDragging.bind(this), this._endResizerDragging.bind(this), this._isVertical ? "ew-resize" : "ns-resize", event);
+},
+
+
+_sizeSetting: function()
+{
+if (!this._sidebarSizeSettingName)
+return null;
+
+var settingName = this._sidebarSizeSettingName + (this._isVertical ? "" : "H");
+if (!WebInspector.settings[settingName])
+WebInspector.settings[settingName] = WebInspector.settings.createSetting(settingName, undefined);
+
+return WebInspector.settings[settingName];
 },
 
 
 _lastSidebarSize: function()
 {
-return this._sidebarSizeSettingName ? WebInspector.settings[this._sidebarSizeSettingName].get() || this._savedSidebarSize : this._savedSidebarSize;
+var sizeSetting = this._sizeSetting();
+var size = sizeSetting ? sizeSetting.get() : 0;
+if (!size)
+size = this._isVertical ? this._savedSidebarWidth : this._savedSidebarHeight;
+if (this._useFraction)
+size *= this._totalSize;
+return size;
 },
 
 
 _saveSidebarSize: function(size)
 {
-this._savedSidebarSize = size;
-if (!this._sidebarSizeSettingName)
-return;
+if (this._useFraction)
+size /= this._totalSize;
 
-WebInspector.settings[this._sidebarSizeSettingName].set(this._savedSidebarSize);
+if (this._isVertical)
+this._savedSidebarWidth = size;
+else
+this._savedSidebarHeight = size;
+
+var sizeSetting = this._sizeSetting();
+if (sizeSetting)
+sizeSetting.set(size);
 },
 
 __proto__: WebInspector.View.prototype
@@ -31600,21 +34126,18 @@
 
 
 
-WebInspector.SidebarView = function(sidebarPosition, sidebarWidthSettingName, defaultSidebarWidth)
+WebInspector.SidebarView = function(sidebarPosition, sidebarWidthSettingName, defaultSidebarWidth, defaultSidebarHeight)
 {
-WebInspector.SplitView.call(this, true, sidebarWidthSettingName, defaultSidebarWidth || 200);
-
-this._leftElement = this.firstElement();
-this._rightElement = this.secondElement();
+WebInspector.SplitView.call(this, true, sidebarWidthSettingName, defaultSidebarWidth, defaultSidebarHeight);
 
 this._minimumSidebarWidth = Preferences.minSidebarWidth;
 this._minimumMainWidthPercent = 50;
 
-this._mainElementHidden = false;
-this._sidebarElementHidden = false;
+this._minimumSidebarHeight = Preferences.minSidebarHeight;
+this._minimumMainHeightPercent = 50;
 
-this._innerSetSidebarPosition(sidebarPosition || WebInspector.SidebarView.SidebarPosition.Left);
-this.setSecondIsSidebar(sidebarPosition !== WebInspector.SidebarView.SidebarPosition.Left);
+this._sidebarPosition = sidebarPosition || WebInspector.SidebarView.SidebarPosition.Start;
+this.setSecondIsSidebar(this._sidebarPosition === WebInspector.SidebarView.SidebarPosition.End);
 }
 
 WebInspector.SidebarView.EventTypes = {
@@ -31623,56 +34146,36 @@
 
 
 WebInspector.SidebarView.SidebarPosition = {
-Left: "Left",
-Right: "Right"
+Start: "Start",
+End: "End"
 }
 
 WebInspector.SidebarView.prototype = {
 
-_hasLeftSidebar: function()
-{
-return this._sidebarPosition === WebInspector.SidebarView.SidebarPosition.Left;
-},
-
-
-get mainElement()
-{
-return this._hasLeftSidebar() ? this._rightElement : this._leftElement;
-},
-
-
-get sidebarElement()
-{
-return this._hasLeftSidebar() ? this._leftElement : this._rightElement;
-},
-
-
-_innerSetSidebarPosition: function(sidebarPosition)
-{
-this._sidebarPosition = sidebarPosition;
-
-if (this._hasLeftSidebar()) {
-this._leftElement.addStyleClass("split-view-sidebar-left");
-this._rightElement.removeStyleClass("split-view-sidebar-right");
-} else {
-this._rightElement.addStyleClass("split-view-sidebar-right");
-this._leftElement.removeStyleClass("split-view-sidebar-left");
-}
-},
-
-
 setMinimumSidebarWidth: function(width)
 {
 this._minimumSidebarWidth = width;
 },
 
 
+setMinimumSidebarHeight: function(height)
+{
+this._minimumSidebarHeight = height;
+},
+
+
 setMinimumMainWidthPercent: function(widthPercent)
 {
 this._minimumMainWidthPercent = widthPercent;
 },
 
 
+setMinimumMainHeightPercent: function(heightPercent)
+{
+this._minimumMainHeightPercent = heightPercent;
+},
+
+
 setSidebarWidth: function(width)
 {
 this.setSidebarSize(width);
@@ -31693,15 +34196,18 @@
 
 applyConstraints: function(size)
 {
-return Number.constrain(size, this._minimumSidebarWidth, this.element.offsetWidth * (100 - this._minimumMainWidthPercent) / 100);
+var from = this.isVertical() ? this._minimumSidebarWidth : this._minimumSidebarHeight;
+var minMainSizePercent = this.isVertical() ? this._minimumMainWidthPercent : this._minimumMainHeightPercent;
+var to = this.totalSize() * (100 - minMainSizePercent) / 100;
+return from > to ? -1 : Number.constrain(size, from, to);
 },
 
 hideMainElement: function()
 {
-if (this._hasLeftSidebar())
-this.showOnlyFirst();
-else
+if (this.isSidebarSecond())
 this.showOnlySecond();
+else
+this.showOnlyFirst();
 },
 
 showMainElement: function()
@@ -31711,10 +34217,10 @@
 
 hideSidebarElement: function()
 {
-if (this._hasLeftSidebar())
-this.showOnlySecond();
-else
+if (this.isSidebarSecond())
 this.showOnlyFirst();
+else
+this.showOnlySecond();
 },
 
 showSidebarElement: function()
@@ -31785,7 +34291,7 @@
 this._searchRegex = createPlainTextSearchRegex(query, "gi");
 
 this._searchResults = [];
-var messages = WebInspector.consoleView.messages;
+var messages = WebInspector.console.messages;
 for (var i = 0; i < messages.length; i++) {
 if (messages[i].matchesRegex(this._searchRegex)) {
 this._searchResults.push(messages[i]);
@@ -31813,7 +34319,6 @@
 if (index === -1)
 index = this._searchResults.length - 1;
 this._jumpToSearchResult(index);
-return true;
 },
 
 _clearCurrentSearchResultHighlight: function()
@@ -31876,7 +34381,6 @@
 if (!apiPrivate.console)
 apiPrivate.console = {};
 apiPrivate.console.Severity = {
-Tip: "tip",
 Debug: "debug",
 Log: "log",
 Warning: "warning",
@@ -31898,7 +34402,6 @@
 ConsoleMessageAdded: "console-message-added",
 ElementsPanelObjectSelected: "panel-objectSelected-elements",
 NetworkRequestFinished: "network-request-finished",
-Reset: "reset",
 OpenResource: "open-resource",
 PanelSearch: "panel-search-",
 Reload: "Reload",
@@ -32014,8 +34517,6 @@
 defineDeprecatedProperty(this, "webInspector", "resources", "network");
 this.timeline = new Timeline();
 this.console = new ConsoleAPI();
-
-this.onReset = new EventSink(events.Reset);
 }
 
 
@@ -32260,7 +34761,6 @@
 
 setExpression: function(expression, rootTitle, evaluateOptions)
 {
-var callback = extractCallbackArgument(arguments);
 var request = {
 command: commands.SetSidebarContent,
 id: this._id,
@@ -32270,7 +34770,7 @@
 };
 if (typeof evaluateOptions === "object")
 request.evaluateOptions = evaluateOptions;
-extensionServer.sendRequest(request, callback);
+extensionServer.sendRequest(request, extractCallbackArgument(arguments));
 },
 
 setObject: function(jsonObject, rootTitle, callback)
@@ -32456,7 +34956,10 @@
 var callback = extractCallbackArgument(arguments);
 function callbackWrapper(result)
 {
-callback(result.value, result.isException);
+if (result.isError || result.isException)
+callback(undefined, result);
+else
+callback(result.value);
 }
 var request = {
 command: commands.EvaluateOnInspectedPage,
@@ -32654,25 +35157,18 @@
 var Resource = declareInterfaceClass(ResourceImpl);
 var Timeline = declareInterfaceClass(TimelineImpl);
 
-var extensionServer = new ExtensionServerClient();
+
+if (!extensionServer)
+extensionServer = new ExtensionServerClient();
 
 return new InspectorExtensionAPI();
 }
 
 
-function buildPlatformExtensionAPI(extensionInfo)
-{
-function platformExtensionAPI(coreAPI)
-{
-window.webInspector = coreAPI;
-}
-return platformExtensionAPI.toString();
-}
-
-
 function buildExtensionAPIInjectedScript(extensionInfo)
 {
-return "(function(injectedScriptHost, inspectedWindow, injectedScriptId){ " +
+return "(function(injectedScriptId){ " +
+"var extensionServer;" +
 defineCommonExtensionSymbols.toString() + ";" +
 injectedExtensionAPI.toString() + ";" +
 buildPlatformExtensionAPI(extensionInfo) + ";" +
@@ -32914,11 +35410,6 @@
 this._postNotification(WebInspector.extensionAPI.Events.InspectedURLChanged, url);
 },
 
-_mainFrameNavigated: function(event)
-{
-this._postNotification(WebInspector.extensionAPI.Events.Reset);
-},
-
 startAuditRun: function(category, auditRun)
 {
 this._clientObjects[auditRun.id] = auditRun;
@@ -33039,13 +35530,12 @@
 var panel = WebInspector.panel(message.panel);
 if (!panel)
 return this._status.E_NOTFOUND(message.panel);
-if (!panel.sidebarElement || !panel.sidebarPanes)
+if (!panel.addExtensionSidebarPane)
 return this._status.E_NOTSUPPORTED();
 var id = message.id;
 var sidebar = new WebInspector.ExtensionSidebarPane(message.title, message.id);
 this._clientObjects[id] = sidebar;
-panel.sidebarPanes[id] = sidebar;
-panel.sidebarElement.appendChild(sidebar.element);
+panel.addExtensionSidebarPane(id, sidebar);
 
 return this._status.OK();
 },
@@ -33094,7 +35584,7 @@
 _handleOpenURL: function(port, details)
 {
 var url =   (details.url);
-var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
+var contentProvider = WebInspector.workspace.uiSourceCodeForOriginURL(url) || WebInspector.resourceForURL(url);
 if (!contentProvider)
 return false;
 
@@ -33119,11 +35609,8 @@
 var options =   (message.options || {});
 NetworkAgent.setUserAgentOverride(typeof options.userAgent === "string" ? options.userAgent : "");
 var injectedScript;
-if (options.injectedScript) {
-
-
-injectedScript = "((function(){" + options.injectedScript + "})(),function(){return {}})";
-}
+if (options.injectedScript)
+injectedScript = "(function(){" + options.injectedScript + "})()";
 PageAgent.reload(!!options.ignoreCache, injectedScript);
 return this._status.OK();
 },
@@ -33133,15 +35620,13 @@
 
 function callback(error, resultPayload, wasThrown)
 {
-var result = {};
-if (error) {
-result.isException = true;
-result.value = error.toString();
-}  else
-result.value = resultPayload.value;
-
-if (wasThrown)
-result.isException = true;
+var result;
+if (error)
+result = this._status.E_PROTOCOLERROR(error.toString());
+else if (wasThrown)
+result = { isException: true, value: resultPayload.description };
+else
+result = { value: resultPayload.value };
 
 this._dispatchCallback(message.requestId, port, result);
 }
@@ -33158,8 +35643,6 @@
 function convertSeverity(level)
 {
 switch (level) {
-case WebInspector.extensionAPI.console.Severity.Tip:
-return WebInspector.ConsoleMessage.MessageLevel.Tip;
 case WebInspector.extensionAPI.console.Severity.Log:
 return WebInspector.ConsoleMessage.MessageLevel.Log;
 case WebInspector.extensionAPI.console.Severity.Warning:
@@ -33191,8 +35674,6 @@
 if (!level)
 return;
 switch (level) {
-case WebInspector.ConsoleMessage.MessageLevel.Tip:
-return WebInspector.extensionAPI.console.Severity.Tip;
 case WebInspector.ConsoleMessage.MessageLevel.Log:
 return WebInspector.extensionAPI.console.Severity.Log;
 case WebInspector.ConsoleMessage.MessageLevel.Warning:
@@ -33243,7 +35724,8 @@
 if (!resources[contentProvider.contentURL()])
 resources[contentProvider.contentURL()] = this._makeResource(contentProvider);
 }
-WebInspector.workspace.uiSourceCodes().forEach(pushResourceData.bind(this));
+var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network);
+uiSourceCodes.forEach(pushResourceData.bind(this));
 WebInspector.resourceTreeModel.forAllResources(pushResourceData.bind(this));
 return Object.values(resources);
 },
@@ -33274,7 +35756,7 @@
 _onGetResourceContent: function(message, port)
 {
 var url =   (message.url);
-var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
+var contentProvider = WebInspector.workspace.uiSourceCodeForOriginURL(url) || WebInspector.resourceForURL(url);
 if (!contentProvider)
 return this._status.E_NOTFOUND(url);
 this._getResourceContent(contentProvider, message, port);
@@ -33290,7 +35772,7 @@
 }
 
 var url =   (message.url);
-var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
+var uiSourceCode = WebInspector.workspace.uiSourceCodeForOriginURL(url);
 if (!uiSourceCode) {
 var resource = WebInspector.resourceTreeModel.resourceForURL(url);
 if (!resource)
@@ -33398,7 +35880,6 @@
 
 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,
 this._inspectedURLChanged, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
 this._initDone = true;
 if (this._pendingExtensions) {
 this._pendingExtensions.forEach(this._innerAddExtension, this);
@@ -33447,6 +35928,7 @@
 extensions.forEach(this._addExtension, this);
 },
 
+
 _addExtension: function(extensionInfo)
 {
 if (this._initDone) {
@@ -33459,6 +35941,7 @@
 this._pendingExtensions = [extensionInfo];
 },
 
+
 _innerAddExtension: function(extensionInfo)
 {
 const urlOriginRegExp = new RegExp("([^:]+:\/\/[^/]*)\/"); 
@@ -33568,13 +36051,49 @@
 evaluate: function(expression, exposeCommandLineAPI, returnByValue, options, securityOrigin, callback) 
 {
 var contextId;
-if (typeof options === "object" && options["useContentScriptContext"]) {
-var mainFrame = WebInspector.resourceTreeModel.mainFrame;
-if (!mainFrame)
-return this._status.E_FAILED("main frame not available yet");
-var context = WebInspector.runtimeModel.contextByFrameAndSecurityOrigin(mainFrame, securityOrigin);
-if (!context)
-return this._status.E_NOTFOUND(securityOrigin);
+if (typeof options === "object") {
+
+function resolveURLToFrame(url)
+{
+var found;
+function hasMatchingURL(frame) 
+{
+found = (frame.url === url) ? frame : null;
+return found;
+}
+WebInspector.resourceTreeModel.frames().some(hasMatchingURL);
+return found;
+}
+
+var frame = options.frameURL ? resolveURLToFrame(options.frameURL) : WebInspector.resourceTreeModel.mainFrame;
+if (!frame) {
+if (options.frameURL)
+console.warn("evaluate: there is no frame with URL " + options.frameURL);
+else
+console.warn("evaluate: the main frame is not yet available");
+return this._status.E_NOTFOUND(options.frameURL || "<top>");
+}
+
+var contextSecurityOrigin;
+if (options.useContentScriptContext)
+contextSecurityOrigin = securityOrigin;
+else if (options.scriptExecutionContext)
+contextSecurityOrigin = options.scriptExecutionContext;
+
+var frameContextList = WebInspector.runtimeModel.contextListByFrame(frame);
+var context; 
+if (contextSecurityOrigin) {
+context = frameContextList.contextBySecurityOrigin(contextSecurityOrigin);
+if (!context) {
+console.warn("The JS context " + contextSecurityOrigin + " was not found in the frame " + frame.url)
+return this._status.E_NOTFOUND(contextSecurityOrigin)
+}
+} else {
+context = frameContextList.mainWorldContext();
+if (!context) 
+return this._status.E_FAILED(frame.url + " has no execution context");
+}
+
 contextId = context.id;
 }
 RuntimeAgent.evaluate(expression, "extension", exposeCommandLineAPI, true, contextId, returnByValue, false, callback);
@@ -33601,6 +36120,7 @@
 this.E_BADARGTYPE = makeStatus.bind(null, "E_BADARGTYPE", "Invalid type for argument %s: got %s, expected %s");
 this.E_NOTFOUND = makeStatus.bind(null, "E_NOTFOUND", "Object not found: %s");
 this.E_NOTSUPPORTED = makeStatus.bind(null, "E_NOTSUPPORTED", "Object does not support requested operation: %s");
+this.E_PROTOCOLERROR = makeStatus.bind(null, "E_PROTOCOLERROR", "Inspector protocol error: %s");
 this.E_FAILED = makeStatus.bind(null, "E_FAILED", "Operation failed: %s");
 }
 
@@ -33657,7 +36177,8 @@
 
 _onLoad: function()
 {
-this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow);
+var frames =   (window.frames);
+this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.contentWindow);
 if (this.isShowing())
 WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex);
 },
@@ -33779,6 +36300,7 @@
 WebInspector.ExtensionSidebarPane = function(title, id)
 {
 WebInspector.SidebarPane.call(this, title);
+this.setHideOnDetach();
 this._id = id;
 }
 
@@ -34076,7 +36598,7 @@
 {
 var span = document.createElement("span");
 span.className = "webkit-" + className;
-if (this._stripExtraWhitespace)
+if (this._stripExtraWhitespace && className !== "whitespace")
 content = content.replace(/^[\n\r]*/, "").replace(/\s*$/, "");
 span.appendChild(document.createTextNode(content));
 return span;
@@ -34150,6 +36672,22 @@
 },
 
 
+immediatelyPrecedes: function(range)
+{
+if (!range)
+return false;
+return this.endLine === range.startLine && this.endColumn === range.startColumn;
+},
+
+
+immediatelyFollows: function(range)
+{
+if (!range)
+return false;
+return range.immediatelyPrecedes(this);
+},
+
+
 get linesCount()
 {
 return this.endLine - this.startLine;
@@ -34213,10 +36751,11 @@
 }
 
 
-WebInspector.TextEditorCommand = function(newRange, originalText)
+WebInspector.TextEditorCommand = function(newRange, originalText, originalSelection)
 {
 this.newRange = newRange;
 this.originalText = originalText;
+this.originalSelection = originalSelection;
 }
 
 
@@ -34230,13 +36769,6 @@
 this._lineBreak = "\n";
 }
 
-WebInspector.TextEditorModel.Indent = {
-TwoSpaces: "  ",
-FourSpaces: "    ",
-EightSpaces: "        ",
-TabCharacter: "\t"
-}
-
 WebInspector.TextEditorModel.Events = {
 TextChanged: "TextChanged"
 }
@@ -34245,6 +36777,15 @@
 
 WebInspector.TextEditorModel.prototype = {
 
+isClean: function() {
+return !this._undoStack.length;
+},
+
+markClean: function() {
+this._resetUndoStack();
+},
+
+
 get linesCount()
 {
 return this._lines.length;
@@ -34294,24 +36835,55 @@
 },
 
 
-editRange: function(range, text)
-{   
-if (this._lastEditedRange && (!text || text.indexOf("\n") !== -1 || this._lastEditedRange.endLine !== range.startLine || this._lastEditedRange.endColumn !== range.startColumn))
-this._markUndoableState();
-return this._innerEditRange(range, text);
+_rangeHasOneCharacter: function(range)
+{
+if (range.startLine === range.endLine && range.endColumn - range.startColumn === 1)
+return true;
+if (range.endLine - range.startLine === 1 && range.endColumn === 0 && range.startColumn === this.lineLength(range.startLine))
+return true;
+return false;
 },
 
 
-_innerEditRange: function(range, text)
+_isEditRangeUndoBoundary: function(range, text, originalSelection)
+{
+if (originalSelection && !originalSelection.isEmpty())
+return true;
+if (text)
+return text.length > 1 || !range.isEmpty();
+return !this._rangeHasOneCharacter(range);
+},
+
+
+_isEditRangeAdjacentToLastCommand: function(range, text)
+{
+if (!this._lastCommand)
+return true;
+if (!text) {
+
+return this._lastCommand.newRange.immediatelyPrecedes(range) || this._lastCommand.newRange.immediatelyFollows(range);
+}
+return text.indexOf("\n") === -1 && this._lastCommand.newRange.immediatelyPrecedes(range);
+},
+
+
+editRange: function(range, text, originalSelection)
+{
+var undoBoundary = this._isEditRangeUndoBoundary(range, text, originalSelection);
+if (undoBoundary || !this._isEditRangeAdjacentToLastCommand(range, text))
+this._markUndoableState();
+var newRange = this._innerEditRange(range, text, originalSelection);
+if (undoBoundary)
+this._markUndoableState();
+return newRange;
+},
+
+
+_innerEditRange: function(range, text, originalSelection)
 {
 var originalText = this.copyRange(range);
-this._lastEditedRange = range;
-var newRange = range;
-if (text !== originalText) {
-newRange = this._innerSetText(range, text);
-this._pushUndoableCommand(newRange, originalText);
-}
-
+var newRange = this._innerSetText(range, text);
+this._lastCommand = this._pushUndoableCommand(newRange, originalText, originalSelection || range);
 this.dispatchEventToListeners(WebInspector.TextEditorModel.Events.TextChanged, { oldRange: range, newRange: newRange, editRange: true });
 return newRange;
 },
@@ -34459,9 +37031,9 @@
 },
 
 
-_pushUndoableCommand: function(newRange, originalText)
+_pushUndoableCommand: function(newRange, originalText, originalSelection)
 {
-var command = new WebInspector.TextEditorCommand(newRange.clone(), originalText);
+var command = new WebInspector.TextEditorCommand(newRange.clone(), originalText, originalSelection);
 if (this._inUndo)
 this._redoStack.push(command);
 else {
@@ -34498,7 +37070,7 @@
 var range = this._doUndo(this._redoStack);
 delete this._inRedo;
 
-return range;
+return range ? range.collapseToEnd() : null;
 },
 
 
@@ -34508,7 +37080,8 @@
 for (var i = stack.length - 1; i >= 0; --i) {
 var command = stack[i];
 stack.length = i;
-range = this._innerEditRange(command.newRange, command.originalText);
+this._innerEditRange(command.newRange, command.originalText);
+range = command.originalSelection;
 if (i > 0 && stack[i - 1].explicit)
 return range;
 }
@@ -34561,7 +37134,7 @@
 this._markUndoableState();
 
 var indent = WebInspector.settings.textEditorIndent.get();
-var indentLength = indent === WebInspector.TextEditorModel.Indent.TabCharacter ? 4 : indent.length;
+var indentLength = indent === WebInspector.TextUtils.Indent.TabCharacter ? 4 : indent.length;
 var lineIndentRegex = new RegExp("^ {1," + indentLength + "}");
 var newRange = range.clone();
 
@@ -34629,6 +37202,134 @@
 }
 
 
+WebInspector.TextEditorModel.BraceMatcher = function(textModel)
+{
+this._textModel = textModel;
+}
+
+WebInspector.TextEditorModel.BraceMatcher.prototype = {
+
+_braceRanges: function(lineNumber)
+{
+if (lineNumber >= this._textModel.linesCount || lineNumber < 0)
+return null;
+
+var attribute = this._textModel.getAttribute(lineNumber, "highlight");
+if (!attribute)
+return null;
+else
+return attribute.braces;
+},
+
+
+_matches: function(braceTokenLeft, braceTokenRight)
+{
+return ((braceTokenLeft === "brace-start" && braceTokenRight === "brace-end") || (braceTokenLeft === "block-start" && braceTokenRight === "block-end"));
+},
+
+
+findLeftCandidate: function(lineNumber, column, maxBraceIteration)
+{
+var braces = this._braceRanges(lineNumber);
+if (!braces)
+return null;
+
+var braceIndex = braces.length - 1;
+while (braceIndex >= 0 && braces[braceIndex].startColumn > column)
+--braceIndex;
+
+var brace = braceIndex >= 0 ? braces[braceIndex] : null;
+if (brace && brace.startColumn === column && (brace.token === "block-end" || brace.token === "brace-end"))
+--braceIndex;
+
+var stack = [];
+maxBraceIteration = maxBraceIteration || Number.MAX_VALUE;
+while (--maxBraceIteration) {
+if (braceIndex < 0) {
+while ((braces = this._braceRanges(--lineNumber)) && !braces.length) {};
+if (!braces)
+return null;
+braceIndex = braces.length - 1;
+}
+brace = braces[braceIndex];
+if (brace.token === "block-end" || brace.token === "brace-end")
+stack.push(brace.token);
+else if (stack.length === 0)
+return {
+lineNumber: lineNumber,
+column: brace.startColumn,
+token: brace.token
+};
+else if (!this._matches(brace.token, stack.pop()))
+return null;
+
+--braceIndex;
+}
+return null;
+},
+
+
+findRightCandidate: function(lineNumber, column, maxBraceIteration)
+{
+var braces = this._braceRanges(lineNumber);
+if (!braces)
+return null;
+
+var braceIndex = 0;
+while (braceIndex < braces.length && braces[braceIndex].startColumn < column)
+++braceIndex;
+
+var brace = braceIndex < braces.length ? braces[braceIndex] : null;
+if (brace && brace.startColumn === column && (brace.token === "block-start" || brace.token === "brace-start"))
+++braceIndex;
+
+var stack = [];
+maxBraceIteration = maxBraceIteration || Number.MAX_VALUE;
+while (--maxBraceIteration) {
+if (braceIndex >= braces.length) {
+while ((braces = this._braceRanges(++lineNumber)) && !braces.length) {};
+if (!braces)
+return null;
+braceIndex = 0;
+}
+brace = braces[braceIndex];
+if (brace.token === "block-start" || brace.token === "brace-start")
+stack.push(brace.token);
+else if (stack.length === 0)
+return {
+lineNumber: lineNumber,
+column: brace.startColumn,
+token: brace.token
+};
+else if (!this._matches(stack.pop(), brace.token))
+return null;
+++braceIndex;
+}
+return null;
+},
+
+
+enclosingBraces: function(lineNumber, column, maxBraceIteration)
+{
+var leftBraceLocation = this.findLeftCandidate(lineNumber, column, maxBraceIteration);
+if (!leftBraceLocation)
+return null;
+
+var rightBraceLocation = this.findRightCandidate(lineNumber, column, maxBraceIteration);
+if (!rightBraceLocation)
+return null;
+
+if (!this._matches(leftBraceLocation.token, rightBraceLocation.token))
+return null;
+
+return {
+leftBrace: leftBraceLocation,
+rightBrace: rightBraceLocation
+};
+},
+}
+
+
 
 
 
@@ -34636,19 +37337,30 @@
 WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
 {
 this._textModel = textModel;
-this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
+this._mimeType = "text/html";
+this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(this._mimeType);
 this._damageCallback = damageCallback;
 this._highlightChunkLimit = 1000;
+this._highlightLineLimit = 500;
 }
 
 WebInspector.TextEditorHighlighter._MaxLineCount = 10000;
 
 WebInspector.TextEditorHighlighter.prototype = {
+
+get mimeType()
+{
+return this._mimeType;
+},
+
+
 set mimeType(mimeType)
 {
 var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
-if (tokenizer)
+if (tokenizer) {
 this._tokenizer = tokenizer;
+this._mimeType = mimeType;
+}
 },
 
 set highlightChunkLimit(highlightChunkLimit)
@@ -34657,17 +37369,9 @@
 },
 
 
-orderedRangesPerLine: function(lineNumber)
+setHighlightLineLimit: function(highlightLineLimit)
 {
-var syntaxTokenHighligh = this._textModel.getAttribute(lineNumber, "highlight");
-if (!syntaxTokenHighligh)
-return [];
-
-syntaxTokenHighligh.ranges.sort(function(a, b) {
-return a.startColumn - b.startColumn;
-});
-
-return syntaxTokenHighligh.ranges;
+this._highlightLineLimit = highlightLineLimit;
 },
 
 
@@ -34788,16 +37492,26 @@
 this._tokenizer.condition = JSON.parse(postConditionStringified);
 
 
-state.ranges = [];
+state.ranges = state.ranges || [];
+state.braces = state.braces || [];
 do {
 var newColumn = this._tokenizer.nextToken(lastHighlightedColumn);
 var tokenType = this._tokenizer.tokenType;
-if (tokenType)
+if (tokenType && lastHighlightedColumn < this._highlightLineLimit) {
+if (tokenType === "brace-start" || tokenType === "brace-end" || tokenType === "block-start" || tokenType === "block-end") {
+state.braces.push({
+startColumn: lastHighlightedColumn,
+endColumn: newColumn - 1,
+token: tokenType
+});
+} else {
 state.ranges.push({
 startColumn: lastHighlightedColumn,
 endColumn: newColumn - 1,
 token: tokenType
 });
+}
+}
 lastHighlightedColumn = newColumn;
 if (++tokensCount > this._highlightChunkLimit)
 break;
@@ -34873,10 +37587,78 @@
 
 
 
+WebInspector.TextUtils = {
+
+isStopChar: function(char)
+{
+return (char > " " && char < "0") ||
+(char > "9" && char < "A") ||
+(char > "Z" && char < "_") ||
+(char > "_" && char < "a") ||
+(char > "z" && char <= "~");
+},
+
+
+isWordChar: function(char)
+{
+return !WebInspector.TextUtils.isStopChar(char) && !WebInspector.TextUtils.isSpaceChar(char);
+},
+
+
+isSpaceChar: function(char)
+{
+return WebInspector.TextUtils._SpaceCharRegex.test(char);
+},
+
+
+isWord: function(word)
+{
+for (var i = 0; i < word.length; ++i) {
+if (!WebInspector.TextUtils.isWordChar(word.charAt(i)))
+return false;
+}
+return true;
+},
+
+
+isOpeningBraceChar: function(char)
+{
+return char === "(" || char === "{";
+},
+
+
+isClosingBraceChar: function(char)
+{
+return char === ")" || char === "}";
+},
+
+
+isBraceChar: function(char)
+{
+return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.TextUtils.isClosingBraceChar(char);
+}
+}
+
+WebInspector.TextUtils._SpaceCharRegex = /\s/;
+
+
+WebInspector.TextUtils.Indent = {
+TwoSpaces: "  ",
+FourSpaces: "    ",
+EightSpaces: "        ",
+TabCharacter: "\t"
+}
+
+
+
+
+
 
 
 WebInspector.SourceTokenizer = function()
 {
+
+this.tokenType = null;
 }
 
 WebInspector.SourceTokenizer.prototype = {
@@ -34904,6 +37686,7 @@
 this.condition.lexCondition = lexCondition;
 },
 
+
 _charAt: function(cursor)
 {
 return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
@@ -34913,6 +37696,7 @@
 {
 },
 
+
 nextToken: function(cursor)
 {
 }
@@ -34929,6 +37713,7 @@
 };
 }
 
+
 WebInspector.SourceTokenizer.Registry.getInstance = function()
 {
 if (!WebInspector.SourceTokenizer.Registry._instance)
@@ -34937,6 +37722,7 @@
 }
 
 WebInspector.SourceTokenizer.Registry.prototype = {
+
 getTokenizer: function(mimeType)
 {
 if (!this._tokenizerConstructors[mimeType])
@@ -37305,6 +40091,12 @@
 "class", "enum", "export", "extends", "import", "super", "get", "set", "with"
 ].keySet();
 
+WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties = {
+"NaN": "javascript-nan",
+"undefined": "javascript-undef",
+"Infinity": "javascript-inf"
+};
+
 WebInspector.SourceJavaScriptTokenizer.prototype = {
 createInitialCondition: function()
 {
@@ -37396,69 +40188,73 @@
 case this.case_DIV:
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych <= '(') {
-if (yych <= '#') {
-if (yych <= ' ') { gotoCase = 15; continue; };
-if (yych <= '!') { gotoCase = 17; continue; };
-if (yych <= '"') { gotoCase = 19; continue; };
+if (yych <= '\'') {
+if (yych <= '"') {
+if (yych <= String.fromCharCode(0x1F)) { gotoCase = 15; continue; };
+if (yych <= ' ') { gotoCase = 17; continue; };
+if (yych <= '!') { gotoCase = 19; continue; };
+{ gotoCase = 21; continue; };
 } else {
-if (yych <= '%') {
-if (yych <= '$') { gotoCase = 20; continue; };
-{ gotoCase = 22; continue; };
+if (yych <= '$') {
+if (yych >= '$') { gotoCase = 22; continue; };
 } else {
-if (yych <= '&') { gotoCase = 23; continue; };
-if (yych <= '\'') { gotoCase = 24; continue; };
-{ gotoCase = 25; continue; };
+if (yych <= '%') { gotoCase = 24; continue; };
+if (yych <= '&') { gotoCase = 25; continue; };
+{ gotoCase = 26; continue; };
 }
 }
 } else {
 if (yych <= ',') {
-if (yych <= ')') { gotoCase = 26; continue; };
-if (yych <= '*') { gotoCase = 28; continue; };
-if (yych <= '+') { gotoCase = 29; continue; };
-{ gotoCase = 25; continue; };
+if (yych <= ')') {
+if (yych <= '(') { gotoCase = 27; continue; };
+{ gotoCase = 28; continue; };
+} else {
+if (yych <= '*') { gotoCase = 30; continue; };
+if (yych <= '+') { gotoCase = 31; continue; };
+{ gotoCase = 27; continue; };
+}
 } else {
 if (yych <= '.') {
-if (yych <= '-') { gotoCase = 30; continue; };
-{ gotoCase = 31; continue; };
+if (yych <= '-') { gotoCase = 32; continue; };
+{ gotoCase = 33; continue; };
 } else {
-if (yych <= '/') { gotoCase = 32; continue; };
-if (yych <= '0') { gotoCase = 34; continue; };
-{ gotoCase = 36; continue; };
+if (yych <= '/') { gotoCase = 34; continue; };
+if (yych <= '0') { gotoCase = 36; continue; };
+{ gotoCase = 38; continue; };
 }
 }
 }
 } else {
 if (yych <= '\\') {
 if (yych <= '>') {
-if (yych <= ';') { gotoCase = 25; continue; };
-if (yych <= '<') { gotoCase = 37; continue; };
-if (yych <= '=') { gotoCase = 38; continue; };
-{ gotoCase = 39; continue; };
+if (yych <= ';') { gotoCase = 27; continue; };
+if (yych <= '<') { gotoCase = 39; continue; };
+if (yych <= '=') { gotoCase = 40; continue; };
+{ gotoCase = 41; continue; };
 } else {
 if (yych <= '@') {
-if (yych <= '?') { gotoCase = 25; continue; };
+if (yych <= '?') { gotoCase = 27; continue; };
 } else {
-if (yych <= 'Z') { gotoCase = 20; continue; };
-if (yych <= '[') { gotoCase = 25; continue; };
-{ gotoCase = 40; continue; };
+if (yych <= 'Z') { gotoCase = 22; continue; };
+if (yych <= '[') { gotoCase = 27; continue; };
+{ gotoCase = 42; continue; };
 }
 }
 } else {
 if (yych <= 'z') {
 if (yych <= '^') {
-if (yych <= ']') { gotoCase = 25; continue; };
-{ gotoCase = 41; continue; };
+if (yych <= ']') { gotoCase = 27; continue; };
+{ gotoCase = 43; continue; };
 } else {
-if (yych != '`') { gotoCase = 20; continue; };
+if (yych != '`') { gotoCase = 22; continue; };
 }
 } else {
 if (yych <= '|') {
-if (yych <= '{') { gotoCase = 25; continue; };
-{ gotoCase = 42; continue; };
+if (yych <= '{') { gotoCase = 27; continue; };
+{ gotoCase = 44; continue; };
 } else {
-if (yych <= '~') { gotoCase = 25; continue; };
-if (yych >= 0x80) { gotoCase = 20; continue; };
+if (yych <= '~') { gotoCase = 27; continue; };
+if (yych >= 0x80) { gotoCase = 22; continue; };
 }
 }
 }
@@ -37469,8 +40265,14 @@
 { this.tokenType = null; return cursor; }
 case 17:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 115; continue; };
+yych = this._charAt(cursor);
+{ gotoCase = 119; continue; };
 case 18:
+{this.tokenType = "whitespace"; return cursor; }
+case 19:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 117; continue; };
+case 20:
 this.setLexCondition(this._lexConditions.NODIV);
 {
 var token = this._line.charAt(cursorOnEnter);
@@ -37478,472 +40280,476 @@
 this.tokenType = "block-start";
 else if (token === "}")
 this.tokenType = "block-end";
+else if (token === "(")
+this.tokenType = "brace-start";
 else this.tokenType = null;
 return cursor;
 }
-case 19:
+case 21:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych == '\n') { gotoCase = 16; continue; };
 if (yych == '\r') { gotoCase = 16; continue; };
-{ gotoCase = 107; continue; };
-case 20:
+{ gotoCase = 109; continue; };
+case 22:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 50; continue; };
-case 21:
+{ gotoCase = 52; continue; };
+case 23:
 {
 var token = this._line.substring(cursorOnEnter, cursor);
-if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
 this.tokenType = "javascript-keyword";
 else
 this.tokenType = "javascript-ident";
 return cursor;
 }
-case 22:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 23:
-yych = this._charAt(++cursor);
-if (yych == '&') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
 case 24:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 25:
+yych = this._charAt(++cursor);
+if (yych == '&') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 26:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych == '\n') { gotoCase = 16; continue; };
 if (yych == '\r') { gotoCase = 16; continue; };
-{ gotoCase = 96; continue; };
-case 25:
+{ gotoCase = 98; continue; };
+case 27:
 yych = this._charAt(++cursor);
-{ gotoCase = 18; continue; };
-case 26:
-++cursor;
-{ this.tokenType = null; return cursor; }
+{ gotoCase = 20; continue; };
 case 28:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 29:
-yych = this._charAt(++cursor);
-if (yych == '+') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+++cursor;
+{ this.tokenType = "brace-end"; return cursor; }
 case 30:
 yych = this._charAt(++cursor);
-if (yych == '-') { gotoCase = 43; continue; };
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 31:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 18; continue; };
-if (yych <= '9') { gotoCase = 89; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '+') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 32:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 45; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 33:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 20; continue; };
+if (yych <= '9') { gotoCase = 91; continue; };
+{ gotoCase = 20; continue; };
+case 34:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '.') {
-if (yych == '*') { gotoCase = 78; continue; };
+if (yych == '*') { gotoCase = 80; continue; };
 } else {
-if (yych <= '/') { gotoCase = 80; continue; };
-if (yych == '=') { gotoCase = 77; continue; };
+if (yych <= '/') { gotoCase = 82; continue; };
+if (yych == '=') { gotoCase = 79; continue; };
 }
-case 33:
+case 35:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = null; return cursor; }
-case 34:
+case 36:
 yyaccept = 3;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'E') {
 if (yych <= '/') {
-if (yych == '.') { gotoCase = 63; continue; };
+if (yych == '.') { gotoCase = 65; continue; };
 } else {
-if (yych <= '7') { gotoCase = 72; continue; };
-if (yych >= 'E') { gotoCase = 62; continue; };
+if (yych <= '7') { gotoCase = 74; continue; };
+if (yych >= 'E') { gotoCase = 64; continue; };
 }
 } else {
 if (yych <= 'd') {
-if (yych == 'X') { gotoCase = 74; continue; };
+if (yych == 'X') { gotoCase = 76; continue; };
 } else {
-if (yych <= 'e') { gotoCase = 62; continue; };
-if (yych == 'x') { gotoCase = 74; continue; };
-}
-}
-case 35:
-{ this.tokenType = "javascript-number"; return cursor; }
-case 36:
-yyaccept = 3;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych <= '9') {
-if (yych == '.') { gotoCase = 63; continue; };
-if (yych <= '/') { gotoCase = 35; continue; };
-{ gotoCase = 60; continue; };
-} else {
-if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 35; continue; };
-{ gotoCase = 62; continue; };
-} else {
-if (yych == 'e') { gotoCase = 62; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= 'e') { gotoCase = 64; continue; };
+if (yych == 'x') { gotoCase = 76; continue; };
 }
 }
 case 37:
-yych = this._charAt(++cursor);
-if (yych <= ';') { gotoCase = 18; continue; };
-if (yych <= '<') { gotoCase = 59; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+{ this.tokenType = "javascript-number"; return cursor; }
 case 38:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 58; continue; };
-{ gotoCase = 18; continue; };
+yyaccept = 3;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 65; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+{ gotoCase = 62; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 37; continue; };
+{ gotoCase = 64; continue; };
+} else {
+if (yych == 'e') { gotoCase = 64; continue; };
+{ gotoCase = 37; continue; };
+}
+}
 case 39:
 yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 18; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-if (yych <= '>') { gotoCase = 56; continue; };
-{ gotoCase = 18; continue; };
+if (yych <= ';') { gotoCase = 20; continue; };
+if (yych <= '<') { gotoCase = 61; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 40:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == 'u') { gotoCase = 44; continue; };
-{ gotoCase = 16; continue; };
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 60; continue; };
+{ gotoCase = 20; continue; };
 case 41:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych <= '<') { gotoCase = 20; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+if (yych <= '>') { gotoCase = 58; continue; };
+{ gotoCase = 20; continue; };
 case 42:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-if (yych != '|') { gotoCase = 18; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 46; continue; };
+{ gotoCase = 16; continue; };
 case 43:
 yych = this._charAt(++cursor);
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 44:
 yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 46; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 46; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 46; continue; };
-}
+if (yych == '=') { gotoCase = 45; continue; };
+if (yych != '|') { gotoCase = 20; continue; };
 case 45:
+yych = this._charAt(++cursor);
+{ gotoCase = 20; continue; };
+case 46:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 48; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 48; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 48; continue; };
+}
+case 47:
 cursor = YYMARKER;
 if (yyaccept <= 1) {
 if (yyaccept <= 0) {
 { gotoCase = 16; continue; };
 } else {
-{ gotoCase = 21; continue; };
+{ gotoCase = 23; continue; };
 }
 } else {
 if (yyaccept <= 2) {
-{ gotoCase = 33; continue; };
-} else {
 { gotoCase = 35; continue; };
-}
-}
-case 46:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 47; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+{ gotoCase = 37; continue; };
 }
-case 47:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 48; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
 }
 case 48:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 49; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 49:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 50; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 50:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 51; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 51:
 yyaccept = 1;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 50:
+case 52:
 if (yych <= '[') {
 if (yych <= '/') {
-if (yych == '$') { gotoCase = 49; continue; };
-{ gotoCase = 21; continue; };
+if (yych == '$') { gotoCase = 51; continue; };
+{ gotoCase = 23; continue; };
 } else {
-if (yych <= '9') { gotoCase = 49; continue; };
-if (yych <= '@') { gotoCase = 21; continue; };
-if (yych <= 'Z') { gotoCase = 49; continue; };
-{ gotoCase = 21; continue; };
+if (yych <= '9') { gotoCase = 51; continue; };
+if (yych <= '@') { gotoCase = 23; continue; };
+if (yych <= 'Z') { gotoCase = 51; continue; };
+{ gotoCase = 23; continue; };
 }
 } else {
 if (yych <= '_') {
-if (yych <= '\\') { gotoCase = 51; continue; };
-if (yych <= '^') { gotoCase = 21; continue; };
-{ gotoCase = 49; continue; };
+if (yych <= '\\') { gotoCase = 53; continue; };
+if (yych <= '^') { gotoCase = 23; continue; };
+{ gotoCase = 51; continue; };
 } else {
-if (yych <= '`') { gotoCase = 21; continue; };
-if (yych <= 'z') { gotoCase = 49; continue; };
-if (yych <= String.fromCharCode(0x7F)) { gotoCase = 21; continue; };
-{ gotoCase = 49; continue; };
+if (yych <= '`') { gotoCase = 23; continue; };
+if (yych <= 'z') { gotoCase = 51; continue; };
+if (yych <= String.fromCharCode(0x7F)) { gotoCase = 23; continue; };
+{ gotoCase = 51; continue; };
 }
 }
-case 51:
-++cursor;
-yych = this._charAt(cursor);
-if (yych != 'u') { gotoCase = 45; continue; };
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 53; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 53:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 54; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 54:
+if (yych != 'u') { gotoCase = 47; continue; };
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 55; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 55:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 49; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 49; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 49; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 56; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 56:
-yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 18; continue; };
-if (yych <= '=') { gotoCase = 43; continue; };
-if (yych >= '?') { gotoCase = 18; continue; };
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 57; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 57:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 51; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 51; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 51; continue; };
+{ gotoCase = 47; continue; };
+}
 case 58:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
-case 59:
+if (yych <= '<') { gotoCase = 20; continue; };
+if (yych <= '=') { gotoCase = 45; continue; };
+if (yych >= '?') { gotoCase = 20; continue; };
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 43; continue; };
-{ gotoCase = 18; continue; };
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
 case 60:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 61:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 62:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 63; continue; };
-if (yych <= '/') { gotoCase = 35; continue; };
-{ gotoCase = 60; continue; };
+if (yych == '.') { gotoCase = 65; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+{ gotoCase = 62; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 35; continue; };
+if (yych <= 'D') { gotoCase = 37; continue; };
 } else {
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
 }
-case 62:
+case 64:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych == '+') { gotoCase = 69; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '+') { gotoCase = 71; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 69; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 70; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 71; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 72; continue; };
+{ gotoCase = 47; continue; };
 }
-case 63:
+case 65:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 63; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 65; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 65; continue; };
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych <= 'E') { gotoCase = 67; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
-case 65:
+case 67:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 45; continue; };
+if (yych != '+') { gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 66; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 67; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 68; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 69; continue; };
+{ gotoCase = 47; continue; };
 }
-case 66:
+case 68:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 67:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 67; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 69:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 70:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 70; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 69; continue; };
+{ gotoCase = 37; continue; };
+case 71:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 72:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '7') { gotoCase = 72; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 72; continue; };
+{ gotoCase = 37; continue; };
 case 74:
-yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 75; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 75:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '7') { gotoCase = 74; continue; };
+{ gotoCase = 37; continue; };
+case 76:
+yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 75; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 75; continue; };
-if (yych <= '`') { gotoCase = 35; continue; };
-if (yych <= 'f') { gotoCase = 75; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= 'F') { gotoCase = 77; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 77:
-yych = this._charAt(++cursor);
-{ gotoCase = 33; continue; };
-case 78:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 85; continue; };
-{ gotoCase = 78; continue; };
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 77; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 85; continue; };
-if (yych == '*') { gotoCase = 83; continue; };
-{ gotoCase = 78; continue; };
+if (yych <= 'F') { gotoCase = 77; continue; };
+if (yych <= '`') { gotoCase = 37; continue; };
+if (yych <= 'f') { gotoCase = 77; continue; };
+{ gotoCase = 37; continue; };
 }
+case 79:
+yych = this._charAt(++cursor);
+{ gotoCase = 35; continue; };
 case 80:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 82; continue; };
-if (yych != '\r') { gotoCase = 80; continue; };
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 87; continue; };
+{ gotoCase = 80; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 87; continue; };
+if (yych == '*') { gotoCase = 85; continue; };
+{ gotoCase = 80; continue; };
+}
 case 82:
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 83:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '*') { gotoCase = 83; continue; };
-if (yych == '/') { gotoCase = 87; continue; };
-{ gotoCase = 78; continue; };
+if (yych == '\n') { gotoCase = 84; continue; };
+if (yych != '\r') { gotoCase = 82; continue; };
+case 84:
+{ this.tokenType = "javascript-comment"; return cursor; }
 case 85:
 ++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 85; continue; };
+if (yych == '/') { gotoCase = 89; continue; };
+{ gotoCase = 80; continue; };
+case 87:
+++cursor;
 this.setLexCondition(this._lexConditions.COMMENT);
 { this.tokenType = "javascript-comment"; return cursor; }
-case 87:
+case 89:
 ++cursor;
 { this.tokenType = "javascript-comment"; return cursor; }
-case 89:
+case 91:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 89; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 91; continue; };
+{ gotoCase = 37; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 91; continue; };
-if (yych != 'e') { gotoCase = 35; continue; };
+if (yych <= 'E') { gotoCase = 93; continue; };
+if (yych != 'e') { gotoCase = 37; continue; };
 }
-case 91:
+case 93:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 45; continue; };
+if (yych != '+') { gotoCase = 47; continue; };
 } else {
-if (yych <= '-') { gotoCase = 92; continue; };
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 93; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '-') { gotoCase = 94; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 95; continue; };
+{ gotoCase = 47; continue; };
 }
-case 92:
+case 94:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-case 93:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 35; continue; };
-if (yych <= '9') { gotoCase = 93; continue; };
-{ gotoCase = 35; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 case 95:
 ++cursor;
 yych = this._charAt(cursor);
-case 96:
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 95; continue; };
+{ gotoCase = 37; continue; };
+case 97:
+++cursor;
+yych = this._charAt(cursor);
+case 98:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 45; continue; };
-if (yych <= '\f') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\n') { gotoCase = 47; continue; };
+if (yych <= '\f') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 95; continue; };
-{ gotoCase = 98; continue; };
+if (yych <= '&') { gotoCase = 97; continue; };
+{ gotoCase = 100; continue; };
 } else {
-if (yych != '\\') { gotoCase = 95; continue; };
+if (yych != '\\') { gotoCase = 97; continue; };
 }
 }
 ++cursor;
@@ -37951,112 +40757,112 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 45; continue; };
-{ gotoCase = 101; continue; };
+if (yych <= '\t') { gotoCase = 47; continue; };
+{ gotoCase = 103; continue; };
 } else {
-if (yych == '\r') { gotoCase = 101; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\r') { gotoCase = 103; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 95; continue; };
-if (yych <= '&') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych <= '"') { gotoCase = 97; continue; };
+if (yych <= '&') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych == '\\') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\\') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 95; continue; };
-if (yych <= 'e') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych <= 'b') { gotoCase = 97; continue; };
+if (yych <= 'e') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych == 'n') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych == 'n') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 45; continue; };
-{ gotoCase = 95; continue; };
+if (yych == 's') { gotoCase = 47; continue; };
+{ gotoCase = 97; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 100; continue; };
-if (yych <= 'v') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'u') { gotoCase = 102; continue; };
+if (yych <= 'v') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 }
-case 98:
+case 100:
 ++cursor;
 { this.tokenType = "javascript-string"; return cursor; }
-case 100:
+case 102:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 103; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 105; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 103; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 103; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 105; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 105; continue; };
+{ gotoCase = 47; continue; };
 }
-case 101:
+case 103:
 ++cursor;
 this.setLexCondition(this._lexConditions.SSTRING);
 { this.tokenType = "javascript-string"; return cursor; }
-case 103:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 104; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 104:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 105; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 105:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 95; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 95; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 106; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 106:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 107; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
 case 107:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 97; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 97; continue; };
+{ gotoCase = 47; continue; };
+}
+case 108:
+++cursor;
+yych = this._charAt(cursor);
+case 109:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 45; continue; };
-if (yych <= '\f') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\n') { gotoCase = 47; continue; };
+if (yych <= '\f') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 106; continue; };
-{ gotoCase = 98; continue; };
+if (yych <= '!') { gotoCase = 108; continue; };
+{ gotoCase = 100; continue; };
 } else {
-if (yych != '\\') { gotoCase = 106; continue; };
+if (yych != '\\') { gotoCase = 108; continue; };
 }
 }
 ++cursor;
@@ -38064,1052 +40870,1072 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 45; continue; };
-{ gotoCase = 110; continue; };
+if (yych <= '\t') { gotoCase = 47; continue; };
+{ gotoCase = 112; continue; };
 } else {
-if (yych == '\r') { gotoCase = 110; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\r') { gotoCase = 112; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 106; continue; };
-if (yych <= '&') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych <= '"') { gotoCase = 108; continue; };
+if (yych <= '&') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych == '\\') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == '\\') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 106; continue; };
-if (yych <= 'e') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych <= 'b') { gotoCase = 108; continue; };
+if (yych <= 'e') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych == 'n') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych == 'n') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 45; continue; };
-{ gotoCase = 106; continue; };
+if (yych == 's') { gotoCase = 47; continue; };
+{ gotoCase = 108; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 109; continue; };
-if (yych <= 'v') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'u') { gotoCase = 111; continue; };
+if (yych <= 'v') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
 }
 }
 }
-case 109:
+case 111:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 112; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 114; continue; };
+{ gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 112; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 112; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 114; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 114; continue; };
+{ gotoCase = 47; continue; };
 }
-case 110:
+case 112:
 ++cursor;
 this.setLexCondition(this._lexConditions.DSTRING);
 { this.tokenType = "javascript-string"; return cursor; }
-case 112:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 113; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
-case 113:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych >= ':') { gotoCase = 45; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 114; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych >= 'g') { gotoCase = 45; continue; };
-}
 case 114:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 45; continue; };
-if (yych <= '9') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 106; continue; };
-if (yych <= '`') { gotoCase = 45; continue; };
-if (yych <= 'f') { gotoCase = 106; continue; };
-{ gotoCase = 45; continue; };
+if (yych <= 'F') { gotoCase = 115; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
 }
 case 115:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 43; continue; };
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych >= ':') { gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 116; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych >= 'g') { gotoCase = 47; continue; };
+}
+case 116:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 47; continue; };
+if (yych <= '9') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 108; continue; };
+if (yych <= '`') { gotoCase = 47; continue; };
+if (yych <= 'f') { gotoCase = 108; continue; };
+{ gotoCase = 47; continue; };
+}
+case 117:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 45; continue; };
+{ gotoCase = 20; continue; };
+case 118:
+++cursor;
+yych = this._charAt(cursor);
+case 119:
+if (yych == ' ') { gotoCase = 118; continue; };
 { gotoCase = 18; continue; };
 
 case this.case_DSTRING:
 yych = this._charAt(cursor);
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 120; continue; };
-if (yych <= '\f') { gotoCase = 119; continue; };
-{ gotoCase = 120; continue; };
+if (yych == '\n') { gotoCase = 124; continue; };
+if (yych <= '\f') { gotoCase = 123; continue; };
+{ gotoCase = 124; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 119; continue; };
-{ gotoCase = 122; continue; };
+if (yych <= '!') { gotoCase = 123; continue; };
+{ gotoCase = 126; continue; };
 } else {
-if (yych == '\\') { gotoCase = 124; continue; };
-{ gotoCase = 119; continue; };
+if (yych == '\\') { gotoCase = 128; continue; };
+{ gotoCase = 123; continue; };
 }
 }
-case 118:
+case 122:
 { this.tokenType = "javascript-string"; return cursor; }
-case 119:
+case 123:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 126; continue; };
-case 120:
+{ gotoCase = 130; continue; };
+case 124:
 ++cursor;
-case 121:
+case 125:
 { this.tokenType = null; return cursor; }
-case 122:
+case 126:
 ++cursor;
-case 123:
+case 127:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = "javascript-string"; return cursor; }
-case 124:
+case 128:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 125; continue; };
-if (yych <= '&') { gotoCase = 121; continue; };
+if (yych == '"') { gotoCase = 129; continue; };
+if (yych <= '&') { gotoCase = 125; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 121; continue; };
+if (yych <= '[') { gotoCase = 125; continue; };
 } else {
-if (yych != 'b') { gotoCase = 121; continue; };
+if (yych != 'b') { gotoCase = 125; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych >= 'g') { gotoCase = 121; continue; };
+if (yych >= 'g') { gotoCase = 125; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 125; continue; };
-if (yych <= 'q') { gotoCase = 121; continue; };
+if (yych <= 'n') { gotoCase = 129; continue; };
+if (yych <= 'q') { gotoCase = 125; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 121; continue; };
+if (yych <= 's') { gotoCase = 125; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 127; continue; };
-if (yych >= 'w') { gotoCase = 121; continue; };
+if (yych <= 'u') { gotoCase = 131; continue; };
+if (yych >= 'w') { gotoCase = 125; continue; };
 }
 }
 }
-case 125:
+case 129:
 yyaccept = 0;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 126:
+case 130:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 118; continue; };
-if (yych <= '\f') { gotoCase = 125; continue; };
-{ gotoCase = 118; continue; };
+if (yych == '\n') { gotoCase = 122; continue; };
+if (yych <= '\f') { gotoCase = 129; continue; };
+{ gotoCase = 122; continue; };
 } else {
 if (yych <= '"') {
-if (yych <= '!') { gotoCase = 125; continue; };
-{ gotoCase = 133; continue; };
+if (yych <= '!') { gotoCase = 129; continue; };
+{ gotoCase = 137; continue; };
 } else {
-if (yych == '\\') { gotoCase = 132; continue; };
-{ gotoCase = 125; continue; };
+if (yych == '\\') { gotoCase = 136; continue; };
+{ gotoCase = 129; continue; };
 }
 }
-case 127:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych <= '9') { gotoCase = 129; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 129; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych <= 'f') { gotoCase = 129; continue; };
-}
-case 128:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 118; continue; };
-} else {
-{ gotoCase = 121; continue; };
-}
-case 129:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych >= ':') { gotoCase = 128; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 130; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych >= 'g') { gotoCase = 128; continue; };
-}
-case 130:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych >= ':') { gotoCase = 128; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 131; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych >= 'g') { gotoCase = 128; continue; };
-}
 case 131:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 128; continue; };
-if (yych <= '9') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych <= '9') { gotoCase = 133; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 125; continue; };
-if (yych <= '`') { gotoCase = 128; continue; };
-if (yych <= 'f') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'F') { gotoCase = 133; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych <= 'f') { gotoCase = 133; continue; };
 }
 case 132:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 122; continue; };
+} else {
+{ gotoCase = 125; continue; };
+}
+case 133:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych >= ':') { gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 134; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych >= 'g') { gotoCase = 132; continue; };
+}
+case 134:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych >= ':') { gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 135; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych >= 'g') { gotoCase = 132; continue; };
+}
+case 135:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 132; continue; };
+if (yych <= '9') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 129; continue; };
+if (yych <= '`') { gotoCase = 132; continue; };
+if (yych <= 'f') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
+}
+case 136:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 125; continue; };
-if (yych <= '&') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych == '"') { gotoCase = 129; continue; };
+if (yych <= '&') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= '[') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
-if (yych == 'b') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych == 'b') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych <= 'f') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'f') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 125; continue; };
-if (yych <= 'q') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= 'n') { gotoCase = 129; continue; };
+if (yych <= 'q') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 128; continue; };
-{ gotoCase = 125; continue; };
+if (yych <= 's') { gotoCase = 132; continue; };
+{ gotoCase = 129; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 127; continue; };
-if (yych <= 'v') { gotoCase = 125; continue; };
-{ gotoCase = 128; continue; };
+if (yych <= 'u') { gotoCase = 131; continue; };
+if (yych <= 'v') { gotoCase = 129; continue; };
+{ gotoCase = 132; continue; };
 }
 }
 }
-case 133:
+case 137:
 ++cursor;
 yych = this._charAt(cursor);
-{ gotoCase = 123; continue; };
+{ gotoCase = 127; continue; };
 
 case this.case_NODIV:
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych <= '(') {
-if (yych <= '#') {
-if (yych <= ' ') { gotoCase = 136; continue; };
-if (yych <= '!') { gotoCase = 138; continue; };
-if (yych <= '"') { gotoCase = 140; continue; };
-} else {
-if (yych <= '%') {
-if (yych <= '$') { gotoCase = 141; continue; };
-{ gotoCase = 143; continue; };
-} else {
-if (yych <= '&') { gotoCase = 144; continue; };
-if (yych <= '\'') { gotoCase = 145; continue; };
+if (yych <= '\'') {
+if (yych <= '"') {
+if (yych <= String.fromCharCode(0x1F)) { gotoCase = 140; continue; };
+if (yych <= ' ') { gotoCase = 142; continue; };
+if (yych <= '!') { gotoCase = 144; continue; };
 { gotoCase = 146; continue; };
+} else {
+if (yych <= '$') {
+if (yych >= '$') { gotoCase = 147; continue; };
+} else {
+if (yych <= '%') { gotoCase = 149; continue; };
+if (yych <= '&') { gotoCase = 150; continue; };
+{ gotoCase = 151; continue; };
 }
 }
 } else {
 if (yych <= ',') {
-if (yych <= ')') { gotoCase = 147; continue; };
-if (yych <= '*') { gotoCase = 149; continue; };
-if (yych <= '+') { gotoCase = 150; continue; };
-{ gotoCase = 146; continue; };
+if (yych <= ')') {
+if (yych <= '(') { gotoCase = 152; continue; };
+{ gotoCase = 153; continue; };
+} else {
+if (yych <= '*') { gotoCase = 155; continue; };
+if (yych <= '+') { gotoCase = 156; continue; };
+{ gotoCase = 152; continue; };
+}
 } else {
 if (yych <= '.') {
-if (yych <= '-') { gotoCase = 151; continue; };
-{ gotoCase = 152; continue; };
+if (yych <= '-') { gotoCase = 157; continue; };
+{ gotoCase = 158; continue; };
 } else {
-if (yych <= '/') { gotoCase = 153; continue; };
-if (yych <= '0') { gotoCase = 154; continue; };
-{ gotoCase = 156; continue; };
+if (yych <= '/') { gotoCase = 159; continue; };
+if (yych <= '0') { gotoCase = 160; continue; };
+{ gotoCase = 162; continue; };
 }
 }
 }
 } else {
 if (yych <= '\\') {
 if (yych <= '>') {
-if (yych <= ';') { gotoCase = 146; continue; };
-if (yych <= '<') { gotoCase = 157; continue; };
-if (yych <= '=') { gotoCase = 158; continue; };
-{ gotoCase = 159; continue; };
+if (yych <= ';') { gotoCase = 152; continue; };
+if (yych <= '<') { gotoCase = 163; continue; };
+if (yych <= '=') { gotoCase = 164; continue; };
+{ gotoCase = 165; continue; };
 } else {
 if (yych <= '@') {
-if (yych <= '?') { gotoCase = 146; continue; };
+if (yych <= '?') { gotoCase = 152; continue; };
 } else {
-if (yych <= 'Z') { gotoCase = 141; continue; };
-if (yych <= '[') { gotoCase = 146; continue; };
-{ gotoCase = 160; continue; };
+if (yych <= 'Z') { gotoCase = 147; continue; };
+if (yych <= '[') { gotoCase = 152; continue; };
+{ gotoCase = 166; continue; };
 }
 }
 } else {
 if (yych <= 'z') {
 if (yych <= '^') {
-if (yych <= ']') { gotoCase = 146; continue; };
-{ gotoCase = 161; continue; };
+if (yych <= ']') { gotoCase = 152; continue; };
+{ gotoCase = 167; continue; };
 } else {
-if (yych != '`') { gotoCase = 141; continue; };
+if (yych != '`') { gotoCase = 147; continue; };
 }
 } else {
 if (yych <= '|') {
-if (yych <= '{') { gotoCase = 146; continue; };
-{ gotoCase = 162; continue; };
+if (yych <= '{') { gotoCase = 152; continue; };
+{ gotoCase = 168; continue; };
 } else {
-if (yych <= '~') { gotoCase = 146; continue; };
-if (yych >= 0x80) { gotoCase = 141; continue; };
+if (yych <= '~') { gotoCase = 152; continue; };
+if (yych >= 0x80) { gotoCase = 147; continue; };
 }
 }
 }
 }
-case 136:
+case 140:
 ++cursor;
-case 137:
+case 141:
 { this.tokenType = null; return cursor; }
-case 138:
+case 142:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 260; continue; };
-case 139:
+yych = this._charAt(cursor);
+{ gotoCase = 268; continue; };
+case 143:
+{this.tokenType = "whitespace"; return cursor; }
+case 144:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 266; continue; };
+case 145:
 {
 var token = this._line.charAt(cursorOnEnter);
 if (token === "{")
 this.tokenType = "block-start";
 else if (token === "}")
 this.tokenType = "block-end";
+else if (token === "(")
+this.tokenType = "brace-start";
 else this.tokenType = null;
 return cursor;
 }
-case 140:
+case 146:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-if (yych == '\n') { gotoCase = 137; continue; };
-if (yych == '\r') { gotoCase = 137; continue; };
-{ gotoCase = 252; continue; };
-case 141:
+if (yych == '\n') { gotoCase = 141; continue; };
+if (yych == '\r') { gotoCase = 141; continue; };
+{ gotoCase = 258; continue; };
+case 147:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 170; continue; };
-case 142:
+{ gotoCase = 176; continue; };
+case 148:
 this.setLexCondition(this._lexConditions.DIV);
 {
 var token = this._line.substring(cursorOnEnter, cursor);
-if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
+if (WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties.hasOwnProperty(token))
+this.tokenType = WebInspector.SourceJavaScriptTokenizer.GlobalObjectValueProperties[token];
+else if (WebInspector.SourceJavaScriptTokenizer.Keywords[token] === true && token !== "__proto__")
 this.tokenType = "javascript-keyword";
 else
 this.tokenType = "javascript-ident";
 return cursor;
 }
-case 143:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 144:
-yych = this._charAt(++cursor);
-if (yych == '&') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 145:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == '\n') { gotoCase = 137; continue; };
-if (yych == '\r') { gotoCase = 137; continue; };
-{ gotoCase = 241; continue; };
-case 146:
-yych = this._charAt(++cursor);
-{ gotoCase = 139; continue; };
-case 147:
-++cursor;
-this.setLexCondition(this._lexConditions.DIV);
-{ this.tokenType = null; return cursor; }
 case 149:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 150:
 yych = this._charAt(++cursor);
-if (yych == '+') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+if (yych == '&') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 151:
-yych = this._charAt(++cursor);
-if (yych == '-') { gotoCase = 163; continue; };
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 141; continue; };
+if (yych == '\r') { gotoCase = 141; continue; };
+{ gotoCase = 247; continue; };
 case 152:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 139; continue; };
-if (yych <= '9') { gotoCase = 234; continue; };
-{ gotoCase = 139; continue; };
+{ gotoCase = 145; continue; };
 case 153:
+++cursor;
+this.setLexCondition(this._lexConditions.DIV);
+{ this.tokenType = "brace-end"; return cursor; }
+case 155:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 156:
+yych = this._charAt(++cursor);
+if (yych == '+') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 157:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 169; continue; };
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 158:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 145; continue; };
+if (yych <= '9') { gotoCase = 240; continue; };
+{ gotoCase = 145; continue; };
+case 159:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 137; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '\n') { gotoCase = 141; continue; };
+{ gotoCase = 203; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 137; continue; };
-if (yych <= ')') { gotoCase = 197; continue; };
-{ gotoCase = 202; continue; };
+if (yych <= '\r') { gotoCase = 141; continue; };
+if (yych <= ')') { gotoCase = 203; continue; };
+{ gotoCase = 208; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 204; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '/') { gotoCase = 210; continue; };
+{ gotoCase = 203; continue; };
 } else {
-if (yych <= '[') { gotoCase = 200; continue; };
-if (yych <= '\\') { gotoCase = 199; continue; };
-if (yych <= ']') { gotoCase = 137; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '[') { gotoCase = 206; continue; };
+if (yych <= '\\') { gotoCase = 205; continue; };
+if (yych <= ']') { gotoCase = 141; continue; };
+{ gotoCase = 203; continue; };
 }
 }
-case 154:
+case 160:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'E') {
 if (yych <= '/') {
-if (yych == '.') { gotoCase = 183; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
 } else {
-if (yych <= '7') { gotoCase = 192; continue; };
-if (yych >= 'E') { gotoCase = 182; continue; };
+if (yych <= '7') { gotoCase = 198; continue; };
+if (yych >= 'E') { gotoCase = 188; continue; };
 }
 } else {
 if (yych <= 'd') {
-if (yych == 'X') { gotoCase = 194; continue; };
+if (yych == 'X') { gotoCase = 200; continue; };
 } else {
-if (yych <= 'e') { gotoCase = 182; continue; };
-if (yych == 'x') { gotoCase = 194; continue; };
+if (yych <= 'e') { gotoCase = 188; continue; };
+if (yych == 'x') { gotoCase = 200; continue; };
 }
 }
-case 155:
+case 161:
 this.setLexCondition(this._lexConditions.DIV);
 { this.tokenType = "javascript-number"; return cursor; }
-case 156:
+case 162:
 yyaccept = 2;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 183; continue; };
-if (yych <= '/') { gotoCase = 155; continue; };
-{ gotoCase = 180; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+{ gotoCase = 186; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 155; continue; };
-{ gotoCase = 182; continue; };
+if (yych <= 'D') { gotoCase = 161; continue; };
+{ gotoCase = 188; continue; };
 } else {
-if (yych == 'e') { gotoCase = 182; continue; };
-{ gotoCase = 155; continue; };
+if (yych == 'e') { gotoCase = 188; continue; };
+{ gotoCase = 161; continue; };
 }
 }
-case 157:
-yych = this._charAt(++cursor);
-if (yych <= ';') { gotoCase = 139; continue; };
-if (yych <= '<') { gotoCase = 179; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 158:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 178; continue; };
-{ gotoCase = 139; continue; };
-case 159:
-yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 139; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-if (yych <= '>') { gotoCase = 176; continue; };
-{ gotoCase = 139; continue; };
-case 160:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych == 'u') { gotoCase = 164; continue; };
-{ gotoCase = 137; continue; };
-case 161:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 162:
-yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-if (yych != '|') { gotoCase = 139; continue; };
 case 163:
 yych = this._charAt(++cursor);
-{ gotoCase = 139; continue; };
+if (yych <= ';') { gotoCase = 145; continue; };
+if (yych <= '<') { gotoCase = 185; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
 case 164:
 yych = this._charAt(++cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 166; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 166; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 166; continue; };
-}
+if (yych == '=') { gotoCase = 184; continue; };
+{ gotoCase = 145; continue; };
 case 165:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 145; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+if (yych <= '>') { gotoCase = 182; continue; };
+{ gotoCase = 145; continue; };
+case 166:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 170; continue; };
+{ gotoCase = 141; continue; };
+case 167:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 168:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+if (yych != '|') { gotoCase = 145; continue; };
+case 169:
+yych = this._charAt(++cursor);
+{ gotoCase = 145; continue; };
+case 170:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 172; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 172; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 172; continue; };
+}
+case 171:
 cursor = YYMARKER;
 if (yyaccept <= 1) {
 if (yyaccept <= 0) {
-{ gotoCase = 137; continue; };
+{ gotoCase = 141; continue; };
 } else {
-{ gotoCase = 142; continue; };
+{ gotoCase = 148; continue; };
 }
 } else {
 if (yyaccept <= 2) {
-{ gotoCase = 155; continue; };
+{ gotoCase = 161; continue; };
 } else {
-{ gotoCase = 217; continue; };
+{ gotoCase = 223; continue; };
 }
 }
-case 166:
+case 172:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 167; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 173; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 167:
+case 173:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 168; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 174; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 168:
+case 174:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 169; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 175; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 169:
+case 175:
 yyaccept = 1;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-case 170:
+case 176:
 if (yych <= '[') {
 if (yych <= '/') {
-if (yych == '$') { gotoCase = 169; continue; };
-{ gotoCase = 142; continue; };
+if (yych == '$') { gotoCase = 175; continue; };
+{ gotoCase = 148; continue; };
 } else {
-if (yych <= '9') { gotoCase = 169; continue; };
-if (yych <= '@') { gotoCase = 142; continue; };
-if (yych <= 'Z') { gotoCase = 169; continue; };
-{ gotoCase = 142; continue; };
+if (yych <= '9') { gotoCase = 175; continue; };
+if (yych <= '@') { gotoCase = 148; continue; };
+if (yych <= 'Z') { gotoCase = 175; continue; };
+{ gotoCase = 148; continue; };
 }
 } else {
 if (yych <= '_') {
-if (yych <= '\\') { gotoCase = 171; continue; };
-if (yych <= '^') { gotoCase = 142; continue; };
-{ gotoCase = 169; continue; };
+if (yych <= '\\') { gotoCase = 177; continue; };
+if (yych <= '^') { gotoCase = 148; continue; };
+{ gotoCase = 175; continue; };
 } else {
-if (yych <= '`') { gotoCase = 142; continue; };
-if (yych <= 'z') { gotoCase = 169; continue; };
-if (yych <= String.fromCharCode(0x7F)) { gotoCase = 142; continue; };
-{ gotoCase = 169; continue; };
+if (yych <= '`') { gotoCase = 148; continue; };
+if (yych <= 'z') { gotoCase = 175; continue; };
+if (yych <= String.fromCharCode(0x7F)) { gotoCase = 148; continue; };
+{ gotoCase = 175; continue; };
 }
 }
-case 171:
+case 177:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych != 'u') { gotoCase = 165; continue; };
+if (yych != 'u') { gotoCase = 171; continue; };
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 173; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 179; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 173:
+case 179:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 174; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 180; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 174:
+case 180:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 181; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 181:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 175; continue; };
+{ gotoCase = 171; continue; };
 } else {
 if (yych <= 'F') { gotoCase = 175; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 175; continue; };
+{ gotoCase = 171; continue; };
 }
-case 175:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 169; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 169; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 169; continue; };
-{ gotoCase = 165; continue; };
-}
-case 176:
+case 182:
 yych = this._charAt(++cursor);
-if (yych <= '<') { gotoCase = 139; continue; };
-if (yych <= '=') { gotoCase = 163; continue; };
-if (yych >= '?') { gotoCase = 139; continue; };
+if (yych <= '<') { gotoCase = 145; continue; };
+if (yych <= '=') { gotoCase = 169; continue; };
+if (yych >= '?') { gotoCase = 145; continue; };
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 178:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 184:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 179:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 185:
 yych = this._charAt(++cursor);
-if (yych == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
-case 180:
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 186:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '9') {
-if (yych == '.') { gotoCase = 183; continue; };
-if (yych <= '/') { gotoCase = 155; continue; };
-{ gotoCase = 180; continue; };
+if (yych == '.') { gotoCase = 189; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+{ gotoCase = 186; continue; };
 } else {
 if (yych <= 'E') {
-if (yych <= 'D') { gotoCase = 155; continue; };
+if (yych <= 'D') { gotoCase = 161; continue; };
 } else {
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
 }
-case 182:
+case 188:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych == '+') { gotoCase = 189; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '+') { gotoCase = 195; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 189; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 190; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 195; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 196; continue; };
+{ gotoCase = 171; continue; };
 }
-case 183:
+case 189:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 183; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 189; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 185; continue; };
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych <= 'E') { gotoCase = 191; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
-case 185:
+case 191:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 165; continue; };
+if (yych != '+') { gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 186; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 187; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 192; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 193; continue; };
+{ gotoCase = 171; continue; };
 }
-case 186:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 187:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 187; continue; };
-{ gotoCase = 155; continue; };
-case 189:
-yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 190:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 190; continue; };
-{ gotoCase = 155; continue; };
 case 192:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 193:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '7') { gotoCase = 192; continue; };
-{ gotoCase = 155; continue; };
-case 194:
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 193; continue; };
+{ gotoCase = 161; continue; };
+case 195:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 196:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 196; continue; };
+{ gotoCase = 161; continue; };
+case 198:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '7') { gotoCase = 198; continue; };
+{ gotoCase = 161; continue; };
+case 200:
 yych = this._charAt(++cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 195; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 201; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
-case 195:
+case 201:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 195; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 201; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 195; continue; };
-if (yych <= '`') { gotoCase = 155; continue; };
-if (yych <= 'f') { gotoCase = 195; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= 'F') { gotoCase = 201; continue; };
+if (yych <= '`') { gotoCase = 161; continue; };
+if (yych <= 'f') { gotoCase = 201; continue; };
+{ gotoCase = 161; continue; };
 }
-case 197:
+case 203:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '.') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 197; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\t') { gotoCase = 203; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych <= '/') { gotoCase = 220; continue; };
-if (yych <= 'Z') { gotoCase = 197; continue; };
-{ gotoCase = 228; continue; };
+if (yych <= '/') { gotoCase = 226; continue; };
+if (yych <= 'Z') { gotoCase = 203; continue; };
+{ gotoCase = 234; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 227; continue; };
-if (yych <= ']') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\\') { gotoCase = 233; continue; };
+if (yych <= ']') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
 }
 }
-case 199:
+case 205:
 yych = this._charAt(++cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 197; continue; };
-case 200:
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 203; continue; };
+case 206:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 200; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 206; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 215; continue; };
-if (yych <= ']') { gotoCase = 213; continue; };
-{ gotoCase = 200; continue; };
+if (yych <= '\\') { gotoCase = 221; continue; };
+if (yych <= ']') { gotoCase = 219; continue; };
+{ gotoCase = 206; continue; };
 }
 }
-case 202:
+case 208:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 209; continue; };
-{ gotoCase = 202; continue; };
+if (yych == '\n') { gotoCase = 215; continue; };
+{ gotoCase = 208; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 209; continue; };
-if (yych == '*') { gotoCase = 207; continue; };
-{ gotoCase = 202; continue; };
+if (yych <= '\r') { gotoCase = 215; continue; };
+if (yych == '*') { gotoCase = 213; continue; };
+{ gotoCase = 208; continue; };
 }
-case 204:
+case 210:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 206; continue; };
-if (yych != '\r') { gotoCase = 204; continue; };
-case 206:
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 207:
-++cursor;
-yych = this._charAt(cursor);
-if (yych == '*') { gotoCase = 207; continue; };
-if (yych == '/') { gotoCase = 211; continue; };
-{ gotoCase = 202; continue; };
-case 209:
-++cursor;
-this.setLexCondition(this._lexConditions.COMMENT);
-{ this.tokenType = "javascript-comment"; return cursor; }
-case 211:
-++cursor;
+if (yych == '\n') { gotoCase = 212; continue; };
+if (yych != '\r') { gotoCase = 210; continue; };
+case 212:
 { this.tokenType = "javascript-comment"; return cursor; }
 case 213:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 213; continue; };
+if (yych == '/') { gotoCase = 217; continue; };
+{ gotoCase = 208; continue; };
+case 215:
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 217:
+++cursor;
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 219:
+++cursor;
+yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 213; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 219; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 213; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 219; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 213; continue; };
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 219; continue; };
 } else {
-if (yych <= '[') { gotoCase = 218; continue; };
-if (yych <= '\\') { gotoCase = 216; continue; };
-{ gotoCase = 213; continue; };
+if (yych <= '[') { gotoCase = 224; continue; };
+if (yych <= '\\') { gotoCase = 222; continue; };
+{ gotoCase = 219; continue; };
 }
 }
-case 215:
+case 221:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 200; continue; };
-case 216:
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 206; continue; };
+case 222:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych != '\r') { gotoCase = 213; continue; };
-case 217:
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych != '\r') { gotoCase = 219; continue; };
+case 223:
 this.setLexCondition(this._lexConditions.REGEX);
 { this.tokenType = "javascript-regexp"; return cursor; }
-case 218:
+case 224:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 218; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 224; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 225; continue; };
-if (yych <= ']') { gotoCase = 223; continue; };
-{ gotoCase = 218; continue; };
+if (yych <= '\\') { gotoCase = 231; continue; };
+if (yych <= ']') { gotoCase = 229; continue; };
+{ gotoCase = 224; continue; };
 }
 }
-case 220:
+case 226:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'h') {
-if (yych == 'g') { gotoCase = 220; continue; };
+if (yych == 'g') { gotoCase = 226; continue; };
 } else {
-if (yych <= 'i') { gotoCase = 220; continue; };
-if (yych == 'm') { gotoCase = 220; continue; };
+if (yych <= 'i') { gotoCase = 226; continue; };
+if (yych == 'm') { gotoCase = 226; continue; };
 }
 { this.tokenType = "javascript-regexp"; return cursor; }
-case 223:
+case 229:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '*') {
 if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 223; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 229; continue; };
 } else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 223; continue; };
-{ gotoCase = 197; continue; };
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 229; continue; };
+{ gotoCase = 203; continue; };
 }
 } else {
 if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 223; continue; };
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 229; continue; };
 } else {
-if (yych <= '[') { gotoCase = 218; continue; };
-if (yych <= '\\') { gotoCase = 226; continue; };
-{ gotoCase = 223; continue; };
-}
-}
-case 225:
-++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 218; continue; };
-case 226:
-yyaccept = 3;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 223; continue; };
-case 227:
-yyaccept = 3;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 197; continue; };
-case 228:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 228; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych == '/') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
-} else {
+if (yych <= '[') { gotoCase = 224; continue; };
 if (yych <= '\\') { gotoCase = 232; continue; };
-if (yych >= '^') { gotoCase = 228; continue; };
+{ gotoCase = 229; continue; };
 }
 }
-case 230:
+case 231:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 165; continue; };
-{ gotoCase = 230; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 165; continue; };
-if (yych <= ')') { gotoCase = 230; continue; };
-{ gotoCase = 197; continue; };
-}
-} else {
-if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 220; continue; };
-{ gotoCase = 230; continue; };
-} else {
-if (yych <= '[') { gotoCase = 228; continue; };
-if (yych <= '\\') { gotoCase = 233; continue; };
-{ gotoCase = 230; continue; };
-}
-}
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 224; continue; };
 case 232:
-++cursor;
+yyaccept = 3;
+YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych == '\r') { gotoCase = 165; continue; };
-{ gotoCase = 228; continue; };
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 229; continue; };
 case 233:
 yyaccept = 3;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 217; continue; };
-if (yych == '\r') { gotoCase = 217; continue; };
-{ gotoCase = 230; continue; };
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 203; continue; };
 case 234:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 234; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 238; continue; };
+if (yych >= '^') { gotoCase = 234; continue; };
+}
+}
+case 236:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 171; continue; };
+{ gotoCase = 236; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 171; continue; };
+if (yych <= ')') { gotoCase = 236; continue; };
+{ gotoCase = 203; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 226; continue; };
+{ gotoCase = 236; continue; };
+} else {
+if (yych <= '[') { gotoCase = 234; continue; };
+if (yych <= '\\') { gotoCase = 239; continue; };
+{ gotoCase = 236; continue; };
+}
+}
+case 238:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych == '\r') { gotoCase = 171; continue; };
+{ gotoCase = 234; continue; };
+case 239:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 223; continue; };
+if (yych == '\r') { gotoCase = 223; continue; };
+{ gotoCase = 236; continue; };
+case 240:
 yyaccept = 2;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
 if (yych <= 'D') {
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 234; continue; };
-{ gotoCase = 155; continue; };
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 240; continue; };
+{ gotoCase = 161; continue; };
 } else {
-if (yych <= 'E') { gotoCase = 236; continue; };
-if (yych != 'e') { gotoCase = 155; continue; };
+if (yych <= 'E') { gotoCase = 242; continue; };
+if (yych != 'e') { gotoCase = 161; continue; };
 }
-case 236:
+case 242:
 yych = this._charAt(++cursor);
 if (yych <= ',') {
-if (yych != '+') { gotoCase = 165; continue; };
+if (yych != '+') { gotoCase = 171; continue; };
 } else {
-if (yych <= '-') { gotoCase = 237; continue; };
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 238; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '-') { gotoCase = 243; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 244; continue; };
+{ gotoCase = 171; continue; };
 }
-case 237:
+case 243:
 yych = this._charAt(++cursor);
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-case 238:
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+case 244:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '/') { gotoCase = 155; continue; };
-if (yych <= '9') { gotoCase = 238; continue; };
-{ gotoCase = 155; continue; };
-case 240:
+if (yych <= '/') { gotoCase = 161; continue; };
+if (yych <= '9') { gotoCase = 244; continue; };
+{ gotoCase = 161; continue; };
+case 246:
 ++cursor;
 yych = this._charAt(cursor);
-case 241:
+case 247:
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych <= '\f') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych <= '\f') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 240; continue; };
-{ gotoCase = 243; continue; };
+if (yych <= '&') { gotoCase = 246; continue; };
+{ gotoCase = 249; continue; };
 } else {
-if (yych != '\\') { gotoCase = 240; continue; };
+if (yych != '\\') { gotoCase = 246; continue; };
 }
 }
 ++cursor;
@@ -39117,552 +41943,558 @@
 if (yych <= 'a') {
 if (yych <= '!') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 165; continue; };
-{ gotoCase = 246; continue; };
+if (yych <= '\t') { gotoCase = 171; continue; };
+{ gotoCase = 252; continue; };
 } else {
-if (yych == '\r') { gotoCase = 246; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 252; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 240; continue; };
-if (yych <= '&') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych <= '"') { gotoCase = 246; continue; };
+if (yych <= '&') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych == '\\') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\\') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 }
 } else {
 if (yych <= 'q') {
 if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 240; continue; };
-if (yych <= 'e') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych <= 'b') { gotoCase = 246; continue; };
+if (yych <= 'e') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych == 'n') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych == 'n') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych == 's') { gotoCase = 165; continue; };
-{ gotoCase = 240; continue; };
+if (yych == 's') { gotoCase = 171; continue; };
+{ gotoCase = 246; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 245; continue; };
-if (yych <= 'v') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'u') { gotoCase = 251; continue; };
+if (yych <= 'v') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
 }
 }
 }
-case 243:
-++cursor;
-{ this.tokenType = "javascript-string"; return cursor; }
-case 245:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 248; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 248; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 248; continue; };
-{ gotoCase = 165; continue; };
-}
-case 246:
-++cursor;
-this.setLexCondition(this._lexConditions.SSTRING);
-{ this.tokenType = "javascript-string"; return cursor; }
-case 248:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 249; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
 case 249:
 ++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 250; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
-case 250:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 240; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 240; continue; };
-{ gotoCase = 165; continue; };
-}
+{ this.tokenType = "javascript-string"; return cursor; }
 case 251:
 ++cursor;
 yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 254; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 254; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 254; continue; };
+{ gotoCase = 171; continue; };
+}
 case 252:
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 165; continue; };
-if (yych <= '\f') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-} else {
-if (yych <= '"') {
-if (yych <= '!') { gotoCase = 251; continue; };
-{ gotoCase = 243; continue; };
-} else {
-if (yych != '\\') { gotoCase = 251; continue; };
-}
-}
 ++cursor;
-yych = this._charAt(cursor);
-if (yych <= 'a') {
-if (yych <= '!') {
-if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 165; continue; };
-{ gotoCase = 255; continue; };
-} else {
-if (yych == '\r') { gotoCase = 255; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= '\'') {
-if (yych <= '"') { gotoCase = 251; continue; };
-if (yych <= '&') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych == '\\') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-}
-} else {
-if (yych <= 'q') {
-if (yych <= 'f') {
-if (yych <= 'b') { gotoCase = 251; continue; };
-if (yych <= 'e') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych == 'n') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-} else {
-if (yych <= 't') {
-if (yych == 's') { gotoCase = 165; continue; };
-{ gotoCase = 251; continue; };
-} else {
-if (yych <= 'u') { gotoCase = 254; continue; };
-if (yych <= 'v') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
-}
-}
-}
+this.setLexCondition(this._lexConditions.SSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
 case 254:
 ++cursor;
 yych = this._charAt(cursor);
 if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 257; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 257; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 257; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'F') { gotoCase = 255; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
 }
 case 255:
 ++cursor;
-this.setLexCondition(this._lexConditions.DSTRING);
-{ this.tokenType = "javascript-string"; return cursor; }
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 256; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 256:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 246; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 246; continue; };
+{ gotoCase = 171; continue; };
+}
 case 257:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 258; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
-}
 case 258:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych >= ':') { gotoCase = 165; continue; };
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 171; continue; };
+if (yych <= '\f') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 259; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych >= 'g') { gotoCase = 165; continue; };
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 257; continue; };
+{ gotoCase = 249; continue; };
+} else {
+if (yych != '\\') { gotoCase = 257; continue; };
 }
-case 259:
+}
 ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 165; continue; };
-if (yych <= '9') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 171; continue; };
+{ gotoCase = 261; continue; };
 } else {
-if (yych <= 'F') { gotoCase = 251; continue; };
-if (yych <= '`') { gotoCase = 165; continue; };
-if (yych <= 'f') { gotoCase = 251; continue; };
-{ gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 261; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 257; continue; };
+if (yych <= '&') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych == '\\') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 257; continue; };
+if (yych <= 'e') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych == 'n') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 171; continue; };
+{ gotoCase = 257; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 260; continue; };
+if (yych <= 'v') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+}
 }
 case 260:
 ++cursor;
-if ((yych = this._charAt(cursor)) == '=') { gotoCase = 163; continue; };
-{ gotoCase = 139; continue; };
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 263; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 263; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 263; continue; };
+{ gotoCase = 171; continue; };
+}
+case 261:
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 263:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 264; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 264:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych >= ':') { gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 265; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych >= 'g') { gotoCase = 171; continue; };
+}
+case 265:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 171; continue; };
+if (yych <= '9') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 257; continue; };
+if (yych <= '`') { gotoCase = 171; continue; };
+if (yych <= 'f') { gotoCase = 257; continue; };
+{ gotoCase = 171; continue; };
+}
+case 266:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 169; continue; };
+{ gotoCase = 145; continue; };
+case 267:
+++cursor;
+yych = this._charAt(cursor);
+case 268:
+if (yych == ' ') { gotoCase = 267; continue; };
+{ gotoCase = 143; continue; };
 
 case this.case_REGEX:
 yych = this._charAt(cursor);
 if (yych <= '.') {
 if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 264; continue; };
-{ gotoCase = 265; continue; };
+if (yych <= '\t') { gotoCase = 272; continue; };
+{ gotoCase = 273; continue; };
 } else {
-if (yych == '\r') { gotoCase = 265; continue; };
-{ gotoCase = 264; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych <= '/') { gotoCase = 267; continue; };
-if (yych <= 'Z') { gotoCase = 264; continue; };
-{ gotoCase = 269; continue; };
-} else {
-if (yych <= '\\') { gotoCase = 270; continue; };
-if (yych <= ']') { gotoCase = 265; continue; };
-{ gotoCase = 264; continue; };
-}
-}
-case 263:
-{ this.tokenType = "javascript-regexp"; return cursor; }
-case 264:
-yyaccept = 0;
-yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\r') { gotoCase = 273; continue; };
 { gotoCase = 272; continue; };
-case 265:
-++cursor;
-case 266:
-{ this.tokenType = null; return cursor; }
-case 267:
-++cursor;
-yych = this._charAt(cursor);
-{ gotoCase = 278; continue; };
-case 268:
-this.setLexCondition(this._lexConditions.NODIV);
-{ this.tokenType = "javascript-regexp"; return cursor; }
-case 269:
-yyaccept = 1;
-yych = this._charAt(YYMARKER = ++cursor);
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 266; continue; };
-if (yych <= '\f') { gotoCase = 276; continue; };
-{ gotoCase = 266; continue; };
-} else {
-if (yych <= '*') {
-if (yych <= ')') { gotoCase = 276; continue; };
-{ gotoCase = 266; continue; };
-} else {
-if (yych == '/') { gotoCase = 266; continue; };
-{ gotoCase = 276; continue; };
-}
-}
-case 270:
-yych = this._charAt(++cursor);
-if (yych == '\n') { gotoCase = 266; continue; };
-if (yych == '\r') { gotoCase = 266; continue; };
-case 271:
-yyaccept = 0;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-case 272:
-if (yych <= '.') {
-if (yych <= '\n') {
-if (yych <= '\t') { gotoCase = 271; continue; };
-{ gotoCase = 263; continue; };
-} else {
-if (yych == '\r') { gotoCase = 263; continue; };
-{ gotoCase = 271; continue; };
 }
 } else {
 if (yych <= '[') {
-if (yych <= '/') { gotoCase = 277; continue; };
-if (yych <= 'Z') { gotoCase = 271; continue; };
-{ gotoCase = 275; continue; };
+if (yych <= '/') { gotoCase = 275; continue; };
+if (yych <= 'Z') { gotoCase = 272; continue; };
+{ gotoCase = 277; continue; };
 } else {
-if (yych <= '\\') { gotoCase = 273; continue; };
-if (yych <= ']') { gotoCase = 263; continue; };
-{ gotoCase = 271; continue; };
+if (yych <= '\\') { gotoCase = 278; continue; };
+if (yych <= ']') { gotoCase = 273; continue; };
+{ gotoCase = 272; continue; };
 }
 }
+case 271:
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 272:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 280; continue; };
 case 273:
 ++cursor;
-yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych != '\r') { gotoCase = 271; continue; };
 case 274:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 263; continue; };
-} else {
-{ gotoCase = 266; continue; };
-}
+{ this.tokenType = null; return cursor; }
 case 275:
 ++cursor;
 yych = this._charAt(cursor);
+{ gotoCase = 286; continue; };
 case 276:
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 274; continue; };
-if (yych <= ')') { gotoCase = 275; continue; };
-{ gotoCase = 274; continue; };
-}
-} else {
-if (yych <= '[') {
-if (yych == '/') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
-} else {
-if (yych <= '\\') { gotoCase = 281; continue; };
-if (yych <= ']') { gotoCase = 279; continue; };
-{ gotoCase = 275; continue; };
-}
-}
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-regexp"; return cursor; }
 case 277:
-++cursor;
-yych = this._charAt(cursor);
-case 278:
-if (yych <= 'h') {
-if (yych == 'g') { gotoCase = 277; continue; };
-{ gotoCase = 268; continue; };
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych <= '\f') { gotoCase = 284; continue; };
+{ gotoCase = 274; continue; };
 } else {
-if (yych <= 'i') { gotoCase = 277; continue; };
-if (yych == 'm') { gotoCase = 277; continue; };
-{ gotoCase = 268; continue; };
+if (yych <= '*') {
+if (yych <= ')') { gotoCase = 284; continue; };
+{ gotoCase = 274; continue; };
+} else {
+if (yych == '/') { gotoCase = 274; continue; };
+{ gotoCase = 284; continue; };
 }
+}
+case 278:
+yych = this._charAt(++cursor);
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych == '\r') { gotoCase = 274; continue; };
 case 279:
 yyaccept = 0;
 YYMARKER = ++cursor;
 yych = this._charAt(cursor);
-if (yych <= '*') {
-if (yych <= '\f') {
-if (yych == '\n') { gotoCase = 263; continue; };
-{ gotoCase = 279; continue; };
-} else {
-if (yych <= '\r') { gotoCase = 263; continue; };
-if (yych <= ')') { gotoCase = 279; continue; };
+case 280:
+if (yych <= '.') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 279; continue; };
 { gotoCase = 271; continue; };
+} else {
+if (yych == '\r') { gotoCase = 271; continue; };
+{ gotoCase = 279; continue; };
 }
 } else {
-if (yych <= 'Z') {
-if (yych == '/') { gotoCase = 277; continue; };
-{ gotoCase = 279; continue; };
+if (yych <= '[') {
+if (yych <= '/') { gotoCase = 285; continue; };
+if (yych <= 'Z') { gotoCase = 279; continue; };
+{ gotoCase = 283; continue; };
 } else {
-if (yych <= '[') { gotoCase = 275; continue; };
-if (yych <= '\\') { gotoCase = 282; continue; };
+if (yych <= '\\') { gotoCase = 281; continue; };
+if (yych <= ']') { gotoCase = 271; continue; };
 { gotoCase = 279; continue; };
 }
 }
 case 281:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych == '\r') { gotoCase = 274; continue; };
-{ gotoCase = 275; continue; };
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych != '\r') { gotoCase = 279; continue; };
 case 282:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 271; continue; };
+} else {
+{ gotoCase = 274; continue; };
+}
+case 283:
 ++cursor;
 yych = this._charAt(cursor);
-if (yych == '\n') { gotoCase = 274; continue; };
-if (yych == '\r') { gotoCase = 274; continue; };
+case 284:
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 282; continue; };
+if (yych <= ')') { gotoCase = 283; continue; };
+{ gotoCase = 282; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 289; continue; };
+if (yych <= ']') { gotoCase = 287; continue; };
+{ gotoCase = 283; continue; };
+}
+}
+case 285:
+++cursor;
+yych = this._charAt(cursor);
+case 286:
+if (yych <= 'h') {
+if (yych == 'g') { gotoCase = 285; continue; };
+{ gotoCase = 276; continue; };
+} else {
+if (yych <= 'i') { gotoCase = 285; continue; };
+if (yych == 'm') { gotoCase = 285; continue; };
+{ gotoCase = 276; continue; };
+}
+case 287:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 271; continue; };
+{ gotoCase = 287; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 271; continue; };
+if (yych <= ')') { gotoCase = 287; continue; };
 { gotoCase = 279; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 285; continue; };
+{ gotoCase = 287; continue; };
+} else {
+if (yych <= '[') { gotoCase = 283; continue; };
+if (yych <= '\\') { gotoCase = 290; continue; };
+{ gotoCase = 287; continue; };
+}
+}
+case 289:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych == '\r') { gotoCase = 282; continue; };
+{ gotoCase = 283; continue; };
+case 290:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 282; continue; };
+if (yych == '\r') { gotoCase = 282; continue; };
+{ gotoCase = 287; continue; };
 
 case this.case_SSTRING:
 yych = this._charAt(cursor);
 if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 287; continue; };
-if (yych <= '\f') { gotoCase = 286; continue; };
-{ gotoCase = 287; continue; };
+if (yych == '\n') { gotoCase = 295; continue; };
+if (yych <= '\f') { gotoCase = 294; continue; };
+{ gotoCase = 295; continue; };
 } else {
 if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 286; continue; };
-{ gotoCase = 289; continue; };
+if (yych <= '&') { gotoCase = 294; continue; };
+{ gotoCase = 297; continue; };
 } else {
-if (yych == '\\') { gotoCase = 291; continue; };
-{ gotoCase = 286; continue; };
+if (yych == '\\') { gotoCase = 299; continue; };
+{ gotoCase = 294; continue; };
 }
 }
-case 285:
+case 293:
 { this.tokenType = "javascript-string"; return cursor; }
-case 286:
+case 294:
 yyaccept = 0;
 yych = this._charAt(YYMARKER = ++cursor);
-{ gotoCase = 293; continue; };
-case 287:
+{ gotoCase = 301; continue; };
+case 295:
 ++cursor;
-case 288:
+case 296:
 { this.tokenType = null; return cursor; }
-case 289:
+case 297:
 ++cursor;
-case 290:
+case 298:
 this.setLexCondition(this._lexConditions.NODIV);
 { this.tokenType = "javascript-string"; return cursor; }
-case 291:
+case 299:
 yyaccept = 1;
 yych = this._charAt(YYMARKER = ++cursor);
 if (yych <= 'e') {
 if (yych <= '\'') {
-if (yych == '"') { gotoCase = 292; continue; };
-if (yych <= '&') { gotoCase = 288; continue; };
+if (yych == '"') { gotoCase = 300; continue; };
+if (yych <= '&') { gotoCase = 296; continue; };
 } else {
 if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 288; continue; };
+if (yych <= '[') { gotoCase = 296; continue; };
 } else {
-if (yych != 'b') { gotoCase = 288; continue; };
+if (yych != 'b') { gotoCase = 296; continue; };
 }
 }
 } else {
 if (yych <= 'r') {
 if (yych <= 'm') {
-if (yych >= 'g') { gotoCase = 288; continue; };
+if (yych >= 'g') { gotoCase = 296; continue; };
 } else {
-if (yych <= 'n') { gotoCase = 292; continue; };
-if (yych <= 'q') { gotoCase = 288; continue; };
+if (yych <= 'n') { gotoCase = 300; continue; };
+if (yych <= 'q') { gotoCase = 296; continue; };
 }
 } else {
 if (yych <= 't') {
-if (yych <= 's') { gotoCase = 288; continue; };
+if (yych <= 's') { gotoCase = 296; continue; };
 } else {
-if (yych <= 'u') { gotoCase = 294; continue; };
-if (yych >= 'w') { gotoCase = 288; continue; };
-}
-}
-}
-case 292:
-yyaccept = 0;
-YYMARKER = ++cursor;
-yych = this._charAt(cursor);
-case 293:
-if (yych <= '\r') {
-if (yych == '\n') { gotoCase = 285; continue; };
-if (yych <= '\f') { gotoCase = 292; continue; };
-{ gotoCase = 285; continue; };
-} else {
-if (yych <= '\'') {
-if (yych <= '&') { gotoCase = 292; continue; };
-{ gotoCase = 300; continue; };
-} else {
-if (yych == '\\') { gotoCase = 299; continue; };
-{ gotoCase = 292; continue; };
-}
-}
-case 294:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych <= '9') { gotoCase = 296; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 296; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych <= 'f') { gotoCase = 296; continue; };
-}
-case 295:
-cursor = YYMARKER;
-if (yyaccept <= 0) {
-{ gotoCase = 285; continue; };
-} else {
-{ gotoCase = 288; continue; };
-}
-case 296:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych >= ':') { gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 297; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych >= 'g') { gotoCase = 295; continue; };
-}
-case 297:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych >= ':') { gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 298; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych >= 'g') { gotoCase = 295; continue; };
-}
-case 298:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= '@') {
-if (yych <= '/') { gotoCase = 295; continue; };
-if (yych <= '9') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-} else {
-if (yych <= 'F') { gotoCase = 292; continue; };
-if (yych <= '`') { gotoCase = 295; continue; };
-if (yych <= 'f') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-}
-case 299:
-++cursor;
-yych = this._charAt(cursor);
-if (yych <= 'e') {
-if (yych <= '\'') {
-if (yych == '"') { gotoCase = 292; continue; };
-if (yych <= '&') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych <= '\\') {
-if (yych <= '[') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych == 'b') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-}
-}
-} else {
-if (yych <= 'r') {
-if (yych <= 'm') {
-if (yych <= 'f') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
-} else {
-if (yych <= 'n') { gotoCase = 292; continue; };
-if (yych <= 'q') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-}
-} else {
-if (yych <= 't') {
-if (yych <= 's') { gotoCase = 295; continue; };
-{ gotoCase = 292; continue; };
-} else {
-if (yych <= 'u') { gotoCase = 294; continue; };
-if (yych <= 'v') { gotoCase = 292; continue; };
-{ gotoCase = 295; continue; };
+if (yych <= 'u') { gotoCase = 302; continue; };
+if (yych >= 'w') { gotoCase = 296; continue; };
 }
 }
 }
 case 300:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 301:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 293; continue; };
+if (yych <= '\f') { gotoCase = 300; continue; };
+{ gotoCase = 293; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 300; continue; };
+{ gotoCase = 308; continue; };
+} else {
+if (yych == '\\') { gotoCase = 307; continue; };
+{ gotoCase = 300; continue; };
+}
+}
+case 302:
 ++cursor;
 yych = this._charAt(cursor);
-{ gotoCase = 290; continue; };
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych <= '9') { gotoCase = 304; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 304; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych <= 'f') { gotoCase = 304; continue; };
+}
+case 303:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 293; continue; };
+} else {
+{ gotoCase = 296; continue; };
+}
+case 304:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych >= ':') { gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 305; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych >= 'g') { gotoCase = 303; continue; };
+}
+case 305:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych >= ':') { gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 306; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych >= 'g') { gotoCase = 303; continue; };
+}
+case 306:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 303; continue; };
+if (yych <= '9') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 300; continue; };
+if (yych <= '`') { gotoCase = 303; continue; };
+if (yych <= 'f') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+case 307:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 300; continue; };
+if (yych <= '&') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych == 'b') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 300; continue; };
+if (yych <= 'q') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 303; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 302; continue; };
+if (yych <= 'v') { gotoCase = 300; continue; };
+{ gotoCase = 303; continue; };
+}
+}
+}
+case 308:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 298; continue; };
 }
 
 }
@@ -39680,103 +42512,59 @@
 {
 WebInspector.Object.call(this);
 
-this._originForFrameId = {};
-this._frameIdsForOrigin = {};
 this._fileSystemsForOrigin = {};
 
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
 
 FileSystemAgent.enable();
 
-if (WebInspector.resourceTreeModel.mainFrame)
-this._attachFrameRecursively(WebInspector.resourceTreeModel.mainFrame);
+this._reset();
 }
 
 WebInspector.FileSystemModel.prototype = {
-
-_frameAdded: function(event)
+_reset: function()
 {
-var frame =   (event.data);
-this._attachFrameRecursively(frame);
+for (var securityOrigin in this._fileSystemsForOrigin)
+this._removeOrigin(securityOrigin);
+var securityOrigins = WebInspector.resourceTreeModel.securityOrigins();
+for (var i = 0; i < securityOrigins.length; ++i)
+this._addOrigin(securityOrigins[i]);
 },
 
 
-_frameNavigated: function(event)
+_securityOriginAdded: function(event)
 {
-var frame =   (event.data);
-this._attachFrameRecursively(frame);
+var securityOrigin =   (event.data);
+this._addOrigin(securityOrigin);
 },
 
 
-_frameDetached: function(event)
+_securityOriginRemoved: function(event)
 {
-var frame =   (event.data);
-this._detachFrameRecursively(frame);
+var securityOrigin =   (event.data);
+this._removeOrigin(securityOrigin);
 },
 
 
-_attachFrame: function(frame)
+_addOrigin: function(securityOrigin)
 {
-if (this._originForFrameId[frame.id])
-this._detachFrameRecursively(frame);
-
-if (frame.securityOrigin === "null")
-return;
-
-this._originForFrameId[frame.id] = frame.securityOrigin;
-
-var newOrigin = false;
-if (!this._frameIdsForOrigin[frame.securityOrigin]) {
-this._frameIdsForOrigin[frame.securityOrigin] = {};
-newOrigin = true;
-}
-this._frameIdsForOrigin[frame.securityOrigin][frame.id] = frame.id;
-if (newOrigin)
-this._originAdded(frame.securityOrigin);
-},
-
-
-_attachFrameRecursively: function(frame)
-{
-this._attachFrame(frame);
-for (var i = 0; i < frame.childFrames.length; ++i)
-this._attachFrameRecursively(frame.childFrames[i]);
-},
-
-
-_detachFrame: function(frame)
-{
-if (!this._originForFrameId[frame.id])
-return;
-var origin = this._originForFrameId[frame.id];
-delete this._originForFrameId[frame.id];
-delete this._frameIdsForOrigin[origin][frame.id];
-
-var lastOrigin = Object.isEmpty(this._frameIdsForOrigin[origin]);
-if (lastOrigin) {
-delete this._frameIdsForOrigin[origin];
-this._originRemoved(origin);
-}
-},
-
-
-_detachFrameRecursively: function(frame)
-{
-for (var i = 0; i < frame.childFrames.length; ++i)
-this._detachFrameRecursively(frame.childFrames[i]);
-this._detachFrame(frame);
-},
-
-
-_originAdded: function(origin)
-{
-this._fileSystemsForOrigin[origin] = {};
+this._fileSystemsForOrigin[securityOrigin] = {};
 
 var types = ["persistent", "temporary"];
 for (var i = 0; i < types.length; ++i)
-this._requestFileSystemRoot(origin, types[i], this._fileSystemRootReceived.bind(this, origin, types[i], this._fileSystemsForOrigin[origin]));
+this._requestFileSystemRoot(securityOrigin, types[i], this._fileSystemRootReceived.bind(this, securityOrigin, types[i], this._fileSystemsForOrigin[securityOrigin]));
+},
+
+
+_removeOrigin: function(securityOrigin)
+{
+for (var type in this._fileSystemsForOrigin[securityOrigin]) {
+var fileSystem = this._fileSystemsForOrigin[securityOrigin][type];
+delete this._fileSystemsForOrigin[securityOrigin][type];
+this._fileSystemRemoved(fileSystem);
+}
+delete this._fileSystemsForOrigin[securityOrigin];
 },
 
 
@@ -39797,17 +42585,6 @@
 },
 
 
-_originRemoved: function(origin)
-{
-for (var type in this._fileSystemsForOrigin[origin]) {
-var fileSystem = this._fileSystemsForOrigin[origin][type];
-delete this._fileSystemsForOrigin[origin][type];
-this._fileSystemRemoved(fileSystem);
-}
-delete this._fileSystemsForOrigin[origin];
-},
-
-
 _fileSystemAdded: function(fileSystem)
 {
 this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemAdded, fileSystem);
@@ -39821,10 +42598,7 @@
 
 refreshFileSystemList: function()
 {
-if (WebInspector.resourceTreeModel.mainFrame) {
-this._detachFrameRecursively(WebInspector.resourceTreeModel.mainFrame);
-this._attachFrameRecursively(WebInspector.resourceTreeModel.mainFrame);
-}
+this._reset();
 },
 
 
@@ -40012,7 +42786,7 @@
 {
 if (x.isDirectory != y.isDirectory)
 return y.isDirectory ? 1 : -1;
-return x.name.localeCompare(y.name);
+return x.name.compareTo(y.name);
 }
 
 WebInspector.FileSystemModel.Entry.prototype = {
@@ -40335,6 +43109,7 @@
 WebInspector.createFileSelectorElement = function(callback) {
 var fileSelectorElement = document.createElement("input");
 fileSelectorElement.type = "file";
+fileSelectorElement.setAttribute("tabindex", -1);
 fileSelectorElement.style.zIndex = -1;
 fileSelectorElement.style.position = "absolute";
 fileSelectorElement.onchange = function(event) {
@@ -40447,7 +43222,6 @@
 WebInspector.settings.pauseOnExceptionStateString = WebInspector.settings.createSetting("pauseOnExceptionStateString", WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions);
 WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pauseOnExceptionStateChanged, this);
 
-if (!Capabilities.debuggerCausesRecompilation || WebInspector.settings.debuggerEnabled.get())
 this.enableDebugger();
 }
 
@@ -40945,6 +43719,12 @@
 },
 
 
+get id()
+{
+return this._payload.callFrameId;
+},
+
+
 get scopeChain()
 {
 return this._payload.scopeChain;
@@ -41057,12 +43837,32 @@
 }
 
 this._sourceMappingURL = sourceMappingURL;
+this._reverseMappingsBySourceURL = {};
 this._mappings = [];
 this._sources = {};
 this._sourceContentByURL = {};
 this._parseMappingPayload(payload);
 }
 
+
+WebInspector.SourceMap.load = function(sourceMapURL, compiledURL)
+{
+try {
+
+var response = InspectorFrontendHost.loadResourceSynchronously(sourceMapURL);
+if (!response)
+return null;
+if (response.slice(0, 3) === ")]}")
+response = response.substring(response.indexOf('\n'));
+var payload =   (JSON.parse(response));
+var baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourceMapURL;
+return new WebInspector.SourceMap(baseURL, payload);
+} catch(e) {
+console.error(e.message);
+return null;
+}
+}
+
 WebInspector.SourceMap.prototype = {
 
 sources: function()
@@ -41095,6 +43895,40 @@
 },
 
 
+findEntry: function(lineNumber, columnNumber)
+{
+var first = 0;
+var count = this._mappings.length;
+while (count > 1) {
+var step = count >> 1;
+var middle = first + step;
+var mapping = this._mappings[middle];
+if (lineNumber < mapping[0] || (lineNumber === mapping[0] && columnNumber < mapping[1]))
+count = step;
+else {
+first = middle;
+count -= step;
+}
+}
+var entry = this._mappings[first];
+if (!first && entry && (lineNumber < entry[0] || (lineNumber === entry[0] && columnNumber < entry[1])))
+return null;
+return entry;
+},
+
+
+findEntryReversed: function(sourceURL, lineNumber)
+{
+var mappings = this._reverseMappingsBySourceURL[sourceURL];
+for ( ; lineNumber < mappings.length; ++lineNumber) {
+var mapping = mappings[lineNumber];
+if (mapping)
+return mapping;
+}
+return this._mappings[0];
+},
+
+
 _parseMap: function(map, lineNumber, columnNumber)
 {
 var sourceIndex = 0;
@@ -41106,7 +43940,8 @@
 var originalToCanonicalURLMap = {};
 for (var i = 0; i < map.sources.length; ++i) {
 var originalSourceURL = map.sources[i];
-var url = this._canonicalizeURL((map.sourceRoot ? map.sourceRoot + "/" : "") + originalSourceURL, this._sourceMappingURL);
+var href = (map.sourceRoot ? map.sourceRoot + "/" : "") + originalSourceURL;
+var url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL, href) || href;
 originalToCanonicalURLMap[originalSourceURL] = url;
 sources.push(url);
 this._sources[url] = true;
@@ -41149,6 +43984,19 @@
 
 this._mappings.push([lineNumber, columnNumber, sourceURL, sourceLineNumber, sourceColumnNumber]);
 }
+
+for (var i = 0; i < this._mappings.length; ++i) {
+var mapping = this._mappings[i];
+var url = mapping[2];
+if (!url)
+continue;
+if (!this._reverseMappingsBySourceURL[url])
+this._reverseMappingsBySourceURL[url] = [];
+var reverseMappings = this._reverseMappingsBySourceURL[url];
+var sourceLine = mapping[3];
+if (!reverseMappings[sourceLine])
+reverseMappings[sourceLine] = [mapping[0], mapping[1]];
+}
 },
 
 
@@ -41175,22 +44023,6 @@
 return negative ? -result : result;
 },
 
-
-_canonicalizeURL: function(url, baseURL)
-{
-if (!url || !baseURL || url.asParsedURL() || url.substring(0, 5) === "data:")
-return url;
-
-var base = baseURL.asParsedURL();
-if (!base)
-return url;
-
-var baseHost = base.scheme + "://" + base.host + (base.port ? ":" + base.port : "");
-if (url[0] === "/")
-return baseHost + url;
-return baseHost + base.folderPathComponents + "/" + url;
-},
-
 _VLQ_BASE_SHIFT: 5,
 _VLQ_BASE_MASK: (1 << 5) - 1,
 _VLQ_CONTINUATION_MASK: 1 << 5
@@ -41224,138 +44056,6 @@
 }
 
 
-WebInspector.PositionBasedSourceMap = function(sourceMappingURL, payload)
-{
-this._reverseMappingsBySourceURL = {};
-WebInspector.SourceMap.call(this, sourceMappingURL, payload);
-}
-
-WebInspector.PositionBasedSourceMap.prototype = {
-
-findEntry: function(lineNumber, columnNumber)
-{
-var first = 0;
-var count = this._mappings.length;
-while (count > 1) {
-var step = count >> 1;
-var middle = first + step;
-var mapping = this._mappings[middle];
-if (lineNumber < mapping[0] || (lineNumber == mapping[0] && columnNumber < mapping[1]))
-count = step;
-else {
-first = middle;
-count -= step;
-}
-}
-return this._mappings[first];
-},
-
-
-findEntryReversed: function(sourceURL, lineNumber)
-{
-var mappings = this._reverseMappingsBySourceURL[sourceURL];
-for ( ; lineNumber < mappings.length; ++lineNumber) {
-var mapping = mappings[lineNumber];
-if (mapping)
-return mapping;
-}
-return this._mappings[0];
-},
-
-
-_parseMap: function(map, lineNumber, columnNumber)
-{
-WebInspector.SourceMap.prototype._parseMap.call(this, map, lineNumber, columnNumber);
-
-for (var i = 0; i < this._mappings.length; ++i) {
-var mapping = this._mappings[i];
-var url = mapping[2];
-if (!url)
-continue;
-if (!this._reverseMappingsBySourceURL[url])
-this._reverseMappingsBySourceURL[url] = [];
-var reverseMappings = this._reverseMappingsBySourceURL[url];
-var sourceLine = mapping[3];
-if (!reverseMappings[sourceLine])
-reverseMappings[sourceLine] = [mapping[0], mapping[1]];
-}
-},
-
-__proto__: WebInspector.SourceMap.prototype
-}
-
-
-WebInspector.RangeBasedSourceMap = function(sourceMappingURL, payload)
-{
-WebInspector.SourceMap.call(this, sourceMappingURL, payload);
-
-
-function callback(value)
-{
-return !!value[2];
-}
-this._mappings = this._mappings.filter(callback);
-}
-
-WebInspector.RangeBasedSourceMap.MappingComparator = function(a, b)
-{
-if (a[0] !== b[0])
-return a[0] - b[0];
-return a[1] - b[1];
-}
-
-WebInspector.RangeBasedSourceMap.prototype = {
-
-findSourceRange: function(lineNumber, columnNumber)
-{
-var comparator = WebInspector.RangeBasedSourceMap.MappingComparator;
-var lookupEntry = [lineNumber, columnNumber];
-var index = binarySearch(lookupEntry, this._mappings, comparator);
-if (index >= 0) {
-if (index % 2) {
-
-if (index + 1 >= this._mappings.length || comparator(lookupEntry, this._mappings[index + 1]))
-return null;
-return this._rangeForStartIndex(index + 1);
-}
-
-return this._rangeForStartIndex(index);
-}
-
-index = -(index + 1);
-if ((index % 2) && comparator(lookupEntry, this._mappings[index - 1]) >= 0 && comparator(lookupEntry, this._mappings[index]) <= 0)
-return this._rangeForStartIndex(index - 1);
-
-return null;
-},
-
-
-_rangeForStartIndex: function(index)
-{
-var startEntry = this._mappings[index];
-var endEntry = this._mappings[index + 1];
-if (startEntry[2] !== endEntry[2]) {
-console.error("Mismatched source URLs in adjacent range-based sourcemap entries: %s vs %s", JSON.stringify(startEntry), JSON.stringify(endEntry));
-return null;
-}
-
-return new WebInspector.RangeBasedSourceMap.SourceRange(startEntry[2], startEntry[3], startEntry[4], endEntry[3], endEntry[4]);
-},
-
-__proto__: WebInspector.SourceMap.prototype
-}
-
-
-WebInspector.RangeBasedSourceMap.SourceRange = function(url, startLine, startColumn, endLine, endColumn)
-{
-this.url = url;
-this.startLine = startLine;
-this.endLine = endLine;
-this.startColumn = startColumn;
-this.endColumn = endColumn;
-}
-
-
 
 
 
@@ -41369,7 +44069,10 @@
 rawLocationToUILocation: function(rawLocation) { },
 
 
-uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { }
+uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { },
+
+
+isIdentity: function() { }
 }
 
 
@@ -41397,7 +44100,7 @@
 this.isContentScript = isContentScript;
 this.sourceMapURL = sourceMapURL;
 this.hasSourceURL = hasSourceURL;
-this._locations = [];
+this._locations = new Set();
 this._sourceMappings = [];
 }
 
@@ -41518,60 +44221,14 @@
 
 rawLocationToUILocation: function(lineNumber, columnNumber)
 {
-var sourceMappings = this._enabledSourceMappings();
 var uiLocation;
 var rawLocation = new WebInspector.DebuggerModel.Location(this.scriptId, lineNumber, columnNumber || 0);
-for (var i = sourceMappings.length - 1; !uiLocation && i >= 0; --i)
-uiLocation = sourceMappings[i].rawLocationToUILocation(rawLocation);
+for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i)
+uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLocation);
 console.assert(uiLocation, "Script raw location can not be mapped to any ui location.");
 return uiLocation.uiSourceCode.overrideLocation(uiLocation);
 },
 
-_enabledSourceMappings: function()
-{
-function filter(sourceMapping)
-{
-return !this._disabledSourceMappings.get(sourceMapping);
-}
-
-var sourceMappings = this._disabledSourceMappings ? this._sourceMappings.filter(filter.bind(this)) : this._sourceMappings.slice();
-console.assert(sourceMappings.length, "Script does not have any source mapping.");
-return sourceMappings;
-},
-
-
-_sourceMappingsDiffer: function(oldSourceMappings, newSourceMappings)
-{
-if (oldSourceMappings.length !== newSourceMappings.length)
-return true;
-for (var i = 0; i < newSourceMappings.length; ++i) {
-if (oldSourceMappings[i] !== newSourceMappings[i])
-return true;
-}
-return false;
-},
-
-
-disableSourceMapping: function(sourceMapping)
-{
-var oldSourceMappings = this._enabledSourceMappings();
-this._disabledSourceMappings = this._disabledSourceMappings || new Map();
-this._disabledSourceMappings.put(sourceMapping, true);
-if (this._sourceMappingsDiffer(oldSourceMappings,this._enabledSourceMappings()))
-this.updateLocations();
-},
-
-
-enableSourceMapping: function(sourceMapping)
-{
-var oldSourceMappings = this._enabledSourceMappings();
-this._disabledSourceMappings.remove(sourceMapping);
-if (!this._disabledSourceMappings.size())
-delete this._disabledSourceMappings;
-if (this._sourceMappingsDiffer(oldSourceMappings,this._enabledSourceMappings()))
-this.updateLocations();
-},
-
 
 pushSourceMapping: function(sourceMapping)
 {
@@ -41587,8 +44244,9 @@
 
 updateLocations: function()
 {
-for (var i = 0; i < this._locations.length; ++i)
-this._locations[i].update();
+var items = this._locations.items();
+for (var i = 0; i < items.length; ++i)
+items[i].update();
 },
 
 
@@ -41596,7 +44254,7 @@
 {
 console.assert(rawLocation.scriptId === this.scriptId);
 var location = new WebInspector.Script.Location(this, rawLocation, updateDelegate);
-this._locations.push(location);
+this._locations.add(location);
 location.update();
 return location;
 },
@@ -41693,7 +44351,7 @@
 _updateAnchor: function(anchor, uiLocation)
 {
 anchor.preferredPanel = "scripts";
-anchor.href = sanitizeHref(uiLocation.uiSourceCode.url);
+anchor.href = sanitizeHref(uiLocation.uiSourceCode.originURL());
 anchor.uiSourceCode = uiLocation.uiSourceCode;
 anchor.lineNumber = uiLocation.lineNumber;
 this._formatter.formatLiveAnchor(anchor, uiLocation);
@@ -41710,12 +44368,12 @@
 
 formatLiveAnchor: function(anchor, uiLocation)
 {
-var text = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);
+var text = uiLocation.linkText();
 if (this._maxLength)
 text = text.trimMiddle(this._maxLength);
 anchor.textContent = text;
 
-var titleText = uiLocation.uiSourceCode.url;
+var titleText = uiLocation.uiSourceCode.originURL();
 if (typeof uiLocation.lineNumber === "number")
 titleText += ":" + (uiLocation.lineNumber + 1);
 anchor.title = titleText;
@@ -41750,9 +44408,9 @@
 
 
 
-WebInspector.DebuggerScriptMapping = function(workspace, debuggerWorkspaceProvider, networkWorkspaceProvider)
+WebInspector.DebuggerScriptMapping = function(workspace, networkWorkspaceProvider)
 {
-this._defaultMapping = new WebInspector.DefaultScriptMapping(workspace, debuggerWorkspaceProvider);
+this._defaultMapping = new WebInspector.DefaultScriptMapping(workspace);
 this._resourceMapping = new WebInspector.ResourceScriptMapping(workspace);
 this._compilerMapping = new WebInspector.CompilerScriptMapping(workspace, networkWorkspaceProvider);
 this._snippetMapping = WebInspector.scriptSnippetModel.scriptMapping;
@@ -41775,12 +44433,10 @@
 
 this._resourceMapping.addScript(script);
 
-if (WebInspector.settings.sourceMapsEnabled.get() && script.sourceMapURL) {
-if (this._compilerMapping.loadSourceMapForScript(script))
+if (WebInspector.settings.sourceMapsEnabled.get())
 this._compilerMapping.addScript(script);
 }
 }
-}
 
 
 
@@ -41910,92 +44566,763 @@
 
 
 
-WebInspector.ContentProviderWorkspaceProvider = function()
+WebInspector.FileSystemProjectDelegate = function(isolatedFileSystem, workspace)
 {
-
-this._contentProviders = {};
+this._fileSystem = isolatedFileSystem;
+this._workspace = workspace;
 }
 
+WebInspector.FileSystemProjectDelegate._scriptExtensions = ["js", "java", "cc", "cpp", "h", "cs", "py", "php"].keySet();
 
-WebInspector.ContentProviderWorkspaceProvider.uriForURL = function(url)
+WebInspector.FileSystemProjectDelegate.projectId = function(fileSystemPath)
 {
-var uri = url;
-return uri;
-},
+return "filesystem:" + fileSystemPath;
+}
 
-WebInspector.ContentProviderWorkspaceProvider.prototype = {
+WebInspector.FileSystemProjectDelegate.prototype = {
 
-requestFileContent: function(uri, callback)
+id: function()
 {
-var contentProvider = this._contentProviders[uri];
-contentProvider.requestContent(callback);
+return WebInspector.FileSystemProjectDelegate.projectId(this._fileSystem.path());
 },
 
 
-setFileContent: function(uri, newContent, callback)
+type: function()
 {
-callback(null);
+return WebInspector.projectTypes.FileSystem;
 },
 
 
-searchInFileContent: function(uri, query, caseSensitive, isRegex, callback)
+fileSystemPath: function()
 {
-var contentProvider = this._contentProviders[uri];
-contentProvider.searchInContent(query, caseSensitive, isRegex, callback);
+return this._fileSystem.path();
 },
 
 
-addFile: function(uri, url, contentProvider, isEditable, isContentScript, isSnippet)
+displayName: function()
 {
-console.assert(!this._contentProviders[uri]);
-var fileDescriptor = new WebInspector.FileDescriptor(uri, url, contentProvider.contentType(), isEditable, isContentScript, isSnippet);
-this._contentProviders[uri] = contentProvider;
-this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.FileAdded, fileDescriptor);
+return this._fileSystem.path().substr(this._fileSystem.path().lastIndexOf("/") + 1);
 },
 
 
-removeFile: function(uri)
+_filePathForPath: function(path)
 {
-delete this._contentProviders[uri];
-this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.FileRemoved, uri);
+return "/" + path.join("/");
 },
 
 
-uniqueURI: function(uri)
+requestFileContent: function(path, callback)
 {
-var uniqueURI = uri;
-for (var i = 1; this._contentProviders[uniqueURI]; ++i)
-uniqueURI = uri + " (" + i + ")";
-return uniqueURI;
+var filePath = this._filePathForPath(path);
+this._fileSystem.requestFileContent(filePath, innerCallback.bind(this));
+
+
+function innerCallback(content)
+{
+var contentType = this._contentTypeForPath(path);
+callback(content, false, contentType.canonicalMimeType());
+}
+},
+
+
+canSetFileContent: function()
+{
+return true;
+},
+
+
+setFileContent: function(path, newContent, callback)
+{
+var filePath = this._filePathForPath(path);
+this._fileSystem.setFileContent(filePath, newContent, callback.bind(this, ""));
+},
+
+
+searchInFileContent: function(path, query, caseSensitive, isRegex, callback)
+{
+var filePath = this._filePathForPath(path);
+this._fileSystem.requestFileContent(filePath, contentCallback.bind(this));
+
+
+function contentCallback(content)
+{
+var result = [];
+if (content !== null)
+result = WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex);
+callback(result);
+}
+},
+
+
+_contentTypeForPath: function(path)
+{
+var fileName = path[path.length - 1];
+var extensionIndex = fileName.lastIndexOf(".");
+var extension = "";
+if (extensionIndex !== -1)
+extension = fileName.substring(extensionIndex + 1);
+var contentType = WebInspector.resourceTypes.Other;
+if (WebInspector.FileSystemProjectDelegate._scriptExtensions[extension])
+return WebInspector.resourceTypes.Script;
+if (extension === "css")
+return WebInspector.resourceTypes.Stylesheet;
+if (extension === "html")
+return WebInspector.resourceTypes.Document;
+return WebInspector.resourceTypes.Other;
+},
+
+populate: function()
+{
+this._fileSystem.requestFilesRecursive("", fileLoaded.bind(this));
+
+function fileLoaded(filePath)
+{
+var path = filePath.split("/");
+path.shift();
+console.assert(path.length);
+var fullPath = this._fileSystem.path() + filePath;
+var url = this._workspace.urlForPath(fullPath);
+var contentType = this._contentTypeForPath(path);
+var fileDescriptor = new WebInspector.FileDescriptor(path, "file://" + fullPath, url, contentType, true);
+this._addFile(fileDescriptor);
+}
+},
+
+
+_addFile: function(fileDescriptor)
+{
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded, fileDescriptor);
+},
+
+
+_removeFile: function(path)
+{
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved, path);
 },
 
 reset: function()
 {
-this._contentProviders = {};
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset, null);
 },
 
 __proto__: WebInspector.Object.prototype
 }
 
 
-WebInspector.NetworkWorkspaceProvider = function()
+WebInspector.fileSystemProjectDelegate = null;
+
+
+WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemManager, workspace)
 {
-WebInspector.ContentProviderWorkspaceProvider.call(this);
+this._isolatedFileSystemManager = isolatedFileSystemManager;
+this._workspace = workspace;
+this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
+this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
+this._simpleProjectDelegates = {};
 }
 
-WebInspector.NetworkWorkspaceProvider.prototype = {
+WebInspector.FileSystemWorkspaceProvider.prototype = {
 
-addNetworkFile: function(url, contentProvider, isEditable, isContentScript, isSnippet)
+_fileSystemAdded: function(event)
 {
-var uri = WebInspector.ContentProviderWorkspaceProvider.uriForURL(url);
-this.addFile(uri, url, contentProvider, isEditable, isContentScript, isSnippet);
+var fileSystem =   (event.data);
+var projectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());
+var projectDelegate = new WebInspector.FileSystemProjectDelegate(fileSystem, this._workspace)
+this._simpleProjectDelegates[projectDelegate.id()] = projectDelegate;
+console.assert(!this._workspace.project(projectDelegate.id()));
+this._workspace.addProject(projectDelegate);
+projectDelegate.populate();
 },
 
-__proto__: WebInspector.ContentProviderWorkspaceProvider.prototype
+
+_fileSystemRemoved: function(event)
+{
+var fileSystem =   (event.data);
+var projectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());
+this._workspace.removeProject(projectId);
+delete this._simpleProjectDelegates[projectId];
+},
+
+
+fileSystemPath: function(uiSourceCode)
+{
+var projectDelegate = this._simpleProjectDelegates[uiSourceCode.project().id()];
+return projectDelegate.fileSystemPath();
+}
 }
 
 
-WebInspector.networkWorkspaceProvider = null;
+WebInspector.fileSystemWorkspaceProvider = null;
+
+
+
+
+
+
+WebInspector.FileSystemMapping = function() { }
+
+WebInspector.FileSystemMapping.prototype = {
+
+fileSystemPaths: function() { },
+
+
+fileSystemPathForPrefix: function(prefix) { }
+}
+
+
+WebInspector.FileSystemMappingImpl = function()
+{
+WebInspector.Object.call(this);
+this._fileSystemMappingSetting = WebInspector.settings.createSetting("fileSystemMapping", {});
+
+this._fileSystemPaths = {};
+this._loadFromSettings();
+}
+
+WebInspector.FileSystemMappingImpl.prototype = {
+_loadFromSettings: function()
+{
+var savedMapping = this._fileSystemMappingSetting.get();
+this._fileSystemPaths = savedMapping ?   (savedMapping.registeredFileSystemPaths) || {} : {};
+},
+
+_saveToSettings: function()
+{
+var savedMapping = {};
+savedMapping.registeredFileSystemPaths = this._fileSystemPaths;
+this._fileSystemMappingSetting.set(savedMapping);
+},
+
+
+
+addFileSystemMapping: function(fileSystemPath)
+{
+if (this._fileSystemPaths[fileSystemPath])
+return;
+
+this._fileSystemPaths[fileSystemPath] = true;
+this._saveToSettings();
+delete this._cachedFileSystemPaths;
+},
+
+
+removeFileSystemMapping: function(fileSystemPath)
+{
+if (!this._fileSystemPaths[fileSystemPath])
+return;
+delete this._fileSystemPaths[fileSystemPath];
+this._saveToSettings();
+delete this._cachedFileSystemPaths;
+},
+
+
+fileSystemPaths: function()
+{
+return Object.keys(this._fileSystemPaths);
+},
+
+
+fileSystemPathForPrefix: function(prefix)
+{
+this._cachedFileSystemPaths = this._cachedFileSystemPaths || {};
+if (this._cachedFileSystemPaths.hasOwnProperty(prefix))
+return this._cachedFileSystemPaths[prefix];
+var result = null;
+for (var fileSystemPath in this._fileSystemPaths) {
+if (prefix.startsWith(fileSystemPath + "/")) {
+result = fileSystemPath;
+break;
+}
+}
+this._cachedFileSystemPaths[prefix] = result;
+return result;
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+
+
+
+
+WebInspector.IsolatedFileSystem = function(manager, path, name, rootURL)
+{
+this._manager = manager;
+this._path = path;
+this._name = name;
+this._rootURL = rootURL;
+}
+
+WebInspector.IsolatedFileSystem.errorMessage = function(error)
+{
+var msg;
+switch (error.code) {
+case FileError.QUOTA_EXCEEDED_ERR:
+msg = "QUOTA_EXCEEDED_ERR";
+break;
+case FileError.NOT_FOUND_ERR:
+msg = "NOT_FOUND_ERR";
+break;
+case FileError.SECURITY_ERR:
+msg = "SECURITY_ERR";
+break;
+case FileError.INVALID_MODIFICATION_ERR:
+msg = "INVALID_MODIFICATION_ERR";
+break;
+case FileError.INVALID_STATE_ERR:
+msg = "INVALID_STATE_ERR";
+break;
+default:
+msg = "Unknown Error";
+break;
+};
+
+return "File system error: " + msg;
+}
+
+WebInspector.IsolatedFileSystem.prototype = {
+
+path: function()
+{
+return this._path;
+},
+
+
+name: function()
+{
+return this._name;
+},
+
+
+rootURL: function()
+{
+return this._rootURL;
+},
+
+
+_requestFileSystem: function(callback)
+{
+this._manager.requestDOMFileSystem(this._path, callback);
+},
+
+
+requestFilesRecursive: function(path, callback)
+{
+this._requestFileSystem(fileSystemLoaded.bind(this));
+
+var domFileSystem;
+
+function fileSystemLoaded(fs)
+{
+domFileSystem = fs;
+this._requestEntries(domFileSystem, path, innerCallback.bind(this));
+}
+
+
+function innerCallback(entries)
+{
+for (var i = 0; i < entries.length; ++i) {
+var entry = entries[i];
+if (!entry.isDirectory)
+callback(entry.fullPath);
+else
+this._requestEntries(domFileSystem, entry.fullPath, innerCallback.bind(this));
+}
+}
+},
+
+
+requestFileContent: function(path, callback)
+{
+this._requestFileSystem(fileSystemLoaded.bind(this));
+
+
+function fileSystemLoaded(domFileSystem)
+{
+domFileSystem.root.getFile(path, null, fileEntryLoaded, errorHandler);
+}
+
+
+function fileEntryLoaded(entry)
+{
+entry.file(fileLoaded, errorHandler);
+}
+
+
+function fileLoaded(file)
+{
+var reader = new FileReader();
+reader.onloadend = readerLoadEnd;
+reader.readAsText(file);
+}
+
+
+function readerLoadEnd()
+{
+callback(  (this.result));
+}
+
+function errorHandler(error)
+{
+if (error.code === FileError.NOT_FOUND_ERR) {
+callback(null);
+return;
+}
+
+var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(error);
+console.error(errorMessage + " when getting content for file '" + (this._path + "/" + path) + "'");
+callback(null);
+}
+},
+
+
+setFileContent: function(path, content, callback)
+{
+this._requestFileSystem(fileSystemLoaded);
+
+
+function fileSystemLoaded(domFileSystem)
+{
+domFileSystem.root.getFile(path, { create: true }, fileEntryLoaded, errorHandler);
+}
+
+
+function fileEntryLoaded(entry)
+{
+entry.createWriter(fileWriterCreated, errorHandler);
+}
+
+
+function fileWriterCreated(fileWriter)
+{
+fileWriter.onerror = errorHandler;
+fileWriter.onwriteend = fileTruncated;
+fileWriter.truncate(0);
+
+function fileTruncated()
+{
+fileWriter.onwriteend = writerEnd;
+var blob = new Blob([content], { type: "text/plain" });
+fileWriter.write(blob);
+}
+}
+
+function writerEnd()
+{
+callback();
+}
+
+function errorHandler(error)
+{
+var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(error);
+console.error(errorMessage + " when setting content for file '" + (this._path + "/" + path) + "'");
+callback();
+}
+},
+
+
+_readDirectory: function(dirEntry, callback)
+{
+var dirReader = dirEntry.createReader();
+var entries = [];
+
+function innerCallback(results)
+{
+if (!results.length)
+callback(entries.sort());
+else {
+entries = entries.concat(toArray(results));
+dirReader.readEntries(innerCallback, errorHandler);
+}
+}
+
+function toArray(list)
+{
+return Array.prototype.slice.call(list || [], 0);
+}    
+
+dirReader.readEntries(innerCallback, errorHandler);
+
+function errorHandler(error)
+{
+var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(error);
+console.error(errorMessage + " when reading directory '" + dirEntry.fullPath + "'");
+callback([]);
+}
+},
+
+
+_requestEntries: function(domFileSystem, path, callback)
+{
+domFileSystem.root.getDirectory(path, null, innerCallback.bind(this), errorHandler);
+
+function innerCallback(dirEntry)
+{
+this._readDirectory(dirEntry, callback)
+}
+
+function errorHandler(error)
+{
+var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(error);
+console.error(errorMessage + " when requesting entry '" + path + "'");
+callback([]);
+}
+}
+}
+
+
+
+
+
+
+WebInspector.IsolatedFileSystemManager = function()
+{
+
+this._fileSystems = {};
+
+this._pendingFileSystemRequests = {};
+this._fileSystemMapping = new WebInspector.FileSystemMappingImpl();
+
+if (this.supportsFileSystems())
+this._requestFileSystems();
+}
+
+
+WebInspector.IsolatedFileSystemManager.FileSystem;
+
+WebInspector.IsolatedFileSystemManager.Events = {
+FileSystemAdded: "FileSystemAdded",
+FileSystemRemoved: "FileSystemRemoved"
+}
+
+WebInspector.IsolatedFileSystemManager.prototype = {
+
+mapping: function()
+{
+return this._fileSystemMapping;
+},
+
+
+supportsFileSystems: function()
+{
+return InspectorFrontendHost.supportsFileSystems();
+},
+
+_requestFileSystems: function()
+{
+console.assert(!this._loaded);
+InspectorFrontendHost.requestFileSystems();
+},
+
+
+addFileSystem: function(callback)
+{
+this._selectFileSystemPathCallback = callback;
+InspectorFrontendHost.addFileSystem();
+},
+
+
+removeFileSystem: function(fileSystemPath, callback)
+{
+this._removeFileSystemCallback = callback;
+InspectorFrontendHost.removeFileSystem(fileSystemPath);
+},
+
+
+_fileSystemsLoaded: function(fileSystems)
+{
+for (var i = 0; i < fileSystems.length; ++i)
+this._innerAddFileSystem(fileSystems[i]);
+this._loaded = true;
+this._processPendingFileSystemRequests();
+},
+
+
+_innerAddFileSystem: function(fileSystem)
+{
+var fileSystemPath = fileSystem.fileSystemPath;
+this._fileSystemMapping.addFileSystemMapping(fileSystemPath);
+var isolatedFileSystem = new WebInspector.IsolatedFileSystem(this, fileSystemPath, fileSystem.fileSystemName, fileSystem.rootURL);
+this._fileSystems[fileSystemPath] = isolatedFileSystem;
+this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, isolatedFileSystem);
+},
+
+
+_fileSystemPaths: function()
+{
+return Object.keys(this._fileSystems);
+},
+
+_processPendingFileSystemRequests: function()
+{
+for (var fileSystemPath in this._pendingFileSystemRequests) {
+var callbacks = this._pendingFileSystemRequests[fileSystemPath];
+for (var i = 0; i < callbacks.length; ++i)
+callbacks[i](this._isolatedFileSystem(fileSystemPath));
+}
+delete this._pendingFileSystemRequests;
+},
+
+
+_fileSystemAdded: function(errorMessage, fileSystem)
+{
+var fileSystemPath;
+if (errorMessage)
+WebInspector.showErrorMessage(errorMessage)
+else if (fileSystem) {
+this._innerAddFileSystem(fileSystem);
+fileSystemPath = fileSystem.fileSystemPath;
+}
+
+if (this._selectFileSystemPathCallback) {
+this._selectFileSystemPathCallback(fileSystemPath);
+delete this._selectFileSystemPathCallback;
+}
+},
+
+
+_fileSystemRemoved: function(fileSystemPath)
+{
+this._fileSystemMapping.removeFileSystemMapping(fileSystemPath);
+var isolatedFileSystem = this._fileSystems[fileSystemPath];
+delete this._fileSystems[fileSystemPath];
+if (this._removeFileSystemCallback) {
+this._removeFileSystemCallback(fileSystemPath);
+delete this._removeFileSystemCallback;
+}
+this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, isolatedFileSystem);
+},
+
+
+_isolatedFileSystem: function(fileSystemPath)
+{
+var fileSystem = this._fileSystems[fileSystemPath];
+if (!fileSystem)
+return null;
+if (!InspectorFrontendHost.isolatedFileSystem)
+return null;
+return InspectorFrontendHost.isolatedFileSystem(fileSystem.name(), fileSystem.rootURL());
+},
+
+
+requestDOMFileSystem: function(fileSystemPath, callback)
+{
+if (!this._loaded) {
+if (!this._pendingFileSystemRequests[fileSystemPath])
+this._pendingFileSystemRequests[fileSystemPath] = this._pendingFileSystemRequests[fileSystemPath] || [];
+this._pendingFileSystemRequests[fileSystemPath].push(callback);
+return;
+}
+callback(this._isolatedFileSystem(fileSystemPath));
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+WebInspector.isolatedFileSystemManager = null;
+
+
+WebInspector.IsolatedFileSystemDispatcher = function(IsolatedFileSystemManager)
+{
+this._IsolatedFileSystemManager = IsolatedFileSystemManager;
+}
+
+WebInspector.IsolatedFileSystemDispatcher.prototype = {
+
+fileSystemsLoaded: function(fileSystems)
+{
+this._IsolatedFileSystemManager._fileSystemsLoaded(fileSystems);
+},
+
+
+fileSystemRemoved: function(fileSystemPath)
+{
+this._IsolatedFileSystemManager._fileSystemRemoved(fileSystemPath);
+},
+
+
+fileSystemAdded: function(errorMessage, fileSystem)
+{
+this._IsolatedFileSystemManager._fileSystemAdded(errorMessage, fileSystem);
+}
+}
+
+
+WebInspector.isolatedFileSystemDispatcher = null;
+
+
+
+
+
+
+WebInspector.FileMapping = function()
+{
+this._mappingEntriesSetting = WebInspector.settings.createSetting("fileMappingEntries", []);
+
+this._entries = [];
+this._loadFromSettings();
+}
+
+WebInspector.FileMapping.prototype = {
+
+mappingEntryForURL: function(url)
+{
+for (var i = 0; i < this._entries.length; ++i) {
+var entry = this._entries[i];
+if (url.startsWith(entry.urlPrefix))
+return entry;
+}
+return null;
+},
+
+
+mappingEntryForPath: function(path)
+{
+for (var i = 0; i < this._entries.length; ++i) {
+var entry = this._entries[i];
+if (path.startsWith(entry.pathPrefix))
+return entry;
+}
+return null;
+},
+
+
+mappingEntries: function()
+{
+return this._entries.slice();
+},
+
+
+setMappingEntries: function(mappingEntries)
+{
+this._entries = mappingEntries;
+this._mappingEntriesSetting.set(mappingEntries);
+},
+
+_loadFromSettings: function()
+{
+var savedEntries = this._mappingEntriesSetting.get();
+this._entries = [];
+for (var i = 0; i < savedEntries.length; ++i) {
+var entry = new WebInspector.FileMapping.Entry(savedEntries[i].urlPrefix, savedEntries[i].pathPrefix);
+this._entries.push(entry);
+}
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+WebInspector.FileMapping.Entry = function(urlPrefix, pathPrefix)
+{
+this.urlPrefix = urlPrefix;
+this.pathPrefix = pathPrefix;
+}
+
+
+WebInspector.fileMapping = null;
 
 
 
@@ -42005,255 +45332,366 @@
 WebInspector.WorkspaceController = function(workspace)
 {
 this._workspace = workspace;
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
-WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
 }
 
 WebInspector.WorkspaceController.prototype = {
-_mainFrameNavigated: function()
-{
-WebInspector.Revision.filterOutStaleRevisions();
-this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset, this._workspace.project());
-this._workspace.project().reset();
-this._workspace.reset();
-this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectDidReset, this._workspace.project());
-},
 
-_frameAdded: function(event)
+_inspectedURLChanged: function(event)
 {
-var frame =   (event.data);
-if (frame.isMainFrame())
 WebInspector.Revision.filterOutStaleRevisions();
 }
 }
 
 
-WebInspector.FileDescriptor = function(uri, url, contentType, isEditable, isContentScript, isSnippet)
+WebInspector.FileDescriptor = function(path, originURL, url, contentType, isEditable, isContentScript)
 {
-this.uri = uri;
+this.path = path;
+this.originURL = originURL;
 this.url = url;
 this.contentType = contentType;
 this.isEditable = isEditable;
 this.isContentScript = isContentScript || false;
-this.isSnippet = isSnippet || false;
 }
 
 
-WebInspector.WorkspaceProvider = function() { }
+WebInspector.ProjectDelegate = function() { }
 
-WebInspector.WorkspaceProvider.Events = {
+WebInspector.ProjectDelegate.Events = {
 FileAdded: "FileAdded",
-FileRemoved: "FileRemoved"
+FileRemoved: "FileRemoved",
+Reset: "Reset",
 }
 
-WebInspector.WorkspaceProvider.prototype = {
+WebInspector.ProjectDelegate.prototype = {
 
-requestFileContent: function(uri, callback) { },
+id: function() { },
 
 
-setFileContent: function(uri, newContent, callback) { },
+type: function() { },
 
 
-searchInFileContent: function(uri, query, caseSensitive, isRegex, callback) { },
+displayName: function() { }, 
 
 
-addEventListener: function(eventType, listener, thisObject) { },
+requestFileContent: function(path, callback) { },
 
 
-removeEventListener: function(eventType, listener, thisObject) { }
+canSetFileContent: function() { },
+
+
+setFileContent: function(path, newContent, callback) { },
+
+
+searchInFileContent: function(path, query, caseSensitive, isRegex, callback) { }
 }
 
 
 WebInspector.workspaceController = null;
 
 
-WebInspector.Project = function(workspace, workspaceProvider)
+WebInspector.Project = function(workspace, projectDelegate)
 {
-this._uiSourceCodes = [];
+
+this._uiSourceCodes = {};
 this._workspace = workspace;
-this._workspaceProvider = workspaceProvider;
-this._workspaceProvider.addEventListener(WebInspector.WorkspaceProvider.Events.FileAdded, this._fileAdded, this);
-this._workspaceProvider.addEventListener(WebInspector.WorkspaceProvider.Events.FileRemoved, this._fileRemoved, this);
+this._projectDelegate = projectDelegate;
+this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded, this._fileAdded, this);
+this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved, this._fileRemoved, this);
+this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.Reset, this._reset, this);
 }
 
 WebInspector.Project.prototype = {
-reset: function()
+
+id: function()
 {
-this._workspaceProvider.reset();
-this._uiSourceCodes = [];
+return this._projectDelegate.id();
+},
+
+
+type: function()
+{
+return this._projectDelegate.type(); 
+},
+
+
+displayName: function() 
+{
+return this._projectDelegate.displayName(); 
+},
+
+
+isServiceProject: function()
+{
+return this._projectDelegate.type() === WebInspector.projectTypes.Debugger || this._projectDelegate.type() === WebInspector.projectTypes.LiveEdit;
 },
 
 _fileAdded: function(event)
 {
 var fileDescriptor =   (event.data);
-var uiSourceCode = this.uiSourceCodeForURI(fileDescriptor.uri);
+var uiSourceCode = this.uiSourceCode(fileDescriptor.path);
 if (uiSourceCode) {
 
 return;
 }
-uiSourceCode = new WebInspector.UISourceCode(this._workspace, fileDescriptor.uri, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable);
+
+uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.path, fileDescriptor.originURL, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable); 
 uiSourceCode.isContentScript = fileDescriptor.isContentScript;
-uiSourceCode.isSnippet = fileDescriptor.isSnippet;
-this._uiSourceCodes.push(uiSourceCode);
+this._uiSourceCodes[uiSourceCode.path().join("/")] = uiSourceCode;
 this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
 },
 
 _fileRemoved: function(event)
 {
-var uri =   (event.data);
-var uiSourceCode = this.uiSourceCodeForURI(uri);
+var path =   (event.data);
+var uiSourceCode = this.uiSourceCode(path);
 if (!uiSourceCode)
 return;
-this._uiSourceCodes.splice(this._uiSourceCodes.indexOf(uiSourceCode), 1);
+delete this._uiSourceCodes[uiSourceCode.path().join("/")];
 this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, uiSourceCode);
 },
 
-
-uiSourceCodeForURL: function(url)
+_reset: function()
 {
-for (var i = 0; i < this._uiSourceCodes.length; ++i) {
-if (this._uiSourceCodes[i].url === url)
-return this._uiSourceCodes[i];
-}
-return null;
+this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset, this);
+this._uiSourceCodes = {};
 },
 
 
-uiSourceCodeForURI: function(uri)
+uiSourceCode: function(path)
 {
-for (var i = 0; i < this._uiSourceCodes.length; ++i) {
-if (this._uiSourceCodes[i].uri() === uri)
-return this._uiSourceCodes[i];
-}
-return null;
+return this._uiSourceCodes[path.join("/")] || null;
 },
 
 
-uiSourceCodes: function()
+uiSourceCodeForOriginURL: function(originURL)
 {
-return this._uiSourceCodes;
-},
-
-
-requestFileContent: function(uri, callback)
-{
-this._workspaceProvider.requestFileContent(uri, callback);
-},
-
-
-setFileContent: function(uri, newContent, callback)
-{
-this._workspaceProvider.setFileContent(uri, newContent, callback);
-},
-
-
-searchInFileContent: function(uri, query, caseSensitive, isRegex, callback)
-{
-this._workspaceProvider.searchInFileContent(uri, query, caseSensitive, isRegex, callback);
-}
-}
-
-
-WebInspector.Workspace = function()
-{
-
-this._temporaryContentProviders = {};
-
-this._temporaryUISourceCodes = {};
-}
-
-WebInspector.Workspace.Events = {
-UISourceCodeContentCommitted: "UISourceCodeContentCommitted",
-ProjectWillReset: "ProjectWillReset",
-ProjectDidReset: "ProjectDidReset"
-}
-
-WebInspector.Workspace.prototype = {
-
-uiSourceCodeForURL: function(url)
-{
-return this._project.uiSourceCodeForURL(url);
-},
-
-
-uiSourceCodeForURI: function(uri)
-{
-return this._temporaryUISourceCodes[uri] || this._project.uiSourceCodeForURI(uri);
-},
-
-
-addProject: function(projectName, workspaceProvider)
-{
-
-this._project = new WebInspector.Project(this, workspaceProvider);
-},
-
-
-project: function()
-{
-return this._project;
-},
-
-
-uiSourceCodes: function()
-{
-return this._project.uiSourceCodes();
-},
-
-
-addTemporaryUISourceCode: function(uri, url, contentProvider, isEditable, isContentScript)
-{
-var uiSourceCode = new WebInspector.UISourceCode(this, uri, url, contentProvider.contentType(), isEditable);
-this._temporaryContentProviders[uri] = contentProvider;
-this._temporaryUISourceCodes[uri] = uiSourceCode;
-uiSourceCode.isContentScript = isContentScript;
-uiSourceCode.isTemporary = true;
-this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, uiSourceCode);
+for (var path in this._uiSourceCodes) {
+var uiSourceCode = this._uiSourceCodes[path];
+if (uiSourceCode.originURL() === originURL)
 return uiSourceCode;
+}
+return null;
 },
 
 
-removeTemporaryUISourceCode: function(uiSourceCode)
+uiSourceCodes: function()
 {
-delete this._temporaryContentProviders[uiSourceCode.uri()];
-delete this._temporaryUISourceCodes[uiSourceCode.uri()];
-this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, uiSourceCode);
+return Object.values(this._uiSourceCodes);
 },
 
 
 requestFileContent: function(uiSourceCode, callback)
 {
-var temporaryContentProvider = this._temporaryContentProviders[uiSourceCode.uri()];
-if (temporaryContentProvider) {
-temporaryContentProvider.requestContent(callback);
-return;
-}
-this._project.requestFileContent(uiSourceCode.uri(), callback);
+this._projectDelegate.requestFileContent(uiSourceCode.path(), callback);
+},
+
+
+canSetFileContent: function()
+{
+return this._projectDelegate.canSetFileContent();
 },
 
 
 setFileContent: function(uiSourceCode, newContent, callback)
 {
-if (this._temporaryContentProviders[uiSourceCode.uri()])
-return;
-this._project.setFileContent(uiSourceCode.url, newContent, callback);
+this._projectDelegate.setFileContent(uiSourceCode.path(), newContent, callback);
+this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: uiSourceCode, content: newContent });
 },
 
 
 searchInFileContent: function(uiSourceCode, query, caseSensitive, isRegex, callback)
 {
-var temporaryContentProvider = this._temporaryContentProviders[uiSourceCode.uri()];
-if (temporaryContentProvider) {
-temporaryContentProvider.searchInContent(query, caseSensitive, isRegex, callback);
-return;
-}
-this._project.searchInFileContent(uiSourceCode.uri(), query, caseSensitive, isRegex, callback);
+this._projectDelegate.searchInFileContent(uiSourceCode.path(), query, caseSensitive, isRegex, callback);
 },
 
-reset: function()
+dispose: function()
 {
-this._temporaryContentProviders = {};
-this._temporaryUISourceCodes = {};
+this._projectDelegate.reset();
+}
+}
+
+WebInspector.projectTypes = {
+Debugger: "debugger",
+LiveEdit: "liveedit",
+Network: "network",
+Snippets: "snippets",
+FileSystem: "filesystem"
+}
+
+
+WebInspector.Workspace = function(fileMapping, fileSystemMapping)
+{
+this._fileMapping = fileMapping;
+this._fileSystemMapping = fileSystemMapping;
+
+this._projects = {};
+}
+
+WebInspector.Workspace.Events = {
+UISourceCodeContentCommitted: "UISourceCodeContentCommitted",
+ProjectWillReset: "ProjectWillReset"
+}
+
+WebInspector.Workspace.prototype = {
+
+uiSourceCode: function(projectId, path)
+{
+var project = this._projects[projectId];
+return project ? project.uiSourceCode(path) : null;
+},
+
+
+uiSourceCodeForOriginURL: function(originURL)
+{
+var networkProjects = this.projectsForType(WebInspector.projectTypes.Network)
+for (var i = 0; i < networkProjects.length; ++i) {
+var project = networkProjects[i];
+var uiSourceCode = project.uiSourceCodeForOriginURL(originURL);
+if (uiSourceCode)
+return uiSourceCode;
+}
+return null;
+},
+
+
+uiSourceCodesForProjectType: function(type)
+{
+var result = [];
+for (var projectName in this._projects) {
+var project = this._projects[projectName];
+if (project.type() === type)
+result = result.concat(project.uiSourceCodes());
+}
+return result;
+},
+
+
+addProject: function(projectDelegate)
+{
+var projectId = projectDelegate.id();
+this._projects[projectId] = new WebInspector.Project(this, projectDelegate);
+return this._projects[projectId];
+},
+
+
+removeProject: function(projectId)
+{
+var project = this._projects[projectId];
+if (!project)
+return;
+project.dispose();
+delete this._projects[projectId];
+},
+
+
+project: function(projectId)
+{
+return this._projects[projectId];
+},
+
+
+projects: function()
+{
+return Object.values(this._projects);
+},
+
+
+projectsForType: function(type)
+{
+function filterByType(project)
+{
+return project.type() === type;
+}
+return this.projects().filter(filterByType);
+},
+
+
+uiSourceCodes: function()
+{
+var result = [];
+for (var projectId in this._projects) {
+var project = this._projects[projectId];
+result = result.concat(project.uiSourceCodes());
+}
+return result;
+},
+
+
+hasMappingForURL: function(url)
+{
+var entry = this._fileMapping.mappingEntryForURL(url);
+if (!entry)
+return false;
+return !!this._fileSystemPathForEntry(entry);
+},
+
+
+_fileSystemPathForEntry: function(entry)
+{
+return this._fileSystemMapping.fileSystemPathForPrefix(entry.pathPrefix);
+},
+
+uiSourceCodeForURL: function(url)
+{
+var entry = this._fileMapping.mappingEntryForURL(url);
+var fileSystemPath = entry ? this._fileSystemPathForEntry(entry) : null;
+if (!fileSystemPath) {
+var splittedURL = WebInspector.ParsedURL.splitURL(url);
+var projectId = WebInspector.SimpleProjectDelegate.projectId(splittedURL[0], WebInspector.projectTypes.Network);
+var path = WebInspector.SimpleWorkspaceProvider.pathForSplittedURL(splittedURL);
+var project = this.project(projectId);
+return project ? project.uiSourceCode(path) : null;
+}
+
+var projectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);
+var pathPrefix = entry.pathPrefix.substr(fileSystemPath.length + 1);
+var path = pathPrefix + url.substr(entry.urlPrefix.length);
+var project = this.project(projectId);
+return project ? project.uiSourceCode(path.split("/")) : null;
+},
+
+
+urlForPath: function(path)
+{
+var entry = this._fileMapping.mappingEntryForPath(path);
+if (!entry)
+return "";
+return entry.urlPrefix + path.substring(entry.pathPrefix.length);
+},
+
+
+addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceProvider)
+{
+var url = networkUISourceCode.url;
+var path = uiSourceCode.path();
+var suffix = "";
+for (var i = path.length - 1; i >= 0; --i) {
+var nextSuffix = "/" + path[i] + suffix;
+if (!url.endsWith(nextSuffix))
+break;
+suffix = nextSuffix;
+}
+var fileSystemPath = fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);
+var filePath = "/" + path.join("/");
+var pathPrefix = fileSystemPath + filePath.substr(0, filePath.length - suffix.length) + "/";
+var urlPrefix = url.substr(0, url.length - suffix.length) + "/";
+
+var entries = this._fileMapping.mappingEntries();
+var entry = new WebInspector.FileMapping.Entry(urlPrefix, pathPrefix);
+entries.push(entry);
+this._fileMapping.setMappingEntries(entries);
+WebInspector.suggestReload();
+},
+
+
+removeMapping: function(uiSourceCode)
+{
+var entry = this._fileMapping.mappingEntryForURL(uiSourceCode.url);
+var entries = this._fileMapping.mappingEntries();
+entries.remove(entry);
+this._fileMapping.setMappingEntries(entries);
+WebInspector.suggestReload();
 },
 
 __proto__: WebInspector.Object.prototype
@@ -42267,21 +45705,259 @@
 
 
 
+WebInspector.ContentProviderBasedProjectDelegate = function(type)
+{
+this._type = type;
+
+this._contentProviders = {};
+}
+
+WebInspector.ContentProviderBasedProjectDelegate.prototype = {
+
+id: function()
+{
+
+return "";
+},
+
+
+type: function()
+{
+return this._type;
+},
+
+
+displayName: function()
+{
+
+return "";
+},
+
+
+requestFileContent: function(path, callback)
+{
+var contentProvider = this._contentProviders[path.join("/")];
+contentProvider.requestContent(callback);
+},
+
+
+canSetFileContent: function()
+{
+return false;
+},
+
+
+setFileContent: function(path, newContent, callback)
+{
+callback(null);
+},
+
+
+searchInFileContent: function(path, query, caseSensitive, isRegex, callback)
+{
+var contentProvider = this._contentProviders[path.join("/")];
+contentProvider.searchInContent(query, caseSensitive, isRegex, callback);
+},
+
+
+addContentProvider: function(path, url, contentProvider, isEditable, isContentScript)
+{
+var fileDescriptor = new WebInspector.FileDescriptor(path, url, url, contentProvider.contentType(), isEditable, isContentScript);
+this._contentProviders[path.join("/")] = contentProvider;
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded, fileDescriptor);
+return path;
+},
+
+
+removeFile: function(path)
+{
+delete this._contentProviders[path.join("/")];
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved, path);
+},
+
+
+contentProviders: function()
+{
+return this._contentProviders;
+},
+
+reset: function()
+{
+this._contentProviders = {};
+this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset, null);
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+
+
+
+
+WebInspector.SimpleProjectDelegate = function(name, type)
+{
+WebInspector.ContentProviderBasedProjectDelegate.call(this, type);
+this._name = name;
+this._lastUniqueSuffix = 0;
+}
+
+WebInspector.SimpleProjectDelegate.projectId = function(name, type)
+{
+var typePrefix = type !== WebInspector.projectTypes.Network ? (type + ":") : "";
+return typePrefix + name;
+}
+
+WebInspector.SimpleProjectDelegate.prototype = {
+
+id: function()
+{
+return WebInspector.SimpleProjectDelegate.projectId(this._name, this.type());
+},
+
+
+displayName: function()
+{
+if (typeof this._displayName !== "undefined")
+return this._displayName;
+if (!this._name) {
+this._displayName = this.type() !== WebInspector.projectTypes.Snippets ? WebInspector.UIString("(no domain)") : "";
+return this._displayName;
+}
+var parsedURL = new WebInspector.ParsedURL(this._name);
+if (parsedURL.isValid) {
+this._displayName = parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "");
+if (!this._displayName)
+this._displayName = this._name;
+}
+else
+this._displayName = this._name;
+return this._displayName;
+},
+
+
+addFile: function(path, forceUniquePath, url, contentProvider, isEditable, isContentScript)
+{
+if (forceUniquePath)
+this._ensureUniquePath(path);
+return this.addContentProvider(path, url, contentProvider, isEditable, isContentScript);
+},
+
+
+_ensureUniquePath: function(path)
+{
+var uniquePath = path.join("/");
+var suffix = "";
+var contentProviders = this.contentProviders();
+while (contentProviders[uniquePath]) {
+suffix = " (" + (++this._lastUniqueSuffix) + ")";
+uniquePath = path + suffix;
+}
+path[path.length - 1] += suffix;
+},
+
+__proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype
+}
+
+
+WebInspector.SimpleWorkspaceProvider = function(workspace, type)
+{
+this._workspace = workspace;
+this._type = type;
+this._simpleProjectDelegates = {};
+}
+
+
+WebInspector.SimpleWorkspaceProvider.pathForSplittedURL = function(splittedURL)
+{
+var result = splittedURL.slice();
+result.shift();
+return result;
+}
+
+WebInspector.SimpleWorkspaceProvider.prototype = {
+
+_projectDelegate: function(projectName)
+{
+if (this._simpleProjectDelegates[projectName])
+return this._simpleProjectDelegates[projectName];
+var simpleProjectDelegate = new WebInspector.SimpleProjectDelegate(projectName, this._type);
+this._simpleProjectDelegates[projectName] = simpleProjectDelegate;
+this._workspace.addProject(simpleProjectDelegate);
+return simpleProjectDelegate;
+},
+
+
+addFileForURL: function(url, contentProvider, isEditable, isContentScript)
+{
+return this._innerAddFileForURL(url, contentProvider, isEditable, false, isContentScript);
+},
+
+
+addUniqueFileForURL: function(url, contentProvider, isEditable, isContentScript)
+{
+return this._innerAddFileForURL(url, contentProvider, isEditable, true, isContentScript);
+},
+
+
+_innerAddFileForURL: function(url, contentProvider, isEditable, forceUnique, isContentScript)
+{
+var splittedURL = WebInspector.ParsedURL.splitURL(url);
+var projectName = splittedURL[0];
+var path = WebInspector.SimpleWorkspaceProvider.pathForSplittedURL(splittedURL);
+return this._innerAddFile(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript);
+},
+
+
+addFileByName: function(projectName, name, contentProvider, isEditable, isContentScript)
+{
+return this._innerAddFile("", [name], name, contentProvider, isEditable, false, isContentScript);
+},
+
+
+_innerAddFile: function(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript)
+{
+var projectDelegate = this._projectDelegate(projectName);
+path = projectDelegate.addFile(path, forceUnique, url, contentProvider, isEditable, isContentScript);
+return this._workspace.uiSourceCode(projectDelegate.id(), path);
+},
+
+
+removeFileByName: function(projectName, name)
+{
+var projectDelegate = this._projectDelegate(projectName);
+projectDelegate.removeFile([name]);
+},
+
+reset: function()
+{
+for (var projectName in this._simpleProjectDelegates)
+this._simpleProjectDelegates[projectName].reset();
+this._simpleProjectDelegates = {};
+},
+
+__proto__: WebInspector.Object.prototype
+}
+
+
+
+
+
+
 WebInspector.BreakpointManager = function(breakpointStorage, debuggerModel, workspace)
 {
 this._storage = new WebInspector.BreakpointManager.Storage(this, breakpointStorage);
 this._debuggerModel = debuggerModel;
 this._workspace = workspace;
 
-this._breakpoints = [];
+this._breakpoints = new Map();
 this._breakpointForDebuggerId = {};
 this._breakpointsForUISourceCode = new Map();
 this._sourceFilesWithRestoredBreakpoints = {};
 
 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._workspaceReset, this);
+this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
-this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, this._uiSourceCodeAdded, this);
 }
 
 WebInspector.BreakpointManager.Events = {
@@ -42311,9 +45987,7 @@
 var breakpoint = this._breakpointForDebuggerId[debuggerId];
 if (breakpoint._sourceFileId !== sourceFileId)
 continue;
-this._debuggerModel.removeBreakpoint(debuggerId);
-delete this._breakpointForDebuggerId[debuggerId];
-delete breakpoint._debuggerId;
+breakpoint.remove(true);
 }
 this._storage._restoreBreakpoints(uiSourceCode);
 },
@@ -42322,8 +45996,9 @@
 _uiSourceCodeAdded: function(event)
 {
 var uiSourceCode =   (event.data);
-if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script || uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
 this._restoreBreakpoints(uiSourceCode);
+if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script || uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
+uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMappingChanged, this);
 uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormatted, this);
 }
 },
@@ -42336,6 +46011,32 @@
 },
 
 
+_resetBreakpoints: function(uiSourceCode)
+{
+var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
+var breakpoints = this._breakpoints.keys();
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+if (breakpoint._sourceFileId !== sourceFileId)
+return;
+if (breakpoint.enabled()) {
+breakpoint._removeFromDebugger();
+breakpoint._setInDebugger();
+}
+}
+},
+
+
+_uiSourceCodeMappingChanged: function(event)
+{
+var identityHasChanged =   (event.data.identityHasChanged);
+if (!identityHasChanged)
+return;
+var uiSourceCode =   (event.target);
+this._resetBreakpoints(uiSourceCode);
+},
+
+
 setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
 {
 this._debuggerModel.setBreakpointsActive(true);
@@ -42351,7 +46052,7 @@
 return breakpoint;
 }
 breakpoint = new WebInspector.BreakpointManager.Breakpoint(this, uiSourceCode, lineNumber, condition, enabled);
-this._breakpoints.push(breakpoint);
+this._breakpoints.put(breakpoint);
 return breakpoint;
 },
 
@@ -42364,42 +46065,64 @@
 },
 
 
-_filteredBreakpointLocations: function(filter)
+breakpointsForUISourceCode: function(uiSourceCode)
 {
 var result = [];
-for (var i = 0; i < this._breakpoints.length; ++i) {
-var breakpoint = this._breakpoints[i];
-for (var stringifiedLocation in breakpoint._uiLocations) {
-var uiLocation = breakpoint._uiLocations[stringifiedLocation];
-if (filter(breakpoint, uiLocation))
-result.push({breakpoint: breakpoint, uiLocation: uiLocation});
+var breakpoints =  (this._breakpoints.keys());
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+var uiLocation = breakpoint._primaryUILocation;
+if (uiLocation.uiSourceCode === uiSourceCode)
+result.push(breakpoint);
+}
+return result;
+},
+
+
+allBreakpoints: function()
+{
+var result = [];
+var breakpoints =  (this._breakpoints.keys());
+return breakpoints;
+},
+
+
+breakpointLocationsForUISourceCode: function(uiSourceCode)
+{
+var result = [];
+var breakpoints =  (this._breakpoints.keys());
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+var uiLocations = Object.values(breakpoint._uiLocations);
+for (var j = 0; j < uiLocations.length; ++j) {
+var uiLocation = uiLocations[j];
+if (uiLocation.uiSourceCode === uiSourceCode)
+result.push({breakpoint: breakpoint, uiLocation: uiLocations[j]});
 }
 }
 return result;
 },
 
 
-breakpointLocationsForUISourceCode: function(uiSourceCode)
-{
-function filter(breakpoint, uiLocation)
-{
-return uiLocation.uiSourceCode === uiSourceCode;
-}
-
-return this._filteredBreakpointLocations(filter);
-},
-
-
 allBreakpointLocations: function()
 {
-return this._filteredBreakpointLocations(function(breakpoint, uiLocation) { return true; });
+var result = [];
+var breakpoints =  (this._breakpoints.keys());
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+var uiLocations = Object.values(breakpoint._uiLocations);
+for (var j = 0; j < uiLocations.length; ++j)
+result.push({breakpoint: breakpoint, uiLocation: uiLocations[j]});
+}
+return result;
 },
 
 
 toggleAllBreakpoints: function(toggleState)
 {
-for (var i = 0; i < this._breakpoints.length; ++i) {
-var breakpoint = this._breakpoints[i];
+var breakpoints =  (this._breakpoints.keys());
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
 if (breakpoint.enabled() != toggleState)
 breakpoint.setEnabled(toggleState);
 }
@@ -42407,7 +46130,7 @@
 
 removeAllBreakpoints: function()
 {
-var breakpoints = this._breakpoints.slice();
+var breakpoints =  (this._breakpoints.keys());
 for (var i = 0; i < breakpoints.length; ++i)
 breakpoints[i].remove();
 },
@@ -42426,16 +46149,32 @@
 this._sourceFilesWithRestoredBreakpoints = {};
 },
 
-_workspaceReset: function()
+_projectWillReset: function(event)
 {
-var breakpoints = this._breakpoints.slice();
-for (var i = 0; i < breakpoints.length; ++i) {
-breakpoints[i]._resetLocations();
-breakpoints[i]._isProvisional = true;
+var project =   (event.data);
+var uiSourceCodes = project.uiSourceCodes();
+for (var i = 0; i < uiSourceCodes.length; ++i) {
+var uiSourceCode = uiSourceCodes[i];
+var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode) || [];
+for (var lineNumber in breakpoints) {
+var lineBreakpoints = breakpoints[lineNumber];
+for (var j = 0; j < lineBreakpoints.length; ++j) {
+var breakpoint = lineBreakpoints[j];
+breakpoint._resetLocations();
 }
-this._breakpoints = [];
-this._breakpointsForUISourceCode.clear();
-this._sourceFilesWithRestoredBreakpoints = {};
+}
+this._breakpointsForUISourceCode.remove(uiSourceCode);
+
+breakpoints = this.breakpointsForUISourceCode(uiSourceCode);
+for (var j = 0; j < breakpoints.length; ++j) { 
+var breakpoint = breakpoints[j];
+this._breakpoints.remove(breakpoint);
+delete breakpoint._primaryUILocation;
+}
+
+var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
+delete this._sourceFilesWithRestoredBreakpoints[sourceFileId];
+}
 },
 
 _breakpointResolved: function(event)
@@ -42443,8 +46182,10 @@
 var breakpointId =   (event.data.breakpointId);
 var location =   (event.data.location);
 var breakpoint = this._breakpointForDebuggerId[breakpointId];
-if (!breakpoint || breakpoint._isProvisional)
+if (!breakpoint)
 return;
+if (!this._breakpoints.contains(breakpoint))
+this._breakpoints.put(breakpoint);
 breakpoint._addResolvedLocation(location);
 },
 
@@ -42598,6 +46339,7 @@
 
 _setInDebugger: function()
 {
+console.assert(!this._debuggerId);
 var rawLocation = this._primaryUILocation.uiLocationToRawLocation();
 var debuggerModelLocation =   (rawLocation);
 if (debuggerModelLocation)
@@ -42952,21 +46694,7 @@
 {
 function performSearch()
 {
-var regex = createSearchRegex(query, caseSensitive, isRegex);
-
-var result = [];
-var lineEndings = this._content.lineEndings();
-for (var i = 0; i < lineEndings.length; ++i) {
-var lineStart = i > 0 ? lineEndings[i - 1] + 1 : 0;
-var lineEnd = lineEndings[i];
-var lineContent = this._content.substring(lineStart, lineEnd);
-if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r")
-lineContent = lineContent.substring(0, lineContent.length - 1)
-
-if (regex.exec(lineContent))
-result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent));
-}
-callback(result);
+callback(WebInspector.ContentProvider.performSearchInContent(this._content, query, caseSensitive, isRegex));
 }
 
 
@@ -42981,12 +46709,13 @@
 
 
 
-WebInspector.DefaultScriptMapping = function(workspace, debuggerWorkspaceProvider)
+WebInspector.DefaultScriptMapping = function(workspace)
 {
+this._projectDelegate = new WebInspector.DebuggerProjectDelegate();
 this._workspace = workspace;
-this._debuggerWorkspaceProvider = debuggerWorkspaceProvider;
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
-this._reset();
+this._workspace.addProject(this._projectDelegate);
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+this._debuggerReset();
 }
 
 WebInspector.DefaultScriptMapping.prototype = {
@@ -43010,10 +46739,16 @@
 },
 
 
+isIdentity: function()
+{
+return true;
+},
+
+
 addScript: function(script)
 {
-var contentProvider = script.isInlineScript() ? new WebInspector.ConcatenatedScriptsContentProvider([script]) : script;
-var uiSourceCode = this._debuggerWorkspaceProvider.addDebuggerFile(script.sourceURL, contentProvider, false);
+var path = this._projectDelegate.addScript(script);
+var uiSourceCode = this._workspace.uiSourceCode(this._projectDelegate.id(), path);
 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;
 this._scriptIdForUISourceCode.put(uiSourceCode, script.scriptId);
 uiSourceCode.setSourceMapping(this);
@@ -43025,44 +46760,52 @@
 
 _scriptEdited: function(scriptId, event)
 {
-var content =   event.data;
+var content =  (event.data);
 this._uiSourceCodeForScriptId[scriptId].addRevision(content);
 },
 
-_reset: function()
+_debuggerReset: function()
 {
 
 this._uiSourceCodeForScriptId = {};
 this._scriptIdForUISourceCode = new Map();
-},
+this._projectDelegate.reset();
+}
 }
 
 
-WebInspector.DebuggerWorkspaceProvider = function(workspace)
+WebInspector.DebuggerProjectDelegate = function()
 {
-WebInspector.ContentProviderWorkspaceProvider.call(this);
-this._workspace = workspace;
+WebInspector.ContentProviderBasedProjectDelegate.call(this, WebInspector.projectTypes.Debugger);
 }
 
-WebInspector.DebuggerWorkspaceProvider.prototype = {
+WebInspector.DebuggerProjectDelegate.prototype = {
 
-addDebuggerFile: function(url, contentProvider, isEditable)
+id: function()
 {
-var uri = "debugger:" + WebInspector.ContentProviderWorkspaceProvider.uriForURL(url);
-var uniqueURI = this.uniqueURI(uri);
-var uiSourceCode = this._workspace.addTemporaryUISourceCode(uniqueURI, url, contentProvider, isEditable);
-
-this._contentProviders[uniqueURI] = uiSourceCode;
-return uiSourceCode;
+return "debugger:";
 },
 
-__proto__: WebInspector.ContentProviderWorkspaceProvider.prototype
+
+displayName: function()
+{
+return "debugger";
+},
+
+
+addScript: function(script)
+{
+var contentProvider = script.isInlineScript() ? new WebInspector.ConcatenatedScriptsContentProvider([script]) : script;
+var splittedURL = WebInspector.ParsedURL.splitURL(script.sourceURL);
+var name = splittedURL[splittedURL.length - 1];
+name = "[VM] " + name + " (" + script.scriptId + ")";
+return this.addContentProvider([name], script.sourceURL, contentProvider, false, script.isContentScript);
+},
+
+__proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype
 }
 
 
-WebInspector.debuggerWorkspaceProvider = null;
-
-
 
 
 
@@ -43070,10 +46813,10 @@
 WebInspector.ResourceScriptMapping = function(workspace)
 {
 this._workspace = workspace;
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
 
-this._reset();
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+this._initialize();
 }
 
 WebInspector.ResourceScriptMapping.prototype = {
@@ -43085,6 +46828,9 @@
 var uiSourceCode = this._workspaceUISourceCodeForScript(script);
 if (!uiSourceCode)
 return null;
+var scriptFile = uiSourceCode.scriptFile();
+if (scriptFile && ((scriptFile.hasDivergedFromVM() && !scriptFile.isMergingToVM()) || scriptFile.isDivergingFromVM()))
+return null;
 return new WebInspector.UILocation(uiSourceCode, debuggerModelLocation.lineNumber, debuggerModelLocation.columnNumber || 0);
 },
 
@@ -43097,6 +46843,12 @@
 },
 
 
+isIdentity: function()
+{
+return true;
+},
+
+
 addScript: function(script)
 {
 if (script.isAnonymousScript() || script.isDynamicScript())
@@ -43117,7 +46869,8 @@
 _uiSourceCodeAddedToWorkspace: function(event)
 {
 var uiSourceCode =   (event.data);
-console.assert(!!uiSourceCode.url);
+if (!uiSourceCode.url)
+return;
 
 var scripts = this._scriptsForUISourceCode(uiSourceCode);
 if (!scripts.length)
@@ -43133,7 +46886,7 @@
 if (!scripts.length)
 return;
 for (var i = 0; i < scripts.length; ++i)
-scripts[i].enableSourceMapping(this);
+scripts[i].updateLocations();
 },
 
 
@@ -43143,7 +46896,7 @@
 if (!scripts.length)
 return;
 for (var i = 0; i < scripts.length; ++i)
-scripts[i].disableSourceMapping(this);
+scripts[i].updateLocations();
 },
 
 
@@ -43171,6 +46924,8 @@
 default:
 return [];
 }
+if (!uiSourceCode.url)
+return [];
 var scriptsForSourceURL = isInlineScript ? this._inlineScriptsForSourceURL : this._nonInlineScriptsForSourceURL;
 return scriptsForSourceURL[uiSourceCode.url] || [];
 },
@@ -43179,20 +46934,51 @@
 _bindUISourceCodeToScripts: function(uiSourceCode, scripts)
 {
 console.assert(scripts.length);
-var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode);
+var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode, scripts);
 uiSourceCode.setScriptFile(scriptFile);
 for (var i = 0; i < scripts.length; ++i)
 scripts[i].updateLocations();
 uiSourceCode.setSourceMapping(this);
 },
 
-_reset: function()
+
+_unbindUISourceCodeFromScripts: function(uiSourceCode, scripts)
+{
+console.assert(scripts.length);
+var scriptFile =   (uiSourceCode.scriptFile());
+scriptFile.dispose();
+uiSourceCode.setScriptFile(null);
+uiSourceCode.setSourceMapping(null);
+},
+
+_initialize: function()
 {
 
 this._inlineScriptsForSourceURL = {};
 
 this._nonInlineScriptsForSourceURL = {};
 },
+
+_debuggerReset: function()
+{
+
+function unbindUISourceCodes(scriptsForSourceURL)
+{
+for (var sourceURL in scriptsForSourceURL) {
+var scripts = scriptsForSourceURL[sourceURL];
+if (!scripts.length)
+continue;
+var uiSourceCode = this._workspaceUISourceCodeForScript(scripts[0]);
+if (!uiSourceCode)
+continue;
+this._unbindUISourceCodeFromScripts(uiSourceCode, scripts);
+}
+}
+
+unbindUISourceCodes.call(this, this._inlineScriptsForSourceURL);
+unbindUISourceCodes.call(this, this._nonInlineScriptsForSourceURL);
+this._initialize();
+},
 }
 
 
@@ -43201,9 +46987,7 @@
 }
 
 WebInspector.ScriptFile.Events = {
-WillMergeToVM: "WillMergeToVM",
 DidMergeToVM: "DidMergeToVM",
-WillDivergeFromVM: "WillDivergeFromVM",
 DidDivergeFromVM: "DidDivergeFromVM",
 }
 
@@ -43215,20 +46999,26 @@
 isDivergingFromVM: function() { return false; },
 
 
-addEventListener: function(eventType, listener, thisObject) { },
+isMergingToVM: function() { return false; },
 
-
-removeEventListener: function(eventType, listener, thisObject) { }
+checkMapping: function() { },
 }
 
 
-WebInspector.ResourceScriptFile = function(resourceScriptMapping, uiSourceCode)
+WebInspector.ResourceScriptFile = function(resourceScriptMapping, uiSourceCode, scripts)
 {
+console.assert(scripts.length);
+
 WebInspector.ScriptFile.call(this);
 this._resourceScriptMapping = resourceScriptMapping;
 this._uiSourceCode = uiSourceCode;
+
+if (this._uiSourceCode.contentType() === WebInspector.resourceTypes.Script)
+this._script = scripts[0];
+
 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+this._update();
 }
 
 WebInspector.ResourceScriptFile.prototype = {
@@ -43238,44 +47028,87 @@
 function innerCallback(error)
 {
 if (error) {
-this._hasDivergedFromVM = true;
+this._update();
 WebInspector.showErrorMessage(error);
 return;
 }
 
-this.dispatchEventToListeners(WebInspector.ScriptFile.Events.WillMergeToVM, this);
-delete this._hasDivergedFromVM;
-this._resourceScriptMapping._hasMergedToVM(this._uiSourceCode);
-this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidMergeToVM, this);
+this._scriptSource = source;
+this._update();
 }
-
-var rawLocation =   (this._uiSourceCode.uiLocationToRawLocation(0, 0));
-if (!rawLocation)
+if (!this._script)
 return;
-var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);
-WebInspector.debuggerModel.setScriptSource(script.scriptId, this._uiSourceCode.workingCopy(), innerCallback.bind(this));
+var source = this._uiSourceCode.workingCopy();
+if (this._script.hasSourceURL && !this._sourceEndsWithSourceURL(source))
+source += "\n //@ sourceURL=" + this._script.sourceURL;
+WebInspector.debuggerModel.setScriptSource(this._script.scriptId, source, innerCallback.bind(this));
 },
 
+
+_isDiverged: function()
+{
+if (this._uiSourceCode.formatted())
+return false;
+if (this._uiSourceCode.isDirty())
+return true;
+if (!this._script)
+return false;
+if (typeof this._scriptSource === "undefined")
+return false;
+return !this._sourceMatchesScriptSource(this._uiSourceCode.workingCopy(), this._scriptSource);
+},
+
+
+_sourceMatchesScriptSource: function(source, scriptSource)
+{
+if (!scriptSource.startsWith(source))
+return false;
+var scriptSourceTail = scriptSource.substr(source.length).trim();
+return !scriptSourceTail || !!scriptSourceTail.match(/^\/\/@\ssourceURL=\s*(\S*?)\s*$/m);
+},
+
+
+_sourceEndsWithSourceURL: function(source)
+{
+return !!source.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m);
+},
+
+
 _workingCopyChanged: function(event)
 {
-var wasDirty =   (event.data.wasDirty);
-if (!wasDirty && this._uiSourceCode.isDirty() && !this._hasDivergedFromVM) {
+this._update();
+},
+
+_update: function()
+{
+if (this._isDiverged() && !this._hasDivergedFromVM)
+this._divergeFromVM();
+else if (!this._isDiverged() && this._hasDivergedFromVM)
+this._mergeToVM();
+},
+
+_divergeFromVM: function()
+{
 this._isDivergingFromVM = true;
-this.dispatchEventToListeners(WebInspector.ScriptFile.Events.WillDivergeFromVM, this._uiSourceCode);
 this._resourceScriptMapping._hasDivergedFromVM(this._uiSourceCode);
-this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidDivergeFromVM, this._uiSourceCode);
 delete this._isDivergingFromVM;
-} else if (wasDirty && !this._uiSourceCode.isDirty() && !this._hasDivergedFromVM) {
-this.dispatchEventToListeners(WebInspector.ScriptFile.Events.WillMergeToVM, this._uiSourceCode);
+this._hasDivergedFromVM = true;
+this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidDivergeFromVM, this._uiSourceCode);
+},
+
+_mergeToVM: function()
+{
+delete this._hasDivergedFromVM;
+this._isMergingToVM = true;
 this._resourceScriptMapping._hasMergedToVM(this._uiSourceCode);
+delete this._isMergingToVM;
 this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidMergeToVM, this._uiSourceCode);
-}
 },
 
 
 hasDivergedFromVM: function()
 {
-return this._uiSourceCode.isDirty() || this._hasDivergedFromVM;
+return this._hasDivergedFromVM;
 },
 
 
@@ -43284,6 +47117,34 @@
 return this._isDivergingFromVM;
 },
 
+
+isMergingToVM: function()
+{
+return this._isMergingToVM;
+},
+
+checkMapping: function()
+{
+if (!this._script)
+return;
+if (typeof this._scriptSource !== "undefined")
+return;
+this._script.requestContent(callback.bind(this));
+
+
+function callback(source, encoded, contentType)
+{
+this._scriptSource = source;
+this._update();
+}
+},
+
+dispose: function()
+{
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+},
+
 __proto__: WebInspector.Object.prototype
 }
 
@@ -43295,6 +47156,7 @@
 WebInspector.CompilerScriptMapping = function(workspace, networkWorkspaceProvider)
 {
 this._workspace = workspace;
+this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
 this._networkWorkspaceProvider = networkWorkspaceProvider;
 
 this._sourceMapForSourceMapURL = {};
@@ -43303,7 +47165,7 @@
 this._scriptForSourceMap = new Map();
 
 this._sourceMapForURL = {};
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
 }
 
 WebInspector.CompilerScriptMapping.prototype = {
@@ -43315,24 +47177,39 @@
 var lineNumber = debuggerModelLocation.lineNumber;
 var columnNumber = debuggerModelLocation.columnNumber || 0;
 var entry = sourceMap.findEntry(lineNumber, columnNumber);
-if (entry.length === 2)
+if (!entry || entry.length === 2)
 return null;
-var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]);
+var url = entry[2];
+var uiSourceCode = this._workspace.uiSourceCodeForURL(url);
+if (!uiSourceCode)
+return null;
 return new WebInspector.UILocation(uiSourceCode, entry[3], entry[4]);
 },
 
 
 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
 {
+if (!uiSourceCode.url)
+return null;
 var sourceMap = this._sourceMapForURL[uiSourceCode.url];
+if (!sourceMap)
+return null;
 var entry = sourceMap.findEntryReversed(uiSourceCode.url, lineNumber);
 return WebInspector.debuggerModel.createRawLocation(this._scriptForSourceMap.get(sourceMap), entry[0], entry[1]);
 },
 
 
+isIdentity: function()
+{
+return false;
+},
+
+
 addScript: function(script)
 {
 var sourceMap = this.loadSourceMapForScript(script);
+if (!sourceMap)
+return;
 
 if (this._scriptForSourceMap.get(sourceMap)) {
 this._sourceMapForScriptId[script.scriptId] = sourceMap;
@@ -43340,53 +47217,73 @@
 return;
 }
 
+this._sourceMapForScriptId[script.scriptId] = sourceMap;
+this._scriptForSourceMap.put(sourceMap, script);
+
 var sourceURLs = sourceMap.sources();
 for (var i = 0; i < sourceURLs.length; ++i) {
 var sourceURL = sourceURLs[i];
-if (this._workspace.uiSourceCodeForURL(sourceURL))
+if (this._sourceMapForURL[sourceURL])
 continue;
 this._sourceMapForURL[sourceURL] = sourceMap;
+if (!this._workspace.hasMappingForURL(sourceURL) && !this._workspace.uiSourceCodeForURL(sourceURL)) {
 var sourceContent = sourceMap.sourceContent(sourceURL);
 var contentProvider;
 if (sourceContent)
 contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, sourceContent);
 else
 contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL);
-this._networkWorkspaceProvider.addNetworkFile(sourceURL, contentProvider, true);
+this._networkWorkspaceProvider.addFileForURL(sourceURL, contentProvider, true);
+}
 var uiSourceCode = this._workspace.uiSourceCodeForURL(sourceURL);
-uiSourceCode.setSourceMapping(this);
+if (uiSourceCode) {
+this._bindUISourceCode(uiSourceCode);
 uiSourceCode.isContentScript = script.isContentScript;
 }
-
-this._sourceMapForScriptId[script.scriptId] = sourceMap;
-this._scriptForSourceMap.put(sourceMap, script);
+}
 script.pushSourceMapping(this);
 },
 
 
+_bindUISourceCode: function(uiSourceCode)
+{
+uiSourceCode.setSourceMapping(this);
+},
+
+
+_uiSourceCodeAddedToWorkspace: function(event)
+{
+var uiSourceCode =   (event.data);
+if (!uiSourceCode.url || !this._sourceMapForURL[uiSourceCode.url])
+return;
+this._bindUISourceCode(uiSourceCode);
+},
+
+
 loadSourceMapForScript: function(script)
 {
-var sourceMapURL = WebInspector.PositionBasedSourceMap.prototype._canonicalizeURL(script.sourceMapURL, script.sourceURL);
+
+
+if (!script.sourceMapURL)
+return null;
+var scriptURL = WebInspector.ParsedURL.completeURL(WebInspector.inspectedPageURL, script.sourceURL);
+if (!scriptURL)
+return null;
+var sourceMapURL = WebInspector.ParsedURL.completeURL(scriptURL, script.sourceMapURL);
+if (!sourceMapURL)
+return null;
 var sourceMap = this._sourceMapForSourceMapURL[sourceMapURL];
 if (sourceMap)
 return sourceMap;
 
-try {
-
-var response = InspectorFrontendHost.loadResourceSynchronously(sourceMapURL);
-if (response.slice(0, 3) === ")]}")
-response = response.substring(response.indexOf('\n'));
-var payload =   (JSON.parse(response));
-sourceMap = new WebInspector.PositionBasedSourceMap(sourceMapURL, payload);
-} catch(e) {
-console.error(e.message);
+sourceMap = WebInspector.SourceMap.load(sourceMapURL, scriptURL);
+if (!sourceMap)
 return null;
-}
 this._sourceMapForSourceMapURL[sourceMapURL] = sourceMap;
 return sourceMap;
 },
 
-_reset: function()
+_debuggerReset: function()
 {
 this._sourceMapForSourceMapURL = {};
 this._sourceMapForScriptId = {};
@@ -43402,10 +47299,9 @@
 
 WebInspector.LiveEditSupport = function(workspace)
 {
-this._workspace = workspace;
-this._liveEditWorkspaceProvider = new WebInspector.LiveEditWorkspaceProvider(workspace);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
-this._reset();
+this._workspaceProvider = new WebInspector.SimpleWorkspaceProvider(workspace, WebInspector.projectTypes.LiveEdit);
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+this._debuggerReset();
 }
 
 WebInspector.LiveEditSupport.prototype = {
@@ -43424,19 +47320,20 @@
 return this._uiSourceCodeForScriptId[script.scriptId];
 
 console.assert(!script.isInlineScript());
-var uri = uiSourceCode.uri();
-var liveEditUISourceCode = this._liveEditWorkspaceProvider.addLiveEditFile(uiSourceCode.url, script, true);
+var liveEditUISourceCode = this._workspaceProvider.addUniqueFileForURL(script.sourceURL, script, true, script.isContentScript);
+
 liveEditUISourceCode.setScriptFile(new WebInspector.LiveEditScriptFile(uiSourceCode, liveEditUISourceCode, script.scriptId));
 this._uiSourceCodeForScriptId[script.scriptId] = liveEditUISourceCode;
 this._scriptIdForUISourceCode.put(liveEditUISourceCode, script.scriptId);
 return liveEditUISourceCode;
 },
 
-_reset: function()
+_debuggerReset: function()
 {
 
 this._uiSourceCodeForScriptId = {};
 this._scriptIdForUISourceCode = new Map();
+this._workspaceProvider.reset();
 },
 }
 
@@ -43478,6 +47375,16 @@
 return false;
 },
 
+
+isMergingToVM: function()
+{
+return false;
+},
+
+checkMapping: function()
+{
+},
+
 __proto__: WebInspector.Object.prototype
 }
 
@@ -43485,40 +47392,22 @@
 WebInspector.liveEditSupport = null;
 
 
-WebInspector.LiveEditWorkspaceProvider = function(workspace)
+
+
+
+
+WebInspector.SASSSourceMapping = function(cssModel, workspace, networkWorkspaceProvider)
 {
-WebInspector.ContentProviderWorkspaceProvider.call(this);
-this._workspace = workspace;
-}
-
-WebInspector.LiveEditWorkspaceProvider.prototype = {
-
-addLiveEditFile: function(url, contentProvider, isEditable)
-{
-var uri = "liveedit:" + WebInspector.ContentProviderWorkspaceProvider.uriForURL(url);
-var uniqueURI = this.uniqueURI(uri);
-
-this._contentProviders[uniqueURI] = null;
-return this._workspace.addTemporaryUISourceCode(uniqueURI, url, contentProvider, isEditable);
-},
-
-__proto__: WebInspector.ContentProviderWorkspaceProvider.prototype
-}
-
-
-
-
-
-
-WebInspector.SASSSourceMapping = function(workspace, networkWorkspaceProvider)
-{
+this._cssModel = cssModel;
 this._workspace = workspace;
 this._networkWorkspaceProvider = networkWorkspaceProvider;
-this._uiLocations = {};
+this._sourceMapByURL = {};
+this._sourceMapByStyleSheetURL = {};
 this._cssURLsForSASSURL = {};
 this._timeoutForURL = {};
 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
 WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL, this._fileSaveFinished, this);
+this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
 }
 
@@ -43539,8 +47428,27 @@
 },
 
 
+_styleSheetChanged: function(event)
+{
+var isAddingRevision = this._isAddingRevision;
+delete this._isAddingRevision;
+
+if (isAddingRevision)
+return;
+this._cssModel.resourceBinding().requestResourceURLForStyleSheetId(event.data.styleSheetId, callback.bind(this));
+
+function callback(url)
+{
+if (!url)
+return;
+this._cssModel.setSourceMapping(url, null);
+}
+},
+
+
 _fileSaveFinished: function(event)
 {
+
 var sassURL =   (event.data);
 function callback()
 {
@@ -43570,7 +47478,10 @@
 if (!uiSourceCode)
 return;
 var newContent = InspectorFrontendHost.loadResourceSynchronously(url);
+this._isAddingRevision = true;
 uiSourceCode.addRevision(newContent);
+
+this._loadAndProcessSourceMap(newContent, url, true);
 },
 
 
@@ -43583,50 +47494,34 @@
 
 function didRequestContent(content, contentEncoded, mimeType)
 {
-if (!content)
-return;
-var lines = content.split(/\r?\n/);
-var debugInfoRegex = /@media\s\-sass\-debug\-info{filename{font-family:([^}]+)}line{font-family:\\0000(\d\d)([^}]*)}}/i;
-            var lineNumbersRegex = /\/\*\s+line\s+([0-9]+),\s+([^*\/]+)/;
-for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) {
-var match = debugInfoRegex.exec(lines[lineNumber]);
-if (match) {
-var url = match[1].replace(/\\(.)/g, "$1");
-var line = parseInt(decodeURI("%" + match[2]) + match[3], 10);
-this._bindUISourceCode(url, line, resource.url, lineNumber);
-continue;
-}
-match = lineNumbersRegex.exec(lines[lineNumber]);
-if (match) {
-var fileName = match[2].trim();
-var line = parseInt(match[1], 10);
-var url = resource.url;
-if (url.endsWith("/" + resource.parsedURL.lastPathComponent))
-url = url.substring(0, url.length - resource.parsedURL.lastPathComponent.length) + fileName;
-else
-url = fileName;
-this._bindUISourceCode(url, line, resource.url, lineNumber);
-continue;
-}
-}
+this._loadAndProcessSourceMap(content, resource.url);
 }
 resource.requestContent(didRequestContent.bind(this));
 },
 
 
-_bindUISourceCode: function(url, line, rawURL, rawLine)
+_loadAndProcessSourceMap: function(content, cssURL, forceRebind)
 {
-var uiSourceCode = this._workspace.uiSourceCodeForURL(url);
-if (!uiSourceCode) {
-var content = InspectorFrontendHost.loadResourceSynchronously(url);
-var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss");
-this._networkWorkspaceProvider.addNetworkFile(url, contentProvider, true);
-uiSourceCode = this._workspace.uiSourceCodeForURL(url);
-WebInspector.cssModel.setSourceMapping(rawURL, this);
-}
-var rawLocationString = rawURL + ":" + (rawLine + 1);  
-this._uiLocations[rawLocationString] = new WebInspector.UILocation(uiSourceCode, line - 1, 0);
-this._addCSSURLforSASSURL(rawURL, url);
+if (!content)
+return;
+var lines = content.split(/\r?\n/);
+if (!lines.length)
+return;
+
+const sourceMapRegex = /^\/\*@ sourceMappingURL=([^\s]+)\s*\*\/$/;
+var lastLine = lines[lines.length - 1];
+var match = lastLine.match(sourceMapRegex);
+if (!match)
+return;
+
+if (!forceRebind && this._sourceMapByStyleSheetURL[cssURL])
+return;
+var sourceMap = this.loadSourceMapForStyleSheet(match[1], cssURL, forceRebind);
+
+if (!sourceMap)
+return;
+this._sourceMapByStyleSheetURL[cssURL] = sourceMap;
+this._bindUISourceCode(cssURL, sourceMap);
 },
 
 
@@ -43644,27 +47539,77 @@
 },
 
 
+loadSourceMapForStyleSheet: function(sourceMapURL, styleSheetURL, forceReload)
+{
+var completeStyleSheetURL = WebInspector.ParsedURL.completeURL(WebInspector.inspectedPageURL, styleSheetURL);
+if (!completeStyleSheetURL)
+return null;
+var completeSourceMapURL = WebInspector.ParsedURL.completeURL(completeStyleSheetURL, sourceMapURL);
+if (!completeSourceMapURL)
+return null;
+var sourceMap = this._sourceMapByURL[completeSourceMapURL];
+if (sourceMap && !forceReload)
+return sourceMap;
+sourceMap = WebInspector.SourceMap.load(completeSourceMapURL, completeStyleSheetURL);
+if (!sourceMap) {
+delete this._sourceMapByURL[completeSourceMapURL];
+return null;
+}
+this._sourceMapByURL[completeSourceMapURL] = sourceMap;
+return sourceMap;
+},
+
+
+_bindUISourceCode: function(rawURL, sourceMap)
+{
+this._cssModel.setSourceMapping(rawURL, this);
+var sources = sourceMap.sources();
+for (var i = 0; i < sources.length; ++i) {
+var url = sources[i];
+if (!this._workspace.hasMappingForURL(url) && !this._workspace.uiSourceCodeForURL(url)) {
+var content = InspectorFrontendHost.loadResourceSynchronously(url);
+var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss");
+var uiSourceCode = this._networkWorkspaceProvider.addFileForURL(url, contentProvider, true);
+this._addCSSURLforSASSURL(rawURL, url);
+uiSourceCode.setSourceMapping(this);
+}
+}
+},
+
+
 rawLocationToUILocation: function(rawLocation)
 {
 var location =   (rawLocation);
-var uiLocation = this._uiLocations[location.url + ":" + location.lineNumber];
-if (!uiLocation) {
-var uiSourceCode = this._workspace.uiSourceCodeForURL(location.url);
-uiLocation = new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0);
-}
-return uiLocation;
+var entry;
+var sourceMap = this._sourceMapByStyleSheetURL[location.url];
+if (!sourceMap)
+return null;
+entry = sourceMap.findEntry(location.lineNumber, location.columnNumber);
+if (!entry || entry.length === 2)
+return null;
+var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]);
+if (!uiSourceCode)
+return null;
+return new WebInspector.UILocation(uiSourceCode, entry[3], entry[4]);
 },
 
 
 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
 {
 
-return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber);
+return new WebInspector.CSSLocation(uiSourceCode.url || "", lineNumber, columnNumber);
+},
+
+
+isIdentity: function()
+{
+return false;
 },
 
 _reset: function()
 {
-this._uiLocations = {};
+this._sourceMapByURL = {};
+this._sourceMapByStyleSheetURL = {};
 this._populate();
 }
 }
@@ -43674,7 +47619,6 @@
 
 
 
-
 WebInspector.DOMNode = function(domAgent, doc, isInShadowTree, payload) {
 this._domAgent = domAgent;
 this.ownerDocument = doc;
@@ -43714,6 +47658,9 @@
 }
 }
 
+if (payload.templateContent)
+this._templateContent = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, payload.templateContent);
+
 if (payload.children)
 this._setChildrenPayload(payload.children);
 
@@ -43763,7 +47710,7 @@
 
 hasChildNodes: function()
 {
-return this._childNodeCount > 0 || !!this._shadowRoots.length;
+return this._childNodeCount > 0 || !!this._shadowRoots.length || !!this._templateContent;
 },
 
 
@@ -43882,7 +47829,20 @@
 callback(this.children);
 }
 
-DOMAgent.requestChildNodes(this.id, mycallback.bind(this));
+DOMAgent.requestChildNodes(this.id, undefined, mycallback.bind(this));
+},
+
+
+getSubtree: function(depth, callback)
+{
+
+function mycallback(error)
+{
+if (callback)
+callback(error ? null : this.children);                
+}
+
+DOMAgent.requestChildNodes(this.id, depth, mycallback.bind(this));
 },
 
 
@@ -43920,9 +47880,9 @@
 },
 
 
-eventListeners: function(callback)
+eventListeners: function(objectGroupId, callback)
 {
-DOMAgent.getEventListenersForNode(this.id, callback);
+DOMAgent.getEventListenersForNode(this.id, objectGroupId, callback);
 },
 
 
@@ -44012,7 +47972,11 @@
 if (!prev) {
 if (!this.children) {
 
-this.children = this._shadowRoots.concat([ node ]);
+this.children = this._shadowRoots.slice();
+if (this._templateContent)
+this.children.push(this._templateContent);
+
+this.children.push(node);
 } else
 this.children.unshift(node);
 } else
@@ -44038,6 +48002,9 @@
 return;
 
 this.children = this._shadowRoots.slice();
+if (this._templateContent)
+this.children.push(this._templateContent);
+
 for (var i = 0; i < payloads.length; ++i) {
 var payload = payloads[i];
 var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, this._isInShadowTree, payload);
@@ -44375,14 +48342,14 @@
 
 pushNodeToFrontend: function(objectId, callback)
 {
-var callbackCast =   callback;
+var callbackCast =  (callback);
 this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent, objectId), callbackCast);
 },
 
 
 pushNodeByPathToFrontend: function(path, callback)
 {
-var callbackCast =   callback;
+var callbackCast =  (callback);
 this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent, path), callbackCast);
 },
 
@@ -44402,7 +48369,7 @@
 
 _dispatchWhenDocumentAvailable: function(func, callback)
 {
-var callbackWrapper =   this._wrapClientCallback(callback);
+var callbackWrapper =  (this._wrapClientCallback(callback));
 
 function onDocumentAvailable()
 {
@@ -44619,14 +48586,14 @@
 
 querySelector: function(nodeId, selectors, callback)
 {
-var callbackCast =  callback;
+var callbackCast =  (callback);
 DOMAgent.querySelector(nodeId, selectors, this._wrapClientCallback(callbackCast));
 },
 
 
 querySelectorAll: function(nodeId, selectors, callback)
 {
-var callbackCast =  callback;
+var callbackCast =  (callback);
 DOMAgent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(callbackCast));
 },
 
@@ -44712,7 +48679,7 @@
 var emulationEnabled = WebInspector.settings.emulateTouchEvents.get();
 if (emulationEnabled && !this._addTouchEventsScriptInjecting) {
 this._addTouchEventsScriptInjecting = true;
-PageAgent.addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")", scriptAddedCallback.bind(this));
+PageAgent.addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")()", scriptAddedCallback.bind(this));
 } else {
 if (typeof this._addTouchEventsScriptId !== "undefined") {
 PageAgent.removeScriptToEvaluateOnLoad(this._addTouchEventsScriptId);
@@ -44845,31 +48812,22 @@
 
 
 
-
-WebInspector.TestController = function()
-{
-}
-
-WebInspector.TestController.prototype = {
-notifyDone: function(callId, result)
-{
-var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
-RuntimeAgent.evaluate("didEvaluateForTestInFrontend(" + callId + ", " + message + ")", "test");
-}
-}
-
 WebInspector.evaluateForTestInFrontend = function(callId, script)
 {
-window.isUnderTest = true;
+if (!InspectorFrontendHost.isUnderTest())
+return;
+
 function invokeMethod()
 {
+var message;
 try {
 script = script + "//@ sourceURL=evaluateInWebInspector" + callId + ".js";
 var result = window.eval(script);
-WebInspector.TestController.prototype.notifyDone(callId, result);
+message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
 } catch (e) {
-WebInspector.TestController.prototype.notifyDone(callId, e.toString());
+message = e.toString();
 }
+RuntimeAgent.evaluate("didEvaluateForTestInFrontend(" + callId + ", " + message + ")", "test");
 }
 InspectorBackend.runAfterPendingDispatches(invokeMethod);
 }
@@ -44884,13 +48842,12 @@
 this._delegate = delegate;
 this._relativeToElement = relativeToElement;
 
+this._glassPane = new WebInspector.GlassPane();
 
-this._glassPaneElement = document.body.createChild("div");
-this._glassPaneElement.className = "dialog-glass-pane";
-this._glassPaneElement.tabIndex = 0;
-this._glassPaneElement.addEventListener("focus", this._onGlassPaneFocus.bind(this), false);
+this._glassPane.element.tabIndex = 0;
+this._glassPane.element.addEventListener("focus", this._onGlassPaneFocus.bind(this), false);
 
-this._element = this._glassPaneElement.createChild("div");
+this._element = this._glassPane.element.createChild("div");
 this._element.tabIndex = 0;
 this._element.addEventListener("focus", this._onFocus.bind(this), false);
 this._element.addEventListener("keydown", this._onKeyDown.bind(this), false);
@@ -44904,8 +48861,6 @@
 this._position();
 this._windowResizeHandler = this._position.bind(this);
 window.addEventListener("resize", this._windowResizeHandler, true);
-
-this._previousFocusElement = WebInspector.currentFocusElement();
 this._delegate.focus();
 }
 
@@ -44939,10 +48894,8 @@
 
 this._delegate.willHide();
 
-if (this._element.isSelfOrAncestor(document.activeElement))
-WebInspector.setCurrentFocusElement(this._previousFocusElement);
 delete WebInspector.Dialog._instance;
-document.body.removeChild(this._glassPaneElement);
+this._glassPane.dispose();
 window.removeEventListener("resize", this._windowResizeHandler, true);
 },
 
@@ -45045,22 +48998,18 @@
 
 WebInspector.GoToLineDialog.install = function(panel, viewGetter)
 {
-function showGoToLineDialog()
-{
-var view = viewGetter();
-if (view)
-WebInspector.GoToLineDialog._show(view);
-}
-
 var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
-panel.registerShortcuts([goToLineShortcut], showGoToLineDialog);
+panel.registerShortcuts([goToLineShortcut], WebInspector.GoToLineDialog._show.bind(null, viewGetter));
 }
 
-WebInspector.GoToLineDialog._show = function(sourceView)
+
+WebInspector.GoToLineDialog._show = function(viewGetter, event)
 {
+var sourceView = viewGetter();
 if (!sourceView || !sourceView.canHighlightLine())
-return;
+return false;
 WebInspector.Dialog.show(sourceView.element, new WebInspector.GoToLineDialog(sourceView));
+return true;
 }
 
 
@@ -45256,6 +49205,8 @@
 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.General, WebInspector.UIString("General"), new WebInspector.GenericSettingsTab());
 if (!WebInspector.experimentsSettings.showOverridesInDrawer.isEnabled())
 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Overrides, WebInspector.UIString("Overrides"), new WebInspector.OverridesSettingsTab());
+if (WebInspector.experimentsSettings.fileSystemProject.isEnabled())
+this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace, WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab());
 if (WebInspector.experimentsSettings.experimentsEnabled)
 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments, WebInspector.UIString("Experiments"), new WebInspector.ExperimentsSettingsTab());
 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView());
@@ -45270,6 +49221,7 @@
 WebInspector.SettingsScreen.Tabs = {
 General: "general",
 Overrides: "overrides",
+Workspace: "workspace",
 Experiments: "experiments",
 Shortcuts: "shortcuts"
 }
@@ -45425,6 +49377,35 @@
 return pp;
 },
 
+
+_createInputSetting: function(label, setting, numeric, maxLength, width, validatorCallback)
+{
+var fieldset = document.createElement("fieldset");
+var p = fieldset.createChild("p");
+var labelElement = p.createChild("label");
+labelElement.textContent = label + " ";
+var inputElement = labelElement.createChild("input");
+inputElement.value = setting.get();
+inputElement.type = "text";
+if (numeric)
+inputElement.className = "numeric";
+if (maxLength)
+inputElement.maxLength = maxLength;
+if (width)
+inputElement.style.width = width;
+
+function onBlur()
+{
+if (validatorCallback && !validatorCallback(inputElement.value)) {
+inputElement.value = setting.get();
+return;
+}
+setting.set(numeric ? Number(inputElement.value) : inputElement.value);
+}
+inputElement.addEventListener("blur", onBlur, false);
+return fieldset;
+},
+
 _createCustomSetting: function(name, element)
 {
 var p = document.createElement("p");
@@ -45444,8 +49425,7 @@
 WebInspector.SettingsTab.call(this, WebInspector.UIString("General"));
 
 var p = this._appendSection();
-if (Preferences.exposeDisableCache)
-p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled));
+p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache (while DevTools is open)"), WebInspector.settings.cacheDisabled));
 var disableJSElement = this._createCheckboxSetting(WebInspector.UIString("Disable JavaScript"), WebInspector.settings.javaScriptDisabled);
 p.appendChild(disableJSElement);
 WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged, this);
@@ -45454,6 +49434,7 @@
 
 p = this._appendSection(WebInspector.UIString("Appearance"));
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show toolbar icons"), WebInspector.settings.showToolbarIcons));
+p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Split panels vertically when docked to right"), WebInspector.settings.splitVerticallyWhenDockedToRight));
 
 p = this._appendSection(WebInspector.UIString("Elements"));
 p.appendChild(this._createRadioSetting(WebInspector.UIString("Color format"), [
@@ -45470,22 +49451,28 @@
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects));
 WebInspector.settings.showPaintRects.addChangeListener(this._showPaintRectsChanged, this);
 
+p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show composited layer borders"), WebInspector.settings.showDebugBorders));
+WebInspector.settings.showDebugBorders.addChangeListener(this._showDebugBordersChanged, this);
+
 if (Capabilities.canShowFPSCounter) {
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show FPS meter"), WebInspector.settings.showFPSCounter));
 WebInspector.settings.showFPSCounter.addChangeListener(this._showFPSCounterChanged, this);
 }
+if (Capabilities.canContinuouslyPaint) {
+p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable continuous page repainting"), WebInspector.settings.continuousPainting));
+WebInspector.settings.continuousPainting.addChangeListener(this._continuousPaintingChanged, this);
+}
 
 p = this._appendSection(WebInspector.UIString("Sources"));
-p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show folders"), WebInspector.settings.showScriptFolders));
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts));
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled));
 if (WebInspector.experimentsSettings.isEnabled("sass"))
 p.appendChild(this._createCSSAutoReloadControls());
 var indentationElement = this._createSelectSetting(WebInspector.UIString("Indentation"), [
-[ WebInspector.UIString("2 spaces"), WebInspector.TextEditorModel.Indent.TwoSpaces ],
-[ WebInspector.UIString("4 spaces"), WebInspector.TextEditorModel.Indent.FourSpaces ],
-[ WebInspector.UIString("8 spaces"), WebInspector.TextEditorModel.Indent.EightSpaces ],
-[ WebInspector.UIString("Tab character"), WebInspector.TextEditorModel.Indent.TabCharacter ]
+[ WebInspector.UIString("2 spaces"), WebInspector.TextUtils.Indent.TwoSpaces ],
+[ WebInspector.UIString("4 spaces"), WebInspector.TextUtils.Indent.FourSpaces ],
+[ WebInspector.UIString("8 spaces"), WebInspector.TextUtils.Indent.EightSpaces ],
+[ WebInspector.UIString("Tab character"), WebInspector.TextUtils.Indent.TabCharacter ]
 ], WebInspector.settings.textEditorIndent);
 indentationElement.firstChild.className = "toplevel";
 p.appendChild(indentationElement);
@@ -45495,10 +49482,15 @@
 if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled())
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show uninstrumented native memory"), WebInspector.settings.showNativeSnapshotUninstrumentedSize));
 
-if (Capabilities.timelineCanMonitorMainThread) {
 p = this._appendSection(WebInspector.UIString("Timeline"));
+var checkbox = this._createCheckboxSetting(WebInspector.UIString("Limit number of captured JS stack frames"), WebInspector.settings.timelineLimitStackFramesFlag);
+p.appendChild(checkbox);
+var fieldset = this._createInputSetting(WebInspector.UIString("Frames to capture"), WebInspector.settings.timelineStackFramesToCapture, true, 2, "2em");
+fieldset.disabled = !WebInspector.settings.timelineLimitStackFramesFlag.get();
+WebInspector.settings.timelineLimitStackFramesFlag.addChangeListener(this._timelineLimitStackFramesChanged.bind(this, fieldset));
+checkbox.appendChild(fieldset);
+
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show CPU activity on the ruler"), WebInspector.settings.showCpuOnTimelineRuler));
-}
 
 p = this._appendSection(WebInspector.UIString("Console"));
 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Log XMLHttpRequests"), WebInspector.settings.monitoringXHREnabled));
@@ -45517,11 +49509,27 @@
 PageAgent.setShowPaintRects(WebInspector.settings.showPaintRects.get());
 },
 
+_showDebugBordersChanged: function()
+{
+PageAgent.setShowDebugBorders(WebInspector.settings.showDebugBorders.get());
+},
+
 _showFPSCounterChanged: function()
 {
 PageAgent.setShowFPSCounter(WebInspector.settings.showFPSCounter.get());
 },
 
+_continuousPaintingChanged: function()
+{
+PageAgent.setContinuousPaintingEnabled(WebInspector.settings.continuousPainting.get());
+},
+
+
+_timelineLimitStackFramesChanged: function(fieldset)
+{
+fieldset.disabled = !WebInspector.settings.timelineLimitStackFramesFlag.get();
+},
+
 _updateScriptDisabledCheckbox: function()
 {
 function executionStatusCallback(error, status)
@@ -45562,17 +49570,9 @@
 checkboxElement.addEventListener("click", checkboxClicked, false);
 labelElement.appendChild(document.createTextNode(WebInspector.UIString("Auto-reload CSS upon Sass save")));
 
-var fieldsetElement = fragment.createChild("fieldset");
+var fieldsetElement = this._createInputSetting(WebInspector.UIString("Timeout (ms)"), WebInspector.settings.cssReloadTimeout, true, 8, "60px", validateReloadTimeout);
 fieldsetElement.disabled = !checkboxElement.checked;
-var p = fieldsetElement.createChild("p");
-p.appendChild(document.createTextNode(WebInspector.UIString("Timeout (ms)")));
-p.appendChild(document.createTextNode(" "));
-var timeoutInput = p.createChild("input");
-timeoutInput.value = WebInspector.settings.cssReloadTimeout.get();
-timeoutInput.className = "numeric";
-timeoutInput.style.width = "60px";
-timeoutInput.maxLength = 8;
-timeoutInput.addEventListener("blur", blurListener, false);
+fragment.appendChild(fieldsetElement);
 return fragment;
 
 function checkboxClicked()
@@ -45582,14 +49582,9 @@
 fieldsetElement.disabled = !reloadEnabled;
 }
 
-function blurListener()
+function validateReloadTimeout(value)
 {
-var value = timeoutInput.value;
-if (!isFinite(value) || value <= 0) {
-timeoutInput.value = WebInspector.settings.cssReloadTimeout.get();
-return;
-}
-WebInspector.settings.cssReloadTimeout.set(Number(value));
+return isFinite(value) && value > 0;
 }
 },
 
@@ -45602,7 +49597,7 @@
 WebInspector.SettingsTab.call(this, WebInspector.UIString("Overrides"), "overrides-tab-content");
 this._view = new WebInspector.OverridesView();
 this.containerElement.parentElement.appendChild(this._view.containerElement);
-this.containerElement.remove();
+this.containerElement.removeSelf();
 this.containerElement = this._view.containerElement;
 }
 
@@ -45611,6 +49606,191 @@
 }
 
 
+WebInspector.WorkspaceSettingsTab = function()
+{
+WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "workspace-tab-content");
+this._reset();
+}
+
+WebInspector.WorkspaceSettingsTab.prototype = {
+wasShown: function()
+{
+WebInspector.SettingsTab.prototype.wasShown.call(this);
+this._reset();
+},
+
+_reset: function()
+{
+this.containerElement.removeChildren();
+this._createFileSystemsEditor();
+this._createFileMappingEditor();
+},
+
+_createFileSystemsEditor: function()
+{
+var p = this._appendSection(WebInspector.UIString("File systems"));
+this._fileSystemsEditor = p.createChild("p", "file-systems-editor");
+
+this._addFileSystemRowElement = this._fileSystemsEditor.createChild("div", "workspace-settings-row");
+var addFileSystemButton = this._addFileSystemRowElement.createChild("input", "file-system-add-button");
+addFileSystemButton.type = "button";
+addFileSystemButton.value = WebInspector.UIString("Add file system");
+addFileSystemButton.addEventListener("click", this._addFileSystemClicked.bind(this));
+
+var fileSystemPaths = WebInspector.isolatedFileSystemManager.mapping().fileSystemPaths();
+for (var i = 0; i < fileSystemPaths.length; ++i)
+this._addFileSystemRow(fileSystemPaths[i]);
+
+return this._fileSystemsEditor;
+},
+
+
+_createShowTextInput: function(className, value)
+{
+var inputElement = document.createElement("input");
+inputElement.addStyleClass(className);
+inputElement.type = "text";
+inputElement.value = value;
+inputElement.title = value;
+inputElement.disabled = true;
+return inputElement;
+},
+
+
+_createEditTextInput: function(className, placeHolder)
+{
+var inputElement = document.createElement("input");
+inputElement.addStyleClass(className);
+inputElement.type = "text";
+inputElement.placeholder = placeHolder;
+return inputElement;
+},
+
+
+_createRemoveButton: function(handler)
+{
+var removeButton = document.createElement("button");
+removeButton.addStyleClass("button");
+removeButton.addStyleClass("remove-button");
+removeButton.value = WebInspector.UIString("Remove");
+removeButton.addEventListener("click", handler, false);
+return removeButton;
+},
+
+
+_createAddButton: function(handler)
+{
+var addButton = document.createElement("button");
+addButton.addStyleClass("button");
+addButton.addStyleClass("add-button");
+addButton.value = WebInspector.UIString("Add");
+addButton.addEventListener("click", handler, false);
+return addButton;
+},
+
+
+_addFileSystemRow: function(fileSystemPath)
+{
+var fileSystemRow = document.createElement("div");
+fileSystemRow.addStyleClass("workspace-settings-row");
+fileSystemRow.addStyleClass("file-system-row");
+this._fileSystemsEditor.insertBefore(fileSystemRow, this._addFileSystemRowElement);
+
+fileSystemRow.appendChild(this._createShowTextInput("file-system-path", fileSystemPath));
+var removeFileSystemButton = this._createRemoveButton(removeFileSystemClicked.bind(this));
+fileSystemRow.appendChild(removeFileSystemButton);
+
+function removeFileSystemClicked()
+{
+removeFileSystemButton.disabled = true;
+WebInspector.isolatedFileSystemManager.removeFileSystem(fileSystemPath, fileSystemRemoved.bind(this));
+}
+
+function fileSystemRemoved()
+{
+this._fileSystemsEditor.removeChild(fileSystemRow);
+removeFileSystemButton.disabled = false;
+}
+},
+
+_addFileSystemClicked: function()
+{
+WebInspector.isolatedFileSystemManager.addFileSystem(this._fileSystemAdded.bind(this));
+},
+
+
+_fileSystemAdded: function(fileSystemPath)
+{
+if (fileSystemPath)
+this._addFileSystemRow(fileSystemPath);
+},
+
+_createFileMappingEditor: function()
+{
+var p = this._appendSection(WebInspector.UIString("Mappings"));
+this._fileMappingEditor = p.createChild("p", "file-mappings-editor");
+
+this._addMappingRowElement = this._fileMappingEditor.createChild("div", "workspace-settings-row");
+
+this._urlInputElement = this._createEditTextInput("file-mapping-url", WebInspector.UIString("File mapping url"));
+this._addMappingRowElement.appendChild(this._urlInputElement);
+this._pathInputElement = this._createEditTextInput("file-mapping-path", WebInspector.UIString("File mapping path"));
+this._addMappingRowElement.appendChild(this._pathInputElement);
+
+this._addMappingRowElement.appendChild(this._createAddButton(this._addFileMappingClicked.bind(this)));
+
+var mappingEntries = WebInspector.fileMapping.mappingEntries();
+for (var i = 0; i < mappingEntries.length; ++i)
+this._addMappingRow(mappingEntries[i]);
+
+return this._fileMappingEditor;
+},
+
+
+_addMappingRow: function(mappingEntry)
+{
+var fileMappingRow = document.createElement("div");
+fileMappingRow.addStyleClass("workspace-settings-row");
+this._fileMappingEditor.insertBefore(fileMappingRow, this._addMappingRowElement);
+
+fileMappingRow.appendChild(this._createShowTextInput("file-mapping-url", mappingEntry.urlPrefix));
+fileMappingRow.appendChild(this._createShowTextInput("file-mapping-path", mappingEntry.pathPrefix));
+
+fileMappingRow.appendChild(this._createRemoveButton(removeMappingClicked.bind(this)));
+
+function removeMappingClicked()
+{
+var index = Array.prototype.slice.call(fileMappingRow.parentElement.childNodes).indexOf(fileMappingRow);
+var mappingEntries = WebInspector.fileMapping.mappingEntries();
+mappingEntries.splice(index, 1);
+WebInspector.fileMapping.setMappingEntries(mappingEntries);
+this._fileMappingEditor.removeChild(fileMappingRow);
+}
+},
+
+_addFileMappingClicked: function()
+{
+var url = this._urlInputElement.value;
+var path = this._pathInputElement.value;
+if (!url || !path)
+return;
+var mappingEntries = WebInspector.fileMapping.mappingEntries();
+if (url[url.length - 1] !== "/")
+url += "/";
+if (path[path.length - 1] !== "/")
+path += "/";
+var mappingEntry = new WebInspector.FileMapping.Entry(url, path);
+mappingEntries.push(mappingEntry);
+WebInspector.fileMapping.setMappingEntries(mappingEntries);
+this._addMappingRow(mappingEntry);
+this._urlInputElement.value = "";
+this._pathInputElement.value = "";
+},
+
+__proto__: WebInspector.SettingsTab.prototype
+}
+
+
 WebInspector.ExperimentsSettingsTab = function()
 {
 WebInspector.SettingsTab.call(this, WebInspector.UIString("Experiments"), "experiments-tab-content");
@@ -45905,11 +50085,8 @@
 var container = paneContent.createChild("div", "help-container-wrapper").createChild("div", "settings-tab help-content help-container");
 this.containerElement = container;
 appendBlockTo(container, this._createUserAgentControl());
-if (Capabilities.canOverrideDeviceMetrics)
 appendBlockTo(container, this._createDeviceMetricsControl());
-if (Capabilities.canOverrideGeolocation)
 appendBlockTo(container, this._createGeolocationOverrideControl());
-if (Capabilities.canOverrideDeviceOrientation)
 appendBlockTo(container, this._createDeviceOrientationOverrideControl());
 appendBlockTo(container, this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents));
 appendBlockTo(container, this._createMediaEmulationElement());
@@ -46080,7 +50257,7 @@
 this._otherUserAgentElement.focus();
 }
 
-if (isUserGesture && Capabilities.canOverrideDeviceMetrics) {
+if (isUserGesture) {
 var metrics = this._selectElement.options[this._selectElement.selectedIndex]._metrics;
 this._setDeviceMetricsOverride(WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(metrics), false, true);
 }
@@ -46930,7 +51107,7 @@
 this._lastCookie.setSize(keyValue.position - this._lastCookiePosition);
 
 
-this._lastCookie = keyValue.value ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
+this._lastCookie = typeof keyValue.value === "string" ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
 new WebInspector.Cookie("", keyValue.key, type);
 this._lastCookiePosition = keyValue.position;
 this._cookies.push(this._lastCookie);
@@ -47064,6 +51241,12 @@
 addAttribute: function(key, value)
 {
 this._attributes[key.toLowerCase()] = value;
+},
+
+
+remove: function(callback)
+{
+PageAgent.deleteCookie(this.name(), (this.secure() ? "https://" : "http://") + this.domain() + this.path(), callback);
 }
 }
 
@@ -47075,6 +51258,7 @@
 
 WebInspector.Cookies = {}
 
+
 WebInspector.Cookies.getCookiesAsync = function(callback)
 {
 
@@ -47082,38 +51266,13 @@
 {
 if (error)
 return;
-if (cookiesString)
-callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
-else
-callback(cookies.map(WebInspector.Cookies.buildCookieProtocolObject), true);
+callback(cookies.map(WebInspector.Cookies.buildCookieProtocolObject));
 }
 
 PageAgent.getCookies(mycallback);
 }
 
 
-WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
-{
-var rawCookies = rawCookieString.split(/;\s*/);
-var cookies = [];
-
-if (!(/^\s*$/.test(rawCookieString))) {
-for (var i = 0; i < rawCookies.length; ++i) {
-var rawCookie = rawCookies[i];
-var delimIndex = rawCookie.indexOf("=");
-var name = rawCookie.substring(0, delimIndex);
-var value = rawCookie.substring(delimIndex + 1);
-var size = name.length + value.length;
-var cookie = new WebInspector.Cookie(name, value, null);
-cookie.setSize(size);
-cookies.push(cookie);
-}
-}
-
-return cookies;
-}
-
-
 WebInspector.Cookies.buildCookieProtocolObject = function(protocolCookie)
 {
 var cookie = new WebInspector.Cookie(protocolCookie.name, protocolCookie.value, null);
@@ -47162,8 +51321,16 @@
 this._dropdownButton = document.getElementById("toolbar-dropdown-arrow");
 this._dropdownButton.addEventListener("click", this._toggleDropdown.bind(this), false);
 
+this._panelsMenuButton = document.getElementById("toolbar-panels-menu");
+if (this._isToolbarCustomizable()) {
+this._panelsMenuButton.addEventListener("mousedown", this._togglePanelsMenu.bind(this), false);
+this._panelsMenuButton.removeStyleClass("hidden");
+}
+
 document.getElementById("close-button-left").addEventListener("click", this._onClose, true);
 document.getElementById("close-button-right").addEventListener("click", this._onClose, true);
+
+this._panelDescriptors = [];
 }
 
 WebInspector.Toolbar.prototype = {
@@ -47175,25 +51342,161 @@
 
 addPanel: function(panelDescriptor)
 {
-this.element.appendChild(this._createPanelToolbarItem(panelDescriptor));
+this._panelDescriptors.push(panelDescriptor);
+panelDescriptor._toolbarElement = this._createPanelToolbarItem(panelDescriptor);
+if (!this._isToolbarCustomizable() || this._isPanelVisible(panelDescriptor.name()))
+this.element.insertBefore(panelDescriptor._toolbarElement, this._panelInsertLocation(panelDescriptor));
+this._updateAddPanelState();
 this.resize();
 },
 
 
-_createPanelToolbarItem: function(panelDescriptor)
+_panelInsertLocation: function(panelDescriptor)
+{
+var newPanelElement = document.getElementById("toolbar-panels-menu").parentElement;
+if (!this._isToolbarCustomizable())
+return newPanelElement;
+
+if (this._isDefaultPanel(panelDescriptor.name()))
+return this._firstNonDefaultPanel || newPanelElement;
+
+if (!this._firstNonDefaultPanel)
+this._firstNonDefaultPanel = panelDescriptor._toolbarElement;
+return newPanelElement;
+},
+
+
+_isDefaultPanel: function(name)
+{
+var defaultPanels = {
+"elements": true,
+"resources": true,
+"scripts": true,
+"console": true,
+"network": true,
+"timeline": true,
+};
+return !!defaultPanels[name];
+},
+
+
+_isPanelVisibleByDefault: function(name)
+{
+var visible = {
+"elements": true,
+"console": true,
+"network": true,
+"scripts": true,
+"timeline": true,
+"profiles": true,
+"cpu-profiler": true,
+"heap-profiler": true,
+"audits": true,
+"resources": true,
+};
+return !!visible[name];
+},
+
+
+_isToolbarCustomizable: function()
+{
+return WebInspector.experimentsSettings.customizableToolbar.isEnabled();
+},
+
+
+_isPanelVisible: function(name)
+{
+if (!this._isToolbarCustomizable())
+return true;
+var visiblePanels = WebInspector.settings.visiblePanels.get();
+return visiblePanels.hasOwnProperty(name) ? visiblePanels[name] : this._isPanelVisibleByDefault(name);
+},
+
+
+_setPanelVisible: function(name, visible)
+{
+var visiblePanels = WebInspector.settings.visiblePanels.get();
+visiblePanels[name] = visible;
+WebInspector.settings.visiblePanels.set(visiblePanels);
+},
+
+
+_hidePanel: function(panelDescriptor)
+{
+if (!this._isPanelVisible(panelDescriptor.name()))
+return;
+var switchToSibling = panelDescriptor._toolbarElement.nextSibling;
+if (!switchToSibling || !switchToSibling.classList.contains("toggleable"))
+switchToSibling = panelDescriptor._toolbarElement.previousSibling;
+if (!switchToSibling || !switchToSibling.classList || !switchToSibling.classList.contains("toggleable"))
+return;
+this._setPanelVisible(panelDescriptor.name(), false);
+this.element.removeChild(panelDescriptor._toolbarElement);
+if (WebInspector.inspectorView.currentPanel().name === panelDescriptor.name()) {
+for (var i = 0; i < this._panelDescriptors.length; ++i) {
+var descr = this._panelDescriptors[i];
+if (descr._toolbarElement === switchToSibling) {
+WebInspector.showPanel(descr.name());
+break;
+}
+}
+}
+document.getElementById("toolbar-panels-menu").removeStyleClass("disabled");
+this.resize();
+},
+
+_updateAddPanelState: function()
+{
+if (this._panelDescriptors.every(function (descr) { return this._isPanelVisible(descr.name()); }, this))
+document.getElementById("toolbar-panels-menu").addStyleClass("disabled");
+else
+document.getElementById("toolbar-panels-menu").removeStyleClass("disabled");
+},
+
+
+_showPanel: function(panelDescriptor)
+{
+if (this._isPanelVisible(panelDescriptor.name()))
+return;
+this.element.insertBefore(panelDescriptor._toolbarElement, document.getElementById("toolbar-panels-menu").parentElement);
+panelDescriptor._toolbarElement.removeStyleClass("hidden");
+this._setPanelVisible(panelDescriptor.name(), true);
+this._updateAddPanelState();
+this.resize();
+},
+
+
+_createPanelToolbarItem: function(panelDescriptor, noCloseButton)
 {
 var toolbarItem = document.createElement("button");
 toolbarItem.className = "toolbar-item toggleable";
 toolbarItem.panelDescriptor = panelDescriptor;
 toolbarItem.addStyleClass(panelDescriptor.name());
 
+
+function onContextMenuEvent(event)
+{
+var contextMenu = new WebInspector.ContextMenu(event);
+contextMenu.appendItem(WebInspector.UIString("Close"), this._hidePanel.bind(this, panelDescriptor));
+contextMenu.show();
+}
+if (!this._isDefaultPanel(panelDescriptor.name()))
+toolbarItem.addEventListener("contextmenu", onContextMenuEvent.bind(this), true);
+
 function onToolbarItemClicked()
 {
+this._showPanel(panelDescriptor);
 this._updateDropdownButtonAndHideDropdown();
 WebInspector.inspectorView.setCurrentPanel(panelDescriptor.panel());
 }
 toolbarItem.addEventListener("click", onToolbarItemClicked.bind(this), false);
 
+function onToolbarItemCloseButtonClicked(event)
+{
+event.stopPropagation();
+this._hidePanel(panelDescriptor);
+}
+
 function panelSelected()
 {
 if (WebInspector.inspectorView.currentPanel() && panelDescriptor.name() === WebInspector.inspectorView.currentPanel().name)
@@ -47205,6 +51508,11 @@
 
 var iconElement = toolbarItem.createChild("div", "toolbar-icon");
 toolbarItem.createChild("div", "toolbar-label").textContent = panelDescriptor.title();
+if (this._isToolbarCustomizable() && !this._isDefaultPanel(panelDescriptor.name()) && !noCloseButton) {
+var closeButton = toolbarItem.createChild("div", "toolbar-item-close-button");
+closeButton.textContent = "\u00d7";
+closeButton.addEventListener("click", onToolbarItemCloseButtonClicked.bind(this), false);
+}
 if (panelDescriptor.iconURL()) {
 iconElement.addStyleClass("custom-toolbar-icon");
 iconElement.style.backgroundImage = "url(" + panelDescriptor.iconURL() + ")";
@@ -47214,15 +51522,21 @@
 },
 
 
-setDockedToBottom: function(dockedToBottom)
+_isDockedToBottom: function()
 {
-this._isDockedToBottom = dockedToBottom;
+return !!WebInspector.dockController && WebInspector.dockController.dockSide() == WebInspector.DockController.State.DockedToBottom;
+},
+
+
+_isUndocked: function()
+{
+return !!WebInspector.dockController && WebInspector.dockController.dockSide() == WebInspector.DockController.State.Undocked;
 },
 
 
 _toolbarDragStart: function(event)
 {
-if ((!this._isDockedToBottom && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt")
+if (this._isUndocked())
 return false;
 
 var target = event.target;
@@ -47232,36 +51546,60 @@
 if (target !== this.element && !target.hasStyleClass("toolbar-item"))
 return false;
 
-this.element.lastScreenX = event.screenX;
-this.element.lastScreenY = event.screenY;
+this._lastScreenX = event.screenX;
+this._lastScreenY = event.screenY;
+this._lastHeightDuringDrag = window.innerHeight;
+this._startDistanceToRight = window.innerWidth - event.clientX;
+this._startDinstanceToBottom = window.innerHeight - event.clientY;
 return true;
 },
 
 _toolbarDragEnd: function(event)
 {
-delete this.element.lastScreenX;
-delete this.element.lastScreenY;
+
+
+this._toolbarDrag(event);
+delete this._lastScreenX;
+delete this._lastScreenY;
+delete this._lastHeightDuringDrag;
+delete this._startDistanceToRight;
+delete this._startDinstanceToBottom;
 },
 
 _toolbarDrag: function(event)
 {
-if (this._isDockedToBottom) {
-var height = window.innerHeight - (event.screenY - this.element.lastScreenY);
-
-InspectorFrontendHost.setAttachedWindowHeight(height);
-} else {
-var x = event.screenX - this.element.lastScreenX;
-var y = event.screenY - this.element.lastScreenY;
-
-
-
-InspectorFrontendHost.moveWindowBy(x, y);
-}
-
-this.element.lastScreenX = event.screenX;
-this.element.lastScreenY = event.screenY;
-
 event.preventDefault();
+
+if (this._isUndocked())
+return this._toolbarDragMoveWindow(event);
+
+return this._toolbarDragChangeDocking(event);
+},
+
+_toolbarDragMoveWindow: function(event)
+{
+var x = event.screenX - this._lastScreenX;
+var y = event.screenY - this._lastScreenY;
+this._lastScreenX = event.screenX;
+this._lastScreenY = event.screenY;
+InspectorFrontendHost.moveWindowBy(x, y);
+},
+
+_toolbarDragChangeDocking: function(event)
+{
+if (this._isDockedToBottom()) {
+var distanceToRight = window.innerWidth - event.clientX;
+if (distanceToRight < this._startDistanceToRight * 2 / 3) {
+InspectorFrontendHost.requestSetDockSide(WebInspector.DockController.State.DockedToRight);
+return true;
+}
+} else {
+var distanceToBottom = window.innerHeight - event.clientY;
+if (distanceToBottom < this._startDinstanceToBottom * 2 / 3) {
+InspectorFrontendHost.requestSetDockSide(WebInspector.DockController.State.DockedToBottom);
+return true;
+}
+}
 },
 
 _onClose: function()
@@ -47287,6 +51625,25 @@
 this._setDropdownVisible(!this._dropdown || !this._dropdown.visible);
 },
 
+_togglePanelsMenu: function(event)
+{
+function activatePanel(panelDescriptor)
+{
+this._showPanel(panelDescriptor);
+WebInspector.showPanel(panelDescriptor.name());
+}
+
+var contextMenu = new WebInspector.ContextMenu(event);
+for (var i = 0; i < this._panelDescriptors.length; ++i) {
+var descr = this._panelDescriptors[i];
+if (this._isPanelVisible(descr.name()))
+continue;
+contextMenu.appendItem(descr.title(), activatePanel.bind(this, descr));
+}
+
+contextMenu.showSoftMenu();
+},
+
 _updateDropdownButtonAndHideDropdown: function()
 {
 WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateDropdownButtonAndHideDropdown);
@@ -47349,9 +51706,24 @@
 {
 var toolbarItems = this._toolbar.element.querySelectorAll(".toolbar-item.toggleable");
 
+var needsSeparator = false;
 for (var i = 0; i < toolbarItems.length; ++i) {
-if (toolbarItems[i].offsetTop > 1)
-this._contentElement.appendChild(this._toolbar._createPanelToolbarItem(toolbarItems[i].panelDescriptor));
+if (toolbarItems[i].offsetTop >= toolbarItems[0].offsetHeight) {
+this._contentElement.appendChild(this._toolbar._createPanelToolbarItem(toolbarItems[i].panelDescriptor, true));
+needsSeparator = true;
+}
+}
+
+var panelDescriptors = this._toolbar._panelDescriptors;
+for (var i = 0; i < panelDescriptors.length; ++i) {
+var descr = panelDescriptors[i];
+if (this._toolbar._isPanelVisible(descr.name()))
+continue;
+if (needsSeparator) {
+this._contentElement.createChild("div", "toolbar-items-separator");
+needsSeparator = false;
+}
+this._contentElement.appendChild(this._toolbar._createPanelToolbarItem(descr, true));
 }
 },
 
@@ -47583,9 +51955,12 @@
 WebInspector.inspectorView.setFooterElement(this._element);
 this._updateReplaceVisibility();
 this._updateFilterVisibility();
+if (WebInspector.currentFocusElement() !== this._searchInputElement) {
 var selection = window.getSelection();
 if (selection.rangeCount)
 this._searchInputElement.value = selection.toString().replace(/\r?\n.*/, "");
+}
+this._performSearch(this._searchInputElement.value, true, false);
 this._searchInputElement.focus();
 this._searchInputElement.select();
 this._searchIsVisible = true;
@@ -47789,6 +52164,58 @@
 
 
 
+WebInspector.InspectElementModeController = function()
+{
+this.toggleSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
+this.toggleSearchButton.addEventListener("click", this.toggleSearch, this);
+this._shortcut = WebInspector.InspectElementModeController.createShortcut();
+}
+
+WebInspector.InspectElementModeController.createShortcut = function()
+{
+return WebInspector.KeyboardShortcut.makeDescriptor("c", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift);
+}
+
+WebInspector.InspectElementModeController.prototype = {
+enabled: function()
+{
+return this.toggleSearchButton.toggled;
+},
+
+disable: function()
+{
+if (this.enabled())
+this.toggleSearch();
+},
+
+toggleSearch: function()
+{
+var enabled = !this.enabled();
+
+function callback(error)
+{
+if (!error)
+this.toggleSearchButton.toggled = enabled;
+}
+WebInspector.domAgent.setInspectModeEnabled(enabled, callback.bind(this));
+},
+
+
+handleShortcut: function(event)
+{
+if (WebInspector.KeyboardShortcut.makeKeyFromEvent(event) !== this._shortcut.key)
+return false;
+this.toggleSearch();
+event.consume(true);
+return true;
+}
+}
+
+
+
+
+
+
 WebInspector.WorkerManager = function()
 {
 this._workerIdToWindow = {};
@@ -47848,11 +52275,6 @@
 {
 window.opener.postMessage({workerId: workerId, command: "sendMessageToBackend", message: message}, "*");
 }
-
-InspectorFrontendHost.loaded = function()
-{
-window.opener.postMessage({workerId: workerId, command: "loaded"}, "*");
-}
 }
 
 WebInspector.WorkerManager._calculateWorkerInspectorTitle = function()
@@ -47924,8 +52346,11 @@
 url += "&workerPaused=true";
 url = url.replace("docked=true&", "");
 url += hash;
+var width = WebInspector.settings.workerInspectorWidth.get();
+var height = WebInspector.settings.workerInspectorHeight.get();
 
-var workerInspectorWindow = window.open(url, undefined, "location=0");
+var workerInspectorWindow = window.open(url, undefined, "location=0,width=" + width + ",height=" + height);
+workerInspectorWindow.addEventListener("resize", this._onWorkerInspectorResize.bind(this, workerInspectorWindow), false);
 this._workerIdToWindow[workerId] = workerInspectorWindow;
 workerInspectorWindow.addEventListener("beforeunload", this._workerInspectorClosing.bind(this, workerId), true);
 
@@ -47957,6 +52382,13 @@
 }
 },
 
+_onWorkerInspectorResize: function(workerInspectorWindow)
+{
+var doc = workerInspectorWindow.document;
+WebInspector.settings.workerInspectorWidth.set(doc.width);
+WebInspector.settings.workerInspectorHeight.set(doc.height);
+},
+
 _workerInspectorClosing: function(workerId, event)
 {
 if (event.target.location.href === "about:blank")
@@ -48177,10 +52609,9 @@
 },
 
 
-contextByFrameAndSecurityOrigin: function(frame, securityOrigin)
+contextListByFrame: function(frame)
 {
-var frameContext = this._frameIdToContextList[frame.id];
-return frameContext && frameContext.contextBySecurityOrigin(securityOrigin);
+return this._frameIdToContextList[frame.id];
 },
 
 _frameAdded: function(event)
@@ -48345,7 +52776,8 @@
 }
 var includeCommandLineAPI = (!dotNotation && !bracketNotation);
 if (includeCommandLineAPI) {
-const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear"];
+const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear",
+"getEventListeners", "table", "$", "$$", "$x"];
 for (var i = 0; i < commandLineAPI.length; ++i)
 propertyNames[commandLineAPI[i]] = true;
 }
@@ -48466,6 +52898,11 @@
 return this._executionContexts;
 },
 
+mainWorldContext: function() 
+{
+return this._executionContexts[0];
+},
+
 
 contextBySecurityOrigin: function(securityOrigin)
 {
@@ -48588,7 +53025,7 @@
 }
 contextMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFrontendHost.copyText.bind(InspectorFrontendHost, contentProvider.contentURL()));
 
-if (!InspectorFrontendHost.canSave() || !contentProvider.contentURL())
+if (!contentProvider.contentURL())
 return;
 
 var contentType = contentProvider.contentType();
@@ -48847,21 +53284,22 @@
 
 
 
-WebInspector.ScriptSnippetModel = function(workspace, networkWorkspaceProvider)
+WebInspector.ScriptSnippetModel = function(workspace)
 {
 this._workspace = workspace;
-this._networkWorkspaceProvider = networkWorkspaceProvider;
+
 this._uiSourceCodeForScriptId = {};
 this._scriptForUISourceCode = new Map();
+
 this._uiSourceCodeForSnippetId = {};
 this._snippetIdForUISourceCode = new Map();
 
 this._snippetStorage = new WebInspector.SnippetStorage("script", "Script snippet #");
 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSetting("lastSnippetEvaluationIndex", 0);
 this._snippetScriptMapping = new WebInspector.SnippetScriptMapping(this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectDidReset, this._projectDidReset, this);
-this._loadSnippets();
+this._workspaceProvider = new WebInspector.SimpleWorkspaceProvider(this._workspace, WebInspector.projectTypes.Snippets);
+this.reset();
+WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
 }
 
 WebInspector.ScriptSnippetModel.prototype = {
@@ -48888,8 +53326,7 @@
 
 _addScriptSnippet: function(snippet)
 {
-this._networkWorkspaceProvider.addNetworkFile(snippet.name, new WebInspector.SnippetContentProvider(snippet), true, false, true);
-var uiSourceCode = this._workspace.uiSourceCodeForURL(snippet.name);
+var uiSourceCode = this._workspaceProvider.addFileByName("", snippet.name, new WebInspector.SnippetContentProvider(snippet), true);
 var scriptFile = new WebInspector.SnippetScriptFile(this, uiSourceCode);
 uiSourceCode.setScriptFile(scriptFile);
 this._snippetIdForUISourceCode.put(uiSourceCode, snippet.id);
@@ -48908,7 +53345,7 @@
 this._releaseSnippetScript(uiSourceCode);
 delete this._uiSourceCodeForSnippetId[snippet.id];
 this._snippetIdForUISourceCode.remove(uiSourceCode);
-this._networkWorkspaceProvider.removeFile(snippet.name);
+this._workspaceProvider.removeFileByName("", snippet.name);
 },
 
 
@@ -48921,7 +53358,6 @@
 return;
 snippet.name = newName;
 this._restoreBreakpoints(uiSourceCode, breakpointLocations);
-uiSourceCode.urlChanged(snippet.name);
 },
 
 
@@ -48971,7 +53407,7 @@
 
 
 
-if (WebInspector.debuggerModel.selectedCallFrame() || !Capabilities.separateScriptCompilationAndExecutionEnabled) {
+if (WebInspector.debuggerModel.selectedCallFrame()) {
 expression = uiSourceCode.workingCopy() + "\n//@ sourceURL=" + evaluationUrl + "\n";
 WebInspector.evaluateInConsole(expression, true);
 return;
@@ -49104,6 +53540,14 @@
 return script.rawLocationToUILocation(0, 0).uiSourceCode;
 },
 
+_debuggerReset: function()
+{
+for (var snippetId in this._uiSourceCodeForSnippetId) {
+var uiSourceCode = this._uiSourceCodeForSnippetId[snippetId];
+this._releaseSnippetScript(uiSourceCode);
+}
+},
+
 
 _evaluationSourceURL: function(uiSourceCode)
 {
@@ -49123,16 +53567,15 @@
 return snippetId;
 },
 
-_projectWillReset: function()
+reset: function()
 {
+
 this._uiSourceCodeForScriptId = {};
 this._scriptForUISourceCode = new Map();
+
 this._uiSourceCodeForSnippetId = {};
 this._snippetIdForUISourceCode = new Map();
-},
-
-_projectDidReset: function()
-{
+this._workspaceProvider.reset();
 this._loadSnippets();
 },
 
@@ -49169,6 +53612,16 @@
 return this._isDivergingFromVM;
 },
 
+checkMapping: function()
+{
+},
+
+
+isMergingToVM: function()
+{
+return false;
+},
+
 
 setIsDivergingFromVM: function(isDivergingFromVM)
 {
@@ -49198,7 +53651,7 @@
 
 rawLocationToUILocation: function(rawLocation)
 {
-var debuggerModelLocation =   rawLocation;
+var debuggerModelLocation =  (rawLocation);
 return this._scriptSnippetModel._rawLocationToUILocation(debuggerModelLocation);
 },
 
@@ -49209,6 +53662,12 @@
 },
 
 
+isIdentity: function()
+{
+return true;
+},
+
+
 snippetIdForSourceURL: function(sourceURL)
 {
 return this._scriptSnippetModel._snippetIdForSourceURL(sourceURL);
@@ -49442,13 +53901,16 @@
 
 
 
-WebInspector.StylesSourceMapping = function(workspace)
+WebInspector.StylesSourceMapping = function(cssModel, workspace)
 {
+this._cssModel = cssModel;
 this._workspace = workspace;
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this);
+this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
 
-this._uiSourceCodeForURL = {};
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
+this._initialize();
 }
 
 WebInspector.StylesSourceMapping.prototype = {
@@ -49456,43 +53918,82 @@
 rawLocationToUILocation: function(rawLocation)
 {
 var location =   (rawLocation);
-var uiSourceCode = this._uiSourceCodeForURL[location.url];
+var uiSourceCode = this._workspace.uiSourceCodeForURL(location.url);
 return new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0);
 },
 
 
 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
 {
-return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber);
+return new WebInspector.CSSLocation(uiSourceCode.url || "", lineNumber);
+},
+
+
+isIdentity: function()
+{
+return true;
+},
+
+_resourceAdded: function(event)
+{
+var resource =   (event.data);
+if (resource.contentType() !== WebInspector.resourceTypes.Stylesheet)
+return;
+if (!resource.url)
+return;
+var uiSourceCode = this._workspace.uiSourceCodeForURL(resource.url);
+if (!uiSourceCode)
+return;
+this._bindUISourceCode(uiSourceCode);
 },
 
 _uiSourceCodeAddedToWorkspace: function(event)
 {
 var uiSourceCode =   (event.data);
-if (!uiSourceCode.url || this._uiSourceCodeForURL[uiSourceCode.url])
-return;
 if (uiSourceCode.contentType() !== WebInspector.resourceTypes.Stylesheet)
 return;
-if (!WebInspector.resourceForURL(uiSourceCode.url))
+if (!uiSourceCode.url || !WebInspector.resourceForURL(uiSourceCode.url))
 return;
-
-this._addUISourceCode(uiSourceCode);
+this._bindUISourceCode(uiSourceCode);
 },
 
-
-_addUISourceCode: function(uiSourceCode)
+_bindUISourceCode: function(uiSourceCode)
 {
-this._uiSourceCodeForURL[uiSourceCode.url] = uiSourceCode;
+if (this._mappedURLs[uiSourceCode.url])
+return;
+this._mappedURLs[uiSourceCode.url] = true;
 uiSourceCode.setSourceMapping(this);
 var styleFile = new WebInspector.StyleFile(uiSourceCode);
 uiSourceCode.setStyleFile(styleFile);
-WebInspector.cssModel.setSourceMapping(uiSourceCode.url, this);
+this._cssModel.setSourceMapping(uiSourceCode.url, this);
 },
 
-_reset: function()
+_projectWillReset: function(event)
 {
-this._uiSourceCodeForURL = {};
-WebInspector.cssModel.resetSourceMappings();
+var project = event.data;
+var uiSourceCodes = project.uiSourceCodes();
+for (var i = 0; i < uiSourceCodes; ++i)
+delete this._mappedURLs[uiSourceCodes[i].url];
+},
+
+_initialize: function()
+{
+
+this._mappedURLs = {};
+},
+
+
+_mainFrameCreatedOrNavigated: function(event)
+{
+for (var mappedURL in this._mappedURLs) {
+var uiSourceCode = this._workspace.uiSourceCodeForURL(mappedURL);
+if (!uiSourceCode)
+continue;
+uiSourceCode.styleFile().dispose();
+uiSourceCode.setStyleFile(null);
+uiSourceCode.setSourceMapping(null);
+}
+this._initialize();
 }
 }
 
@@ -49556,13 +54057,19 @@
 this._uiSourceCode.addRevision(content);
 delete this._isAddingRevision;
 },
+
+dispose: function()
+{
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
+this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+}
 }
 
 
-
-WebInspector.StyleContentBinding = function(cssModel)
+WebInspector.StyleContentBinding = function(cssModel, workspace)
 {
 this._cssModel = cssModel;
+this._workspace = workspace;
 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
 }
 
@@ -49629,7 +54136,7 @@
 if (typeof styleSheetURL !== "string")
 return;
 
-var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(styleSheetURL);
+var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL);
 if (!uiSourceCode)
 return;
 
@@ -49649,13 +54156,12 @@
 
 
 
-WebInspector.NetworkUISourceCodeProvider = function(workspace, networkWorkspaceProvider)
+WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceProvider, workspace)
 {
-this._workspace = workspace;
 this._networkWorkspaceProvider = networkWorkspaceProvider;
+this._workspace = workspace;
 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
-this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectDidReset, this._projectDidReset, this);
+WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
 
 this._processedURLs = {};
@@ -49713,8 +54219,17 @@
 },
 
 
+_mainFrameNavigated: function(event)
+{
+this._reset();
+},
+
+
 _addFile: function(url, contentProvider, isContentScript)
 {
+if (this._workspace.hasMappingForURL(url))
+return;
+
 var type = contentProvider.contentType();
 if (type !== WebInspector.resourceTypes.Stylesheet && type !== WebInspector.resourceTypes.Document && type !== WebInspector.resourceTypes.Script)
 return;
@@ -49722,22 +54237,22 @@
 return;
 this._processedURLs[url] = true;
 var isEditable = type !== WebInspector.resourceTypes.Document;
-this._networkWorkspaceProvider.addNetworkFile(url, contentProvider, isEditable, isContentScript);
+this._networkWorkspaceProvider.addFileForURL(url, contentProvider, isEditable, isContentScript);
 },
 
-_projectWillReset: function()
+_reset: function()
 {
 this._processedURLs = {};
 this._lastDynamicAnonymousScriptIndexForURL = {};
-},
-
-_projectDidReset: function()
-{
+this._networkWorkspaceProvider.reset();
 this._populate();
 }
 }
 
 
+WebInspector.networkWorkspaceProvider = null;
+
+
 
 
 
@@ -49896,6 +54411,76 @@
 
 
 
+WebInspector.ProfilesPanelDescriptor = function()
+{
+WebInspector.PanelDescriptor.call(this, "profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
+}
+
+WebInspector.ProfilesPanelDescriptor.prototype = {
+__proto__: WebInspector.PanelDescriptor.prototype
+}
+
+WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)/;
+
+WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
+
+
+WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile = function(title)
+{
+return title.startsWith(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName);
+}
+
+
+WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex = function(title)
+{
+if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
+throw "Not user-initiated profile title.";
+var suffix = title.substring(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName.length + 1);
+return parseInt(suffix, 10);
+}
+
+
+WebInspector.ProfilesPanelDescriptor.resolveProfileTitle = function(title)
+{
+if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
+return title;
+return WebInspector.UIString("Profile %d", WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title));
+}
+
+
+WebInspector.ProfilesPanelDescriptor._openCPUProfile = function(event)
+{
+event.preventDefault();
+var panel = WebInspector.showPanel("profiles");
+var link =   (event.target);
+var view =   (panel.showProfile("CPU", link.profileUID));
+if (!view)
+return;
+if (typeof link.timeLeft === "number" && typeof link.timeRight === "number")
+view.selectRange(link.timeLeft, link.timeRight);
+}
+
+
+WebInspector.ProfilesPanelDescriptor.linkifyCPUProfile = function(uid, linkText, timeLeft, timeRight, tooltipText)
+{
+var link = document.createElement("a");
+link.innerText = linkText;
+link.href = WebInspector.UIString("show CPU profile");
+link.target = "_blank";
+if (tooltipText)
+link.title = tooltipText;
+link.timeLeft = timeLeft;
+link.timeRight = timeRight;
+link.profileUID = uid;
+link.addEventListener("click", WebInspector.ProfilesPanelDescriptor._openCPUProfile, true);
+return link;
+}
+
+
+
+
+
+
 WebInspector.ScriptsPanelDescriptor = function()
 {
 WebInspector.PanelDescriptor.call(this, "scripts", WebInspector.UIString("Sources"), "ScriptsPanel", "ScriptsPanel.js");
@@ -49994,7 +54579,6 @@
 {
 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel"));
 section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, WebInspector.UIString("Start/stop recording"));
-if (InspectorFrontendHost.canSave())
 section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, WebInspector.UIString("Save timeline data"));
 section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, WebInspector.UIString("Load timeline data"));
 },
@@ -50027,7 +54611,6 @@
 this._dockToggleButtonOption = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3);
 this._dockToggleButton.addEventListener("click", this._toggleDockState, this);
 this._dockToggleButtonOption.addEventListener("click", this._toggleDockState, this);
-if (Preferences.showDockToRight)
 this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this));
 
 this.setDockSide(WebInspector.queryParamsObject["dockSide"] || "bottom");
@@ -50040,6 +54623,10 @@
 Undocked: "undocked"
 }
 
+WebInspector.DockController.Events = {
+DockSideChanged: "DockSideChanged"
+}
+
 WebInspector.DockController.prototype = {
 
 get element()
@@ -50048,6 +54635,12 @@
 },
 
 
+dockSide: function()
+{
+return this._dockSide;
+},
+
+
 setDockSide: function(dockSide)
 {
 if (this._dockSide === dockSide)
@@ -50062,6 +54655,7 @@
 else
 WebInspector.userMetrics.WindowUndocked.record();
 this._updateUI();
+this.dispatchEventToListeners(WebInspector.DockController.Events.DockSideChanged, this._dockSide);
 },
 
 
@@ -50092,14 +54686,12 @@
 break;
 }
 
-if (WebInspector.toolbar)
-WebInspector.toolbar.setDockedToBottom(this._dockSide === WebInspector.DockController.State.DockedToBottom);
 if (WebInspector.settings.showToolbarIcons.get())
 document.body.addStyleClass("show-toolbar-icons");
 else
 document.body.removeStyleClass("show-toolbar-icons");
 
-if (this._isDockingUnavailable) {
+if (this._isDockingUnavailable && this._dockSide === WebInspector.DockController.State.Undocked) {
 this._dockToggleButton.state = "undock";
 this._dockToggleButton.setEnabled(false);
 return;
@@ -50155,42 +54747,13 @@
 case "undock": action = "undocked"; break;
 }
 InspectorFrontendHost.requestSetDockSide(action);
-}
+},
+
+__proto__: WebInspector.Object.prototype
 }
 
 
-
-
-
-
-
-{(function () {
-Preferences.useLowerCaseMenuTitlesOnWindows = true;
-Preferences.sharedWorkersDebugNote = "Shared workers can be inspected in the Task Manager";
-Preferences.localizeUI = false;
-Preferences.applicationTitle = "Developer Tools - %s";
-Preferences.exposeDisableCache = true;
-Preferences.showDockToRight = true;
-Preferences.exposeFileSystemInspection = true;
-Preferences.experimentsEnabled = false;
-})();}
-
-function buildPlatformExtensionAPI(extensionInfo)
-{
-return "var extensionInfo = " + JSON.stringify(extensionInfo) + ";" +
-"var tabId = " + WebInspector._inspectedTabId + ";" +
-platformExtensionAPI.toString();
-}
-
-WebInspector.setInspectedTabId = function(tabId)
-{
-WebInspector._inspectedTabId = tabId;
-}
-
-WebInspector.clipboardAccessDeniedMessage = function()
-{
-return "You need to install a Chrome extension that grants clipboard access to Developer Tools.";
-}
+WebInspector.dockController = null;
 
 
 
@@ -50280,6 +54843,14 @@
 
 
 
+TestSuite.prototype.assertHasKey = function(object, key)
+{
+if (!object.hasOwnProperty(key))
+this.fail("Expected object to contain key '" + key + "'");
+};
+
+
+
 TestSuite.prototype.assertContains = function(string, substring)
 {
 if (string.indexOf(substring) === -1)
@@ -50449,6 +55020,27 @@
 
 
 
+TestSuite.prototype.testRendererProcessNativeMemorySize = function()
+{
+var test = this;
+var KB = 1024;
+var MB = KB * KB;
+
+function step1(error, memoryBlock)
+{
+test.assertTrue(!error, "An error has occurred: " + error);
+test.assertTrue(memoryBlock.size > 1 * MB && memoryBlock.size < 1500 * MB, "Unfeasible process size: " + memoryBlock.size + " bytes.");
+
+test.releaseControl();
+}
+
+MemoryAgent.getProcessMemoryDistribution(false, step1);
+
+this.takeControl();
+};
+
+
+
 TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
 {
 var test = this;
@@ -50480,9 +55072,9 @@
 function checkNoDuplicates() {
 var uiSourceCodes = test.nonAnonymousUISourceCodes_();
 for (var i = 0; i < uiSourceCodes.length; i++) {
-var scriptName = uiSourceCodes[i].fileName;
+var scriptName = uiSourceCodes[i].url;
 for (var j = i + 1; j < uiSourceCodes.length; j++)
-test.assertTrue(scriptName !== uiSourceCodes[j].fileName, "Found script duplicates: " + test.uiSourceCodesToString_(uiSourceCodes));
+test.assertTrue(scriptName !== uiSourceCodes[j].url, "Found script duplicates: " + test.uiSourceCodesToString_(uiSourceCodes));
 }
 }
 
@@ -50534,7 +55126,7 @@
 function testScriptPause() {
 
 
-WebInspector.panels.scripts.pauseButton.click();
+WebInspector.panels.scripts._pauseButton.element.click();
 
 this._waitForScriptPause(this.releaseControl.bind(this));
 }
@@ -50617,13 +55209,13 @@
 
 
 
-test.assertTrue(resource.timing.receiveHeadersEnd - resource.timing.connectStart >= 70, 
+test.assertTrue(resource.timing.receiveHeadersEnd - resource.timing.connectStart >= 70,
 "Time between receiveHeadersEnd and connectStart should be >=70ms, but was " +
 "receiveHeadersEnd=" + resource.timing.receiveHeadersEnd + ", connectStart=" + resource.timing.connectStart + ".");
-test.assertTrue(resource.responseReceivedTime - resource.startTime >= 0.07, 
+test.assertTrue(resource.responseReceivedTime - resource.startTime >= 0.07,
 "Time between responseReceivedTime and startTime should be >=0.07s, but was " +
 "responseReceivedTime=" + resource.responseReceivedTime + ", startTime=" + resource.startTime + ".");
-test.assertTrue(resource.endTime - resource.startTime >= 0.14, 
+test.assertTrue(resource.endTime - resource.startTime >= 0.14,
 "Time between endTime and startTime should be >=0.14s, but was " +
 "endtime=" + resource.endTime + ", startTime=" + resource.startTime + ".");
 
@@ -50700,27 +55292,48 @@
 };
 
 
+TestSuite.prototype.testTimelineFrames = function()
+{
+var test = this;
+
+function step1()
+{
+test.recordTimeline(onTimelineRecorded);
+test.evaluateInConsole_("runTest()", function(){});
+}
+
+function onTimelineRecorded(records)
+{
+var frameCount = 0;
+var recordsInFrame = {};
+
+for (var i = 0; i < records.length; ++i) {
+var record = records[i];
+if (record.type !== "BeginFrame") {
+recordsInFrame[record.type] = (recordsInFrame[record.type] || 0) + 1;
+continue;
+}
+if (!frameCount++)
+continue;
+
+test.assertHasKey(recordsInFrame, "FireAnimationFrame");
+test.assertHasKey(recordsInFrame, "Layout");
+test.assertHasKey(recordsInFrame, "RecalculateStyles");
+test.assertHasKey(recordsInFrame, "Paint");
+recordsInFrame = {};
+}
+test.assertTrue(frameCount >= 5, "Not enough frames");
+test.releaseControl();
+}
+
+step1();
+test.takeControl();
+}
+
 
 TestSuite.prototype.testPageOverlayUpdate = function()
 {
 var test = this;
-var records = [];
-var dispatchOnRecordType = {}
-
-function addRecord(event)
-{
-innerAddRecord(event.data);
-}
-
-function innerAddRecord(record)
-{
-records.push(record);
-if (typeof dispatchOnRecordType[record.type] === "function")
-dispatchOnRecordType[record.type](record);
-
-if (record.children)
-record.children.forEach(innerAddRecord);
-}
 
 function populatePage()
 {
@@ -50736,9 +55349,6 @@
 
 function step1()
 {
-WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord);
-WebInspector.timelineManager.start();
-
 test.evaluateInConsole_(populatePage.toString() + "; populatePage();" +
 "inspect(document.getElementById('div1'))", function() {});
 WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step2);
@@ -50747,6 +55357,7 @@
 function step2()
 {
 WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step2);
+test.recordTimeline(onTimelineRecorded);
 setTimeout(step3, 500);
 }
 
@@ -50759,15 +55370,12 @@
 function step4()
 {
 WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step4);
-dispatchOnRecordType.TimeStamp = step5;
-test.evaluateInConsole_("console.timeStamp('ready')", function() {});
+test.stopTimeline();
 }
 
-function step5()
+function onTimelineRecorded(records)
 {
 var types = {};
-WebInspector.timelineManager.stop();
-WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord);
 for (var i = 0; i < records.length; ++i)
 types[records[i].type] = (types[records[i].type] || 0) + 1;
 
@@ -50784,6 +55392,45 @@
 this.takeControl();
 }
 
+
+
+TestSuite.prototype.recordTimeline = function(callback)
+{
+var records = [];
+var dispatchOnRecordType = {}
+
+WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord);
+WebInspector.timelineManager.start();
+
+function addRecord(event)
+{
+innerAddRecord(event.data);
+}
+
+function innerAddRecord(record)
+{
+records.push(record);
+if (record.type === "TimeStamp" && record.data.message === "ready")
+done();
+
+if (record.children)
+record.children.forEach(innerAddRecord);
+}
+
+function done()
+{
+WebInspector.timelineManager.stop();
+WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord);
+callback(records);
+}
+}
+
+
+TestSuite.prototype.stopTimeline = function()
+{
+this.evaluateInConsole_("console.timeStamp('ready')", function() {});
+}
+
 TestSuite.prototype.waitForTestResultsInConsole = function()
 {
 var messages = WebInspector.console.messages;
@@ -50858,7 +55505,7 @@
 {
 var names = [];
 for (var i = 0; i < uiSourceCodes.length; i++)
-names.push('"' + uiSourceCodes[i].fileName + '"');
+names.push('"' + uiSourceCodes[i].url + '"');
 return names.join(",");
 };
 
@@ -50871,7 +55518,13 @@
 return !!uiSourceCode.url;
 }
 
+function filterOutService(uiSourceCode)
+{
+return !uiSourceCode.project().isServiceProject();
+}
+
 var uiSourceCodes = WebInspector.workspace.uiSourceCodes();
+uiSourceCodes = uiSourceCodes.filter(filterOutService);
 return uiSourceCodes.filter(filterOutAnonymous);
 };
 
@@ -50898,7 +55551,7 @@
 var missing = expected.slice(0);
 for (var i = 0; i < uiSourceCodes.length; ++i) {
 for (var j = 0; j < missing.length; ++j) {
-if (uiSourceCodes[i].parsedURL.lastPathComponent.search(missing[j]) !== -1) {
+if (uiSourceCodes[i].name().search(missing[j]) !== -1) {
 missing.splice(j, 1);
 break;
 }
diff --git a/resources/inspector/inspectorCommon.css b/resources/inspector/inspectorCommon.css
index 41b44fa..ec4fa69 100644
--- a/resources/inspector/inspectorCommon.css
+++ b/resources/inspector/inspectorCommon.css
@@ -11,10 +11,28 @@
     right: 0;
     overflow: hidden;
     font-family: Lucida Grande, sans-serif;
-    font-size: 10px;
+    font-size: 11px;
     margin: 0;
     tab-size: 4;
     -webkit-user-select: none;
+    color: #222;
+}
+
+body.platform-linux {
+  color: rgb(48, 57, 66);
+  font-family: Ubuntu, Arial, sans-serif;
+  font-size: 12px;
+}
+
+body.platform-mac {
+  color: rgb(48, 57, 66);
+  font-family: 'Lucida Grande', sans-serif;
+  font-size: 12px;
+}
+
+body.platform-windows {
+  font-family: 'Segoe UI', Tahoma, sans-serif;
+  font-size: 12px;
 }
 
 body.dock-to-right:not(.undocked) {
@@ -90,6 +108,8 @@
     height: 20px;
     z-index: 200;
     pointer-events: none;
+    cursor: move;
+    overflow: hidden;
 }
 
 .resources-divider {
@@ -120,11 +140,62 @@
     position: absolute;
     top: 4px;
     right: 3px;
-    font-size: 9px;
-    color: rgb(50%, 50%, 50%);
+    font-size: 80%;
     white-space: nowrap;
+    pointer-events: none;
 }
 
+.overview-grid-window-selector {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    background-color: rgba(125, 173, 217, 0.5);
+    z-index: 250;
+}
+
+.overview-grid-window {
+    background-color: white;
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 60px;
+    z-index: 150;
+}
+
+.overview-grid-dividers-background {
+    left: 0%;
+    right: 0%;
+    top: 0px;
+    bottom: 60px;
+    background-color: black;
+    position: absolute;
+}
+
+.overview-grid-window-rulers {
+    top: 0;
+    bottom: 0;
+    position: absolute;
+    opacity: 0.2;
+    border-right: 1px solid black;
+    border-left: 1px solid black;
+    z-index: 150;
+    pointer-events: none;
+}
+
+.overview-grid-window-resizer {
+    position: absolute;
+    top: 0px;
+    bottom: 60px;
+    width: 5px;
+    margin-left: -3px;
+    margin-right: -2px;
+    background-color: rgb(153, 153, 153);
+    z-index: 500;
+    cursor: ew-resize;
+    -webkit-border-radius: 2px;
+    -webkit-box-shadow: white 1px 0 0, white -1px 0 0, white 0 1px 0, white 0 -1px 0;
+}
 
 /* Network timing is shared between popover and network item view pane */
 
@@ -144,7 +215,7 @@
 
 .network-timing-bar-title {
     position: absolute;
-    color: black;
+    color: #222;
     top: 1px;
 }
 
@@ -155,20 +226,19 @@
     opacity: 0.8;
     -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
     background-color: rgb(241, 234, 0);
-    color: black;
+    color: #222;
 }
 
 .sidebar-separator {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
+    background-color: rgb(230, 230, 230);
     padding: 0 5px;
     border-top: 1px solid rgb(189, 189, 189);
     border-bottom: 1px solid rgb(189, 189, 189);
-    color: rgb(110, 110, 110);
-    text-shadow: white 0 1px 0;
+    color: rgb(50, 50, 50);
     white-space: nowrap;
     text-overflow: ellipsis;
     overflow: hidden;
-    font-size: 11px;
+    line-height: 16px;
 }
 
 .sidebar-label {
diff --git a/resources/inspector/nativeMemoryProfiler.css b/resources/inspector/nativeMemoryProfiler.css
index 47f7713..3f609cb 100644
--- a/resources/inspector/nativeMemoryProfiler.css
+++ b/resources/inspector/nativeMemoryProfiler.css
@@ -29,12 +29,12 @@
  */
 
 .memory-pie-chart-container {
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
 }
 
 .memory-pie-chart {
-    -webkit-box-flex: 1;
+    -webkit-flex: 1;
 }
 
 .memory-blocks-list .swatch {
@@ -50,42 +50,6 @@
     margin: 10px;
 }
 
-.memory-bar-chart-name {
-    text-align: right;
-    white-space: nowrap;
-}
-
-.memory-bar-chart-bar {
-    border: 0px;
-    border-radius: 2px;
-    float: left;
-    height: 18px;
-    overflow: hidden;
-    position: relative;
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.5)), to(rgba(192, 192, 192, 0)));
-}
-
-.memory-bar-chart-unused {
-    background-color: rgba(255, 255, 255, 0.5);
-    float: right;
-    height: 100%;
-}
-
-.memory-bar-chart-percent {
-    position: absolute;
-    text-align: center;
-    width: 100%;
-}
-
-.memory-bar-chart-size {
-    text-indent: 6px;
-    white-space: nowrap;
-}
-
-.memory-bar-chart-total {
-    font-weight: bold;
-}
-
 .native-snapshot-view {
     display: none;
     overflow: hidden;
@@ -109,13 +73,8 @@
     border: none;
 }
 
-.native-snapshot-view .data-grid table {
-    font-size: 11px;
-}
-
 .native-snapshot-view .data-grid td {
     height: 14px;
-    line-height: 14px;
     padding: 1px 4px;
 }
 
@@ -136,7 +95,7 @@
     background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.5)), to(rgba(192, 192, 192, 0)));
     height: 14px;
     border-radius: 2px;
-    color: black;
+    color: #222;
     white-space: normal;
     min-width: 1px;
 }
diff --git a/resources/inspector/navigatorView.css b/resources/inspector/navigatorView.css
index fbc0fae..a3f03e2 100644
--- a/resources/inspector/navigatorView.css
+++ b/resources/inspector/navigatorView.css
@@ -48,8 +48,18 @@
     content: url(Images/resourceDocumentIcon.png);
 }
 
+.navigator-other-tree-item .icon {
+    content: url(Images/resourcePlainIcon.png);
+}
+
+.navigator > ol {
+    min-height: 100%;
+    display: inline-block;
+}
+
 .navigator li {
-    height: 17px;
+    height: 18px;
+    line-height: 17px;
     white-space: nowrap;
 }
 
@@ -58,7 +68,7 @@
 }
 
 .navigator li.selected .selection {
-    height: 17px;
+    height: 18px;
     background-color: rgb(180, 180, 180);
 }
 
@@ -86,11 +96,9 @@
 }
 
 .navigator .base-navigator-tree-element-title {
-    overflow: hidden;
-    text-overflow: ellipsis;
+    display: inline-block;
     position: relative;
     padding-left: 2px;
-    top: 1px;
 }
 
 .navigator .base-navigator-tree-element-title.editing {
@@ -124,8 +132,7 @@
 }
 
 .navigator-tabbed-pane .navigator-container {
-    overflow-y: auto;
-    overflow-x: hidden;
+    overflow: auto;
 }
 
 .navigator-tabbed-pane .navigator {
diff --git a/resources/inspector/networkLogView.css b/resources/inspector/networkLogView.css
index d1c10d2..6750edf 100644
--- a/resources/inspector/networkLogView.css
+++ b/resources/inspector/networkLogView.css
@@ -5,13 +5,11 @@
     left: 0;
     right: 0;
     bottom: 0;
-    font-size: 11px;
 }
 
 .network-log-grid.data-grid table.data {
     -webkit-background-size: 1px 82px;
     background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.05)));
-    font-size: 11px;
 }
 
 .network-log-grid.data-grid.small table.data {
@@ -20,20 +18,18 @@
 
 .network-log-grid.data-grid td {
     line-height: 17px;
-    height: 37px;
+    height: 41px;
     border-right: 1px solid rgb(210, 210, 210);
     vertical-align: middle;
 }
 
 .network-log-grid.data-grid.small td {
-    height: 17px;
+    height: 21px;
 }
 
 .network-log-grid.data-grid th {
     border-bottom: 1px solid rgb(64%, 64%, 64%);
     height: 30px;
-    font-size: 11px;
-    font-weight: bold;
 }
 
 .network-log-grid.data-grid.small th {
@@ -57,8 +53,8 @@
     background-color: transparent;
     border: none;
     width: 100%;
-    font-size: 11px;
-    font-weight: bold;
+    font-size: inherit;
+    color: inherit;
 }
 
 .network-log-grid.data-grid.small tr.offscreen {
@@ -69,7 +65,7 @@
     height: 41px;
 }
 
-.network-log-grid.data-grid tr.offscreen td {
+.network-log-grid.data-grid tr.offscreen > td > div {
     display: none;
 }
 
@@ -78,7 +74,6 @@
 }
 
 .network-log-grid.data-grid tr:not(.filler) td.name-column {
-    font-weight: bold;
     cursor: pointer;
 }
 
@@ -86,20 +81,6 @@
     text-decoration: underline;
 }
 
-.network-log-grid.data-grid td.method-column,
-.network-log-grid.data-grid td.status-column,
-.network-log-grid.data-grid td.type-column,
-.network-log-grid.data-grid td.initiator-column,
-.network-log-grid.data-grid td.size-column,
-.network-log-grid.data-grid td.time-column {
-    background-color: rgba(0, 0, 0, 0.07);
-}
-
-.network-log-grid.data-grid td.size-column,
-.network-log-grid.data-grid td.time-column {
-    text-align: right;
-}
-
 .network-log-grid.data-grid.small .network-graph-side {
     height: 14px;
 }
@@ -230,7 +211,7 @@
 .network-graph-side {
     position: relative;
     height: 36px;
-    padding: 0 5px;
+    padding: 0;
     white-space: nowrap;
     margin-top: 1px;
     border-top: 1px solid transparent;
@@ -241,8 +222,14 @@
     position: absolute;
     top: 0;
     bottom: 0;
-    right: 8px;
-    left: 9px;
+}
+
+.network-graph-bar-area,
+.network-timeline-grid .resources-dividers,
+.network-timeline-grid .resources-event-dividers,
+.network-timeline-grid .resources-dividers-label-bar {
+    right: 12px;
+    left: 12px;
 }
 
 .network-graph-label {
@@ -252,13 +239,12 @@
     margin: auto -7px;
     height: 13px;
     line-height: 13px;
-    font-size: 9px;
+    font-size: 90%;
     color: rgba(0, 0, 0, 0.75);
     text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
     z-index: 150;
     overflow: hidden;
     text-align: center;
-    font-weight: bold;
     opacity: 0;
     -webkit-transition: opacity 250ms ease-in-out;
 }
@@ -395,10 +381,20 @@
     top: 0;
     bottom: 0;
     left: 0;
-    right: 0;
+    right: 14px; /* Keep in sync with td.corner width */
     pointer-events: none;
 }
 
+.network-log-grid.data-grid .timeline-column,
+.network.panel .data-grid th.timeline-column {
+    border-right: none;
+}
+
+.data-grid td.timeline-column {
+    padding-left: 0;
+    padding-right: 0;
+}
+
 .network-event-divider-padding {
     position: absolute;
     width: 8px;
@@ -443,9 +439,8 @@
 }
 
 .network-timeline-grid .resources-divider-label {
-    top: 0px;
-    margin-top: -4px;
-    color: black;
+    top: 0;
+    margin-top: -5px;
 }
 
 .network-timeline-grid .resources-dividers-label-bar .resources-divider {
@@ -456,11 +451,11 @@
     top: 15px;
 }
 
-.network-timeline-grid .resources-divider.first .resources-divider-label {
+.network-timeline-grid .resources-divider:first-child .resources-divider-label {
     display: none;
 }
 
-.network-timeline-grid .resources-dividers-label-bar .resources-divider.first {
+.network-timeline-grid .resources-dividers-label-bar .resources-divider:first-child {
     background-color: transparent;
 }
 
@@ -470,18 +465,6 @@
     display: none;
 }
 
-.network-log-grid.data-grid.filter-all table.data tr.revealed.network-item:not(.filtered-out),
-.network-log-grid.data-grid.filter-document table.data tr.revealed.network-type-document:not(.filtered-out),
-.network-log-grid.data-grid.filter-stylesheet table.data tr.revealed.network-type-stylesheet:not(.filtered-out),
-.network-log-grid.data-grid.filter-image table.data tr.revealed.network-type-image:not(.filtered-out),
-.network-log-grid.data-grid.filter-script table.data tr.revealed.network-type-script:not(.filtered-out),
-.network-log-grid.data-grid.filter-xhr table.data tr.revealed.network-type-xhr:not(.filtered-out),
-.network-log-grid.data-grid.filter-font table.data tr.revealed.network-type-font:not(.filtered-out),
-.network-log-grid.data-grid.filter-websocket table.data tr.revealed.network-type-websocket:not(.filtered-out),
-.network-log-grid.data-grid.filter-other table.data tr.revealed.network-type-other:not(.filtered-out) {
-    display: table-row;
-}
-
 /* Summary */
 
 .network-log-grid.data-grid tr.filler td {
@@ -493,7 +476,6 @@
     left: 0;
     right: 0;
     bottom: 0;
-    margin-right: -14px;
     background-color: rgb(101, 111, 130);
 }
 
@@ -501,8 +483,7 @@
     color: white;
     height: 20px !important;
     border: none;
-    font-size: 11px;
-    font-weight: bold;
+    font-size: 110%;
     padding: 0 0 0 8px;
     white-space: pre;
     overflow : hidden;
@@ -537,10 +518,6 @@
     border-right: none;
 }
 
-#network-container.brief-mode th.corner {
-    display: none;
-}
-
 #network-container.brief-mode .network-log-grid.data-grid .data-grid-resizer {
     display: none;
 }
@@ -551,7 +528,7 @@
 
 #network-container:not(.brief-mode) .data-grid tr.selected {
     background-color: transparent;
-    color: black;
+    color: #222;
 }
 
 #network-container.brief-mode .data-grid .data-container {
diff --git a/resources/inspector/networkPanel.css b/resources/inspector/networkPanel.css
index cda6d10..855f06c 100644
--- a/resources/inspector/networkPanel.css
+++ b/resources/inspector/networkPanel.css
@@ -49,7 +49,7 @@
     display: none;
 }
 
-#network-views.small #network-close-button  {
+#network-views.small #network-close-button {
     top: 4px;
 }
 
@@ -112,7 +112,7 @@
 }
 
 .network-item-view.visible {
-    display: -webkit-box;
+    display: -webkit-flex;
 }
 
 .network-item-view .tabbed-pane-header {
@@ -146,6 +146,10 @@
     font-weight: bold;
 }
 
+.resource-headers-view .outline-disclosure .parent .section * {
+    font-weight: normal;
+}
+
 .resource-headers-view .outline-disclosure .children li {
     white-space: nowrap;
 }
@@ -291,7 +295,6 @@
 
 .resource-websocket .data-grid .data {
     background-image: none;
-    font-size: 11px;
 }
 
 .resource-websocket td {
diff --git a/resources/inspector/panelEnablerView.css b/resources/inspector/panelEnablerView.css
index 4a95b41..97c17f9 100644
--- a/resources/inspector/panelEnablerView.css
+++ b/resources/inspector/panelEnablerView.css
@@ -93,7 +93,7 @@
 }
 
 .panel-enabler-view .flexible-space {
-    -webkit-box-flex: 1;
+    -webkit-flex: 1;
 }
 
 .panel-enabler-view form {
@@ -119,7 +119,6 @@
     padding: 3px 20px;
     height: 24px;
     color: rgb(6, 6, 6);
-    background-color: transparent;
     border: 1px solid rgb(165, 165, 165);
     background-color: rgb(237, 237, 237);
     background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
@@ -127,13 +126,18 @@
     -webkit-appearance: none;
 }
 
-body.inactive .panel-enabler-view button, .panel-enabler-view button:disabled {
+body.inactive .panel-enabler-view button:not(.status-bar-item), .panel-enabler-view button:disabled:not(.status-bar-item) {
     color: rgb(130, 130, 130);
     border-color: rgb(212, 212, 212);
     background-color: rgb(239, 239, 239);
     background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
 }
 
+.panel-enabler-view button:active:not(.status-bar-item) {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
 .panel-enabler-view input[type="radio"] {
     height: 17px;
     width: 17px;
diff --git a/resources/inspector/profilesPanel.css b/resources/inspector/profilesPanel.css
index 464725f..28a2a01 100644
--- a/resources/inspector/profilesPanel.css
+++ b/resources/inspector/profilesPanel.css
@@ -147,15 +147,12 @@
 }
 
 .profile-launcher-view-content {
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-    padding: 0 0 0 16px;
-    display: -webkit-box;
+    padding: 0 16px;
     text-align: left;
-    -webkit-box-orient: vertical;
+}
+
+.control-profiling {
+    -webkit-align-self: flex-start;
 }
 
 .profile-launcher-view-content h1 {
@@ -180,7 +177,7 @@
 
 .panel-enabler-view.profile-launcher-view button:not(.status-bar-item) {
     color: rgb(6, 6, 6);
-    margin: 16px 0;
+    margin: 0 0 16px;
 }
 
 .profile-launcher-view-content button.running:not(.status-bar-item) {
@@ -199,3 +196,14 @@
     from {background-color: rgba(255, 255, 120, 1); }
     to { background-color: rgba(255, 255, 120, 0); }
 }
+
+.profile-canvas-decoration {
+    color: red;
+    margin: -14px 0 13px 22px;
+    padding-left: 14px;
+    background: 0 7px url(Images/warningIcon.png) no-repeat;
+}
+
+.profile-canvas-decoration button {
+    margin: 0 0 0 10px !important;
+}
diff --git a/resources/inspector/resourceView.css b/resources/inspector/resourceView.css
index 5de3c7a..8728cc7 100644
--- a/resources/inspector/resourceView.css
+++ b/resources/inspector/resourceView.css
@@ -49,6 +49,10 @@
     padding: 15px;
 }
 
+.resource-view .script-view {
+    background-color: rgb(240, 240, 240);
+}
+
 .resource-view.image > .image {
     padding: 20px 20px 10px 20px;
     text-align: center;
diff --git a/resources/inspector/resourcesPanel.css b/resources/inspector/resourcesPanel.css
index 1916a3a..3641669 100644
--- a/resources/inspector/resourcesPanel.css
+++ b/resources/inspector/resourcesPanel.css
@@ -37,20 +37,19 @@
 }
 
 .resources.panel .sidebar li {
-    height: 17px;
+    height: 18px;
     white-space: nowrap;
 }
 
 .resources.panel .sidebar li.selected {
     color: white;
-    text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
-    font-weight: bold;
+    text-shadow: rgba(0, 0, 0, 0.33) 1px 1px 0;
 }
 
 .resources.panel .sidebar li.selected .selection {
     background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
     border-top: 1px solid #979797;
-    height: 17px;
+    height: 18px;
 }
 
 .resources.panel .sidebar :focus li.selected .selection {
@@ -118,7 +117,7 @@
     overflow: hidden;
 }
 
-.storage-view .data-grid {
+.storage-view .data-grid:not(.inline) {
     border: none;
     height: 100%;
 }
@@ -131,7 +130,6 @@
     padding: 2px 0;
     overflow-y: overlay;
     overflow-x: hidden;
-    -webkit-text-size-adjust: auto;
 }
 
 .database-query-prompt {
diff --git a/resources/inspector/scriptsPanel.css b/resources/inspector/scriptsPanel.css
index cf45abf..7c385bd 100644
--- a/resources/inspector/scriptsPanel.css
+++ b/resources/inspector/scriptsPanel.css
@@ -62,71 +62,45 @@
     border-bottom: 1px solid rgb(202, 202, 202);
 }
 
-#scripts-debug-sidebar-contents {
-    position: absolute;
-    top: 22px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    overflow: auto;
-}
-
 #scripts-editor-toolbar {
     position: relative;
     margin-top: -1px;
     height: 24px;
 }
 
-#scripts-files {
-    max-width: 250px;
-}
-
-#scripts-files option.extension-script {
-    color: rgb(70, 134, 240);
-}
-
-#scripts-functions {
-    max-width: 150px;
-}
-
 #scripts-status-bar .status-bar-item img {
     margin-top: 2px;
 }
 
-#scripts-pause img {
-    content: url(Images/debuggerPause.png);
+#scripts-debug-toolbar .glyph {
+    opacity: 0.8;
 }
 
-#scripts-pause.paused img {
-    content: url(Images/debuggerContinue.png);
+.scripts-pause .glyph {
+    -webkit-mask-position: -32px -72px;
 }
 
-#scripts-step-over img {
-    content: url(Images/debuggerStepOver.png);
+.scripts-pause.toggled-on .glyph {
+    -webkit-mask-position: 0 -72px;
 }
 
-#scripts-step-into img {
-    content: url(Images/debuggerStepInto.png);
+.scripts-step-over .glyph {
+    -webkit-mask-position: -128px -72px;
 }
 
-#scripts-step-out img {
-    content: url(Images/debuggerStepOut.png);
+.scripts-step-into .glyph {
+    -webkit-mask-position: -64px -72px;
 }
 
-.toggle-breakpoints .glyph {
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
+.scripts-step-out .glyph {
+    -webkit-mask-position: -96px -72px;
+}
+
+.scripts-toggle-breakpoints.toggled-on .glyph {
     -webkit-mask-position: -32px 0;
-    -webkit-mask-size: 320px 72px;
-    background-color: rgb(96, 96, 96) !important;
 }
 
-@media (-webkit-min-device-pixel-ratio: 1.5) {
-.toggle-breakpoints .glyph {
-    -webkit-mask-image: url(Images/statusbarButtonGlyphs2x.png);        
-}
-}
-
-.toggle-breakpoints.toggled-on .glyph {
+.scripts-toggle-breakpoints .glyph {
     -webkit-mask-position: 0 -24px;
 }
 
@@ -162,19 +136,21 @@
     background-position: center;
 }
 
-.status-bar-item.scripts-navigator-show-hide-button > .glyph {
-    background-color: rgba(0, 0, 0, 0.5);
-    -webkit-mask-image: url(Images/navigatorShowHideButton.png);
-    -webkit-mask-position: 0 0;
-    -webkit-mask-size: 48px 32px;
+.status-bar-item.scripts-navigator-show-hide-button,
+.scripts-debugger-show-hide-button {
+    opacity: 0.7;
 }
 
-.status-bar-item.scripts-navigator-show-hide-button.toggled-pinned > .glyph {
-    -webkit-mask-position: -16px 0;
+.status-bar-item.scripts-navigator-show-hide-button.toggled-hidden .glyph {
+    -webkit-mask-position: -167px -76px;
 }
 
-.status-bar-item.scripts-navigator-show-hide-button.toggled-overlay > .glyph {
-    -webkit-mask-position: -32px 0;
+.status-bar-item.scripts-navigator-show-hide-button.toggled-pinned .glyph {
+    -webkit-mask-position: -199px -76px;
+}
+
+.status-bar-item.scripts-navigator-show-hide-button.toggled-overlay .glyph {
+    -webkit-mask-position: -231px -76px;
 }
 
 button.status-bar-item.scripts-navigator-show-hide-button {
@@ -273,15 +249,13 @@
     border: none;
 }
 
-button.status-bar-item.scripts-debugger-show-hide-button:active {
-    top: 1px;
+.split-view-horizontal button.status-bar-item.scripts-debugger-show-hide-button,
+.split-view-horizontal #scripts-debug-sidebar-resizer-widget {
+    display: none;
 }
 
-.status-bar-item.scripts-debugger-show-hide-button > .glyph {
-    background-color: rgba(0, 0, 0, 0.5);
-    -webkit-mask-image: url(Images/navigatorShowHideButton.png);
-    -webkit-mask-position: 0 0;
-    -webkit-mask-size: 48px 32px;
+button.status-bar-item.scripts-debugger-show-hide-button:active {
+    top: 1px;
 }
 
 button.status-bar-item.scripts-debugger-show-hide-button.toggled-shown {
@@ -293,7 +267,7 @@
 }
 
 .status-bar-item.scripts-debugger-show-hide-button.toggled-shown > .glyph {
-    -webkit-mask-position: 0 -16px;
+    -webkit-mask-position: -168px -76px;
 }
 
 button.status-bar-item.scripts-debugger-show-hide-button.toggled-hidden {
@@ -305,5 +279,32 @@
 }
 
 .status-bar-item.scripts-debugger-show-hide-button.toggled-hidden > .glyph {
-    -webkit-mask-position: -16px -16px;
+    -webkit-mask-position: -296px -76px;
+}
+
+div.sidebar-pane-stack#scripts-debug-sidebar-contents, #scripts-sidebar-stack-pane {
+    top: 23px;
+    overflow: auto;
+}
+
+.workers-list > li {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    margin-left: 1em;
+    font-size: 12px;
+}
+
+a.worker-item {
+    color: rgb(33%, 33%, 33%);
+    cursor: pointer;
+    text-decoration: none;
+}
+
+a.worker-item:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+.source-frame-debugger-script {
+    background-color: rgba(255, 255, 194, 0.5);
 }
diff --git a/resources/inspector/sidebarPane.css b/resources/inspector/sidebarPane.css
new file mode 100644
index 0000000..1d6e8d2
--- /dev/null
+++ b/resources/inspector/sidebarPane.css
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.sidebar-pane {
+    position: relative;
+}
+
+.sidebar-pane > .body {
+    position: relative;
+    display: none;
+    overflow-y: auto;
+    overflow-x: hidden;
+}
+
+.sidebar-pane > .body .info {
+    text-align: center;
+    font-style: italic;
+    font-size: 90%;
+    padding: 6px;
+    color: #888;
+}
+
+.sidebar-pane > .body .placard + .info {
+    border-top: 1px solid rgb(189, 189, 189);
+    background-color: rgb(255, 255, 194);
+}
+
+.sidebar-pane.visible > .body {
+    display: block;
+}
+
+.sidebar-pane .section .properties {
+    padding-left: 16px;
+}
+
+.sidebar-tabbed-pane .tabbed-pane-header {
+    background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235));
+    border-bottom: 1px solid rgb(202, 202, 202);
+}
+
+.sidebar-pane-stack > .sidebar-pane.visible:nth-last-of-type(1) {
+    border-bottom: 1px solid rgb(189, 189, 189);
+}
+
+.sidebar-pane-title {
+    position: relative;
+    background: rgb(230, 230, 230);
+    height: 20px;
+    padding: 0 5px;
+    border-top: 1px solid rgb(189, 189, 189);
+    border-bottom: 1px solid rgb(189, 189, 189);
+    line-height: 18px;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.sidebar-pane-title + .sidebar-pane-title, .pane:not(.visible) + .sidebar-pane-title, .sidebar-pane-title:first-of-type {
+    margin-top: -1px;
+}
+
+.sidebar-pane-title:active {
+    background-color: rgb(204, 204, 204);
+    border-top: 1px solid rgb(178, 178, 178);
+    border-bottom: 1px solid rgb(178, 178, 178);
+}
+
+.sidebar-pane-title::before {
+    background-image: url(Images/statusbarButtonGlyphs.png);
+    background-size: 320px 120px;
+    opacity: 0.5;
+    float: left;
+    width: 11px;
+    height: 11px;
+    margin-right: 2px;
+    content: "a";
+    color: transparent;
+    position: relative;
+    top: 3px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 1.5) {
+.sidebar-pane-title::before {
+    background-image: url(Images/statusbarButtonGlyphs2x.png);
+}
+}
+
+.sidebar-pane-title::before {
+    background-position: -4px -96px;
+}
+
+.sidebar-pane-title.expanded::before {
+    background-position: -20px -96px;
+}
+
+.sidebar-pane-toolbar {
+    line-height: 18px;
+    left: 0;
+    right: 4px;
+    top: 0;
+    height: 20px;
+    position: absolute;
+    pointer-events: none;
+}
+
+.sidebar-pane-toolbar > * {
+    pointer-events: auto;
+}
+
+.sidebar-pane-toolbar > .pane-title-button {
+    float: right;
+    width: 23px;
+    height: 17px;
+    color: transparent;
+    background-color: transparent;
+    border: none;
+    background-repeat: no-repeat;
+    margin: 1px 0 0 0;
+    padding: 0;
+    -webkit-border-radius: 0;
+    -webkit-appearance: none;
+}
+
+.sidebar-pane-toolbar > .pane-title-button:hover {
+    background-position: -23px 0px;
+}
+
+.sidebar-pane-toolbar > .pane-title-button:active, .sidebar-pane-toolbar > .pane-title-button.toggled {
+    background-position: -46px 0px;
+}
+
+.sidebar-pane-toolbar > .pane-title-button.add {
+    background-image: url(Images/paneAddButtons.png);
+}
+
+.sidebar-pane-toolbar > .pane-title-button.element-state {
+    background-image: url(Images/paneElementStateButtons.png);
+}
+
+.sidebar-pane-toolbar > .pane-title-button.refresh {
+    background-image: url(Images/paneRefreshButtons.png);
+}
+
+.sidebar-pane-subtitle {
+    position: absolute;
+    right: 0;
+}
+
+body.platform-windows .sidebar-pane-subtitle {
+    padding-top: 1px;
+}
+
+.sidebar-pane-subtitle input, .section > .header input[type=checkbox] {
+    font-size: inherit;
+    height: 1em;
+    width: 1em;
+    margin-left: 0;
+    margin-top: 0;
+    margin-bottom: 0.25em;
+    vertical-align: bottom;
+}
diff --git a/resources/inspector/splitView.css b/resources/inspector/splitView.css
index 8c2d385..9721f0f 100644
--- a/resources/inspector/splitView.css
+++ b/resources/inspector/splitView.css
@@ -41,33 +41,70 @@
     cursor: default;
 }
 
-.split-view-contents.split-view-contents-vertical {
+.split-view-contents.maximized {
+    width: 100%;
+    height: 100%;
+}
+
+.split-view-vertical > .split-view-contents {
     top: 0;
     bottom: 0;
 }
 
-.split-view-contents.split-view-contents-horizontal {
+.split-view-vertical > .split-view-contents-first {
+    left: 0;
+}
+
+.split-view-vertical > .split-view-contents-first.maximized {
+    right: 0;
+}
+
+.split-view-vertical > .split-view-contents-second {
+    right: 0;
+}
+
+.split-view-vertical > .split-view-contents-second.maximized {
+    left: 0;
+}
+
+.split-view-horizontal > .split-view-contents {
     left: 0;
     right: 0;
 }
 
-.split-view-sidebar-left {
+.split-view-horizontal > .split-view-contents-first {
+    top: 0;
+}
+
+.split-view-horizontal > .split-view-contents-first.maximized {
+    bottom: 0;
+}
+
+.split-view-horizontal > .split-view-contents-second {
+    bottom: 0;
+}
+
+.split-view-horizontal > .split-view-contents-second.maximized {
+    top: 0;
+}
+
+.split-view-vertical > .split-view-sidebar.split-view-contents-first:not(.maximized) {
     border-right: 1px solid rgb(64%, 64%, 64%);
 }
 
-.split-view-sidebar-left.maximized {
-    border-right: none;
-}
-
-.split-view-sidebar-right {
+.split-view-vertical > .split-view-sidebar.split-view-contents-second:not(.maximized) {
     border-left: 1px solid rgb(64%, 64%, 64%);
 }
 
-.split-view-sidebar-right.maximized {
-    border-right: none;
+.split-view-horizontal > .split-view-sidebar.split-view-contents-first:not(.maximized) {
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
 }
 
-.split-view-resizer.split-view-resizer-vertical {
+.split-view-horizontal > .split-view-sidebar.split-view-contents-second:not(.maximized) {
+    border-top: 1px solid rgb(64%, 64%, 64%);
+}
+
+.split-view-vertical > .split-view-resizer {
     position: absolute;
     top: 0;
     bottom: 0;
@@ -76,7 +113,7 @@
     cursor: ew-resize;
 }
 
-.split-view-resizer.split-view-resizer-horizontal {
+.split-view-horizontal > .split-view-resizer {
     position: absolute;
     left: 0;
     right: 0;
@@ -94,8 +131,8 @@
     background-color: white;
     border-right: 1px solid gray;
     -webkit-box-shadow: rgb(90,90,90) 20px 0px 50px -25px;
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
 }
 
 .sidebar-overlay-resizer {
diff --git a/resources/inspector/tabbedPane.css b/resources/inspector/tabbedPane.css
index ba496fe..cf2903e 100644
--- a/resources/inspector/tabbedPane.css
+++ b/resources/inspector/tabbedPane.css
@@ -29,13 +29,13 @@
  */
  
  .tabbed-pane {
-    -webkit-box-orient: vertical;
-    display: -webkit-box;
+    -webkit-flex-direction: column;
+    display: -webkit-flex;
     height: 100%;
 }
 
 .tabbed-pane-content {
-    -webkit-box-flex: 1;
+    -webkit-flex: 1;
     position: relative;
     overflow: auto;
 }
@@ -47,6 +47,8 @@
 .tabbed-pane-header {
     height: 23px;
     border-bottom: 1px solid rgb(163, 163, 163);
+    overflow: hidden;
+    width: 100%;
 }
 
 .tabbed-pane-header-contents {
@@ -60,16 +62,11 @@
 .tabbed-pane-header-tab {
     float: left;
     margin-top: 2px;
-    font-size: 11px;
-    font-weight: bold;
-    color: rgb(46, 46, 46);
-    background: transparent;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-    vertical-align: middle;
-    padding: 3px 4px 2px 4px;
+    padding: 2px 4px 2px 4px;
     height: 21px;
     border: 1px solid transparent;
     border-bottom: none;
+    line-height: 15px;
     
     white-space: nowrap;
     text-overflow: ellipsis;
@@ -86,18 +83,14 @@
     border-bottom: none;
 }
 
-.tabbed-pane-header .tabbed-pane-header-tab-title {
-    vertical-align: top;
-}
-
 .tabbed-pane-header-tab-close-button {
-    font-family: Arial, monospace;
     position: relative;
-    bottom: 1px;
+    bottom: 0;
     opacity: 0;
     padding-left: 3px;
     font-size: 14px;
     color: rgb(80, 80, 80);
+    line-height: 12px;
 }
 
 .tabbed-pane-header-tab:hover .tabbed-pane-header-tab-close-button {
@@ -162,4 +155,3 @@
     margin: 0;
     -webkit-appearance: none;
 }
- 
\ No newline at end of file
diff --git a/resources/inspector/textEditor.css b/resources/inspector/textEditor.css
index 2a2562b..ccc7bbe 100644
--- a/resources/inspector/textEditor.css
+++ b/resources/inspector/textEditor.css
@@ -30,6 +30,22 @@
     -webkit-user-select: text;
 }
 
+.webkit-line-content > .text-editor-overlay-highlight {
+    position: absolute;
+    pointer-events: none;
+    -webkit-user-select: none;
+    z-index: 1;
+}
+
+.text-editor-token-highlight {
+    border: 1px solid gray;
+    border-radius: 3px;
+}
+
+.text-editor-brace-match {
+    border-bottom: 1px solid black;
+}
+
 .text-editor-contents .inner-container {
     position: absolute;
     top: 0;
@@ -166,6 +182,11 @@
     opacity: 0.3;
 }
 
+.webkit-line-content > * {
+    position: relative;
+    z-index: 2;
+}
+
 .webkit-execution-line.webkit-line-content {
     background-color: rgb(171, 191, 254);
     outline: 1px solid rgb(64, 115, 244);
@@ -183,6 +204,7 @@
 .debug-fadeout {
     -webkit-animation: "debug-fadeout" 1s 0s;
     border: 1px solid white;
+    margin: -1px;
 }
 
 @-webkit-keyframes debug-fadeout {
diff --git a/resources/inspector/timelinePanel.css b/resources/inspector/timelinePanel.css
index a7abd51..a35c942 100644
--- a/resources/inspector/timelinePanel.css
+++ b/resources/inspector/timelinePanel.css
@@ -42,10 +42,10 @@
 .timeline .sidebar {
     overflow-y: hidden;
     min-height: 100%;
-    bottom: auto;
+    bottom: auto !important;
 }
 
-.timeline .split-view-resizer {
+.timeline.split-view-vertical .split-view-resizer {
     top: 20px;
 }
 
@@ -88,65 +88,14 @@
     pointer-events: auto;
 }
 
-.timeline-window-selector {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    background-color: rgba(125, 173, 217, 0.5);
-    z-index: 250;
-}
-
-.timeline-overview-window {
-    background-color: white;
-    position: absolute;
-    left: 0;
-    right: 0;
-    top: 0;
-    bottom: 60px;
-    z-index: 150;
-}
-
-.timeline-frame-overview .timeline-overview-window {
+.timeline-frame-overview .overview-grid-window {
     bottom: 0;
 }
 
-.timeline-overview-dividers-background {
-    left: 0%;
-    right: 0%;
-    top: 0px;
-    bottom: 60px;
-    background-color: black;
-    position: absolute;
-}
-
-.timeline-frame-overview .timeline-overview-dividers-background {
+.timeline-frame-overview .overview-grid-dividers-background {
     bottom: 0;
 }
 
-.timeline-overview-window-rulers {
-    top: 0;
-    bottom: 0;
-    position: absolute;
-    opacity: 0.2;
-    border-right: 1px solid black;
-    border-left: 1px solid black;
-    z-index: 150;
-}
-
-.timeline-window-resizer {
-    position: absolute;
-    top: 0px;
-    bottom: 60px;
-    width: 5px;
-    margin-left: -3px;
-    margin-right: -2px;
-    background-color: rgb(153, 153, 153);
-    z-index: 500;
-    cursor: ew-resize;
-    -webkit-border-radius: 2px;
-    -webkit-box-shadow: white 1px 0 0, white -1px 0 0, white 0 1px 0, white 0 -1px 0;
-}
-
 #timeline-overview-grid #resources-graphs {
     position: absolute;
     top: 0;
@@ -166,7 +115,7 @@
     overflow-x: hidden;
 }
 
-#timeline-container .split-view-sidebar-left {
+#timeline-container .split-view-sidebar {
     z-index: 1;
 }
 
@@ -175,6 +124,15 @@
     color: inherit;
 }
 
+.timeline-misc-status-bar-items {
+    right: 64px;
+}
+
+.timeline-misc-status-bar-filters {
+    display: -webkit-flex;
+    -webkit-flex-orientation: row;
+}
+
 .timeline-category-statusbar-item {
     height: 24px;
     line-height: 24px;
@@ -183,6 +141,8 @@
     text-overflow: ellipsis;
     overflow: hidden;
     font-weight: bold;
+    min-width: 20px;
+    -webkit-flex: auto 0 1;
 }
 
 .timeline-category-statusbar-item,
@@ -190,6 +150,10 @@
     color: rgb(65, 65, 65);
 }
 
+.timeline-category-statusbar-item input {
+    vertical-align: middle;
+}
+
 .timeline-category-statusbar-item .timeline-category-checkbox {
     width: 10px;
     height: 11px;
@@ -252,7 +216,6 @@
 }
 
 .timeline-tree-item .count {
-    font-family: Helvetica, Arial, sans-serif;
     font-weight: bold;
 }
 
@@ -267,6 +230,10 @@
     position: absolute;
 }
 
+.timeline-tree-item.background .timeline-tree-icon {
+    background: none !important;
+}
+
 .timeline-tree-item.even {
     background-color: rgba(0, 0, 0, 0.05);
 }
@@ -286,7 +253,7 @@
     color: rgba(0, 0, 0, 0.7);
 }
 
-#timeline-overview-timelines,
+#timeline-overview-events,
 #timeline-overview-memory {
     position: absolute;
     left: 0;
@@ -358,6 +325,11 @@
     opacity: 0.7;
 }
 
+.timeline-graph-side.background .timeline-graph-bar {
+    background: transparent !important;
+    border-width: 2px;
+}
+
 .timeline-graph-side.even {
     background-color: rgba(0, 0, 0, 0.05);
 }
@@ -377,38 +349,6 @@
     margin-left: 0px;
 }
 
-.timeline-details {
-    -webkit-user-select: text;
-    vertical-align: top;
-}
-
-.timeline-function-name {
-    text-align: right;
-}
-
-.timeline-stacktrace-title {
-    padding-top: 4px;
-}
-
-.timeline-details-row-title {
-    font-weight: bold;
-    text-align: right;
-    white-space: nowrap;
-}
-
-.timeline-details-row-data {
-    white-space: nowrap;
-}
-
-.timeline-details-title {
-    border-bottom: 1px solid #B8B8B8;
-    font-size: 11px;
-    font-weight: bold;
-    padding-bottom: 5px;
-    padding-top: 0px;
-    white-space: nowrap;
-}
-
 .garbage-collect-status-bar-item .glyph {
     -webkit-mask-position: -128px -24px;
 }
@@ -417,19 +357,29 @@
     -webkit-mask-position: -128px -48px;
 }
 
+.glue-async-status-bar-item.toggled-on:disabled .glyph {
+    background-color: rgba(0, 0, 0, 0.75);
+}
+
 .timeline-frame-overview-status-bar-item.toggled-on .glyph {
     background-color: rgb(66, 129, 235) !important;
 }
 
 .timeline-records-stats, .storage-application-cache-status, .storage-application-cache-connectivity {
-    font-size: 11px;
     text-shadow: white 0 1px 0;
 }
 
 .timeline-records-stats {
-    float: right;
     margin-top: 5px;
-    margin-right: 6px;
+    margin-left: 6px;
+    -webkit-flex: 1;
+}
+
+.timeline-records-stats-container {
+    display: inline-block;
+    border-left: 1px solid rgb(202, 202, 202);
+    height: 24px;
+    margin-left: 6px;
 }
 
 .timeline-frames-stats {
@@ -484,7 +434,7 @@
     margin-left: 0;
     margin-right: 0;
     -webkit-mask-image: url(Images/statusbarButtonGlyphs.png);
-    -webkit-mask-size: 320px 72px;
+    -webkit-mask-size: 320px 120px;
     background-color: black;
 }
 
@@ -543,7 +493,7 @@
     border-right: 1px solid #AAA;
 }
 
-#memory-graphs-canvas-container .resources-dividers {
+#memory-graphs-canvas-container.dom-counters .resources-dividers {
     top: 15px;
 }
 
@@ -552,7 +502,6 @@
 }
 
 .memory-counter-sidebar-info {
-    font-size: 11px;
     margin: 10px;
 }
 
@@ -570,7 +519,6 @@
 
 .memory-counter-value {
     margin: 4px;
-    font-size: 11px;
 }
 
 #counter-values-bar {
@@ -606,7 +554,7 @@
     border-color: rgba(255, 178, 23, 0.5);
 }
 
-.resources-divider.last {
+.resources-divider:last-child {
     border-color: transparent;
 }
 
@@ -629,7 +577,7 @@
     overflow: hidden;
     background-color: rgb(220, 220, 220);
     opacity: 0.6;
-    color: black;
+    color: #222;
     text-align: center;
     padding-top: 3px;
     z-index: 350;
@@ -661,12 +609,27 @@
 
 .timeline-cpu-bars .timeline-graph-bar {
     border-color: rgb(192, 192, 192);
-    background-color: rgba(0, 0, 0, 0.15);
-    top: 2px;
-    bottom: 2px;
+    background-color: rgba(0, 0, 0, 0.1);
+    top: 4px;
+    bottom: 4px;
     height: auto;
 }
 
+.timeline-cpu-curtain-left, .timeline-cpu-curtain-right {
+    background-color: rgba(0, 0, 0, 0.15);
+    position: absolute;
+    top: 0;
+    height: 100%;
+}
+
+.timeline-cpu-curtain-left {
+    left: 0;
+}
+
+.timeline-cpu-curtain-right {
+    right: 0;
+}
+
 .image-preview-container {
     background: transparent;
     text-align: left;
@@ -684,3 +647,16 @@
 .image-container {
     padding: 0;
 }
+
+.memory-category-value {
+    float: right;
+}
+
+.highlighted-timeline-record {
+    -webkit-animation: "timeline_record_highlight" 2s 0s;
+}
+
+@-webkit-keyframes timeline_record_highlight {
+    from {background-color: rgba(255, 255, 120, 1); }
+    to { background-color: rgba(255, 255, 120, 0); }
+}