diff options
-rw-r--r-- | devtools/shared/css/generated/properties-db.js | 2 | ||||
-rw-r--r-- | docs/CONTRIBUTING.md | 9 | ||||
-rw-r--r-- | gfx/thebes/gfxTextRun.cpp | 28 | ||||
-rw-r--r-- | gfx/thebes/gfxTextRun.h | 6 | ||||
-rw-r--r-- | ipc/app/plugin-container.exe.manifest | 1 | ||||
-rw-r--r-- | layout/generic/nsTextFrame.cpp | 11 | ||||
-rw-r--r-- | layout/style/nsCSSKeywordList.h | 1 | ||||
-rw-r--r-- | layout/style/nsCSSProps.cpp | 1 | ||||
-rw-r--r-- | layout/style/nsStyleConsts.h | 1 | ||||
-rw-r--r-- | layout/style/nsStyleStruct.h | 7 | ||||
-rw-r--r-- | widget/windows/WinUtils.cpp | 20 | ||||
-rw-r--r-- | widget/windows/WinUtils.h | 21 | ||||
-rw-r--r-- | widget/windows/nsWindow.cpp | 2 |
13 files changed, 95 insertions, 15 deletions
diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index 25d9e2d33..316352771 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -7857,6 +7857,7 @@ exports.CSS_PROPERTIES = { ], "supports": [], "values": [ + "anywhere", "break-word", "inherit", "initial", @@ -9317,6 +9318,7 @@ exports.CSS_PROPERTIES = { ], "supports": [], "values": [ + "anywhere", "break-word", "inherit", "initial", diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9379ea45a..031ddb904 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -93,15 +93,20 @@ With rare exception, it is advisable to use the following style for commit messa This would directly apply to anyone making a pull request.
+Single commits are where issues can be reasonably resolved in a single commit.
- Single Commit: `Issue #xxx - Cited issue title or appropriate direct description of changes`
- *`Issue #1083 - Deprecate FUEL extension helper javascript library`*
-- Multi-Part Commits: `Issue #xxx - Part Number: Appropriate direct description of changes`
+
+Multi-part commits would be used for complex issues. However, an exception exists for multi-part commits where the issue is anticipated or ends up being long term such as "Stop using unified compilation of sources". In these instances the multi-part form is not required.
+- Multi-Part Form: `Issue #xxx - Part Number: Appropriate direct description of changes`
- *`Issue #492 - Part 1: Remove files`*
- *`Issue #492 - Part 2: Build system, Installer/Packaging`*
- *`Issue #492 - Part 3: nsUpdateService.js, updater.cpp, nsUpdateDriver.cpp`*
- *`Issue #492 - Part 4: Remove superfluous brackets in nsUpdateService.js and updater.cpp`*
-An exception exists for multi-part commits where the issue is anticipated or ends up being long term such as "Stop using unified compilation of sources". In these instances the multi-part form is not required.
+Occasionally a resolved (and shipped) issue requires further changes to fix bugs. However, If follow-ups are complex enough to be multi-part it should be considered a new issue.
+- Follow-up Form: *`Issue #xxx - Follow-up: Appropriate direct description of changes`*
+ - *`Issue #1643 - Follow-up: Make sure things aren't changed while iterating.`*
### Commits with no issue
diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 2e2a0d239..d6cb1bdb2 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -1072,6 +1072,34 @@ gfxTextRun::GetAdvanceWidth(Range aRange, PropertyProvider *aProvider, return result + GetAdvanceForGlyphs(ligatureRange); } +gfxFloat +gfxTextRun::GetMinAdvanceWidth(Range aRange) +{ + MOZ_ASSERT(aRange.end <= GetLength(), "Substring out of range"); + + Range ligatureRange = aRange; + ShrinkToLigatureBoundaries(&ligatureRange); + + gfxFloat result = std::max( + ComputePartialLigatureWidth(Range(aRange.start, ligatureRange.start), + nullptr), + ComputePartialLigatureWidth(Range(ligatureRange.end, aRange.end), + nullptr)); + + // XXX Do we need to take spacing into account? When each grapheme cluster + // takes its own line, we shouldn't be adding spacings around them. + gfxFloat clusterAdvance = 0; + for (uint32_t i = ligatureRange.start; i < ligatureRange.end; ++i) { + clusterAdvance += GetAdvanceForGlyph(i); + if (i + 1 == ligatureRange.end || IsClusterStart(i + 1)) { + result = std::max(result, clusterAdvance); + clusterAdvance = 0; + } + } + + return result; +} + bool gfxTextRun::SetLineBreaks(Range aRange, bool aLineBreakBefore, bool aLineBreakAfter, diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index 3c9ded1dc..a565075cd 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -299,6 +299,12 @@ public: } /** + * Computes the minimum advance width for a substring assuming line + * breaking is allowed everywhere. + */ + gfxFloat GetMinAdvanceWidth(Range aRange); + + /** * Clear all stored line breaks for the given range (both before and after), * and then set the line-break state before aRange.start to aBreakBefore and * after the last cluster to aBreakAfter. diff --git a/ipc/app/plugin-container.exe.manifest b/ipc/app/plugin-container.exe.manifest index 303109523..e3bdc56b0 100644 --- a/ipc/app/plugin-container.exe.manifest +++ b/ipc/app/plugin-container.exe.manifest @@ -29,6 +29,7 @@ <ms_asmv3:application xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3"> <ms_asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>True/PM</dpiAware> + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness> </ms_asmv3:windowsSettings> </ms_asmv3:application> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 4bc542626..a47b87e38 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -8245,6 +8245,17 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext, return; } + // If overflow-wrap is 'anywhere', we can wrap everywhere. + if (textStyle->mOverflowWrap == NS_STYLE_OVERFLOWWRAP_ANYWHERE && + textStyle->WordCanWrap(this)) { + aData->OptionallyBreak(); + aData->mCurrentLine += + textRun->GetMinAdvanceWidth(Range(start, flowEndInTextRun)); + aData->mTrailingWhitespace = 0; + aData->OptionallyBreak(); + return; + } + AutoTArray<bool,BIG_TEXT_NODE_SIZE> hyphBuffer; bool *hyphBreakBefore = nullptr; if (hyphenating) { diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 9045da9ff..86ba59142 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -144,6 +144,7 @@ CSS_KEY(alternate, alternate) CSS_KEY(alternate-reverse, alternate_reverse) CSS_KEY(always, always) CSS_KEY(annotation, annotation) +CSS_KEY(anywhere, anywhere) CSS_KEY(appworkspace, appworkspace) CSS_KEY(auto, auto) CSS_KEY(auto-fill, auto_fill) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 24c97cf33..e0cda2488 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2284,6 +2284,7 @@ const KTableEntry nsCSSProps::kWordBreakKTable[] = { const KTableEntry nsCSSProps::kOverflowWrapKTable[] = { { eCSSKeyword_normal, NS_STYLE_OVERFLOWWRAP_NORMAL }, { eCSSKeyword_break_word, NS_STYLE_OVERFLOWWRAP_BREAK_WORD }, + { eCSSKeyword_anywhere, NS_STYLE_OVERFLOWWRAP_ANYWHERE }, { eCSSKeyword_UNKNOWN, -1 } }; diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index f54387aa8..e6a0cc65a 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -997,6 +997,7 @@ enum class StyleDisplay : uint8_t { // See nsStyleText #define NS_STYLE_OVERFLOWWRAP_NORMAL 0 #define NS_STYLE_OVERFLOWWRAP_BREAK_WORD 1 +#define NS_STYLE_OVERFLOWWRAP_ANYWHERE 2 // See nsStyleText #define NS_STYLE_HYPHENS_NONE 0 diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index f49cdc43e..cca7bb8d4 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2134,8 +2134,11 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText } bool WordCanWrapStyle() const { - return WhiteSpaceCanWrapStyle() && - mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD; + if (!WhiteSpaceCanWrapStyle()) { + return false; + } + return (mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD || + mOverflowWrap == NS_STYLE_OVERFLOWWRAP_ANYWHERE); } bool HasTextEmphasis() const { diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index 28033193f..a43c92b69 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -449,10 +449,20 @@ WinUtils::Initialize() if (IsWin10OrLater()) { HMODULE user32Dll = ::GetModuleHandleW(L"user32"); if (user32Dll) { - sEnableNonClientDpiScaling = (EnableNonClientDpiScalingProc) - ::GetProcAddress(user32Dll, "EnableNonClientDpiScaling"); - sSetThreadDpiAwarenessContext = (SetThreadDpiAwarenessContextProc) - ::GetProcAddress(user32Dll, "SetThreadDpiAwarenessContext"); + auto getThreadDpiAwarenessContext = (decltype(GetThreadDpiAwarenessContext)*) + ::GetProcAddress(user32Dll, "GetThreadDpiAwarenessContext"); + auto areDpiAwarenessContextsEqual = (decltype(AreDpiAwarenessContextsEqual)*) + ::GetProcAddress(user32Dll, "AreDpiAwarenessContextsEqual"); + if (getThreadDpiAwarenessContext && areDpiAwarenessContextsEqual && + areDpiAwarenessContextsEqual(getThreadDpiAwarenessContext(), + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE)) { + // Only per-monitor DPI awareness v1 requires these workarounds. + // Since this was introduced in Win 8.1 we'll need to keep this indefinitely. + sEnableNonClientDpiScaling = (EnableNonClientDpiScalingProc) + ::GetProcAddress(user32Dll, "EnableNonClientDpiScaling"); + sSetThreadDpiAwarenessContext = (SetThreadDpiAwarenessContextProc) + ::GetProcAddress(user32Dll, "SetThreadDpiAwarenessContext"); + } } } @@ -468,7 +478,7 @@ LRESULT WINAPI WinUtils::NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_NCCREATE && sEnableNonClientDpiScaling) { + if (msg == WM_NCCREATE) { sEnableNonClientDpiScaling(hWnd); } return ::DefWindowProcW(hWnd, msg, wParam, lParam); diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h index 1281171be..f268f907f 100644 --- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -96,6 +96,11 @@ typedef enum DPI_AWARENESS { #define DPI_AWARENESS_CONTEXT_DECLARED #endif // (DPI_AWARENESS_CONTEXT_DECLARED) +#if WINVER < 0x0605 +WINUSERAPI DPI_AWARENESS_CONTEXT WINAPI GetThreadDpiAwarenessContext(); +WINUSERAPI BOOL WINAPI +AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); +#endif /* WINVER < 0x0605 */ typedef DPI_AWARENESS_CONTEXT(WINAPI * SetThreadDpiAwarenessContextProc)(DPI_AWARENESS_CONTEXT); typedef BOOL(WINAPI * EnableNonClientDpiScalingProc)(HWND); @@ -152,6 +157,12 @@ class WinUtils static SetThreadDpiAwarenessContextProc sSetThreadDpiAwarenessContext; static EnableNonClientDpiScalingProc sEnableNonClientDpiScaling; + // Wrapper for DefWindowProc that will enable non-client dpi scaling on the + // window during creation. + static LRESULT WINAPI + NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg, + WPARAM wParam, LPARAM lParam); + public: class AutoSystemDpiAware { @@ -174,11 +185,11 @@ public: DPI_AWARENESS_CONTEXT mPrevContext; }; - // Wrapper for DefWindowProc that will enable non-client dpi scaling on the - // window during creation. - static LRESULT WINAPI - NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg, - WPARAM wParam, LPARAM lParam); + static decltype(::DefWindowProcW)* GetDefWindowProc() { + return sEnableNonClientDpiScaling ? + NonClientDpiScalingDefWindowProcW : + ::DefWindowProcW; + } /** * Get the system's default logical-to-physical DPI scaling factor, diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 907d8b9a5..b9c3ea154 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -999,7 +999,7 @@ nsWindow::RegisterWindowClass(const wchar_t* aClassName, } wc.style = CS_DBLCLKS | aExtraStyle; - wc.lpfnWndProc = WinUtils::NonClientDpiScalingDefWindowProcW; + wc.lpfnWndProc = WinUtils::GetDefWindowProc(); wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = nsToolkit::mDllInstance; |